Documentation ¶
Index ¶
- Constants
- Variables
- func RandomIdentifier() string
- type Config
- func (c *Config) AddAcceptAddrs(acceptAddrs []string) error
- func (c *Config) AddAdminAddrs(adminAddrs []string) error
- func (c *Config) GetAcceptAddrs() []string
- func (c *Config) GetAdminAddrs() []string
- func (c *Config) RemoveAcceptAddrs(acceptAddrs []string) error
- func (c *Config) RemoveAdminAddrs(adminAddrs []string) error
- func (c *Config) Save() error
- func (c *Config) SetAcceptAddrs(acceptAddrs []string) error
- func (c *Config) SetAdminAddrs(adminAddrs []string) error
- func (c *Config) SetAdminHTTPAPI(disable bool) error
- func (c *Config) SetPlatformSpecificDefaultValues() error
- func (c *Config) SetSeed(s string) error
- func (c *Config) SetTunaConfig(serviceName string, country []string, allowNknAddr []string, ...) error
- func (c *Config) VerifyClient() error
- func (c *Config) VerifyServer() error
- type Opts
Constants ¶
View Source
const ( RandomIdentifierChars = "abcdefghijklmnopqrstuvwxyz0123456789" RandomIdentifierLength = 6 DefaultTunNameLinux = "nConnect-tun0" DefaultTunNameNonLinux = "nConnect-tap0" FallbackTunaMaxPrice = "0.01" DefaultUDPTimeout = time.Hour * 720 )
Variables ¶
View Source
var (
Version string
)
Functions ¶
func RandomIdentifier ¶
func RandomIdentifier() string
Types ¶
type Config ¶
type Config struct { // Account config Identifier string `` /* 145-byte string literal not displayed */ Seed string `` /* 134-byte string literal not displayed */ // NKN Client config SeedRPCServerAddr []string `json:"seedRPCServerAddr,omitempty" long:"rpc" description:"Seed RPC server address"` ConnectRetries int32 `` /* 134-byte string literal not displayed */ // Cipher config Cipher string `` /* 290-byte string literal not displayed */ Password string `json:"password,omitempty" long:"password" description:"Socks proxy password"` // Session config DialTimeout int32 `json:"dialTimeout,omitempty" long:"dial-timeout" description:"dial timeout in milliseconds"` SessionWindowSize int32 `json:"sessionWindowSize,omitempty" long:"session-window-size" description:"tuna session window size (byte)."` // Log config LogFileName string `json:"log,omitempty" long:"log" description:"Log file path. Will write log to stdout if not provided."` LogMaxSize int `` /* 139-byte string literal not displayed */ LogMaxBackups int `json:"logMaxBackups,omitempty" long:"log-max-backups" description:"Maximum number of old log files to retain." default:"3"` LogAPIResponseSize int `` /* 230-byte string literal not displayed */ // Remote address RemoteAdminAddr []string `json:"remoteAdminAddr,omitempty" short:"a" long:"remote-admin-addr" description:"(client only) Remote server admin address"` RemoteTunnelAddr []string `` /* 178-byte string literal not displayed */ // Socks proxy config LocalSocksAddr string `` /* 151-byte string literal not displayed */ // TUN/TAP device config Tun bool `json:"tun,omitempty" long:"tun" description:"(client only) Enable TUN device, might require root privilege"` TunAddr string `json:"tunAddr,omitempty" long:"tun-addr" description:"(client only) TUN device IP address" default:"10.0.86.2"` TunGateway string `json:"tunGateway,omitempty" long:"tun-gateway" description:"(client only) TUN device gateway" default:"10.0.86.1"` TunMask string `` /* 167-byte string literal not displayed */ TunDNS []string `` /* 150-byte string literal not displayed */ TunName string `` /* 175-byte string literal not displayed */ // VPN mode config VPN bool `` /* 159-byte string literal not displayed */ VPNRoute []string `` /* 199-byte string literal not displayed */ // Tuna config Tuna bool `json:"tuna,omitempty" short:"t" long:"tuna" description:"Enable tuna sessions"` TunaMinBalance string `` /* 138-byte string literal not displayed */ TunaMaxPrice string `` /* 197-byte string literal not displayed */ TunaMinFee string `json:"tunaMinFee,omitempty" long:"tuna-min-fee" description:"(server only) Tuna nanopay minimal txn fee" default:"0.00001"` TunaFeeRatio float64 `json:"tunaFeeRatio,omitempty" long:"tuna-fee-ratio" description:"(server only) Tuna nanopay txn fee ratio" default:"0.1"` TunaCountry []string `` /* 171-byte string literal not displayed */ TunaServiceName string `json:"tunaServiceName,omitempty" long:"tuna-service-name" description:"(server only) Tuna reverse service name"` TunaAllowNknAddr []string `` /* 175-byte string literal not displayed */ TunaDisallowNknAddr []string `` /* 184-byte string literal not displayed */ TunaAllowIp []string `` /* 146-byte string literal not displayed */ TunaDisallowIp []string `` /* 155-byte string literal not displayed */ TunaDisableDownloadGeoDB bool `` /* 142-byte string literal not displayed */ TunaGeoDBPath string `json:"tunaGeoDBPath,omitempty" long:"tuna-geo-db-path" description:"(server only) Path to store Tuna geo db" default:"."` TunaDisableMeasureBandwidth bool `` /* 170-byte string literal not displayed */ TunaMeasureStoragePath string `` /* 151-byte string literal not displayed */ TunaMeasureBandwidthBytes int32 `` /* 188-byte string literal not displayed */ // UDP config UDP bool `json:"udp,omitempty" long:"udp" description:"Support udp proxy"` UDPIdleTime int32 `` /* 154-byte string literal not displayed */ // Admin config AdminIdentifier string `` /* 138-byte string literal not displayed */ AdminHTTPAddr string `` /* 127-byte string literal not displayed */ DisableAdminHTTPAPI bool `` /* 158-byte string literal not displayed */ WebRootPath string `json:"webRootPath,omitempty" long:"web-root-path" description:"(server only) Web root path" default:"web/dist"` Tags []string `json:"tags,omitempty" long:"tags" description:"(server only) Tags that will be included in get info api"` Verbose bool `json:"verbose,omitempty" short:"v" long:"verbose" description:"Verbose mode, show logs on dialing/accepting connections"` AcceptAddrs []string `json:"acceptAddrs"` AdminAddrs []string `json:"adminAddrs"` // nconnect network NodeName string `` /* 127-byte string literal not displayed */ ManagerAddress string `` /* 143-byte string literal not displayed */ // contains filtered or unexported fields }
func LoadOrNewConfig ¶
func (*Config) AddAcceptAddrs ¶
func (*Config) AddAdminAddrs ¶
func (*Config) GetAcceptAddrs ¶
func (*Config) GetAdminAddrs ¶
func (*Config) RemoveAcceptAddrs ¶
func (*Config) RemoveAdminAddrs ¶
func (*Config) SetAcceptAddrs ¶
func (*Config) SetAdminAddrs ¶
func (*Config) SetAdminHTTPAPI ¶ added in v1.0.1
func (*Config) SetPlatformSpecificDefaultValues ¶ added in v1.0.2
func (*Config) SetTunaConfig ¶ added in v1.0.2
func (*Config) VerifyClient ¶ added in v1.0.2
func (*Config) VerifyServer ¶ added in v1.0.2
type Opts ¶ added in v1.2.0
type Opts struct { Client bool `short:"c" long:"client" description:"Client mode"` Server bool `short:"s" long:"server" description:"Server mode"` NetworkManager bool `short:"m" long:"network-manager" description:"Network manager mode"` NetworkMember bool `short:"n" long:"network-member" description:"Join nConnect network as a member node"` Config ConfigFile string `short:"f" long:"config-file" default:"config.json" description:"Config file path"` Address bool `long:"address" description:"Print client address (client mode) or admin address (server mode)"` WalletAddress bool `long:"wallet-address" description:"Print wallet address (server only)"` Version bool `long:"version" description:"Print version"` Info string `short:"i" long:"info" description:"nConnect information"` }
Click to show internal directories.
Click to hide internal directories.