Documentation
¶
Overview ¶
transport package implements SIP transport layer.
Index ¶
- Constants
- func DefaultPort(protocol string) sip.Port
- func SetProtocolFactory(factory ProtocolFactory)
- type Connection
- type ConnectionError
- type ConnectionHandler
- type ConnectionHandlerError
- 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
- type ConnectionPool
- type Error
- type ExpireError
- type Layer
- type ListenerHandler
- type ListenerHandlerError
- 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
- type ListenerPool
- type PoolError
- type Protocol
- type ProtocolError
- type ProtocolFactory
- type Target
- type UnsupportedProtocolError
Constants ¶
Variables ¶
This section is empty.
Functions ¶
func DefaultPort ¶
DefaultPort returns protocol default port by network.
func SetProtocolFactory ¶
func SetProtocolFactory(factory ProtocolFactory)
SetProtocolFactory replaces default protocol factory
Types ¶
type Connection ¶
type Connection interface { net.Conn Key() ConnectionKey Network() string Streamed() bool String() string ReadFrom(buf []byte) (num int, raddr net.Addr, err error) WriteTo(buf []byte, raddr net.Addr) (num int, err error) }
Wrapper around net.Conn.
func NewConnection ¶
func NewConnection(baseConn net.Conn, key ConnectionKey, logger log.Logger) Connection
type ConnectionError ¶
type ConnectionError struct { Err error Op string Net string Source string Dest string ConnPtr string }
Connection level error.
func (*ConnectionError) Error ¶
func (err *ConnectionError) Error() string
func (*ConnectionError) Network ¶
func (err *ConnectionError) Network() bool
func (*ConnectionError) Temporary ¶
func (err *ConnectionError) Temporary() bool
func (*ConnectionError) Timeout ¶
func (err *ConnectionError) Timeout() bool
func (*ConnectionError) Unwrap ¶
func (err *ConnectionError) Unwrap() error
type ConnectionHandler ¶
type ConnectionHandler interface { Cancel() Done() <-chan struct{} String() string Key() ConnectionKey Connection() Connection // Expiry returns connection expiry time. Expiry() time.Time Expired() bool // Update updates connection expiry time. // TODO put later to allow runtime update // Update(conn Connection, ttl time.Duration) // Manage runs connection serving. Serve(done func()) }
ConnectionHandler serves associated connection, i.e. parses incoming data, manages expiry time & etc.
func NewConnectionHandler ¶
func NewConnectionHandler( conn Connection, ttl time.Duration, output chan<- sip.Message, errs chan<- error, cancel <-chan struct{}, msgMapper sip.MessageMapper, logger log.Logger, ) ConnectionHandler
type ConnectionHandlerError ¶
type ConnectionHandlerError struct { Err error Key ConnectionKey HandlerPtr string Net string LAddr string RAddr string }
func (*ConnectionHandlerError) Canceled ¶
func (err *ConnectionHandlerError) Canceled() bool
func (*ConnectionHandlerError) EOF ¶
func (err *ConnectionHandlerError) EOF() bool
func (*ConnectionHandlerError) Error ¶
func (err *ConnectionHandlerError) Error() string
func (*ConnectionHandlerError) Expired ¶
func (err *ConnectionHandlerError) Expired() bool
func (*ConnectionHandlerError) Network ¶
func (err *ConnectionHandlerError) Network() bool
func (*ConnectionHandlerError) Temporary ¶
func (err *ConnectionHandlerError) Temporary() bool
func (*ConnectionHandlerError) Timeout ¶
func (err *ConnectionHandlerError) Timeout() bool
func (*ConnectionHandlerError) Unwrap ¶
func (err *ConnectionHandlerError) Unwrap() error
type ConnectionKey ¶
type ConnectionKey string
func (ConnectionKey) String ¶
func (key ConnectionKey) String() string
type ConnectionPool ¶
type ConnectionPool interface { Done() <-chan struct{} String() string Put(connection Connection, ttl time.Duration) error Get(key ConnectionKey) (Connection, error) All() []Connection Drop(key ConnectionKey) error DropAll() error Length() int }
ConnectionPool used for active connection management.
func NewConnectionPool ¶
func NewConnectionPool( output chan<- sip.Message, errs chan<- error, cancel <-chan struct{}, msgMapper sip.MessageMapper, logger log.Logger, ) ConnectionPool
type ExpireError ¶
type ExpireError string
func (ExpireError) Canceled ¶
func (err ExpireError) Canceled() bool
func (ExpireError) Error ¶
func (err ExpireError) Error() string
func (ExpireError) Expired ¶
func (err ExpireError) Expired() bool
func (ExpireError) Network ¶
func (err ExpireError) Network() bool
func (ExpireError) Temporary ¶
func (err ExpireError) Temporary() bool
func (ExpireError) Timeout ¶
func (err ExpireError) Timeout() bool
type Layer ¶
type Layer interface { Cancel() Done() <-chan struct{} Messages() <-chan sip.Message Errors() <-chan error // Listen starts listening on `addr` for each registered protocol. Listen(network string, addr string) error // Send sends message on suitable protocol. Send(msg sip.Message) error String() string IsReliable(network string) bool }
TransportLayer layer is responsible for the actual transmission of messages - RFC 3261 - 18.
type ListenerHandler ¶
type ListenerHandler interface { log.Loggable Cancel() Done() <-chan struct{} String() string Key() ListenerKey Listener() net.Listener Serve(done func()) }
func NewListenerHandler ¶
func NewListenerHandler( key ListenerKey, listener net.Listener, output chan<- Connection, errs chan<- error, cancel <-chan struct{}, logger log.Logger, ) ListenerHandler
type ListenerHandlerError ¶
type ListenerHandlerError struct { Err error Key ListenerKey HandlerPtr string Net string Addr string }
func (*ListenerHandlerError) Canceled ¶
func (err *ListenerHandlerError) Canceled() bool
func (*ListenerHandlerError) Error ¶
func (err *ListenerHandlerError) Error() string
func (*ListenerHandlerError) Expired ¶
func (err *ListenerHandlerError) Expired() bool
func (*ListenerHandlerError) Network ¶
func (err *ListenerHandlerError) Network() bool
func (*ListenerHandlerError) Temporary ¶
func (err *ListenerHandlerError) Temporary() bool
func (*ListenerHandlerError) Timeout ¶
func (err *ListenerHandlerError) Timeout() bool
func (*ListenerHandlerError) Unwrap ¶
func (err *ListenerHandlerError) Unwrap() error
type ListenerKey ¶
type ListenerKey string
func (ListenerKey) String ¶
func (key ListenerKey) String() string
type ListenerPool ¶
type ListenerPool interface { log.Loggable Done() <-chan struct{} String() string Put(key ListenerKey, listener net.Listener) error Get(key ListenerKey) (net.Listener, error) All() []net.Listener Drop(key ListenerKey) error DropAll() error Length() int }
func NewListenerPool ¶
func NewListenerPool( output chan<- Connection, errs chan<- error, cancel <-chan struct{}, logger log.Logger, ) ListenerPool
type Protocol ¶
type Protocol interface { Done() <-chan struct{} Network() string Reliable() bool Streamed() bool Listen(target *Target) error Send(target *Target, msg sip.Message) error String() string }
Protocol implements network specific features.
func NewTcpProtocol ¶
func NewUdpProtocol ¶
type ProtocolError ¶
Net Protocol level error
func (*ProtocolError) Error ¶
func (err *ProtocolError) Error() string
func (*ProtocolError) Network ¶
func (err *ProtocolError) Network() bool
func (*ProtocolError) Temporary ¶
func (err *ProtocolError) Temporary() bool
func (*ProtocolError) Timeout ¶
func (err *ProtocolError) Timeout() bool
func (*ProtocolError) Unwrap ¶
func (err *ProtocolError) Unwrap() error
type ProtocolFactory ¶
type ProtocolFactory func( network string, output chan<- sip.Message, errs chan<- error, cancel <-chan struct{}, msgMapper sip.MessageMapper, logger log.Logger, ) (Protocol, error)
func GetProtocolFactory ¶
func GetProtocolFactory() ProtocolFactory
ProtocolFactory returns default protocol factory
type Target ¶
Target endpoint
func FillTargetHostAndPort ¶
Fills endpoint target with default values.
func NewTargetFromAddr ¶
type UnsupportedProtocolError ¶
type UnsupportedProtocolError string
func (UnsupportedProtocolError) Error ¶
func (err UnsupportedProtocolError) Error() string
func (UnsupportedProtocolError) Network ¶
func (err UnsupportedProtocolError) Network() bool
func (UnsupportedProtocolError) Temporary ¶
func (err UnsupportedProtocolError) Temporary() bool
func (UnsupportedProtocolError) Timeout ¶
func (err UnsupportedProtocolError) Timeout() bool
Click to show internal directories.
Click to hide internal directories.