conn

package
v1.1.4 Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2024 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewWSConn

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

Types

type RelayConn

type RelayConn interface {
	// Transport transports data between the client and the remote server.
	// The remoteLabel is the label of the remote server.
	Transport(remoteLabel string) error

	// GetRelayLabel returns the label of the Relay instance.
	GetRelayLabel() string

	GetStats() *Stats

	Close() error
}

func NewRelayConn

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

type RelayConnOption

type RelayConnOption func(*relayConnImpl)

func WithHandshakeDuration

func WithHandshakeDuration(duration time.Duration) 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

Jump to

Keyboard shortcuts

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