-
Notifications
You must be signed in to change notification settings - Fork 216
Description
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
- Global config struct
ehco/internal/config/config.go
Line 30 in 00478cf
RelayConfigs []*conf.Config `json:"relay_configs"` - Relay Rule Config struct
ehco/internal/relay/conf/cfg.go
Line 13 in 00478cf
type Config struct {
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.