visitor

package
v0.0.0-...-c277624 Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2024 License: Apache-2.0 Imports: 23 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 wraps 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 *v1.ClientCommonConfig,
	connectServer func() (net.Conn, error),
	msgTransporter transport.MessageTransporter,
) *Manager

func (*Manager) Close

func (vm *Manager) Close()

func (*Manager) TransferConn

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

TransferConn transfers a connection to a visitor.

func (*Manager) UpdateAll

func (vm *Manager) UpdateAll(cfgs []v1.VisitorConfigurer)

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 *v1.ClientCommonConfig) 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 v1.VisitorConfigurer,
	clientCfg *v1.ClientCommonConfig,
	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