Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor 'addressmanager', reorder fetching sources for-external ip #300

Commits on Oct 24, 2023

  1. Refactor 'addressmanager' to improve readability and maintainability

    The 'addressmanager' component of the codebase has been thoroughly refined for improved readability and maintainability. Firstly, the logic for assigning local network addresses has been streamlined and broken down into smaller methods for more clarity. Old methods 'add_routable_addresses_from_net_interfaces' and 'configured_address' have been replaced by 'routable_addresses_from_net_interfaces', 'local_addresses', and 'upnp'. This also led to the removal of redundant code.
    biryukovmaxim committed Oct 24, 2023
    Configuration menu
    Copy the full SHA
    ae725b6 View commit details
    Browse the repository at this point in the history
  2. clippy fixes

    biryukovmaxim committed Oct 24, 2023
    Configuration menu
    Copy the full SHA
    a76413f View commit details
    Browse the repository at this point in the history
  3. Refactor upnp error handling and add UpnpError enum

    Introduced thiserror dependency and created UpnpError enum in the addressmanager module. The enum encapsulates possible errors from Universal plug and play (upnp) functionality in idg_next crate, providing a more granular approach to error handling. The upnp function was also refactored to return a Result type - improving code readability and easing error propagation.
    biryukovmaxim committed Oct 24, 2023
    Configuration menu
    Copy the full SHA
    c1d3e7c View commit details
    Browse the repository at this point in the history
  4. Update log messages to include UPnP context

    Modified log messages in the addressmanager and port_mapping_extender modules to improve readability by including the '[UPnP]' context. The messages were updated in multiple sections where the upnp() function was used, thus helping in easier identification and debugging of UPnP related issues.
    biryukovmaxim committed Oct 24, 2023
    Configuration menu
    Copy the full SHA
    1afbbb6 View commit details
    Browse the repository at this point in the history
  5. Add UPnP context to existing port mapping detection

    Enhanced the port mapping detection functionality in the address manager to handle cases where the default port is already in use by another service. This change allows the gateway to map to a random external port if the default one is already mapped. This is crucial for avoiding port mapping conflicts under UPnP protocol, and hence, improving the robustness of the network setup process.
    biryukovmaxim committed Oct 24, 2023
    Configuration menu
    Copy the full SHA
    b490ddf View commit details
    Browse the repository at this point in the history
  6. Refactor existing port mapping check logic in UPnP

    Refactored the logic used to check whether the default external port is already mapped under UPnP in the address manager. The changes allow the application to handle scenarios where the port is in use by another service more effectively, ultimately enabling the gateway to map to another external port when required. This refinement is critical for averting potential port mapping conflicts, thereby enhancing the reliability of the network initialization process.
    biryukovmaxim committed Oct 24, 2023
    Configuration menu
    Copy the full SHA
    519b4a2 View commit details
    Browse the repository at this point in the history
  7. Add cleanup logic for UPnP port removal

    Added an additional step to handle the removal of a mapped port in the Universal Plug and Play (UPnP) protocol when stopping a service. Included a warning message if the port removal fails and an informational message upon successful removal. This enhancement improves service lifecycle management by ensuring that resources are appropriately released when a service is stopped, preventing potential port leaking issues.
    biryukovmaxim committed Oct 24, 2023
    Configuration menu
    Copy the full SHA
    e8cc440 View commit details
    Browse the repository at this point in the history
  8. found -> Found

    biryukovmaxim committed Oct 24, 2023
    Configuration menu
    Copy the full SHA
    557b50a View commit details
    Browse the repository at this point in the history
  9. "Handle specific port mapping errors in address manager

    Updated the address manager component to specifically handle `RequestError` and `SpecifiedArrayIndexInvalid` errors from the `GetGenericPortMappingEntry` method. This change results in improved error logging and handling, improving overall reliability of the UPnP functionality."
    biryukovmaxim committed Oct 24, 2023
    Configuration menu
    Copy the full SHA
    8796124 View commit details
    Browse the repository at this point in the history
  10. Configuration menu
    Copy the full SHA
    373f826 View commit details
    Browse the repository at this point in the history
  11. Configuration menu
    Copy the full SHA
    406a314 View commit details
    Browse the repository at this point in the history
  12. Refactor itertools usage in addressmanager

    This commit simplifies the use of the itertools library in our address manager module to improve readability. Instead of using the full `itertools::Either::` syntax every time, we've destructured `Either::{Left, Right}` at the beginning, allowing for leaner and semantically clearer code.
    biryukovmaxim committed Oct 24, 2023
    Configuration menu
    Copy the full SHA
    76b3fcc View commit details
    Browse the repository at this point in the history

Commits on Oct 25, 2023

  1. This commit introduces a documentary comment explaining the loop that

    checks for existing port mappings in the UPnP-enabled Internet Gateway Device (IGD).
    The clarification helps developers understand the necessity of this loop, especially
    in scenarios where the IGD might not explicitly signal port conflicts.
    biryukovmaxim committed Oct 25, 2023
    Configuration menu
    Copy the full SHA
    748b0d8 View commit details
    Browse the repository at this point in the history