tcpudp

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrUDPServer = errors.New("UDP server crashed")
	ErrTCPServer = errors.New("TCP server crashed")
)

Functions

This section is empty.

Types

type Logger added in v0.5.0

type Logger interface {
	Debug(s string)
	Info(s string)
	Error(s string)
}

type Server

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

func NewServer

func NewServer(settings Settings, logger Logger) (s *Server, err error)

func (*Server) Listen

func (s *Server) Listen(ctx context.Context) (err error)

type Settings added in v0.3.0

type Settings struct {
	// Listening address for the TCP and UDP servers.
	// It defaults to ":8388". It cannot be nil in the
	// internal state. Note it overrides the Address for both
	// the TCP and the UDP servers.
	Address *string
	// LogAddresses to log addresses proxied for the TCP server.
	// It cannot be nil in the internal state.
	// Note it overrides the LogAddresses for both the TCP and the UDP servers.
	LogAddresses *bool
	// CipherName is the cipher to use for the TCP and UDP servers.
	// It defaults to chacha20-ietf-poly1305. It cannot be empty in the
	// internal state.
	CipherName string
	// Password for the TCP and UDP servers. It cannot be nil in the
	// internal state.
	Password *string

	// TCP can be used to set specific settings for the TCP server.
	TCP tcp.Settings
	// UDP can be used to set specific settings for the UDP server.
	UDP udp.Settings
}

func (Settings) Copy added in v0.4.0

func (s Settings) Copy() (copied Settings)

Copy returns a deep copy of the settings.

func (*Settings) OverrideWith added in v0.4.0

func (s *Settings) OverrideWith(other Settings)

OverrideWith sets any field of the receiving settings with the field value of any set field from the other settings.

func (*Settings) SetDefaults added in v0.4.0

func (s *Settings) SetDefaults()

SetDefaults sets default values for all unset field in the settings.

func (*Settings) Validate added in v0.4.0

func (s *Settings) Validate() (err error)

Validate validates the settings are correct.

Jump to

Keyboard shortcuts

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