Documentation
¶
Index ¶
- func GetRenderedConfFromFile(path string) (out string, err error)
- func InitServerCfg(cfg *ServerCommonConf)
- func LoadAllConfFromIni(prefix string, content string, startProxy map[string]struct{}) (proxyConfs map[string]ProxyConf, visitorConfs map[string]VisitorConf, ...)
- func ParseRangeSection(name string, section ini.Section) (sections map[string]ini.Section, err error)
- func RenderContent(in string) (out string, err error)
- type BaseProxyConf
- type BaseVisitorConf
- type BindInfoConf
- type ClientCommonConf
- type DomainConf
- type HealthCheckConf
- type HttpProxyConf
- func (cfg *HttpProxyConf) CheckForCli() (err error)
- func (cfg *HttpProxyConf) CheckForSvr() (err error)
- func (cfg *HttpProxyConf) Compare(cmp ProxyConf) bool
- func (cfg *HttpProxyConf) MarshalToMsg(pMsg *msg.NewProxy)
- func (cfg *HttpProxyConf) UnmarshalFromIni(prefix string, name string, section ini.Section) (err error)
- func (cfg *HttpProxyConf) UnmarshalFromMsg(pMsg *msg.NewProxy)
- type HttpsProxyConf
- func (cfg *HttpsProxyConf) CheckForCli() (err error)
- func (cfg *HttpsProxyConf) CheckForSvr() (err error)
- func (cfg *HttpsProxyConf) Compare(cmp ProxyConf) bool
- func (cfg *HttpsProxyConf) MarshalToMsg(pMsg *msg.NewProxy)
- func (cfg *HttpsProxyConf) UnmarshalFromIni(prefix string, name string, section ini.Section) (err error)
- func (cfg *HttpsProxyConf) UnmarshalFromMsg(pMsg *msg.NewProxy)
- type LocalSvrConf
- type ProxyConf
- type ServerCommonConf
- type StcpProxyConf
- func (cfg *StcpProxyConf) CheckForCli() (err error)
- func (cfg *StcpProxyConf) CheckForSvr() (err error)
- func (cfg *StcpProxyConf) Compare(cmp ProxyConf) bool
- func (cfg *StcpProxyConf) MarshalToMsg(pMsg *msg.NewProxy)
- func (cfg *StcpProxyConf) UnmarshalFromIni(prefix string, name string, section ini.Section) (err error)
- func (cfg *StcpProxyConf) UnmarshalFromMsg(pMsg *msg.NewProxy)
- type StcpVisitorConf
- type TcpProxyConf
- func (cfg *TcpProxyConf) CheckForCli() (err error)
- func (cfg *TcpProxyConf) CheckForSvr() error
- func (cfg *TcpProxyConf) Compare(cmp ProxyConf) bool
- func (cfg *TcpProxyConf) MarshalToMsg(pMsg *msg.NewProxy)
- func (cfg *TcpProxyConf) UnmarshalFromIni(prefix string, name string, section ini.Section) (err error)
- func (cfg *TcpProxyConf) UnmarshalFromMsg(pMsg *msg.NewProxy)
- type UdpProxyConf
- func (cfg *UdpProxyConf) CheckForCli() (err error)
- func (cfg *UdpProxyConf) CheckForSvr() error
- func (cfg *UdpProxyConf) Compare(cmp ProxyConf) bool
- func (cfg *UdpProxyConf) MarshalToMsg(pMsg *msg.NewProxy)
- func (cfg *UdpProxyConf) UnmarshalFromIni(prefix string, name string, section ini.Section) (err error)
- func (cfg *UdpProxyConf) UnmarshalFromMsg(pMsg *msg.NewProxy)
- type Values
- type VisitorConf
- type XtcpProxyConf
- func (cfg *XtcpProxyConf) CheckForCli() (err error)
- func (cfg *XtcpProxyConf) CheckForSvr() (err error)
- func (cfg *XtcpProxyConf) Compare(cmp ProxyConf) bool
- func (cfg *XtcpProxyConf) MarshalToMsg(pMsg *msg.NewProxy)
- func (cfg *XtcpProxyConf) UnmarshalFromIni(prefix string, name string, section ini.Section) (err error)
- func (cfg *XtcpProxyConf) UnmarshalFromMsg(pMsg *msg.NewProxy)
- type XtcpVisitorConf
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetRenderedConfFromFile ¶ added in v0.23.0
func InitServerCfg ¶ added in v0.17.0
func InitServerCfg(cfg *ServerCommonConf)
func LoadAllConfFromIni ¶ added in v0.22.0
func LoadAllConfFromIni(prefix string, content string, startProxy map[string]struct{}) ( proxyConfs map[string]ProxyConf, visitorConfs map[string]VisitorConf, err error)
if len(startProxy) is 0, start all otherwise just start proxies in startProxy map
func ParseRangeSection ¶ added in v0.16.0
func RenderContent ¶ added in v0.23.0
Types ¶
type BaseProxyConf ¶
type BaseProxyConf struct {
ProxyName string `json:"proxy_name"`
ProxyType string `json:"proxy_type"`
UseEncryption bool `json:"use_encryption"`
UseCompression bool `json:"use_compression"`
Group string `json:"group"`
GroupKey string `json:"group_key"`
LocalSvrConf
HealthCheckConf // only used for client
}
BaseProxy info
func (*BaseProxyConf) GetBaseInfo ¶
func (cfg *BaseProxyConf) GetBaseInfo() *BaseProxyConf
func (*BaseProxyConf) MarshalToMsg ¶ added in v0.17.0
func (cfg *BaseProxyConf) MarshalToMsg(pMsg *msg.NewProxy)
func (*BaseProxyConf) UnmarshalFromIni ¶ added in v0.17.0
func (*BaseProxyConf) UnmarshalFromMsg ¶ added in v0.17.0
func (cfg *BaseProxyConf) UnmarshalFromMsg(pMsg *msg.NewProxy)
type BaseVisitorConf ¶ added in v0.22.0
type BaseVisitorConf struct {
ProxyName string `json:"proxy_name"`
ProxyType string `json:"proxy_type"`
UseEncryption bool `json:"use_encryption"`
UseCompression bool `json:"use_compression"`
Role string `json:"role"`
Sk string `json:"sk"`
ServerName string `json:"server_name"`
BindAddr string `json:"bind_addr"`
BindPort int `json:"bind_port"`
}
func (*BaseVisitorConf) GetBaseInfo ¶ added in v0.22.0
func (cfg *BaseVisitorConf) GetBaseInfo() *BaseVisitorConf
func (*BaseVisitorConf) UnmarshalFromIni ¶ added in v0.22.0
type BindInfoConf ¶
type BindInfoConf struct {
RemotePort int `json:"remote_port"`
}
Bind info
func (*BindInfoConf) MarshalToMsg ¶ added in v0.17.0
func (cfg *BindInfoConf) MarshalToMsg(pMsg *msg.NewProxy)
func (*BindInfoConf) UnmarshalFromIni ¶ added in v0.17.0
func (*BindInfoConf) UnmarshalFromMsg ¶ added in v0.17.0
func (cfg *BindInfoConf) UnmarshalFromMsg(pMsg *msg.NewProxy)
type ClientCommonConf ¶
type ClientCommonConf struct {
ServerAddr string `json:"server_addr"`
ServerPort int `json:"server_port"`
HttpProxy string `json:"http_proxy"`
LogFile string `json:"log_file"`
LogWay string `json:"log_way"`
LogLevel string `json:"log_level"`
LogMaxDays int64 `json:"log_max_days"`
Token string `json:"token"`
AdminAddr string `json:"admin_addr"`
AdminPort int `json:"admin_port"`
AdminUser string `json:"admin_user"`
AdminPwd string `json:"admin_pwd"`
PoolCount int `json:"pool_count"`
TcpMux bool `json:"tcp_mux"`
User string `json:"user"`
DnsServer string `json:"dns_server"`
LoginFailExit bool `json:"login_fail_exit"`
Start map[string]struct{} `json:"start"`
Protocol string `json:"protocol"`
HeartBeatInterval int64 `json:"heartbeat_interval"`
HeartBeatTimeout int64 `json:"heartbeat_timeout"`
}
client common config
func GetDefaultClientConf ¶ added in v0.17.0
func GetDefaultClientConf() *ClientCommonConf
func UnmarshalClientConfFromIni ¶ added in v0.17.0
func UnmarshalClientConfFromIni(defaultCfg *ClientCommonConf, content string) (cfg *ClientCommonConf, err error)
func (*ClientCommonConf) Check ¶ added in v0.17.0
func (cfg *ClientCommonConf) Check() (err error)
type DomainConf ¶
type DomainConf struct {
CustomDomains []string `json:"custom_domains"`
SubDomain string `json:"sub_domain"`
}
Domain info
func (*DomainConf) MarshalToMsg ¶ added in v0.17.0
func (cfg *DomainConf) MarshalToMsg(pMsg *msg.NewProxy)
func (*DomainConf) UnmarshalFromIni ¶ added in v0.17.0
func (*DomainConf) UnmarshalFromMsg ¶ added in v0.17.0
func (cfg *DomainConf) UnmarshalFromMsg(pMsg *msg.NewProxy)
type HealthCheckConf ¶ added in v0.22.0
type HealthCheckConf struct {
HealthCheckType string `json:"health_check_type"` // tcp | http
HealthCheckTimeoutS int `json:"health_check_timeout_s"`
HealthCheckMaxFailed int `json:"health_check_max_failed"`
HealthCheckIntervalS int `json:"health_check_interval_s"`
HealthCheckUrl string `json:"health_check_url"`
// local_ip + local_port
HealthCheckAddr string `json:"-"`
}
Health check info
func (*HealthCheckConf) UnmarshalFromIni ¶ added in v0.22.0
type HttpProxyConf ¶
type HttpProxyConf struct {
BaseProxyConf
DomainConf
Locations []string `json:"locations"`
HttpUser string `json:"http_user"`
HttpPwd string `json:"http_pwd"`
HostHeaderRewrite string `json:"host_header_rewrite"`
Headers map[string]string `json:"headers"`
}
HTTP
func (*HttpProxyConf) CheckForCli ¶ added in v0.17.0
func (cfg *HttpProxyConf) CheckForCli() (err error)
func (*HttpProxyConf) CheckForSvr ¶ added in v0.17.0
func (cfg *HttpProxyConf) CheckForSvr() (err error)
func (*HttpProxyConf) Compare ¶ added in v0.13.0
func (cfg *HttpProxyConf) Compare(cmp ProxyConf) bool
func (*HttpProxyConf) MarshalToMsg ¶ added in v0.17.0
func (cfg *HttpProxyConf) MarshalToMsg(pMsg *msg.NewProxy)
func (*HttpProxyConf) UnmarshalFromIni ¶ added in v0.17.0
func (*HttpProxyConf) UnmarshalFromMsg ¶ added in v0.17.0
func (cfg *HttpProxyConf) UnmarshalFromMsg(pMsg *msg.NewProxy)
type HttpsProxyConf ¶
type HttpsProxyConf struct {
BaseProxyConf
DomainConf
}
HTTPS
func (*HttpsProxyConf) CheckForCli ¶ added in v0.17.0
func (cfg *HttpsProxyConf) CheckForCli() (err error)
func (*HttpsProxyConf) CheckForSvr ¶ added in v0.17.0
func (cfg *HttpsProxyConf) CheckForSvr() (err error)
func (*HttpsProxyConf) Compare ¶ added in v0.13.0
func (cfg *HttpsProxyConf) Compare(cmp ProxyConf) bool
func (*HttpsProxyConf) MarshalToMsg ¶ added in v0.17.0
func (cfg *HttpsProxyConf) MarshalToMsg(pMsg *msg.NewProxy)
func (*HttpsProxyConf) UnmarshalFromIni ¶ added in v0.17.0
func (*HttpsProxyConf) UnmarshalFromMsg ¶ added in v0.17.0
func (cfg *HttpsProxyConf) UnmarshalFromMsg(pMsg *msg.NewProxy)
type LocalSvrConf ¶
type LocalSvrConf struct {
LocalIp string `json:"local_ip"`
LocalPort int `json:"local_port"`
Plugin string `json:"plugin"`
PluginParams map[string]string `json:"plugin_params"`
}
Local service info
func (*LocalSvrConf) UnmarshalFromIni ¶ added in v0.17.0
type ProxyConf ¶
type ProxyConf interface {
GetBaseInfo() *BaseProxyConf
UnmarshalFromMsg(pMsg *msg.NewProxy)
UnmarshalFromIni(prefix string, name string, conf ini.Section) error
MarshalToMsg(pMsg *msg.NewProxy)
CheckForCli() error
CheckForSvr() error
Compare(conf ProxyConf) bool
}
func NewConfByType ¶
NewConfByType creates a empty ProxyConf object by proxyType. If proxyType isn't exist, return nil.
func NewProxyConfFromIni ¶ added in v0.17.0
type ServerCommonConf ¶
type ServerCommonConf struct {
BindAddr string `json:"bind_addr"`
BindPort int `json:"bind_port"`
BindUdpPort int `json:"bind_udp_port"`
KcpBindPort int `json:"kcp_bind_port"`
ProxyBindAddr string `json:"proxy_bind_addr"`
// If VhostHttpPort equals 0, don't listen a public port for http protocol.
VhostHttpPort int `json:"vhost_http_port"`
// if VhostHttpsPort equals 0, don't listen a public port for https protocol
VhostHttpsPort int `json:"vhost_http_port"`
VhostHttpTimeout int64 `json:"vhost_http_timeout"`
DashboardAddr string `json:"dashboard_addr"`
// if DashboardPort equals 0, dashboard is not available
DashboardPort int `json:"dashboard_port"`
DashboardUser string `json:"dashboard_user"`
DashboardPwd string `json:"dashboard_pwd"`
AssetsDir string `json:"asserts_dir"`
LogFile string `json:"log_file"`
LogWay string `json:"log_way"` // console or file
LogLevel string `json:"log_level"`
LogMaxDays int64 `json:"log_max_days"`
Token string `json:"token"`
SubDomainHost string `json:"subdomain_host"`
TcpMux bool `json:"tcp_mux"`
AllowPorts map[int]struct{}
MaxPoolCount int64 `json:"max_pool_count"`
MaxPortsPerClient int64 `json:"max_ports_per_client"`
HeartBeatTimeout int64 `json:"heart_beat_timeout"`
UserConnTimeout int64 `json:"user_conn_timeout"`
}
common config
func GetDefaultServerConf ¶ added in v0.17.0
func GetDefaultServerConf() *ServerCommonConf
func UnmarshalServerConfFromIni ¶ added in v0.17.0
func UnmarshalServerConfFromIni(defaultCfg *ServerCommonConf, content string) (cfg *ServerCommonConf, err error)
func (*ServerCommonConf) Check ¶ added in v0.17.0
func (cfg *ServerCommonConf) Check() (err error)
type StcpProxyConf ¶ added in v0.13.0
type StcpProxyConf struct {
BaseProxyConf
Role string `json:"role"`
Sk string `json:"sk"`
}
STCP
func (*StcpProxyConf) CheckForCli ¶ added in v0.17.0
func (cfg *StcpProxyConf) CheckForCli() (err error)
func (*StcpProxyConf) CheckForSvr ¶ added in v0.17.0
func (cfg *StcpProxyConf) CheckForSvr() (err error)
func (*StcpProxyConf) Compare ¶ added in v0.13.0
func (cfg *StcpProxyConf) Compare(cmp ProxyConf) bool
func (*StcpProxyConf) MarshalToMsg ¶ added in v0.17.0
func (cfg *StcpProxyConf) MarshalToMsg(pMsg *msg.NewProxy)
func (*StcpProxyConf) UnmarshalFromIni ¶ added in v0.17.0
func (*StcpProxyConf) UnmarshalFromMsg ¶ added in v0.17.0
func (cfg *StcpProxyConf) UnmarshalFromMsg(pMsg *msg.NewProxy)
Only for role server.
type StcpVisitorConf ¶ added in v0.22.0
type StcpVisitorConf struct {
BaseVisitorConf
}
func (*StcpVisitorConf) Check ¶ added in v0.22.0
func (cfg *StcpVisitorConf) Check() (err error)
func (*StcpVisitorConf) Compare ¶ added in v0.22.0
func (cfg *StcpVisitorConf) Compare(cmp VisitorConf) bool
func (*StcpVisitorConf) UnmarshalFromIni ¶ added in v0.22.0
type TcpProxyConf ¶
type TcpProxyConf struct {
BaseProxyConf
BindInfoConf
}
TCP
func (*TcpProxyConf) CheckForCli ¶ added in v0.17.0
func (cfg *TcpProxyConf) CheckForCli() (err error)
func (*TcpProxyConf) CheckForSvr ¶ added in v0.17.0
func (cfg *TcpProxyConf) CheckForSvr() error
func (*TcpProxyConf) Compare ¶ added in v0.13.0
func (cfg *TcpProxyConf) Compare(cmp ProxyConf) bool
func (*TcpProxyConf) MarshalToMsg ¶ added in v0.17.0
func (cfg *TcpProxyConf) MarshalToMsg(pMsg *msg.NewProxy)
func (*TcpProxyConf) UnmarshalFromIni ¶ added in v0.17.0
func (*TcpProxyConf) UnmarshalFromMsg ¶ added in v0.17.0
func (cfg *TcpProxyConf) UnmarshalFromMsg(pMsg *msg.NewProxy)
type UdpProxyConf ¶
type UdpProxyConf struct {
BaseProxyConf
BindInfoConf
}
UDP
func (*UdpProxyConf) CheckForCli ¶ added in v0.17.0
func (cfg *UdpProxyConf) CheckForCli() (err error)
func (*UdpProxyConf) CheckForSvr ¶ added in v0.17.0
func (cfg *UdpProxyConf) CheckForSvr() error
func (*UdpProxyConf) Compare ¶ added in v0.13.0
func (cfg *UdpProxyConf) Compare(cmp ProxyConf) bool
func (*UdpProxyConf) MarshalToMsg ¶ added in v0.17.0
func (cfg *UdpProxyConf) MarshalToMsg(pMsg *msg.NewProxy)
func (*UdpProxyConf) UnmarshalFromIni ¶ added in v0.17.0
func (*UdpProxyConf) UnmarshalFromMsg ¶ added in v0.17.0
func (cfg *UdpProxyConf) UnmarshalFromMsg(pMsg *msg.NewProxy)
type VisitorConf ¶ added in v0.22.0
type VisitorConf interface {
GetBaseInfo() *BaseVisitorConf
Compare(cmp VisitorConf) bool
UnmarshalFromIni(prefix string, name string, section ini.Section) error
Check() error
}
func NewVisitorConfByType ¶ added in v0.22.0
func NewVisitorConfByType(cfgType string) VisitorConf
func NewVisitorConfFromIni ¶ added in v0.22.0
type XtcpProxyConf ¶ added in v0.14.0
type XtcpProxyConf struct {
BaseProxyConf
Role string `json:"role"`
Sk string `json:"sk"`
}
XTCP
func (*XtcpProxyConf) CheckForCli ¶ added in v0.17.0
func (cfg *XtcpProxyConf) CheckForCli() (err error)
func (*XtcpProxyConf) CheckForSvr ¶ added in v0.17.0
func (cfg *XtcpProxyConf) CheckForSvr() (err error)
func (*XtcpProxyConf) Compare ¶ added in v0.14.0
func (cfg *XtcpProxyConf) Compare(cmp ProxyConf) bool
func (*XtcpProxyConf) MarshalToMsg ¶ added in v0.17.0
func (cfg *XtcpProxyConf) MarshalToMsg(pMsg *msg.NewProxy)
func (*XtcpProxyConf) UnmarshalFromIni ¶ added in v0.17.0
func (*XtcpProxyConf) UnmarshalFromMsg ¶ added in v0.17.0
func (cfg *XtcpProxyConf) UnmarshalFromMsg(pMsg *msg.NewProxy)
Only for role server.
type XtcpVisitorConf ¶ added in v0.22.0
type XtcpVisitorConf struct {
BaseVisitorConf
}
func (*XtcpVisitorConf) Check ¶ added in v0.22.0
func (cfg *XtcpVisitorConf) Check() (err error)
func (*XtcpVisitorConf) Compare ¶ added in v0.22.0
func (cfg *XtcpVisitorConf) Compare(cmp VisitorConf) bool
func (*XtcpVisitorConf) UnmarshalFromIni ¶ added in v0.22.0
Click to show internal directories.
Click to hide internal directories.