From c8ecf9b0e52612dda16e9ac9d55aacd0446b22ef Mon Sep 17 00:00:00 2001 From: Vittorio Parrella Date: Tue, 17 Sep 2024 08:03:57 +0200 Subject: [PATCH] fix merge issue --- workers/gateway/gateway_interface_linux.go | 7 +++++++ workers/gateway/gateway_interface_windows.go | 7 +++++++ workers/gateway/network_config.go | 6 +++++- 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/workers/gateway/gateway_interface_linux.go b/workers/gateway/gateway_interface_linux.go index fa17019..c69fcf6 100644 --- a/workers/gateway/gateway_interface_linux.go +++ b/workers/gateway/gateway_interface_linux.go @@ -27,6 +27,13 @@ const ( var redirectOn = false +func getRouteListeningAddresses() []string { + if defaultListeningAddress == "" { + defaultListeningAddress = "127.0.0.1" + } + return []string{defaultListeningAddress} +} + func getRouteGatewayInterfaces() ([]int64, []string, error) { defaultIP, err := gateway.DiscoverInterface() if err != nil { diff --git a/workers/gateway/gateway_interface_windows.go b/workers/gateway/gateway_interface_windows.go index 228c39a..ced1018 100644 --- a/workers/gateway/gateway_interface_windows.go +++ b/workers/gateway/gateway_interface_windows.go @@ -55,6 +55,13 @@ func init() { panic("Tried to stop the WinDivert orphan instance but it did not terminate, unable to continue") } +func getRouteListeningAddresses() []string { + if defaultListeningAddress == "" { + defaultListeningAddress = "127.0.0.1" + } + return []string{defaultListeningAddress} +} + // getRouteGatewayInterfaces method extracts routing information using the "netsh" utility and returns specifically: // * Network Interface IDs list of all network interfaces configured // * Network Address List for every configured interface diff --git a/workers/gateway/network_config.go b/workers/gateway/network_config.go index 995e92e..3a6257b 100644 --- a/workers/gateway/network_config.go +++ b/workers/gateway/network_config.go @@ -1,8 +1,8 @@ package gateway import ( - "github.com/Project-Faster/qpep/shared/logger" "errors" + "github.com/Project-Faster/qpep/shared/logger" "net/url" "runtime" "strings" @@ -35,6 +35,10 @@ const ( QPEP_PROXY_HEADER = "X-QPEP-PROXY" ) +var ( + errNotImplemented = errors.New("not implemented for OS: " + runtime.GOOS) +) + // init method executes the static initialization for detecting the current system's interfaces and addresses func init() { var err error