client

package
v0.34.1 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2020 License: Apache-2.0 Imports: 35 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseVisitor

type BaseVisitor struct {
	// contains filtered or unexported fields
}

type ByProxyStatusResp

type ByProxyStatusResp []ProxyStatusResp

func (ByProxyStatusResp) Len

func (a ByProxyStatusResp) Len() int

func (ByProxyStatusResp) Less

func (a ByProxyStatusResp) Less(i, j int) bool

func (ByProxyStatusResp) Swap

func (a ByProxyStatusResp) Swap(i, j int)

type Control

type Control struct {
	ProxyFunc func(err error)
	// contains filtered or unexported fields
}

func NewControl

func NewControl(ctx context.Context, runID string, conn net.Conn, session *fmux.Session,
	clientCfg config.ClientCommonConf,
	pxyCfgs map[string]config.ProxyConf,
	visitorCfgs map[string]config.VisitorConf,
	serverUDPPort int,
	authSetter auth.Setter) *Control

func (*Control) Close

func (ctl *Control) Close() error

func (*Control) ClosedDoneCh

func (ctl *Control) ClosedDoneCh() <-chan struct{}

ClosedDoneCh returns a channel which will be closed after all resources are released

func (*Control) HandleNewProxyResp

func (ctl *Control) HandleNewProxyResp(inMsg *msg.NewProxyResp)

func (*Control) HandleReqWorkConn

func (ctl *Control) HandleReqWorkConn(inMsg *msg.ReqWorkConn)

func (*Control) ReloadConf

func (ctl *Control) ReloadConf(pxyCfgs map[string]config.ProxyConf, visitorCfgs map[string]config.VisitorConf) error

func (*Control) Run

func (ctl *Control) Run()

type GeneralResponse

type GeneralResponse struct {
	Code int
	Msg  string
}

type ProxyStatusResp

type ProxyStatusResp struct {
	Name       string `json:"name"`
	Type       string `json:"type"`
	Status     string `json:"status"`
	Err        string `json:"err"`
	LocalAddr  string `json:"local_addr"`
	Plugin     string `json:"plugin"`
	RemoteAddr string `json:"remote_addr"`
}

func NewProxyStatusResp

func NewProxyStatusResp(status *proxy.WorkingStatus, serverAddr string) ProxyStatusResp

type STCPVisitor

type STCPVisitor struct {
	*BaseVisitor
	// contains filtered or unexported fields
}

func (*STCPVisitor) Close

func (sv *STCPVisitor) Close()

func (*STCPVisitor) Run

func (sv *STCPVisitor) Run() (err error)

type SUDPVisitor

type SUDPVisitor struct {
	*BaseVisitor
	// contains filtered or unexported fields
}

func (*SUDPVisitor) Close

func (sv *SUDPVisitor) Close()

func (*SUDPVisitor) Run

func (sv *SUDPVisitor) Run() (err error)

SUDP Run start listen a udp port

type Service

type Service struct {
	ReConnectByCount bool
	// contains filtered or unexported fields
}

Service is a client service.

func NewService

func NewService(cfg config.ClientCommonConf, pxyCfgs map[string]config.ProxyConf, visitorCfgs map[string]config.VisitorConf, cfgFile string) (svr *Service, err error)

func (*Service) Close

func (svr *Service) Close()

func (*Service) GetController

func (svr *Service) GetController() *Control

func (*Service) IsClosed

func (svr *Service) IsClosed() bool

func (*Service) ReloadConf

func (svr *Service) ReloadConf(pxyCfgs map[string]config.ProxyConf, visitorCfgs map[string]config.VisitorConf) error

func (*Service) Run

func (svr *Service) Run(isCmd bool) error

func (*Service) RunAdminServer

func (svr *Service) RunAdminServer(addr string, port int) (err error)

func (*Service) SetOnCloseListener

func (svr *Service) SetOnCloseListener(listener ServiceClosedListener)

func (*Service) SetProxyFailedFunc

func (svr *Service) SetProxyFailedFunc(proxyFailedFunc func(err error))

type ServiceClosedListener

type ServiceClosedListener interface {
	OnClosed(msg string)
}

type StatusResp

type StatusResp struct {
	TCP   []ProxyStatusResp `json:"tcp"`
	UDP   []ProxyStatusResp `json:"udp"`
	HTTP  []ProxyStatusResp `json:"http"`
	HTTPS []ProxyStatusResp `json:"https"`
	STCP  []ProxyStatusResp `json:"stcp"`
	XTCP  []ProxyStatusResp `json:"xtcp"`
	SUDP  []ProxyStatusResp `json:"sudp"`
}

type Visitor

type Visitor interface {
	Run() error
	Close()
}

Visitor is used for forward traffics from local port tot remote service.

func NewVisitor

func NewVisitor(ctx context.Context, ctl *Control, cfg config.VisitorConf) (visitor Visitor)

type VisitorManager

type VisitorManager struct {
	// contains filtered or unexported fields
}

func NewVisitorManager

func NewVisitorManager(ctx context.Context, ctl *Control) *VisitorManager

func (*VisitorManager) Close

func (vm *VisitorManager) Close()

func (*VisitorManager) Reload

func (vm *VisitorManager) Reload(cfgs map[string]config.VisitorConf)

func (*VisitorManager) Run

func (vm *VisitorManager) Run()

type XTCPVisitor

type XTCPVisitor struct {
	*BaseVisitor
	// contains filtered or unexported fields
}

func (*XTCPVisitor) Close

func (sv *XTCPVisitor) Close()

func (*XTCPVisitor) Run

func (sv *XTCPVisitor) Run() (err error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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