Class PortMappingUtil.PortMapping

  • Enclosing class:

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

      • 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.
        mapper - router where the port mapping will be requested.
        address - address to be exposed
        protocol - protocol to be exposed
        IllegalStateException - if the port could not be mapped for any reason
    • Method Detail

      • close

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

        public InetSocketAddress currentExternalAddress()
        Returns the external address of the port mapping.
        external address or null if mapping has been closed
      • 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.
        Observable with current and future external addresses