From 4a6f9ce3fcdc85ea7bb17e2c35ba76dbd438ebfb Mon Sep 17 00:00:00 2001 From: golangaddict Date: Wed, 16 Feb 2022 13:46:39 -0500 Subject: [PATCH] Config.Laddr default value localhost. When creating a listener with an empty address, the listener will assume any interface (0.0.0.0). This will trigger firewall permissions to be granted every time a unique binary is generated. This can be problematic during tests as the binary has a unique name by default. Since this is a proxy for development sake. It is safe to assume if Config.Laddr is not provided we can use localhost to avoid the firewall module. --- lib/proxy.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/proxy.go b/lib/proxy.go index d559cac..50253ea 100644 --- a/lib/proxy.go +++ b/lib/proxy.go @@ -27,6 +27,10 @@ func NewProxy(builder Builder, runner Runner) *Proxy { } func (p *Proxy) Run(config *Config) error { + // set Laddr to localhost if empty to avoid firewall permissions + if config.Laddr == "" { + config.Laddr = "127.0.0.1" + } // create our reverse proxy url, err := url.Parse(config.ProxyTo)