config

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Socks5Listener = "socks5"
	NtcpListener   = "ntcp"
	QueryListener  = "query"
)

Variables

View Source
var BuildTime string
View Source
var Version string

Functions

func LoadCfg

func LoadCfg(path string) bool

Types

type BindCfg

type BindCfg struct {
	// 监听地址
	// socks5 表示socks5代理
	// ntcp 表示ntcp代理
	Type         string `json:"type"`
	Open         bool   `json:"open"`
	ListenAddr   string `json:"listen"`    // 代理地址 ntcp信令通道
	TcpProxyAddr string `json:"tcp_proxy"` // tcp 转发数据代理地址 ntcp等协议使用
	UdpProxyAddr string `json:"udp_proxy"` // udp 转发数据代理地址 ntcp等协议使用
	TdpProxyAddr string `json:"tdp_proxy"` // tdp 转发数据代理地址 ntcp等协议使用
	User         string `json:"user"`      // 用户鉴权 ntcp等协议使用
	Password     string `json:"password"`  // 用户鉴权 ntcp等协议使用
}

type ConfigCfg

type ConfigCfg struct {
	BindHost     string     `json:"bind_host"`     // 用于TCP/UDP代理绑定host(域名或者IP),可被客户端连接
	CryptoMethod string     `json:"crypto_method"` // 加密方式 目前 chacha20/tea/aes128
	NextHop      NextHopCfg `json:"nexthop"`       // 下一跳地址
	Listener     []BindCfg  `json:"listener"`      // 监听地址 该绑定地址是本地地址 对于在nat之后的服务 该地址IP不能直接返回给客户端 指定通过 BindHost 返回
	Log          LogCfg     `json:"log"`           // 日志
}

func Config

func Config() *ConfigCfg

func (*ConfigCfg) GetListener

func (c *ConfigCfg) GetListener(Type string) *BindCfg

type LogCfg

type LogCfg struct {
	Console bool   `json:"console"`  //如果是前端运行 是否打印日志到前端
	Level   string `json:"level"`    //日志级别
	Path    string `json:"log_file"` //日志文件目录
	Size    int64  `json:"log_size"` //日志文件大小 单位 500 MB
	ILevel  ulog.LEVEL
}

type NextHopCfg

type NextHopCfg struct {
	// 下一跳服务支持协议
	// direct 表示直连
	// socks5 表示socks5代理
	// ntcp 表示ntcp代理
	Type     string `json:"type"`
	Addr     string `json:"proxy_addr"` // 代理地址
	User     string `json:"user"`       // 用户鉴权 ntcp等协议使用
	Password string `json:"password"`   // 用户鉴权 ntcp等协议使用
}

NextHopCfg 下一跳地址

func (*NextHopCfg) Direct

func (n *NextHopCfg) Direct() bool

func (*NextHopCfg) Ntcp

func (n *NextHopCfg) Ntcp() bool

func (*NextHopCfg) ProxyAddr

func (n *NextHopCfg) ProxyAddr() string

func (*NextHopCfg) Socks5

func (n *NextHopCfg) Socks5() bool

Jump to

Keyboard shortcuts

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