Versions in this module Expand all Collapse all v0 v0.0.1 Jul 31, 2023 Changes in this version + const DefaultHost + const DefaultProtocol + const DefaultTcpPort + const DefaultTlsPort + const DefaultUdpPort + const DefaultWsPort + const DefaultWssPort + const MTU + func NewWsListener(listener net.Listener, network string, log log.Logger) *wsListener + func SetProtocolFactory(factory ProtocolFactory) + func WithLogger(logger log.Logger) interface + func WithMessageMapper(mapper sip.MessageMapper) interface + type Connection interface + Key func() ConnectionKey + Network func() string + ReadFrom func(buf []byte) (num int, raddr net.Addr, err error) + Streamed func() bool + String func() string + WriteTo func(buf []byte, raddr net.Addr) (num int, err error) + func NewConnection(baseConn net.Conn, key ConnectionKey, network string, logger log.Logger) Connection + type ConnectionError struct + ConnPtr string + Dest string + Err error + Net string + Op string + Source string + func (err *ConnectionError) Error() string + func (err *ConnectionError) Network() bool + func (err *ConnectionError) Temporary() bool + func (err *ConnectionError) Timeout() bool + func (err *ConnectionError) Unwrap() error + type ConnectionHandler interface + Cancel func() + Connection func() Connection + Done func() <-chan struct{} + Expired func() bool + Expiry func() time.Time + Key func() ConnectionKey + Serve func() + String func() string + func NewConnectionHandler(conn Connection, ttl time.Duration, output chan<- sip.Message, ...) ConnectionHandler + type ConnectionHandlerError struct + Err error + HandlerPtr string + Key ConnectionKey + LAddr string + Net string + RAddr string + func (err *ConnectionHandlerError) Canceled() bool + func (err *ConnectionHandlerError) EOF() bool + func (err *ConnectionHandlerError) Error() string + func (err *ConnectionHandlerError) Expired() bool + func (err *ConnectionHandlerError) Network() bool + func (err *ConnectionHandlerError) Temporary() bool + func (err *ConnectionHandlerError) Timeout() bool + func (err *ConnectionHandlerError) Unwrap() error + type ConnectionKey string + func (key ConnectionKey) String() string + type ConnectionPool interface + All func() []Connection + Done func() <-chan struct{} + Drop func(key ConnectionKey) error + DropAll func() error + Get func(key ConnectionKey) (Connection, error) + Length func() int + Put func(connection Connection, ttl time.Duration) error + String func() string + func NewConnectionPool(output chan<- sip.Message, errs chan<- error, cancel <-chan struct{}, ...) ConnectionPool + type Error interface + Network func() bool + type ExpireError string + func (err ExpireError) Canceled() bool + func (err ExpireError) Error() string + func (err ExpireError) Expired() bool + func (err ExpireError) Network() bool + func (err ExpireError) Temporary() bool + func (err ExpireError) Timeout() bool + type Layer interface + Cancel func() + Done func() <-chan struct{} + Errors func() <-chan error + IsReliable func(network string) bool + IsStreamed func(network string) bool + Listen func(network string, addr string, options ...ListenOption) error + Messages func() <-chan sip.Message + Send func(msg sip.Message) error + String func() string + func NewLayer(ip net.IP, dnsResolver *net.Resolver, msgMapper sip.MessageMapper, ...) Layer + type LayerOption interface + ApplyLayer func(opts *LayerOptions) + func WithDNSResolver(resolver *net.Resolver) LayerOption + type LayerOptions struct + DNSResolver *net.Resolver + type ListenOption interface + ApplyListen func(opts *ListenOptions) + type ListenOptions struct + TLSConfig TLSConfig + type ListenerHandler interface + Cancel func() + Done func() <-chan struct{} + Key func() ListenerKey + Listener func() net.Listener + Serve func() + String func() string + func NewListenerHandler(key ListenerKey, listener net.Listener, output chan<- Connection, ...) ListenerHandler + type ListenerHandlerError struct + Addr string + Err error + HandlerPtr string + Key ListenerKey + Net string + func (err *ListenerHandlerError) Canceled() bool + func (err *ListenerHandlerError) Error() string + func (err *ListenerHandlerError) Expired() bool + func (err *ListenerHandlerError) Network() bool + func (err *ListenerHandlerError) Temporary() bool + func (err *ListenerHandlerError) Timeout() bool + func (err *ListenerHandlerError) Unwrap() error + type ListenerKey string + func (key ListenerKey) String() string + type ListenerPool interface + All func() []net.Listener + Done func() <-chan struct{} + Drop func(key ListenerKey) error + DropAll func() error + Get func(key ListenerKey) (net.Listener, error) + Length func() int + Put func(key ListenerKey, listener net.Listener) error + String func() string + func NewListenerPool(output chan<- Connection, errs chan<- error, cancel <-chan struct{}, ...) ListenerPool + type Options struct + Logger log.Logger + MessageMapper sip.MessageMapper + type PoolError struct + Err error + Op string + Pool string + func (err *PoolError) Error() string + func (err *PoolError) Network() bool + func (err *PoolError) Temporary() bool + func (err *PoolError) Timeout() bool + func (err *PoolError) Unwrap() error + type Protocol interface + Done func() <-chan struct{} + Listen func(target *Target, options ...ListenOption) error + Network func() string + Reliable func() bool + Send func(target *Target, msg sip.Message) error + Streamed func() bool + String func() string + func NewTcpProtocol(output chan<- sip.Message, errs chan<- error, cancel <-chan struct{}, ...) Protocol + func NewTlsProtocol(output chan<- sip.Message, errs chan<- error, cancel <-chan struct{}, ...) Protocol + func NewUdpProtocol(output chan<- sip.Message, errs chan<- error, cancel <-chan struct{}, ...) Protocol + func NewWsProtocol(output chan<- sip.Message, errs chan<- error, cancel <-chan struct{}, ...) Protocol + func NewWssProtocol(output chan<- sip.Message, errs chan<- error, cancel <-chan struct{}, ...) Protocol + type ProtocolError struct + Err error + Op string + ProtoPtr string + func (err *ProtocolError) Error() string + func (err *ProtocolError) Network() bool + func (err *ProtocolError) Temporary() bool + func (err *ProtocolError) Timeout() bool + func (err *ProtocolError) Unwrap() error + type ProtocolFactory func(network string, output chan<- sip.Message, errs chan<- error, ...) (Protocol, error) + func GetProtocolFactory() ProtocolFactory + type ProtocolOption interface + ApplyProtocol func(opts *ProtocolOptions) + type ProtocolOptions struct + type TLSConfig struct + Cert string + Domain string + Key string + Pass string + func (c TLSConfig) ApplyListen(opts *ListenOptions) + type Target struct + Host string + Port *sip.Port + func FillTargetHostAndPort(network string, target *Target) *Target + func NewTarget(host string, port int) *Target + func NewTargetFromAddr(addr string) (*Target, error) + func (trg *Target) Addr() string + func (trg *Target) String() string + type UnsupportedProtocolError string + func (err UnsupportedProtocolError) Error() string + func (err UnsupportedProtocolError) Network() bool + func (err UnsupportedProtocolError) Temporary() bool + func (err UnsupportedProtocolError) Timeout() bool