Package org.drasyl.util
Class PortMappingUtil
- java.lang.Object
-
- org.drasyl.util.PortMappingUtil
-
public class PortMappingUtil extends Object
Class for the creation of port mappings to make local services externally/publicly accessible.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
PortMappingUtil.PortMapping
Represents a port mapping.static class
PortMappingUtil.Protocol
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Set<PortMappingUtil.PortMapping>
expose(InetSocketAddress address, PortMappingUtil.Protocol protocol)
Exposesaddress
via PCP, NAT-PMP, or UPNP-IGD.
-
-
-
Method Detail
-
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.
-
-