pub struct IceAddressPolicy(/* private fields */);Expand description
An embedder’s address policy for ICE: one predicate asked at every point where an address enters the ICE agent or the peer connection’s stream, TURN and server-reflexive code, whichever way traffic would go.
AddressPurpose::InboundDatagramSource: a datagram (or ICE-TCP stream data) from a refused source is dropped before the agent reads it: it gets no STUN response, teaches no peer-reflexive candidate, refreshes no consent, creates no pair, and no DTLS record or media from it is taken. An ICE-TCP connection from such a source is refused when the driver reports it accepted, and one a TURN server announces for a relayed TCP address is not bound.AddressPurpose::RemoteCandidate: a remote candidate on a refused address is never held or paired (the peer connection treats it as W3C webrtc-pc 4.4.2 “administratively prohibited”:addIceCandidatesucceeds, no check is ever sent there).AddressPurpose::PeerReflexiveSource: a refused source is not learned as a peer-reflexive remote candidate, so its request is not answered.AddressPurpose::StunTurnServer: a server address the engine would send its Binding request or its Allocate to (after the name’s resolution) is skipped, as if it had failed.
The predicate sees the address with an IPv4-mapped IPv6 address (::ffff:a.b.c.d) given as
the IPv4 address it carries, so one rule covers both forms. The default allows everything
and asks nothing: the agent behaves as it does without a policy.
RFC 8445’s procedures (Section 7.3: answer every authenticated request, Section 7.3.1.3: learn its source as a peer-reflexive candidate) apply to what reaches the agent; a datagram the policy refuses is dropped before that, as a host firewall would drop it. This is how an embedder carries out the address handling of RFC 8828 (which modes of address exposure and which routes are allowed) beyond what the candidate types alone can say.
Implementations§
Source§impl IceAddressPolicy
impl IceAddressPolicy
Sourcepub fn new(
predicate: impl Fn(SocketAddr, AddressDirection, AddressPurpose) -> bool + Send + Sync + 'static,
) -> Self
pub fn new( predicate: impl Fn(SocketAddr, AddressDirection, AddressPurpose) -> bool + Send + Sync + 'static, ) -> Self
A policy asking predicate about every address; false refuses it.
Sourcepub fn allow_all() -> Self
pub fn allow_all() -> Self
The default: every address is allowed and the predicate is never asked.
Sourcepub fn is_allow_all(&self) -> bool
pub fn is_allow_all(&self) -> bool
Whether this is the allow-everything default.
Sourcepub fn allows(&self, addr: SocketAddr, purpose: AddressPurpose) -> bool
pub fn allows(&self, addr: SocketAddr, purpose: AddressPurpose) -> bool
Whether addr may be used for purpose (in that purpose’s direction).