client

package
v0.1.6 Latest Latest
Warning

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

Go to latest
Published: May 26, 2017 License: Apache-2.0 Imports: 30 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadConfig

func LoadConfig(configDetail []byte, configType string) error

func LoadTLSConfig

func LoadTLSConfig(rootCertPaths []string) (*tls.Config, error)

func Main

func Main(configDetail []byte, configType string)

Types

type Aes

type Aes struct {
	SecretKey string `yaml:"secret_key,omitempty"`
}

type Config

type Config struct {
	Debug    bool   `yaml:"debug,omitempty"`
	LogFile  string `yaml:"log_file,omitempty"`
	ClientId string `yaml:"id,omitempty"`
	//if EncryptMode is tls and ServerName is empty,ServerAddr can't be IP format
	ServerAddr    string `yaml:"server_addr"`
	ServerUdpAddr string `yaml:"server_udp_addr"`
	ServerTcpAddr string `yaml:"server_tcp_addr"`
	Aes           Aes    `yaml:"aes,omitempty"`
	Tls           Tls    `yaml:"tls,omitempty"`
	EncryptMode   string `yaml:"encrypt_mode,omitempty"`
	//none:no encryption
	//aes:encrpted by aes
	//tls:encrpted by tls,which is default
	Tunnels   map[string]TunnelConfig `yaml:"tunnels"`
	AuthToken string                  `yaml:"auth_token,omitempty"`
	//mix: switch between kcp and tcp automatically,which is default
	//kcp: communicate with server in kcp
	//tcp: communicate with server in tcp
	Transport      string `yaml:"transport,omitempty"`
	HttpProxy      string `yaml:"http_proxy,omitempty"`
	DSN            string `yaml:"dsn,omitempty"`
	EnableCompress bool   `yaml:"enable_compress,omitempty"`
	Durable        bool   `yaml:"durable,omitempty"`
	DurableFile    string `yaml:"durable_file,omitempty"`
	Health         Health `yaml:"health,omitempty"`
	ManagePort     uint16 `yaml:"manage_port,omitempty"`
	DisableManage  bool   `yaml:"disable_manage,omitempty"`
}

type Control

type Control struct {
	ClientID uuid.UUID
	// contains filtered or unexported fields
}

func NewControl

func NewControl(conn net.Conn, encryptMode string, transport string, tunnels map[string]msg.Tunnel, lock *sync.Mutex) *Control

func (*Control) AddTunnel

func (c *Control) AddTunnel(w http.ResponseWriter, r *http.Request)

func (*Control) ClientAddTunnels

func (c *Control) ClientAddTunnels() error

func (*Control) Close

func (c *Control) Close()

func (*Control) Run

func (c *Control) Run()

func (*Control) SyncTunnels

func (c *Control) SyncTunnels(cstm *msg.AddTunnels) error

type Health

type Health struct {
	Interval int64 `yaml:"interval,omitempty"`
	TimeOut  int64 `yaml:"timeout,omitempty"`
}

type Tls

type Tls struct {
	TrustedCert string `yaml:"trusted_cert,omitempty"`
	ServerName  string `yaml:"server_name,omitempty"`
}

type TunnelConfig

type TunnelConfig struct {
	Schema          string `yaml:"schema,omitempty"`
	Host            string `yaml:"host,omitempty"`
	Port            uint16 `yaml:"port,omitempty"`
	LocalAddr       string `yaml:"local,omitempty"`
	HttpHostRewrite string `yaml:"http_host_rewrite,omitempty"`
	HttpsSkipVerify bool   `yaml:"https_skip_verify,omitempty"`
}

Jump to

Keyboard shortcuts

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