Class SdpUtil
-
Method Summary
Modifier and TypeMethodDescriptionstatic StringcandidateAddress(String candidate) The connection address of ana=candidate:line, or null if it has none.static booleanWhether a description holds a host candidate at a routable address.inferredPeerCandidates(String sdp, InetSocketAddress signaledFrom) Candidates for the address a peer signaled from, one per port it gathered locally.static StringwithAdvertisedCandidates(String sdp, Set<String> allowed) Drops every ICE candidate whose address is not inallowed.
-
Method Details
-
candidateAddress
The connection address of ana=candidate:line, or null if it has none.The grammar of RFC 5245 section 15.1 puts the address in the fifth token, after the foundation, component, transport and priority.
- Parameters:
candidate- The candidate line- Returns:
- The address it points at
-
hasRoutableHostCandidate
Whether a description holds a host candidate at a routable address.A host that gathered one is reachable as the protocol expects, and needs none of the guessing
inferredPeerCandidates(java.lang.String, java.net.InetSocketAddress)does.- Parameters:
sdp- The description to read- Returns:
- Whether a peer elsewhere can reach one of its host candidates
-
inferredPeerCandidates
Candidates for the address a peer signaled from, one per port it gathered locally.A peer that holds no reflexive candidate of its own offers nothing a host on another network can reach, and its own checks die on the first NAT they meet. Its public address is known anyway, because it just made an HTTP request from it, and consumer NATs usually keep the port a socket already uses. Checking there costs a few packets, and if it does map that way the check opens the path in both directions.
Nothing is inferred for a peer that already carries a reflexive or relayed candidate, or that signaled from an address on this network, since there is a real path in both cases.
- Parameters:
sdp- The offer to read the peer's ports out ofsignaledFrom- The address the offer arrived from, or null if it is not known- Returns:
- Candidate lines to add to the peer connection, empty when there is nothing to infer
-
withAdvertisedCandidates
Drops every ICE candidate whose address is not inallowed.ICE gathers a candidate on every interface it can see, which on a host network includes container and overlay addresses that are unreachable from outside. Each one costs the remote peer a round of connectivity checks before it gives up, so a host that knows which of its addresses are reachable can announce only those. If nothing would be left the description is returned untouched, since no candidates at all can never connect.
- Parameters:
sdp- The description to filterallowed- The addresses that may be announced, empty to announce everything- Returns:
- The filtered description
-