Documentation
¶
Overview ¶
Package rtppool routes signaling control requests across multiple RTP media nodes.
Nodes are discovered dynamically: RTP servers register with the signaling server's HTTP control API and send periodic heartbeats. Static seed URLs (RTP_CONTROL_URLS) remain supported for local development.
Index ¶
- func ParseControlURLs(urlsEnv, singleEnv string) []string
- func PublicControlURL(publicEnv, mediaIP string, port int) string
- func RegisterHTTP(mux *http.ServeMux, pool *Pool)
- type Node
- type Pool
- func (p *Pool) Delete(callID string) error
- func (p *Pool) NodeInfos() []controlapi.NodeInfo
- func (p *Pool) Nodes() []Node
- func (p *Pool) Prepare(callID, offerSDP string) (*controlapi.PrepareLegResponse, string, error)
- func (p *Pool) Prune() int
- func (p *Pool) Refresh()
- func (p *Pool) Register(req controlapi.RegisterNodeRequest) (controlapi.RegisterNodeResponse, error)
- func (p *Pool) SetTTL(d time.Duration)
- func (p *Pool) Start(callID string) error
- func (p *Pool) Unregister(nodeID string) bool
- type Registrar
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ParseControlURLs ¶
ParseControlURLs reads RTP_CONTROL_URLS (comma-separated) or RTP_CONTROL_URL. Empty env returns no seeds — RTP nodes are expected to register instead.
func PublicControlURL ¶
PublicControlURL builds the control URL RTP advertises to signaling.
func RegisterHTTP ¶
RegisterHTTP mounts the signaling-side node registry API on mux.
Types ¶
type Node ¶
type Node struct {
ID string
ControlURL string
MediaIP string
ActiveLegs int
Healthy bool
Static bool
LastSeen time.Time
}
Node is one RTP media server's control plane endpoint.
type Pool ¶
type Pool struct {
// contains filtered or unexported fields
}
Pool selects RTP nodes and remembers which node owns each Call-ID.
func (*Pool) NodeInfos ¶
func (p *Pool) NodeInfos() []controlapi.NodeInfo
NodeInfos returns registered nodes for the signaling HTTP list API.
func (*Pool) Prepare ¶
func (p *Pool) Prepare(callID, offerSDP string) (*controlapi.PrepareLegResponse, string, error)
Prepare allocates a media leg on the least-loaded healthy node (with failover).
func (*Pool) Register ¶
func (p *Pool) Register(req controlapi.RegisterNodeRequest) (controlapi.RegisterNodeResponse, error)
Register adds or refreshes a dynamically registered RTP node.
func (*Pool) Unregister ¶
Unregister removes a dynamically registered node.
type Registrar ¶
type Registrar struct {
Client *http.Client
Registry string // signaling HTTP base URL, e.g. http://host:8080
Node controlapi.RegisterNodeRequest
Interval time.Duration
LegCount func() int // optional; sent as active_legs on each heartbeat
}
Registrar heartbeats an RTP node to the signaling server's registry API.
func NewRegistrar ¶
func NewRegistrar(client *http.Client, registryURL string, node controlapi.RegisterNodeRequest) *Registrar
NewRegistrar builds a registrar with a default 10s heartbeat interval.
func (*Registrar) Deregister ¶
Deregister removes this node from the signaling pool (best-effort).