From 8943ed3fc9fb3381c2d676367be7713d12dbe8f6 Mon Sep 17 00:00:00 2001 From: Chris Pick Date: Sat, 21 Dec 2024 14:06:49 -0500 Subject: [PATCH] Fix `PortsForwarder.Expose()` proxy check The check for existing `proxies` entries used `local` as a key, but they're actually inserted using keys of: `key(protocol, local)`. This meant that, previously, the check was ineffective and wouldn't reject duplicate forwards. Signed-off-by: Chris Pick --- pkg/services/forwarder/ports.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/services/forwarder/ports.go b/pkg/services/forwarder/ports.go index a99af460..6b92a005 100644 --- a/pkg/services/forwarder/ports.go +++ b/pkg/services/forwarder/ports.go @@ -68,7 +68,7 @@ func NewPortsForwarder(s *stack.Stack) *PortsForwarder { func (f *PortsForwarder) Expose(protocol types.TransportProtocol, local, remote string) error { f.proxiesLock.Lock() defer f.proxiesLock.Unlock() - if _, ok := f.proxies[local]; ok { + if _, ok := f.proxies[key(protocol, local)]; ok { return errors.New("proxy already running") }