visitor

package
v0.51.4 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2023 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNoTunnelSession = errors.New("no tunnel session")

Functions

This section is empty.

Types

type BaseVisitor

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

func (*BaseVisitor) AcceptConn

func (v *BaseVisitor) AcceptConn(conn net.Conn) error

func (*BaseVisitor) Close

func (v *BaseVisitor) Close()

type Helper

type Helper interface {
	// ConnectServer directly connects to the frp server.
	ConnectServer() (net.Conn, error)
	// TransferConn transfers the connection to another visitor.
	TransferConn(string, net.Conn) error
	// MsgTransporter returns the message transporter that is used to send and receive messages
	// to the frp server through the controller.
	MsgTransporter() transport.MessageTransporter
	// RunID returns the run id of current controller.
	RunID() string
}

Helper wrapps some functions for visitor to use.

type KCPTunnelSession

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

func (*KCPTunnelSession) Close

func (ks *KCPTunnelSession) Close()

func (*KCPTunnelSession) Init

func (ks *KCPTunnelSession) Init(listenConn *net.UDPConn, raddr *net.UDPAddr) error

func (*KCPTunnelSession) OpenConn

func (ks *KCPTunnelSession) OpenConn(_ context.Context) (net.Conn, error)

type Manager

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

func NewManager

func NewManager(
	ctx context.Context,
	runID string,
	clientCfg config.ClientCommonConf,
	connectServer func() (net.Conn, error),
	msgTransporter transport.MessageTransporter,
) *Manager

func (*Manager) Close

func (vm *Manager) Close()

func (*Manager) Reload

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

func (*Manager) Run

func (vm *Manager) Run()

func (*Manager) TransferConn

func (vm *Manager) TransferConn(name string, conn net.Conn) error

TransferConn transfers a connection to a visitor.

type QUICTunnelSession

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

func (*QUICTunnelSession) Close

func (qs *QUICTunnelSession) Close()

func (*QUICTunnelSession) Init

func (qs *QUICTunnelSession) Init(listenConn *net.UDPConn, raddr *net.UDPAddr) error

func (*QUICTunnelSession) OpenConn

func (qs *QUICTunnelSession) OpenConn(ctx context.Context) (net.Conn, error)

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 TunnelSession

type TunnelSession interface {
	Init(listenConn *net.UDPConn, raddr *net.UDPAddr) error
	OpenConn(context.Context) (net.Conn, error)
	Close()
}

func NewKCPTunnelSession

func NewKCPTunnelSession() TunnelSession

func NewQUICTunnelSession

func NewQUICTunnelSession(clientCfg *config.ClientCommonConf) TunnelSession

type Visitor

type Visitor interface {
	Run() error
	AcceptConn(conn net.Conn) error
	Close()
}

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

func NewVisitor

func NewVisitor(
	ctx context.Context,
	cfg config.VisitorConf,
	clientCfg config.ClientCommonConf,
	helper Helper,
) (visitor Visitor)

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)

Jump to

Keyboard shortcuts

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