Class PortMappingUtil.PortMapping

java.lang.Object
org.drasyl.util.PortMappingUtil.PortMapping
Enclosing class:
PortMappingUtil

public static class PortMappingUtil.PortMapping extends Object
Represents a port mapping.
  • Constructor Details

    • PortMapping

      public PortMapping(com.offbynull.portmapper.mapper.PortMapper mapper, InetSocketAddress address, PortMappingUtil.Protocol protocol)
      Attempts to create a port mapping for address at router mapper.
      Parameters:
      mapper - router where the port mapping will be requested.
      address - address to be exposed
      protocol - protocol to be exposed
      Throws:
      IllegalStateException - if the port could not be mapped for any reason
  • Method Details

    • close

      public void close()
      Closes this port mapping.
    • currentExternalAddress

      public InetSocketAddress currentExternalAddress()
      Returns the external address of the port mapping.
      Returns:
      external address or null if mapping has been closed
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • externalAddress

      public io.reactivex.rxjava3.core.Observable<Optional<InetSocketAddress>> externalAddress()
      Returns an Observable which emits the current and every future external addresses. Can be used to observe this port mapping for address changes made by the exposing router.
      Returns:
      Observable with current and future external addresses