transport

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ListenAndServe

func ListenAndServe(addr string, events Events, opts ...Option) error

Types

type Conn

type Conn interface {
	Write([]byte) (int, error)
	WriteLease(WriteLease) (int, error)
	WriteHeaderAndLease([]byte, WriteLease) (int, error)
	Writev(...[]byte) (int, error)
	Peek([]byte) []byte
	AcquireRead() ReadLease
	Discard(int) (int, error)
	PauseRead()
	ResumeRead()
	ResumeOnNextRead()
	CompleteRequest()
	Close() error
	Context() any
	SetContext(any)
	LocalAddr() net.Addr
	RemoteAddr() net.Addr
}

type Events

type Events struct {
	OnOpen  func(Conn)
	OnData  func(Conn) error
	OnClose func(Conn, error)
}

type Option

type Option func(*options)

func WithIdleTimeout

func WithIdleTimeout(d time.Duration) Option

func WithReadTimeout

func WithReadTimeout(d time.Duration) Option

func WithWriteTimeout

func WithWriteTimeout(d time.Duration) Option

type ReadLease

type ReadLease interface {
	Bytes() []byte
	Retain() ReadLease
	Release()
}

type Server

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

func NewServer

func NewServer(events Events, opts ...Option) *Server

func (*Server) ListenAndServe

func (s *Server) ListenAndServe(addr string) error

func (*Server) Shutdown

func (s *Server) Shutdown(ctx context.Context) error

type WriteLease

type WriteLease interface {
	Bytes() []byte
	Retain() WriteLease
	Release()
}

Jump to

Keyboard shortcuts

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