tcpx

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2025 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithConnectTimeout

func WithConnectTimeout(timeout time.Duration) opt.Option[connectOptions]

Types

type Client

type Client interface {
	Dial() (Connect, error)
}

func NewClient

func NewClient(conf *ClientConfig) Client

type ClientConfig

type ClientConfig struct {
	Addr    string
	Timeout time.Duration
}

type Connect

type Connect interface {
	Send([]byte) error
	Receive([]byte) error
	SetTimeout(time.Duration)
	Conn() net.Conn
	Close()
}

func NewConnect

func NewConnect(conn net.Conn, opts ...opt.Option[connectOptions]) Connect

type Server

type Server interface {
	Start(ServerRegisterFunc) error
	Shutdown()
}

func NewServer

func NewServer(conf *ServerConfig) Server

type ServerConfig

type ServerConfig struct {
	Addr    string
	Timeout time.Duration
}

type ServerRegisterFunc

type ServerRegisterFunc func(Connect)

Jump to

Keyboard shortcuts

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