Ehco1996 / ehco

ehco is a network ʚrelayɞ tool and a typo :)
https://docs.ehco-relay.cc/
GNU General Public License v3.0
1.2k stars 208 forks source link

Feature Request: Add UPnP Support to Enhance Convenience for Soft Router Users #330

Open Ehco1996 opened 1 month ago

Ehco1996 commented 1 month ago

Description:

The primary objective of this feature request is to integrate UPnP (Universal Plug and Play) functionality into ehco. This enhancement aims to significantly simplify the user experience for individuals utilizing soft routers.

Here's an example of a standard RelayRule configuration:

{
  "listen": "127.0.0.1:1234",
  "listen_type": "raw",
  "transport_type": "raw",
  "label": "relay1",
  "tcp_remotes": [
    "0.0.0.0:5201"
  ]
}

To facilitate this feature, it is proposed to add a new field: "enable_upnp": true/false.

When a rule is identified with UPnP enabled, ehco will leverage a UPnP client to map the specified listen_port (for instance, port 1234 in the example above) to the public internet. This process aims to automate port forwarding, thereby reducing manual configuration steps and improving accessibility for users with dynamic IP addresses or those behind NATs.

By implementing UPnP support, ehco can offer a more user-friendly and efficient setup process for its users, making it an even more powerful tool for traffic forwarding in diverse networking environments.

Related code

Additional Information

By the way, I recommend implementing a separate UPnP client within the pkg directory. This client can then be utilized to integrate the UPnP feature within the internal/relay module. This approach will help in maintaining a clean separation of concerns and enhance the modularity of the codebase, making it easier to manage and extend the UPnP functionality in the future.