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) 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)
- func (c *Connection) TURNResources() (TURNResourceSnapshot, bool)
- type Diagnostic
- type Event
- type MappedEndpoint
- type PairFacts
- type TCPCapability
- type TCPProfile
- type TURNConfig
- type TURNReservation
- type TURNResourceSnapshot
Constants ¶
const ( TURNDialTimeout = 10 * time.Second // TURN deallocation is sent without waiting for a response. This grace // bounds stalled writes/gathering without imposing a normal close delay. TURNCloseGrace = 250 * time.Millisecond )
const InitialCheckingTimeout = 39500 * time.Millisecond
InitialCheckingTimeout follows RFC 8863's default transaction window. It deliberately does not extend failure detection after a pair was connected.
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
TURN *TURNConfig
OnTURNRecovery func(turncontrol.RecoveryReason)
InitialCheckingTimeout time.Duration
TCPProfile TCPProfile
SocketLease *socketauthority.Lease
MappedEndpoints []MappedEndpoint
Observe func(Event)
}
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 (*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 syntax alone can never grant mapped-candidate provenance.
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)
func (*Connection) TURNResources ¶
func (c *Connection) TURNResources() (TURNResourceSnapshot, bool)
type Diagnostic ¶
Diagnostic keeps provider log text separate from transport state transitions.
type Event ¶
type Event struct {
ProtocolSessionID [16]byte
PeerPathID [16]byte
AttemptID [16]byte
NetworkGenerationID uint64
ICEProfileID string
Milestone string
State string
Diagnostic *Diagnostic
At time.Time
Candidate *CandidateFacts
Pair *PairFacts
TURN *TURNResourceSnapshot
TURNService *iceconfig.Identity
TURNCleanup connectionpath.CleanupOutcome
TURNBinding *turn.BindingEvent
TURNRoute *turnroute.Event
}
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.
type TCPCapability ¶
func Capabilities ¶
func Capabilities(profile TCPProfile) TCPCapability
type TCPProfile ¶
type TCPProfile string
TCPProfile names exact implementation/platform combinations backed by local selected-pair and authenticated-payload evidence. It is sent only through authenticated session controls; absent or unknown profiles remain UDP-only.
const ( TCPNativeWindows TCPProfile = "pion-4.2.16-ice-4.2.7-windows" TCPChromiumWindows TCPProfile = "chromium-151.0.7922.34-windows" )
func LocalTCPProfile ¶
func LocalTCPProfile() TCPProfile
type TURNConfig ¶
type TURNConfig struct {
Plan *turnroute.Plan
Reservation TURNReservation
}
TURNConfig keeps the admitted plan and its capacity together through handoff.
type TURNReservation ¶
type TURNReservation interface {
turnroute.Capacity
Claim([16]byte, [16]byte, iceconfig.Identity) error
SocketLimit() int
Close()
}
TURNReservation is the capability an admitted attempt needs. The provider cannot change queue policy, mint capacity or inspect other paths' reservations.
type TURNResourceSnapshot ¶
type TURNResourceSnapshot struct {
ActiveSockets int
OpenedSockets uint64
TransportSent uint64
TransportReceived uint64
}
Transport counters include TURN framing, TLS and protocol retries visible to the process. They are not provider billing or kernel TCP retransmission counts.