libp2p/services/nat/upnp_mapper

Search:
Group by:
Source   Edit  

UPnP-IGD port mapper. The underlying nat_traversal/miniupnpc API is synchronous (blocking C calls into miniupnpc), so this module owns a dedicated worker thread that holds the Miniupnp instance for the lifetime of the mapper. An AsyncLock serializes concurrent main-thread callers, and all transferred data is fixed-size POD so no Nim GC heap crosses the thread boundary.

Types

UpnpMapper = ref object of PortMapper
Source   Edit  

Procs

proc new(T: typedesc[UpnpMapper]): T:type {....raises: [ResourceExhaustedError],
    raises: [].}
Source   Edit  

Methods

method close(self: UpnpMapper): InternalRaisesFuture[void, void] {....gcsafe,
    stackTrace: false, raises: [], gcsafe, raises: [], tags: [RootEffect],
    forbids: [].}
Source   Edit  
method discover(self: UpnpMapper; timeout: Duration): InternalRaisesFuture[
    Result[IpAddress, string], (CancelledError,)] {....gcsafe, stackTrace: false,
    raises: [], gcsafe, raises: [], tags: [RootEffect], forbids: [].}
Source   Edit  
method map(self: UpnpMapper; internalPort: Port; externalPort: Port;
           proto: MapProto; lease: uint32): InternalRaisesFuture[
    Result[Port, string], (CancelledError,)] {....gcsafe, stackTrace: false,
    raises: [], gcsafe, raises: [], tags: [RootEffect], forbids: [].}
Source   Edit  
method unmap(self: UpnpMapper; externalPort: Port; proto: MapProto): InternalRaisesFuture[
    Result[void, string], (CancelledError,)] {....gcsafe, stackTrace: false,
    raises: [], gcsafe, raises: [], tags: [RootEffect], forbids: [].}
Source   Edit