public class MappingCandidateHarvesters extends Object
MappingCandidateHarvester
instances, created
according to configuration provided as system properties.
The instances in the set are safe to use by any Agent
s.Modifier and Type | Field and Description |
---|---|
static String |
DISABLE_AWS_HARVESTER_PNAME
The name of the property used to disable the AWS harvester.
|
static String |
FORCE_AWS_HARVESTER_PNAME
The name of the property which forces the use of the AWS harvester.
|
private static MappingCandidateHarvester[] |
harvesters
The list of already configured harvesters.
|
private static boolean |
initialized
Whether
harvesters has been initialized. |
private static Logger |
logger
The
Logger used by the MappingCandidateHarvesters
class for logging output. |
static String |
NAT_HARVESTER_LOCAL_ADDRESS_PNAME
The name of the property that specifies the local address, if any, for
the pre-configured NAT harvester.
|
static String |
NAT_HARVESTER_PUBLIC_ADDRESS_PNAME
The name of the property that specifies the public address, if any, for
the pre-configured NAT harvester.
|
static String |
STUN_MAPPING_HARVESTER_ADDRESSES_PNAME
The name of the property which contains the addresses of the STUN servers
to use for the STUN mapping harvester.
|
static boolean |
stunDiscoveryFailed
Whether the discovery of a public address via STUN has failed.
|
Modifier | Constructor and Description |
---|---|
private |
MappingCandidateHarvesters()
Prevent instance creation.
|
Modifier and Type | Method and Description |
---|---|
private static List<StunMappingCandidateHarvester> |
createStunHarvesters(String[] stunServers)
Creates STUN mapping harvesters for each of the given STUN servers, and
waits for address discovery to finish for all of them.
|
static MappingCandidateHarvester[] |
getHarvesters() |
static void |
initialize()
Initializes
harvesters . |
private static void |
maybeAdd(MappingCandidateHarvester harvester,
List<MappingCandidateHarvester> harvesters)
Adds
harvester to harvesters , if it has valid addresses
and harvesters doesn't already contain a harvester with the same
addresses. |
private static List<MappingCandidateHarvester> |
prune(List<MappingCandidateHarvester> harvesters)
Prunes a list of mapping harvesters, removing the ones without valid
addresses and those with duplicate addresses.
|
private static final Logger logger
Logger
used by the MappingCandidateHarvesters
class for logging output.public static final String NAT_HARVESTER_LOCAL_ADDRESS_PNAME
public static final String NAT_HARVESTER_PUBLIC_ADDRESS_PNAME
public static final String DISABLE_AWS_HARVESTER_PNAME
public static final String FORCE_AWS_HARVESTER_PNAME
public static final String STUN_MAPPING_HARVESTER_ADDRESSES_PNAME
stun1.example.com:12345,stun2.example.com:23456
private static boolean initialized
harvesters
has been initialized.private static MappingCandidateHarvester[] harvesters
public static boolean stunDiscoveryFailed
private MappingCandidateHarvesters()
public static MappingCandidateHarvester[] getHarvesters()
public static void initialize()
harvesters
.
First it reads the configuration and instantiates harvesters accordingly,
waiting for their initialization (which may include network communication
and thus take a long time). Then it removes harvesters which failed to
initialize properly and remove any harvesters with duplicate addresses.
Three types of mapping harvesters are supported: NAT (with
pre-configured addresses), AWS and STUN.private static List<MappingCandidateHarvester> prune(List<MappingCandidateHarvester> harvesters)
harvesters
- the list of harvesters.private static void maybeAdd(MappingCandidateHarvester harvester, List<MappingCandidateHarvester> harvesters)
harvester
to harvesters
, if it has valid addresses
and harvesters
doesn't already contain a harvester with the same
addresses.harvester
- the harvester to add.harvesters
- the list to add to.private static List<StunMappingCandidateHarvester> createStunHarvesters(String[] stunServers)
stunServers
- an array of STUN server addresses (ip_address:port
pairs).Copyright © 2018. All rights reserved.