* Return all the ports that we have reason to believe are not forwarded. E.g. for the user-alert, which only
* shows if what we return is of nonzero length.
*/
public int[] getUDPPortsNotForwarded() {
OpennetManager om = node.getOpennet();
Status darknetStatus = (node.peers.anyDarknetPeers() ? node.darknetCrypto.getDetectedConnectivityStatus() : AddressTracker.Status.DONT_KNOW);
Status opennetStatus = om == null ? Status.DONT_KNOW : om.crypto.getDetectedConnectivityStatus();
if(om == null || opennetStatus.ordinal() >= AddressTracker.Status.DONT_KNOW.ordinal()) {
if(darknetStatus.ordinal() >= AddressTracker.Status.DONT_KNOW.ordinal()) {
return new int[] { };
} else {
return new int[] { (darknetStatus.ordinal() < AddressTracker.Status.MAYBE_NATED.ordinal() ? -1 : 1) * node.getDarknetPortNumber() };
}
} else {
if(darknetStatus.ordinal() >= AddressTracker.Status.DONT_KNOW.ordinal()) {
return new int[] { (opennetStatus.ordinal() < AddressTracker.Status.MAYBE_NATED.ordinal() ? -1 : 1 ) * om.crypto.portNumber };
} else {
return new int[] { ((darknetStatus.ordinal() < AddressTracker.Status.MAYBE_NATED.ordinal()) ? -1 : 1 ) * node.getDarknetPortNumber(),
(opennetStatus.ordinal() < AddressTracker.Status.MAYBE_NATED.ordinal() ? -1 : 1 ) * om.crypto.portNumber };
}
}
}