conn

package
v1.1.5 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2024 License: GPL-3.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrIdleTimeout = errors.New("connection closed due to idle timeout")

Functions

func NewWSConn

func NewWSConn(conn net.Conn, isServer bool) *wsConn

Types

type RateLimitedConn added in v1.1.5

type RateLimitedConn struct {
	net.Conn
	// contains filtered or unexported fields
}

func NewRateLimitedConn added in v1.1.5

func NewRateLimitedConn(conn net.Conn, kbps int64) *RateLimitedConn

func (*RateLimitedConn) Read added in v1.1.5

func (r *RateLimitedConn) Read(p []byte) (int, error)

type RelayConn

type RelayConn interface {
	// Transport transports data between the client and the remote connection.
	Transport() error
	GetRelayLabel() string
	GetStats() *Stats
	Close() error
}

RelayConn is the interface that represents a relay connection. it contains two connections: clientConn and remoteConn clientConn is the connection from the client to the relay server remoteConn is the connection from the relay server to the remote server and the main function is to transport data between the two connections

func NewRelayConn

func NewRelayConn(clientConn, remoteConn net.Conn, opts ...RelayConnOption) RelayConn

type RelayConnOption

type RelayConnOption func(*relayConnImpl)

func WithConnType added in v1.1.5

func WithConnType(connType string) RelayConnOption

func WithLogger added in v1.1.5

func WithLogger(l *zap.SugaredLogger) RelayConnOption

func WithRelayLabel added in v1.1.5

func WithRelayLabel(relayLabel string) RelayConnOption

func WithRelayOptions added in v1.1.5

func WithRelayOptions(opts *conf.Options) RelayConnOption

func WithRemote added in v1.1.5

func WithRemote(remote *lb.Node) RelayConnOption

type Stats

type Stats struct {
	Up               int64
	Down             int64
	HandShakeLatency time.Duration
}

func (*Stats) Record

func (s *Stats) Record(up, down int64)

func (*Stats) String

func (s *Stats) String() string

type UDPListener added in v1.1.5

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

func NewUDPListener added in v1.1.5

func NewUDPListener(ctx context.Context, cfg *conf.Config) (*UDPListener, error)

func (*UDPListener) Accept added in v1.1.5

func (l *UDPListener) Accept() (*uc, error)

func (*UDPListener) Close added in v1.1.5

func (l *UDPListener) Close() error

Jump to

Keyboard shortcuts

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