transport

package
v0.0.0-...-25c9f67 Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Handler

type Handler func(ctx context.Context, transport net.Conn)

type Server

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

func NewServer

func NewServer(address string, router http.Handler, log lib.ILogger) *Server

func (*Server) Run

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

type StatefulTransport

type StatefulTransport interface {
	Connect(ctx context.Context) error
	Close(ctx context.Context) error
	Read(ctx context.Context) ([]byte, error)
	Write(ctx context.Context, data []byte) error
	OnClose(func(reason error))
}

type StatefulTransportServer

type StatefulTransportServer interface {
	Run(ctx context.Context) error
	OnConnect(Handler)
}

tcp, sip and quic are stateful transports

type StatelessTransport

type StatelessTransport interface {
	Read(ctx context.Context) ([]byte, error)
	Write(ctx context.Context, data []byte) error
}

type StatelessTransportServer

type StatelessTransportServer interface {
	Run(ctx context.Context) error
	OnConnect(func(transport StatelessTransport))
}

udp is a stateless transport TODO: update this interface

type TCPServer

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

func NewTCPServer

func NewTCPServer(serverAddr string, log lib.ILogger) *TCPServer

func (*TCPServer) Run

func (p *TCPServer) Run(ctx context.Context) error

func (*TCPServer) SetConnectionHandler

func (p *TCPServer) SetConnectionHandler(handler Handler)

Jump to

Keyboard shortcuts

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