Package org.drasyl.util
Class PortMappingUtil
java.lang.Object
org.drasyl.util.PortMappingUtil
Class for the creation of port mappings to make local services externally/publicly accessible.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
Represents a port mapping.static enum
-
Method Summary
Modifier and TypeMethodDescriptionstatic Set<PortMappingUtil.PortMapping>
expose
(InetSocketAddress address, PortMappingUtil.Protocol protocol) Exposesaddress
via PCP, NAT-PMP, or UPNP-IGD.
-
Method Details
-
expose
public static Set<PortMappingUtil.PortMapping> expose(InetSocketAddress address, PortMappingUtil.Protocol protocol) Exposesaddress
via PCP, NAT-PMP, or UPNP-IGD. This operation scans the local network for relevant routers. If no devices are discovered or no port forwardings can be created, this method will return an empty set.Note: This is a blocking method, because it connects to other devices that may react slowly or not at all.
- Parameters:
address
- address to be exposedprotocol
- protocol to be exposed- Returns:
- List of port mappings.
-