fix(portforward): trigger after VPN restart

This commit is contained in:
Quentin McGaw
2023-09-28 14:00:58 +00:00
parent a194906bdd
commit d4df87286e
10 changed files with 112 additions and 79 deletions

View File

@@ -5,7 +5,7 @@ import (
"errors"
)
func (l *Loop) cleanup(vpnProvider string) {
func (l *Loop) cleanup() {
for _, vpnPort := range l.vpnInputPorts {
err := l.fw.RemoveAllowedPort(context.Background(), vpnPort)
if err != nil {
@@ -18,7 +18,7 @@ func (l *Loop) cleanup(vpnProvider string) {
l.logger.Error("clearing public IP data: " + err.Error())
}
err = l.stopPortForwarding(vpnProvider)
err = l.stopPortForwarding()
if err != nil {
portForwardingAlreadyStopped := errors.Is(err, context.Canceled)
if !portForwardingAlreadyStopped {