feat(protonvpn): support up to 5 forwarded ports (#3208)

This commit is contained in:
Quentin McGaw
2026-04-18 02:36:06 +02:00
committed by GitHub
parent 7e7e8182ef
commit d5eeec6fb3
17 changed files with 254 additions and 109 deletions
+3 -1
View File
@@ -3,6 +3,7 @@ package service
import (
"context"
"fmt"
"slices"
"time"
)
@@ -38,13 +39,14 @@ func (s *Service) cleanup() (err error) {
}
}
redirectionWasEnabled := !slices.Equal(s.settings.ListeningPorts, []uint16{0})
for _, port := range s.ports {
err = s.portAllower.RemoveAllowedPort(context.Background(), port)
if err != nil {
return fmt.Errorf("blocking previous port in firewall: %w", err)
}
if s.settings.ListeningPort != 0 {
if redirectionWasEnabled {
ctx := context.Background()
const listeningPort = 0 // 0 to clear the redirection
err = s.portAllower.RedirectPort(ctx, s.settings.Interface, port, listeningPort)