libp2p/services/wildcardresolverservice

Search:
Group by:
Source   Edit  

Types

NetworkInterfaceProvider = proc (addrFamily: AddressFamily): seq[
    InterfaceAddress] {....gcsafe, raises: [].}
Source   Edit  
WildcardAddressResolverService = ref object of Service
Service used to resolve wildcard addresses of the type "0.0.0.0" for IPv4 or "::" for IPv6. Source   Edit  

Procs

proc new(T: typedesc[WildcardAddressResolverService];
         networkInterfaceProvider: NetworkInterfaceProvider = getAddresses): T:type {.
    ...raises: [].}

This procedure initializes a new WildcardAddressResolverService with the provided network interface provider.

Parameters:

  • T: The type descriptor for WildcardAddressResolverService.
  • networkInterfaceProvider: A provider that offers access to network interfaces. Defaults to a new instance of NetworkInterfaceProvider.

Returns:

  • A new instance of WildcardAddressResolverService.
Source   Edit  

Methods

method setup(self: WildcardAddressResolverService; switch: Switch) {....raises: [],
    raises: [], tags: [RootEffect, WriteIOEffect], forbids: [].}

Sets up the WildcardAddressResolverService.

This method adds the address mapper to the peer's list of address mappers.

Parameters:

  • self: The instance of WildcardAddressResolverService being set up.
  • switch: The switch context in which the service operates.

Returns:

  • No value.
Source   Edit  
method start(self: WildcardAddressResolverService; switch: Switch): InternalRaisesFuture[
    void, (CancelledError,)] {....stackTrace: false, raises: [], gcsafe,
                               raises: [], tags: [RootEffect], forbids: [].}

Runs the WildcardAddressResolverService for a given switch.

It updates the peer information for the provided switch by running the registered address mapper. Any other address mappers that are registered with the switch will also be run.

Source   Edit  
method stop(self: WildcardAddressResolverService; switch: Switch): InternalRaisesFuture[
    void, (CancelledError,)] {....stackTrace: false, raises: [], gcsafe,
                               raises: [], tags: [RootEffect], forbids: [].}

Stops the WildcardAddressResolverService.

Handles the shutdown process of the WildcardAddressResolverService for a given switch. It removes the address mapper from the switch's list of address mappers. It then updates the peer information for the provided switch. Any wildcard address wont be resolved anymore.

Parameters:

  • self: The instance of the WildcardAddressResolverService.
  • switch: The Switch object associated with the service.
Source   Edit