Documentation
¶
Index ¶
- func Bool(key string) (bool, error)
- func DefaultPaths() []string
- func DefaultString(key, defaultValue string) string
- func Int(key string) (int, error)
- func Int64(key string) (int64, error)
- func IsSupportedConfigPath(path string) bool
- func Load(path string) error
- func LoadCandidates(paths ...string) error
- func LoadDefault() error
- func Path() string
- func RegisterFormat(format string, parser parserFunc, extensions ...string) error
- func RegisterViperFormat(format string, extensions ...string) error
- func Reload() error
- func SetPreferredPath(path string)
- func String(key string) string
- func SupportedExtensions() []string
- type AppConfig
- type AuthConfig
- type BridgeConfig
- type BridgeDisplayConfig
- type BridgeDisplayEndpoint
- type FeatureConfig
- type LogConfig
- type NetworkConfig
- type P2PConfig
- type ProxyConfig
- type RuntimeConfig
- type SSLConfig
- type SecurityConfig
- type Snapshot
- type WebConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultPaths ¶
func DefaultPaths() []string
DefaultPaths returns the candidate nps server config paths in load order.
func DefaultString ¶
func IsSupportedConfigPath ¶
IsSupportedConfigPath reports whether the file extension maps to a registered parser.
func LoadCandidates ¶
LoadCandidates loads the first readable config file from the provided paths.
func LoadDefault ¶
func LoadDefault() error
LoadDefault loads the server config from the default candidate paths.
func RegisterFormat ¶
RegisterFormat registers a parser for one or more file extensions.
func RegisterViperFormat ¶
RegisterViperFormat registers a new config format backed by Viper.
func Reload ¶
func Reload() error
Reload reloads the currently loaded config file. If no config has been loaded yet, it falls back to the default candidate paths.
func SetPreferredPath ¶
func SetPreferredPath(path string)
SetPreferredPath configures an explicit config file path to try before defaults.
func SupportedExtensions ¶
func SupportedExtensions() []string
SupportedExtensions returns all registered config file extensions.
Types ¶
type AppConfig ¶
type AppConfig struct {
Name string
Timezone string
DNSServer string
PprofIP string
PprofPort string
NTPServer string
NTPInterval int
// GeoIPPath and GeoSitePath are the geodata files of the access lists,
// relative to the run path unless absolute.
GeoIPPath string
GeoSitePath string
// AclMaxRules limits the rules of each access list users may write;
// 0 means no limit.
AclMaxRules int
// IPRegisterMaxHours bounds registrations made on the registration page
// with the public key, and with the key of a client that sets no limit.
IPRegisterMaxHours int
// IPRegisterIP and IPRegisterPort, when the port is set, serve the
// registration page on a listener of its own.
IPRegisterIP string
IPRegisterPort int
// IPRegisterCertFile and IPRegisterKeyFile, when both are set, serve
// the listener of the registration page over TLS.
IPRegisterCertFile string
IPRegisterKeyFile string
}
type AuthConfig ¶
type BridgeConfig ¶
type BridgeConfig struct {
Addr string
Type string
PrimaryType string
SelectMode string
CertFile string
KeyFile string
TCPEnable bool
KCPEnable bool
QUICEnable bool
TLSEnable bool
WSEnable bool
WSSEnable bool
ServerTCPEnabled bool
ServerKCPEnabled bool
ServerQUICEnabled bool
ServerTLSEnabled bool
ServerWSEnabled bool
ServerWSSEnabled bool
Display BridgeDisplayConfig
}
type BridgeDisplayConfig ¶
type BridgeDisplayConfig struct {
Path string
TCP BridgeDisplayEndpoint
KCP BridgeDisplayEndpoint
QUIC BridgeDisplayEndpoint
TLS BridgeDisplayEndpoint
WS BridgeDisplayEndpoint
WSS BridgeDisplayEndpoint
}
type BridgeDisplayEndpoint ¶
type FeatureConfig ¶
type FeatureConfig struct {
AllowUserLogin bool
AllowUserRegister bool
AllowUserVkeyLogin bool
AllowUserChangeUsername bool
OpenCaptcha bool
AllowFlowLimit bool
// FlowLimitActual makes flow limits count the actual usage, twice the
// inbound and outbound traffic, rather than the traffic itself.
FlowLimitActual bool
AllowRateLimit bool
AllowTimeLimit bool
AllowConnectionNumLimit bool
AllowMultiIP bool
AllowTunnelNumLimit bool
AllowLocalProxy bool
AllowUserLocal bool
AllowSecretLink bool
AllowSecretLocal bool
SystemInfoDisplay bool
AllowPorts string
}
type NetworkConfig ¶
type NetworkConfig struct {
BridgeIP string
BridgeHost string
BridgeTCPIP string
BridgeKCPIP string
BridgeQUICIP string
BridgeTLSIP string
BridgeWSIP string
BridgeWSSIP string
BridgePort int
BridgeTCPPort int
BridgeKCPPort int
BridgeQUICPort int
BridgeTLSPort int
BridgeWSPort int
BridgeWSSPort int
BridgePath string
BridgeTrustedIPs string
BridgeRealIPHeader string
HTTPProxyIP string
HTTPProxyPort int
HTTPSProxyPort int
// HTTPProxyAccessPort and HTTPSProxyAccessPort are the ports visitors
// reach the host proxy on from outside, behind a reverse proxy or port
// mapping; they default to the listen ports and only build links.
HTTPProxyAccessPort int
HTTPSProxyAccessPort int
HTTP3ProxyPort int
WebIP string
WebPort int
P2PIP string
P2PPort int
QUICALPN string
QUICALPNList []string
QUICKeepAlivePeriod int
QUICMaxIdleTimeout int
QUICMaxIncomingStreams int64
MuxPingInterval int
}
type ProxyConfig ¶
type RuntimeConfig ¶
type SecurityConfig ¶
type Snapshot ¶
type Snapshot struct {
App AppConfig
Log LogConfig
Web WebConfig
Auth AuthConfig
Feature FeatureConfig
Security SecurityConfig
Runtime RuntimeConfig
Network NetworkConfig
Bridge BridgeConfig
Proxy ProxyConfig
P2P P2PConfig
}