-
- All Implemented Interfaces:
-
org.ice4j.ice.harvest.CandidateHarvester
public final class StaticMappingCandidateHarvester extends MappingCandidateHarvester
Uses a predefined static mask in order to generate TransportAddresses. This harvester is meant for use in situations where servers are deployed behind a NAT or in a DMZ with static port mapping.
Every time the .harvest method is called, the mapping harvester will return a list of candidates that provide masked alternatives for every host candidate in the component. Kind of like a STUN server.
Example: You run this on a server with address 192.168.0.1, that is behind a NAT with public IP: 93.184.216.119. You allocate a host candidate 192.168.0.1/UDP/5000. This harvester is going to then generate an address 93.184.216.119/UDP/5000.
This harvester is instant and does not introduce any harvesting latency.
-
-
Field Summary
Fields Modifier and Type Field Description private final TransportAddressmaskprivate final TransportAddressfaceprivate final Stringnameprivate final BooleanmatchPort
-
Constructor Summary
Constructors Constructor Description StaticMappingCandidateHarvester(TransportAddress mask, TransportAddress face, String name, Boolean matchPort)StaticMappingCandidateHarvester(TransportAddress mask, TransportAddress face, String name)StaticMappingCandidateHarvester(TransportAddress mask, TransportAddress face)
-
Method Summary
Modifier and Type Method Description TransportAddressgetMask()The public address (aka mask) TransportAddressgetFace()The local address (aka face) final StringgetName()final BooleangetMatchPort()Whether this harvester should match the port of the public address. StringtoString()-
Methods inherited from class org.ice4j.ice.harvest.StaticMappingCandidateHarvester
harvest, publicAddressMatches -
Methods inherited from class org.ice4j.ice.harvest.MappingCandidateHarvester
getHarvestStatistics, isHostHarvester -
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Constructor Detail
-
StaticMappingCandidateHarvester
StaticMappingCandidateHarvester(TransportAddress mask, TransportAddress face, String name, Boolean matchPort)
-
StaticMappingCandidateHarvester
StaticMappingCandidateHarvester(TransportAddress mask, TransportAddress face, String name)
-
StaticMappingCandidateHarvester
StaticMappingCandidateHarvester(TransportAddress mask, TransportAddress face)
-
-
Method Detail
-
getMask
TransportAddress getMask()
The public address (aka mask)
-
getFace
TransportAddress getFace()
The local address (aka face)
-
getMatchPort
final Boolean getMatchPort()
Whether this harvester should match the port of the public address.
When matchPort is enabled, mapping candidates will be added only when the local host candidate's address and port match the public (mask) address, and the public (mask) address's port will be used.
When matchPort is disabled, mapping candidates will be added whenever the local host candidate's inet address matches the public (mask) address, and the host candidate port will be preserved.
-
-
-
-