config

package
v1.0.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 15, 2019 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckKey added in v1.0.5

func CheckKey(seed, key string) (time.Time, bool)

检查 key 是否有效

func ExtractPorts

func ExtractPorts(address []NetAddress) []uint32

从地址中抽取出端口

func NewKey added in v1.0.5

func NewKey(seed string, expired string) (string, error)

生成 key

Types

type ClientConfig

type ClientConfig struct {
	Key            string       // 参考服务端配置 custom-port-key random-port-key
	ServerAddr     NetAddress   // 服务端地址
	LocalAddr      []NetAddress // 内网服务地址
	AccessPort     []uint32     // 代理访问端口(不能为空)
	MaxRedialTimes int          // 最大重连次数
}

客户端配置

func InitClientConfig

func InitClientConfig(args []string) ClientConfig

初始化客户端配置,支持从参数中读取或者从配置文件中读取

type NetAddress

type NetAddress struct {
	IP   string
	Port uint32
}

网络地址

func ParseNetAddress

func ParseNetAddress(address string) (NetAddress, bool)

解析单个地址

func ParseNetAddresses

func ParseNetAddresses(addresses string) ([]NetAddress, bool)

解析多个地址

func (NetAddress) String

func (t NetAddress) String() string

转字符串

type ServerConfig

type ServerConfig struct {
	Port uint32 // 服务端口
	Key  string // 6-16 个字符,用于身份校验
}

服务端配置

func InitServerConfig

func InitServerConfig(args []string) ServerConfig

初始化服务端配置,支持从参数中读取或者从配置文件中读取

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL