feat(pia): port forwarding options VPN_PORT_FORWARDING_USERNAME and VPN_PORT_FORWARDING_PASSWORD

- Retro-compatible with `OPENVPN_USER` + `OPENVPN_PASSWORD`
- No more reading for the OpenVPN auth file
- Allow to use PIA port forwarding with Wireguard
This commit is contained in:
Quentin McGaw
2024-07-09 14:44:46 +00:00
parent 06c9bc55d3
commit 0501743814
11 changed files with 69 additions and 45 deletions

View File

@@ -30,6 +30,8 @@ func (l *Loop) startPortForwarding(data tunnelUpData) (err error) {
Interface: data.vpnIntf,
ServerName: data.serverName,
CanPortForward: data.canPortForward,
Username: data.username,
Password: data.password,
},
}
return l.portForward.UpdateWith(partialUpdate)

View File

@@ -50,6 +50,8 @@ func (l *Loop) Run(ctx context.Context, done chan<- struct{}) {
canPortForward: canPortForward,
portForwarder: portForwarder,
vpnIntf: vpnInterface,
username: settings.Provider.PortForwarding.Username,
password: settings.Provider.PortForwarding.Password,
}
openvpnCtx, openvpnCancel := context.WithCancel(context.Background())

View File

@@ -12,6 +12,8 @@ type tunnelUpData struct {
vpnIntf string
serverName string // used for PIA
canPortForward bool // used for PIA
username string // used for PIA
password string // used for PIA
portForwarder PortForwarder
}