Documentation
¶
Index ¶
Constants ¶
const ( LocalTCP = "tcp" LocalUDP = "udp" LocalTCPUDP = "tcp_udp" LocalMixed = "mixed" // HTTP and SOCKS5 proxy LocalSOCKS5 = "socks5" // the SOCKS5 half of mixed alone LocalHTTP = "http" // the HTTP half of mixed alone LocalTransparent = "transparent" // transparent proxy (Linux) )
Listener types of a LocalServer.
const ( ConnAuto = "auto" // direct when hole punching succeeds, else relayed by nps ConnRelay = "relay" // always relayed by nps ConnDirect = "direct" // only direct; fails when hole punching does )
Connection modes of a LocalServer, as the later major version names them.
Variables ¶
var ( LocalTypes = []string{LocalTCP, LocalUDP, LocalTCPUDP, LocalMixed, LocalSOCKS5, LocalHTTP, LocalTransparent} ConnModes = []string{ConnAuto, ConnRelay, ConnDirect} )
LocalTypes and ConnModes are the accepted values.
Functions ¶
func IsAccountType ¶ added in v0.35.0
IsAccountType reports whether a listener type is a mixed, socks5 or http proxy, the types that take proxy accounts.
func IsProxyType ¶ added in v0.35.0
IsProxyType reports whether a listener type is a proxy that reads the destination from each connection: mixed, socks5 and http, and transparent.
func LegacyLocal ¶ added in v0.35.0
LegacyLocal maps the old settings to a listener type and connection mode: p2p is direct with relay fallback (auto), or direct only when fallback_secret=false; secret is relayed. target_type tcp/udp/all chose the listeners of p2p and secret.
Types ¶
type CommonConfig ¶
type CommonConfig struct {
Server string
VKey string
Tp string //bridgeType kcp or tcp
Pipes string // connprofile.PipesSingle or PipesMulti
SchedulerUp string // connprofile.Schedulers, new protocol
AutoReconnection bool
ProxyUrl string
LocalIP string
DnsServer string
NtpServer string
NtpInterval int
Client *model.Client
DisconnectTime int
// Role is the set of roles of the connection, as connprofile.NormalizeRole
// writes it (launch key role): empty means the roles follow from what
// is written for the connection.
Role string
CoreSettings
}
func NewCommonConfig ¶ added in v0.35.0
func NewCommonConfig() *CommonConfig
NewCommonConfig returns a [common] section with no key set: the defaults of CommonDefaults and of the keys. dealCommon and the command line build their connection settings from it, so that both have the same defaults.
type Config ¶
type Config struct {
CommonConfig *CommonConfig
Hosts []*model.Host
Tasks []*model.Tunnel
LocalServer []*LocalServer
// contains filtered or unexported fields
}
func ParseUntrusted ¶ added in v0.35.0
ParseUntrusted parses configuration text from a source other than the local user. Nothing in it reaches the local machine: templates and the keys in localKeys are refused before any section is read, so parsing reads no file and opens no listener.
func (*Config) ConvertFileTunnels ¶ added in v0.35.0
func (c *Config) ConvertFileTunnels()
ConvertFileTunnels applies model.ConvertFileTunnel to the tunnels of c: a file tunnel with a listening port becomes a virtual backend and a tcp tunnel to it. It is idempotent.
func (*Config) UsesLegacyPointToPoint ¶ added in v0.35.0
UsesLegacyPointToPoint reports whether c held point-to-point access settings of an earlier version, which were converted. Launch payloads, never released with them, refuse such a config.
type CoreSettings ¶ added in v0.35.0
type CoreSettings struct {
MaxLanes int // session_max_lanes: 0 is 16, 1 turns lanes off
RelayIdle int // relay_idle, seconds: 0 is 60
KeepServer bool // p2p_visitor_keep_server
ResumeTimeout int // session_resume_timeout, seconds: 0 is 30, negative no resume
UsageInterval int // session_usage_interval, seconds between reports of direct traffic: 0 is 60, negative never
Pin string // new_protocol_pin: hex key id the server must have, "" for none
}
CoreSettings are the [common] keys of the new protocol; the zero value of each is the protocol's own default.
type Defaults ¶ added in v0.35.0
type Defaults struct {
Pipes string
SchedulerUp string
CoreSettings
}
Defaults are the values a [common] section starts from. The command line sets them before any file is read, so that a flag is the default of every file and launch payload that does not set the key itself.
var CommonDefaults Defaults
CommonDefaults is set once at start-up, before configuration is parsed.
type LocalServer ¶
type LocalServer struct {
Type string // LocalTCP, LocalUDP, LocalTCPUDP, LocalMixed, LocalTransparent
ConnMode string // ConnAuto, ConnRelay, ConnDirect
Port int
Ip string // listen address; empty for all
Password string
Target string // the destination the visitor names, within the tunnel's destination list; empty for the tunnel's default target
LocalProxy bool
Auth map[string]string // proxy accounts of a mixed, socks5 or http listener, none for no authentication
}
LocalServer is a point-to-point access listener of a visitor npc: a [secret...] section, the -password command line or a launch payload. It reaches the secret tunnel of another client whose password it gives, directly (hole punching) or relayed by nps as ConnMode says.