server

package
v0.48.3 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2023 License: Apache-2.0 Imports: 46 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseOutConf added in v0.20.0

type BaseOutConf struct {
	config.BaseProxyConf
}

type Control

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

func NewControl

func NewControl(
	ctx context.Context,
	rc *controller.ResourceController,
	pxyManager *proxy.Manager,
	pluginManager *plugin.Manager,
	authVerifier auth.Verifier,
	ctlConn net.Conn,
	loginMsg *msg.Login,
	serverCfg config.ServerCommonConf,
) *Control

func (*Control) CloseProxy added in v0.12.0

func (ctl *Control) CloseProxy(closeMsg *msg.CloseProxy) (err error)

func (*Control) GetWorkConn

func (ctl *Control) GetWorkConn() (workConn net.Conn, err error)

When frps get one user connection, we get one work connection from the pool and return it. If no workConn available in the pool, send message to frpc to get one or more and wait until it is available. return an error if wait timeout

func (*Control) RegisterProxy

func (ctl *Control) RegisterProxy(pxyMsg *msg.NewProxy) (remoteAddr string, err error)

func (*Control) RegisterWorkConn

func (ctl *Control) RegisterWorkConn(conn net.Conn) error

func (*Control) Replaced

func (ctl *Control) Replaced(newCtl *Control)

func (*Control) Start

func (ctl *Control) Start()

Start send a login success message to client and start working.

func (*Control) WaitClosed added in v0.23.0

func (ctl *Control) WaitClosed()

block until Control closed

type ControlManager

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

func NewControlManager

func NewControlManager() *ControlManager

func (*ControlManager) Add

func (cm *ControlManager) Add(runID string, ctl *Control) (oldCtl *Control)

func (*ControlManager) Del added in v0.23.0

func (cm *ControlManager) Del(runID string, ctl *Control)

we should make sure if it's the same control to prevent delete a new one

func (*ControlManager) GetByID added in v0.48.2

func (cm *ControlManager) GetByID(runID string) (ctl *Control, ok bool)

type GeneralResponse

type GeneralResponse struct {
	Code int
	Msg  string
}

type GetProxyInfoResp

type GetProxyInfoResp struct {
	Proxies []*ProxyStatsInfo `json:"proxies"`
}

type GetProxyStatsResp added in v0.17.0

type GetProxyStatsResp struct {
	Name            string      `json:"name"`
	Conf            interface{} `json:"conf"`
	TodayTrafficIn  int64       `json:"today_traffic_in"`
	TodayTrafficOut int64       `json:"today_traffic_out"`
	CurConns        int64       `json:"cur_conns"`
	LastStartTime   string      `json:"last_start_time"`
	LastCloseTime   string      `json:"last_close_time"`
	Status          string      `json:"status"`
}

Get proxy info by name.

type GetProxyTrafficResp

type GetProxyTrafficResp struct {
	Name       string  `json:"name"`
	TrafficIn  []int64 `json:"traffic_in"`
	TrafficOut []int64 `json:"traffic_out"`
}

api/traffic/:name

type HTTPOutConf added in v0.48.2

type HTTPOutConf struct {
	BaseOutConf
	config.DomainConf
	Locations         []string `json:"locations"`
	HostHeaderRewrite string   `json:"host_header_rewrite"`
}

type HTTPSOutConf added in v0.48.2

type HTTPSOutConf struct {
	BaseOutConf
	config.DomainConf
}

type ProxyStatsInfo

type ProxyStatsInfo struct {
	Name            string      `json:"name"`
	Conf            interface{} `json:"conf"`
	ClientVersion   string      `json:"client_version,omitempty"`
	TodayTrafficIn  int64       `json:"today_traffic_in"`
	TodayTrafficOut int64       `json:"today_traffic_out"`
	CurConns        int64       `json:"cur_conns"`
	LastStartTime   string      `json:"last_start_time"`
	LastCloseTime   string      `json:"last_close_time"`
	Status          string      `json:"status"`
}

Get proxy info.

type STCPOutConf added in v0.48.2

type STCPOutConf struct {
	BaseOutConf
}

type Service

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

Server service

func NewService

func NewService(cfg config.ServerCommonConf) (svr *Service, err error)

func (*Service) APIProxyByType added in v0.48.2

func (svr *Service) APIProxyByType(w http.ResponseWriter, r *http.Request)

api/proxy/:type

func (*Service) APIProxyByTypeAndName added in v0.48.2

func (svr *Service) APIProxyByTypeAndName(w http.ResponseWriter, r *http.Request)

api/proxy/:type/:name

func (*Service) APIProxyTraffic added in v0.48.2

func (svr *Service) APIProxyTraffic(w http.ResponseWriter, r *http.Request)

func (*Service) APIServerInfo added in v0.48.2

func (svr *Service) APIServerInfo(w http.ResponseWriter, r *http.Request)

api/serverinfo

func (*Service) HandleListener added in v0.12.0

func (svr *Service) HandleListener(l net.Listener)

func (*Service) HandleQUICListener added in v0.48.2

func (svr *Service) HandleQUICListener(l quic.Listener)

func (*Service) Healthz added in v0.48.2

func (svr *Service) Healthz(w http.ResponseWriter, r *http.Request)

/healthz

func (*Service) RegisterControl

func (svr *Service) RegisterControl(ctlConn net.Conn, loginMsg *msg.Login) (err error)

func (*Service) RegisterVisitorConn added in v0.14.0

func (svr *Service) RegisterVisitorConn(visitorConn net.Conn, newMsg *msg.NewVisitorConn) error

func (*Service) RegisterWorkConn

func (svr *Service) RegisterWorkConn(workConn net.Conn, newMsg *msg.NewWorkConn) error

RegisterWorkConn register a new work connection to control and proxies need it.

func (*Service) Run

func (svr *Service) Run()

func (*Service) RunDashboardServer added in v0.23.0

func (svr *Service) RunDashboardServer(address string) (err error)

type TCPMuxOutConf added in v0.48.2

type TCPMuxOutConf struct {
	BaseOutConf
	config.DomainConf
	Multiplexer string `json:"multiplexer"`
}

type TCPOutConf added in v0.48.2

type TCPOutConf struct {
	BaseOutConf
	RemotePort int `json:"remote_port"`
}

type UDPOutConf added in v0.48.2

type UDPOutConf struct {
	BaseOutConf
	RemotePort int `json:"remote_port"`
}

type XTCPOutConf added in v0.48.2

type XTCPOutConf struct {
	BaseOutConf
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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