Documentation
¶
Overview ¶
Package pionpeer adapts one Pion PeerConnection to an immutable connectivity resource snapshot. Retry, mapping and network-generation ownership stay above it.
Index ¶
- Constants
- type AttemptConfig
- type CandidateFacts
- type Connection
- func (c *Connection) Close() error
- func (c *Connection) IsMappedCandidate(raw string) bool
- func (c *Connection) LocalDescription() *pion.SessionDescription
- func (c *Connection) OnConnectionStateChange(callback func(pion.PeerConnectionState))
- func (c *Connection) OnICECandidate(callback func(*pion.ICECandidate))
- func (c *Connection) OnICEConnectionStateChange(callback func(pion.ICEConnectionState))
- func (c *Connection) SelectedPair() (PairFacts, bool)
- type Diagnostic
- type Event
- type MappedEndpoint
- type PairFacts
Constants ¶
const ( HostSTUNDiscovered = "stun_host_port_discovered" GatheringComplete = "gathering_complete" ProviderClosed = "provider_closed" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AttemptConfig ¶
type AttemptConfig struct {
ProtocolSessionID [16]byte
PeerPathID [16]byte
AttemptID [16]byte
NetworkGenerationID uint64
ICEProfileID string
ICE iceconfig.Connection
SocketLease *socketauthority.Lease
MappedEndpoints []MappedEndpoint
Observe func(Event)
// OnClosed runs once synchronously inside Close after physical teardown and
// socket lease release, before Close returns to any concurrent caller. It
// must be lightweight, non-blocking, and must not reenter Connection.Close.
OnClosed func()
// contains filtered or unexported fields
}
AttemptConfig is a value snapshot; referenced lists are copied before creation.
type CandidateFacts ¶
type Connection ¶
type Connection struct {
*pion.PeerConnection
// contains filtered or unexported fields
}
func NewPeerConnection ¶
func NewPeerConnection(configuration pion.Configuration, request AttemptConfig) (*Connection, error)
NewPeerConnection acquires an exclusive attempt reference. The caller's path lease must remain held if a future fresh attempt is already budgeted.
func NewTURNPeerConnection ¶ added in v0.1.6
func NewTURNPeerConnection(ctx context.Context, base pion.Configuration, relay iceconfig.TURNRelay, identity AttemptConfig) (*Connection, error)
TURN uses the system route to the allocation server. Direct interface filters, gateway maps and leased host sockets do not apply to this transport. Dialing and DNS resolution stay bound to ctx and to Connection.Close so an unresponsive TCP/TLS TURN address cannot hold teardown until the OS timeout.
func (*Connection) Close ¶
func (c *Connection) Close() error
func (*Connection) IsMappedCandidate ¶
func (c *Connection) IsMappedCandidate(raw string) bool
IsMappedCandidate matches a candidate to the trusted immutable lease snapshot; srflx or passive TCP syntax alone can never grant mapped-candidate provenance.
func (*Connection) LocalDescription ¶ added in v0.1.6
func (c *Connection) LocalDescription() *pion.SessionDescription
Supplemental mapped candidates travel by trickle, outside Pion's local SDP.
func (*Connection) OnConnectionStateChange ¶
func (c *Connection) OnConnectionStateChange(callback func(pion.PeerConnectionState))
func (*Connection) OnICECandidate ¶
func (c *Connection) OnICECandidate(callback func(*pion.ICECandidate))
func (*Connection) OnICEConnectionStateChange ¶
func (c *Connection) OnICEConnectionStateChange(callback func(pion.ICEConnectionState))
These wrappers preserve provider observations when consumers install their own callbacks. A PC state is recorded as itself, never as an invented DTLS fact.
func (*Connection) SelectedPair ¶
func (c *Connection) SelectedPair() (PairFacts, bool)
type Diagnostic ¶
Diagnostic keeps provider log text separate from transport state transitions.
type MappedEndpoint ¶
type PairFacts ¶
type PairFacts struct {
LocalType string
RemoteType string
Protocol string
LocalAddress string
RemoteAddress string
LocalPort uint16
RemotePort uint16
RoundTripTime time.Duration
}
PairFacts reports the actual selected pair; caller still owns authenticated lane admission and must not infer directness from gathered candidates.