public class MappingCandidateHarvester extends AbstractCandidateHarvester
TransportAddress
es. 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(Component)
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.
Modifier and Type | Field and Description |
---|---|
protected TransportAddress |
face
The addresses that we will be masking
|
private static Logger |
logger
The Logger used by the StunCandidateHarvester class and
its instances for logging output.
|
protected TransportAddress |
mask
The addresses that we will use as a mask
|
Modifier | Constructor and Description |
---|---|
protected |
MappingCandidateHarvester()
Initializes a
MappingCandidateHarvester instance without
specified addresses (only useful in subclasses which override
getMask() and getFace() ). |
|
MappingCandidateHarvester(TransportAddress mask,
TransportAddress face)
Creates a mapping harvester with the specified mask
|
Modifier and Type | Method and Description |
---|---|
TransportAddress |
getFace()
Returns the local (face) address, or null.
|
TransportAddress |
getMask()
Returns the public (mask) address, or null.
|
Collection<LocalCandidate> |
harvest(Component component)
Maps all candidates to this harvester's mask and adds them to
component.
|
String |
toString() |
getHarvestStatistics, isHostHarvester
private static final Logger logger
protected TransportAddress mask
protected TransportAddress face
public MappingCandidateHarvester(TransportAddress mask, TransportAddress face)
mask
- the TransportAddresses that would be used as a mask.face
- the TransportAddresses that we will be masking.protected MappingCandidateHarvester()
MappingCandidateHarvester
instance without
specified addresses (only useful in subclasses which override
getMask()
and getFace()
).public Collection<LocalCandidate> harvest(Component component)
component
- the Component
that we'd like to map candidates
to.public TransportAddress getMask()
public TransportAddress getFace()
Copyright © 2018. All rights reserved.