config

package
v0.14.1 Latest Latest
Warning

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

Go to latest
Published: Dec 14, 2017 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadProxyConfFromFile

func LoadProxyConfFromFile(prefix string, conf ini.File, startProxy map[string]struct{}) (
	proxyConfs map[string]ProxyConf, visitorConfs map[string]ProxyConf, err error)

if len(startProxy) is 0, start all otherwise just start proxies in startProxy map

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"`
}

BaseProxy info

func (*BaseProxyConf) GetBaseInfo

func (cfg *BaseProxyConf) GetBaseInfo() *BaseProxyConf

func (*BaseProxyConf) GetName

func (cfg *BaseProxyConf) GetName() string

func (*BaseProxyConf) LoadFromFile

func (cfg *BaseProxyConf) LoadFromFile(name string, section ini.Section) error

func (*BaseProxyConf) LoadFromMsg

func (cfg *BaseProxyConf) LoadFromMsg(pMsg *msg.NewProxy)

func (*BaseProxyConf) UnMarshalToMsg

func (cfg *BaseProxyConf) UnMarshalToMsg(pMsg *msg.NewProxy)

type BindInfoConf

type BindInfoConf struct {
	BindAddr   string `json:"bind_addr"`
	RemotePort int64  `json:"remote_port"`
}

Bind info

func (*BindInfoConf) LoadFromFile

func (cfg *BindInfoConf) LoadFromFile(name string, section ini.Section) (err error)

func (*BindInfoConf) LoadFromMsg

func (cfg *BindInfoConf) LoadFromMsg(pMsg *msg.NewProxy)

func (*BindInfoConf) UnMarshalToMsg

func (cfg *BindInfoConf) UnMarshalToMsg(pMsg *msg.NewProxy)

type ClientCommonConf

type ClientCommonConf struct {
	ConfigFile        string
	ServerAddr        string
	ServerPort        int64
	ServerUdpPort     int64 // this is specified by login response message from frps
	HttpProxy         string
	LogFile           string
	LogWay            string
	LogLevel          string
	LogMaxDays        int64
	PrivilegeToken    string
	AdminAddr         string
	AdminPort         int64
	AdminUser         string
	AdminPwd          string
	PoolCount         int
	TcpMux            bool
	User              string
	LoginFailExit     bool
	Start             map[string]struct{}
	Protocol          string
	HeartBeatInterval int64
	HeartBeatTimeout  int64
}

client common config

var ClientCommonCfg *ClientCommonConf

func GetDeaultClientCommonConf

func GetDeaultClientCommonConf() *ClientCommonConf

func LoadClientCommonConf

func LoadClientCommonConf(conf ini.File) (cfg *ClientCommonConf, err error)

type DomainConf

type DomainConf struct {
	CustomDomains []string `json:"custom_domains"`
	SubDomain     string   `json:"sub_domain"`
}

Domain info

func (*DomainConf) LoadFromFile

func (cfg *DomainConf) LoadFromFile(name string, section ini.Section) (err error)

func (*DomainConf) LoadFromMsg

func (cfg *DomainConf) LoadFromMsg(pMsg *msg.NewProxy)

func (*DomainConf) UnMarshalToMsg

func (cfg *DomainConf) UnMarshalToMsg(pMsg *msg.NewProxy)

type HttpProxyConf

type HttpProxyConf struct {
	BaseProxyConf
	DomainConf

	LocalSvrConf
	PluginConf

	Locations         []string `json:"locations"`
	HostHeaderRewrite string   `json:"host_header_rewrite"`
	HttpUser          string   `json:"-"`
	HttpPwd           string   `json:"-"`
}

HTTP

func (*HttpProxyConf) Check

func (cfg *HttpProxyConf) Check() (err error)

func (*HttpProxyConf) Compare added in v0.13.0

func (cfg *HttpProxyConf) Compare(cmp ProxyConf) bool

func (*HttpProxyConf) LoadFromFile

func (cfg *HttpProxyConf) LoadFromFile(name string, section ini.Section) (err error)

func (*HttpProxyConf) LoadFromMsg

func (cfg *HttpProxyConf) LoadFromMsg(pMsg *msg.NewProxy)

func (*HttpProxyConf) UnMarshalToMsg

func (cfg *HttpProxyConf) UnMarshalToMsg(pMsg *msg.NewProxy)

type HttpsProxyConf

type HttpsProxyConf struct {
	BaseProxyConf
	DomainConf

	LocalSvrConf
	PluginConf
}

HTTPS

func (*HttpsProxyConf) Check

func (cfg *HttpsProxyConf) Check() (err error)

func (*HttpsProxyConf) Compare added in v0.13.0

func (cfg *HttpsProxyConf) Compare(cmp ProxyConf) bool

func (*HttpsProxyConf) LoadFromFile

func (cfg *HttpsProxyConf) LoadFromFile(name string, section ini.Section) (err error)

func (*HttpsProxyConf) LoadFromMsg

func (cfg *HttpsProxyConf) LoadFromMsg(pMsg *msg.NewProxy)

func (*HttpsProxyConf) UnMarshalToMsg

func (cfg *HttpsProxyConf) UnMarshalToMsg(pMsg *msg.NewProxy)

type LocalSvrConf

type LocalSvrConf struct {
	LocalIp   string `json:"-"`
	LocalPort int    `json:"-"`
}

Local service info

func (*LocalSvrConf) LoadFromFile

func (cfg *LocalSvrConf) LoadFromFile(name string, section ini.Section) (err error)

type PluginConf added in v0.11.0

type PluginConf struct {
	Plugin       string            `json:"-"`
	PluginParams map[string]string `json:"-"`
}

func (*PluginConf) LoadFromFile added in v0.11.0

func (cfg *PluginConf) LoadFromFile(name string, section ini.Section) (err error)

type ProxyConf

type ProxyConf interface {
	GetName() string
	GetBaseInfo() *BaseProxyConf
	LoadFromMsg(pMsg *msg.NewProxy)
	LoadFromFile(name string, conf ini.Section) error
	UnMarshalToMsg(pMsg *msg.NewProxy)
	Check() error
	Compare(conf ProxyConf) bool
}

func NewConfByType

func NewConfByType(proxyType string) ProxyConf

NewConfByType creates a empty ProxyConf object by proxyType. If proxyType isn't exist, return nil.

func NewProxyConf

func NewProxyConf(pMsg *msg.NewProxy) (cfg ProxyConf, err error)

func NewProxyConfFromFile

func NewProxyConfFromFile(name string, section ini.Section) (cfg ProxyConf, err error)

type ServerCommonConf

type ServerCommonConf struct {
	ConfigFile    string
	BindAddr      string
	BindPort      int64
	BindUdpPort   int64
	KcpBindPort   int64
	ProxyBindAddr string

	// If VhostHttpPort equals 0, don't listen a public port for http protocol.
	VhostHttpPort int64

	// if VhostHttpsPort equals 0, don't listen a public port for https protocol
	VhostHttpsPort int64
	DashboardAddr  string

	// if DashboardPort equals 0, dashboard is not available
	DashboardPort  int64
	DashboardUser  string
	DashboardPwd   string
	AssetsDir      string
	LogFile        string
	LogWay         string // console or file
	LogLevel       string
	LogMaxDays     int64
	PrivilegeMode  bool
	PrivilegeToken string
	AuthTimeout    int64
	SubDomainHost  string
	TcpMux         bool

	// if PrivilegeAllowPorts is not nil, tcp proxies which remote port exist in this map can be connected
	PrivilegeAllowPorts [][2]int64
	MaxPoolCount        int64
	HeartBeatTimeout    int64
	UserConnTimeout     int64
}

common config

var ServerCommonCfg *ServerCommonConf

func GetDefaultServerCommonConf

func GetDefaultServerCommonConf() *ServerCommonConf

func LoadServerCommonConf

func LoadServerCommonConf(conf ini.File) (cfg *ServerCommonConf, err error)

Load server common configure.

type StcpProxyConf added in v0.13.0

type StcpProxyConf struct {
	BaseProxyConf

	Role string `json:"role"`
	Sk   string `json:"sk"`

	// used in role server
	LocalSvrConf
	PluginConf

	// used in role visitor
	ServerName string `json:"server_name"`
	BindAddr   string `json:"bind_addr"`
	BindPort   int    `json:"bind_port"`
}

STCP

func (*StcpProxyConf) Check added in v0.13.0

func (cfg *StcpProxyConf) Check() (err error)

func (*StcpProxyConf) Compare added in v0.13.0

func (cfg *StcpProxyConf) Compare(cmp ProxyConf) bool

func (*StcpProxyConf) LoadFromFile added in v0.13.0

func (cfg *StcpProxyConf) LoadFromFile(name string, section ini.Section) (err error)

func (*StcpProxyConf) LoadFromMsg added in v0.13.0

func (cfg *StcpProxyConf) LoadFromMsg(pMsg *msg.NewProxy)

Only for role server.

func (*StcpProxyConf) UnMarshalToMsg added in v0.13.0

func (cfg *StcpProxyConf) UnMarshalToMsg(pMsg *msg.NewProxy)

type TcpProxyConf

type TcpProxyConf struct {
	BaseProxyConf
	BindInfoConf

	LocalSvrConf
	PluginConf
}

TCP

func (*TcpProxyConf) Check

func (cfg *TcpProxyConf) Check() (err error)

func (*TcpProxyConf) Compare added in v0.13.0

func (cfg *TcpProxyConf) Compare(cmp ProxyConf) bool

func (*TcpProxyConf) LoadFromFile

func (cfg *TcpProxyConf) LoadFromFile(name string, section ini.Section) (err error)

func (*TcpProxyConf) LoadFromMsg

func (cfg *TcpProxyConf) LoadFromMsg(pMsg *msg.NewProxy)

func (*TcpProxyConf) UnMarshalToMsg

func (cfg *TcpProxyConf) UnMarshalToMsg(pMsg *msg.NewProxy)

type UdpProxyConf

type UdpProxyConf struct {
	BaseProxyConf
	BindInfoConf

	LocalSvrConf
}

UDP

func (*UdpProxyConf) Check

func (cfg *UdpProxyConf) Check() (err error)

func (*UdpProxyConf) Compare added in v0.13.0

func (cfg *UdpProxyConf) Compare(cmp ProxyConf) bool

func (*UdpProxyConf) LoadFromFile

func (cfg *UdpProxyConf) LoadFromFile(name string, section ini.Section) (err error)

func (*UdpProxyConf) LoadFromMsg

func (cfg *UdpProxyConf) LoadFromMsg(pMsg *msg.NewProxy)

func (*UdpProxyConf) UnMarshalToMsg

func (cfg *UdpProxyConf) UnMarshalToMsg(pMsg *msg.NewProxy)

type XtcpProxyConf added in v0.14.0

type XtcpProxyConf struct {
	BaseProxyConf

	Role string `json:"role"`
	Sk   string `json:"sk"`

	// used in role server
	LocalSvrConf
	PluginConf

	// used in role visitor
	ServerName string `json:"server_name"`
	BindAddr   string `json:"bind_addr"`
	BindPort   int    `json:"bind_port"`
}

XTCP

func (*XtcpProxyConf) Check added in v0.14.0

func (cfg *XtcpProxyConf) Check() (err error)

func (*XtcpProxyConf) Compare added in v0.14.0

func (cfg *XtcpProxyConf) Compare(cmp ProxyConf) bool

func (*XtcpProxyConf) LoadFromFile added in v0.14.0

func (cfg *XtcpProxyConf) LoadFromFile(name string, section ini.Section) (err error)

func (*XtcpProxyConf) LoadFromMsg added in v0.14.0

func (cfg *XtcpProxyConf) LoadFromMsg(pMsg *msg.NewProxy)

Only for role server.

func (*XtcpProxyConf) UnMarshalToMsg added in v0.14.0

func (cfg *XtcpProxyConf) UnMarshalToMsg(pMsg *msg.NewProxy)

Jump to

Keyboard shortcuts

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