// acetone, 2025 // I hate copyright of any kind. This is a public domain. // Original source: http://git.community.i2p/acetone/i2pdtunnelwizard #pragma once #include "notepad.h" #include "tunneltype.h" #include class TunnelConstructor { public: struct Pair { int8_t inbound = 3; int8_t outbound = 3; }; enum class BlindedType { none, simple, password, keys, client // client config }; TunnelConstructor(); bool setName(std::string name); bool setTunnelType(TunnelType type); bool setLength(int8_t inbound, int8_t outbound); bool setLengthVariance(int8_t inbound, int8_t outbound); bool setQuantity(int8_t inbound, int8_t outbound); bool setBlindedLeaseSet(BlindedType type); bool setTransient(bool isTransient); bool setKeepAlive(int8_t interval); bool setHostOverride(bool wantCustomHost); bool setSsl(const bool isSslUpstream); bool setMaxStreamCount(int count); bool setProxyOutproxy(bool isEnabled); bool setB33UserCount(uint16_t number); bool setIrcWebPassword(bool wantToUse); bool setComments(bool enabled); std::string name() const { return name_; } TunnelType tunnelType() const { return tunnelType_; } Pair length() const { return length_; } Pair lengthVariance() const { return lengthVariance_; } Pair quantity() const { return quantity_; } BlindedType blinded() const { return blinded_; } bool isTransient() const { return transient_; } uint8_t keepAliveInterval() const { return keepAliveInterval_; } bool hostOverride() const { return hostoverride_; } bool sslUpstream() const { return ssl_; } int maxStreamCount() const { return maxStreamCount_; } bool proxyOutproxy() const { return proxyOutproxy_; } uint16_t b33UserCount() const { return b33UserCount_; } bool isCommentsEnabled() const { return comments_; } std::u8string generate() const; void setLang(Notepad::Lang lang) { lang_ = lang; } std::u8string errorString() const { return errorString_; } static BlindedType stringToBlindedType(const std::string& type); static std::string blindedTypeToString(BlindedType type); static std::string tunnelTypeToString(TunnelType type); static TunnelType stringToTunnelType(const std::string& type); static bool isClientType(TunnelType type); // otherwise this is server private: std::string name_; TunnelType tunnelType_ = TunnelType::TcpClient; Pair length_; Pair lengthVariance_; Pair quantity_; bool transient_ = false; BlindedType blinded_ = BlindedType::none; uint8_t keepAliveInterval_ = 0; bool hostoverride_ = false; // http server bool webircpassword_ = false; // irc server int maxStreamCount_ = 2048; bool ssl_ = false; Notepad::Lang lang_ = Notepad::Lang::en; bool proxyOutproxy_; uint16_t b33UserCount_ = 1; bool comments_ = true; std::u8string errorString_; };