62 lines
1.8 KiB
C++
62 lines
1.8 KiB
C++
#pragma once
|
|
|
|
#include "notepad.h"
|
|
#include "tunneltype.h"
|
|
|
|
#include <string>
|
|
|
|
class TunnelConstructor
|
|
{
|
|
public:
|
|
struct Pair
|
|
{
|
|
int8_t inbound = 3;
|
|
int8_t outbound = 3;
|
|
};
|
|
|
|
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(bool isBlinded);
|
|
bool setTransient(bool isTransient);
|
|
bool setKeepAlive(int8_t interval);
|
|
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_; }
|
|
bool isBlinded() const { return blinded_; }
|
|
bool isTransient() const { return transient_; }
|
|
uint8_t keepAliveInterval() const { return keepAliveInterval_; }
|
|
bool isCommentsEnabled() const { return comments_; }
|
|
|
|
std::u8string generate() const;
|
|
|
|
void setLang(Notepad::Lang lang) { lang_ = lang; }
|
|
std::u8string errorString() const { return errorString_; }
|
|
|
|
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_ = "TUNNEL";
|
|
TunnelType tunnelType_ = TunnelType::TcpClient;
|
|
Pair length_;
|
|
Pair lengthVariance_;
|
|
Pair quantity_;
|
|
bool transient_ = false;
|
|
bool blinded_ = false;
|
|
uint8_t keepAliveInterval_ = 0;
|
|
Notepad::Lang lang_ = Notepad::Lang::en;
|
|
bool comments_ = true;
|
|
|
|
std::u8string errorString_;
|
|
};
|