config

package
v0.8.698 Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2017 License: Apache-2.0 Imports: 9 Imported by: 12

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, 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 local service port map to remote remote port

func (*BindInfoConf) FillRemotePort

func (cfg *BindInfoConf) FillRemotePort(rport int64)

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
	HttpProxy         string
	LogFile           string
	LogWay            string
	LogLevel          string
	LogMaxDays        int64
	PrivilegeToken    string
	PoolCount         int
	TcpMux            bool
	User              string
	LoginFailExit     bool
	Start             map[string]struct{}
	HeartBeatInterval int64
	HeartBeatTimeout  int64

	// added by liudf
	UseEncryption bool
	UseCompressed bool
}

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 FtpProxyConf

type FtpProxyConf struct {
	BaseProxyConf
	LocalSvrConf

	RemotePort     int64 `json:"remote_port"`
	RemoteDataPort int64 `json:"remote_data_port"`
}

ftp

func (*FtpProxyConf) Check

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

func (*FtpProxyConf) FillLocalServer

func (cfg *FtpProxyConf) FillLocalServer(ip string, port int)

func (*FtpProxyConf) FillRemotePort

func (cfg *FtpProxyConf) FillRemotePort(rport int64)

func (*FtpProxyConf) LoadFromFile

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

func (*FtpProxyConf) LoadFromMsg

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

func (*FtpProxyConf) UnMarshalToMsg

func (cfg *FtpProxyConf) 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) FillLocalServer

func (cfg *HttpProxyConf) FillLocalServer(ip string, port int)

func (*HttpProxyConf) FillRemotePort

func (cfg *HttpProxyConf) FillRemotePort(rport int64)

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) FillLocalServer

func (cfg *HttpsProxyConf) FillLocalServer(ip string, port int)

func (*HttpsProxyConf) FillRemotePort

func (cfg *HttpsProxyConf) FillRemotePort(rport int64)

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

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

func (*PluginConf) LoadFromFile

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
	FillLocalServer(ip string, port int)
	FillRemotePort(rport int64)
}

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

	// 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

	// 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

	// added by liudf
	UseEncryption bool
	UseCompressed bool
}

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 TcpProxyConf

type TcpProxyConf struct {
	BaseProxyConf
	BindInfoConf

	LocalSvrConf
	PluginConf

	FtpCfgProxyName string `json:"-"`
}

TCP

func (*TcpProxyConf) Check

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

func (*TcpProxyConf) FillLocalServer

func (cfg *TcpProxyConf) FillLocalServer(ip string, port int)

func (*TcpProxyConf) FillRemotePort

func (cfg *TcpProxyConf) FillRemotePort(rport int64)

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) FillLocalServer

func (cfg *UdpProxyConf) FillLocalServer(ip string, port int)

func (*UdpProxyConf) FillRemotePort

func (cfg *UdpProxyConf) FillRemotePort(rport int64)

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)

Jump to

Keyboard shortcuts

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