Documentation
¶
Overview ¶
Package server holds what the TURN and L4 servers (the subpackages) share: the accept queue, the conntrack and ErrNotServing.
Index ¶
- Constants
- Variables
- type AcceptQueue
- type Base
- func (b *Base) Admits(peer net.Addr) bool
- func (b *Base) Close(bool) error
- func (b *Base) Clusters() []string
- func (b *Base) Desired(conf stnrv2.Config) (*stnrv2.ServerConfig, error)
- func (b *Base) GetConfig() stnrv2.Config
- func (b *Base) Init(conf *stnrv2.ServerConfig, rt *runtime.Runtime)
- func (b *Base) Inspect(old, new stnrv2.Config, _ *stnrv2.StunnerConfig) (runtime.Action, error)
- func (b *Base) Name() string
- func (b *Base) Reconcile(conf stnrv2.Config) error
- func (b *Base) Serve(api.Conn) (api.Conn, api.Verdict, error)
- func (b *Base) Sessions() int
- func (b *Base) Start() error
- func (b *Base) Status() stnrv2.Status
- func (b *Base) Type() runtime.ObjectType
- type Unimplemented
Constants ¶
const Backlog = 128
Backlog bounds the accept queue of a server.
Variables ¶
var ErrNotServing = errors.New("server is not serving")
ErrNotServing answers a conn handed to a server that is stopped or restarting.
Functions ¶
This section is empty.
Types ¶
type AcceptQueue ¶
type AcceptQueue struct {
// contains filtered or unexported fields
}
AcceptQueue holds the conns handed to a server until its accept loop takes them. It is a net.Listener, so a library with its own accept loop can take from it.
func NewAcceptQueue ¶
func NewAcceptQueue(backlog int) *AcceptQueue
NewAcceptQueue creates an accept queue of backlog conns.
func (*AcceptQueue) Addr ¶
func (q *AcceptQueue) Addr() net.Addr
func (*AcceptQueue) Close ¶
func (q *AcceptQueue) Close() error
Close unblocks the waiting pushes and closes the queued conns.
type Base ¶
type Base struct {
// contains filtered or unexported fields
}
Base is the server object of the fields every server has, its spec: the name, the type, the clusters and the filters. A server of a type embeds it, calls into it for the spec and adds the options of its type. Reconcile writes the clusters and the filters, the data path reads them, under mu.
func (*Base) Admits ¶
Admits tells whether the filters of the server admit a peer: a peer no rule matches is refused. Port 0 asks for the address of the peer on any port.
func (*Base) Clusters ¶
Clusters returns the clusters the server uses, in order; the caller must not modify it.
func (*Base) GetConfig ¶
GetConfig returns the config of the spec the server runs with; a server of a type adds the options of its type.
func (*Base) Init ¶
func (b *Base) Init(conf *stnrv2.ServerConfig, rt *runtime.Runtime)
Init sets the name and the type of the server of a validated config, and the runtime its filters are looked up in.
func (*Base) Reconcile ¶
Reconcile applies the spec of a config: the clusters change in place, the name and the type never do (a type change restarts).
func (*Base) Type ¶
func (b *Base) Type() runtime.ObjectType
type Unimplemented ¶
type Unimplemented struct {
Base
// contains filtered or unexported fields
}
Unimplemented is a server of a type this build has no implementation of: it keeps the options of its type as they are, warns on start and serves no conn.
func NewUnimplemented ¶
func NewUnimplemented(conf *stnrv2.ServerConfig, rt *runtime.Runtime) (*Unimplemented, error)
NewUnimplemented creates the server of a validated config of a type this build does not implement.
func (*Unimplemented) GetConfig ¶
func (s *Unimplemented) GetConfig() stnrv2.Config
func (*Unimplemented) Start ¶
func (s *Unimplemented) Start() error
func (*Unimplemented) Status ¶
func (s *Unimplemented) Status() stnrv2.Status
Directories
¶
| Path | Synopsis |
|---|---|
|
Package balancer chooses the peers of a server among the targets of its clusters, by a load-balancing policy.
|
Package balancer chooses the peers of a server among the targets of its clusters, by a load-balancing policy. |
|
Package l4 implements the L4 server: every client conn becomes a flow to an endpoint of the server's clusters.
|
Package l4 implements the L4 server: every client conn becomes a flow to an endpoint of the server's clusters. |
|
Package rtp implements the RTP server, a media proxy driven over ng.
|
Package rtp implements the RTP server, a media proxy driven over ng. |
|
Package sip implements the SIP server, a transaction-stateful proxy of inbound calls.
|
Package sip implements the SIP server, a transaction-stateful proxy of inbound calls. |
|
Package srt implements the SRT server: it routes every SRT flow by the stream it names to the endpoint holding the stream and relays it, the stream's encryption untouched.
|
Package srt implements the SRT server: it routes every SRT flow by the stream it names to the endpoint holding the stream and relays it, the stream's encryption untouched. |
|
Package turn implements the TURN server: one pion/turn instance serving the client conns handed to it, relaying through the server's clusters.
|
Package turn implements the TURN server: one pion/turn instance serving the client conns handed to it, relaying through the server's clusters. |