server

package
v0.67.0 Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2026 License: Apache-2.0 Imports: 45 Imported by: 28

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

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,
	encryptionKey []byte,
	ctlConn net.Conn,
	ctlConnEncrypted bool,
	loginMsg *msg.Login,
	serverCfg *v1.ServerConfig,
) (*Control, error)

TODO(fatedier): Referencing the implementation of frpc, encapsulate the input parameters as SessionContext.

func (*Control) Close added in v0.49.0

func (ctl *Control) Close() error

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) (old *Control)

func (*ControlManager) Close added in v0.49.0

func (cm *ControlManager) Close() error

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.34.0

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

type Service

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

Server service

func NewService

func NewService(cfg *v1.ServerConfig) (*Service, error)

func (*Service) Close added in v0.49.0

func (svr *Service) Close() error

func (*Service) HandleListener added in v0.12.0

func (svr *Service) HandleListener(l net.Listener, internal bool)

HandleListener accepts connections from client and call handleConnection to handle them. If internal is true, it means that this listener is used for internal communication like ssh tunnel gateway. TODO(fatedier): Pass some parameters of listener/connection through context to avoid passing too many parameters.

func (*Service) HandleQUICListener added in v0.46.0

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

func (*Service) RegisterControl

func (svr *Service) RegisterControl(ctlConn net.Conn, loginMsg *msg.Login, internal bool) 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(ctx context.Context)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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