mirror of
https://github.com/qdm12/gluetun.git
synced 2026-07-31 01:13:21 +02:00
hotfix(portforwarding): allow setting ports when no custom code is running
This commit is contained in:
@@ -6,6 +6,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
"slices"
|
"slices"
|
||||||
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -60,7 +61,8 @@ func (s *Service) SetPortsForwarded(ctx context.Context, ports []uint16) (err er
|
|||||||
s.portMutex.Lock()
|
s.portMutex.Lock()
|
||||||
defer s.portMutex.Unlock()
|
defer s.portMutex.Unlock()
|
||||||
|
|
||||||
if s.settings.PortForwarder != nil {
|
hasPortForwardingCodeRunning := !strings.HasSuffix(s.settings.PortForwarder.Name(), "[not supported]")
|
||||||
|
if hasPortForwardingCodeRunning {
|
||||||
return errors.New("setting port forwarded at runtime is not supported with internally running port forwarding code")
|
return errors.New("setting port forwarded at runtime is not supported with internally running port forwarding code")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ func newNoPortForwarder(providerName string) *noPortForwarder {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (n *noPortForwarder) Name() string {
|
func (n *noPortForwarder) Name() string {
|
||||||
return n.providerName
|
return n.providerName + " [not supported]"
|
||||||
}
|
}
|
||||||
|
|
||||||
func (n *noPortForwarder) PortForward(context.Context, pfutils.PortForwardObjects) (
|
func (n *noPortForwarder) PortForward(context.Context, pfutils.PortForwardObjects) (
|
||||||
|
|||||||
Reference in New Issue
Block a user