Skip to content

Commit

Permalink
Save PIA auth config before.
Browse files Browse the repository at this point in the history
  • Loading branch information
FireMasterK committed Sep 4, 2023
1 parent 1fdda76 commit 3de07f8
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions internal/vpn/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,17 @@ func (l *Loop) Run(ctx context.Context, done chan<- struct{}) {
vpnRunner, serverName, err = setupOpenVPN(ctx, l.fw,
l.openvpnConf, providerConf, settings, l.ipv6Supported, l.starter, subLogger)
} else { // Wireguard
// save auth in case of PIA for port forwarding and getting the wg config
if *settings.Provider.Name == "private internet access" {
if *settings.OpenVPN.User != "" {
err := l.openvpnConf.WriteAuthFile(*settings.OpenVPN.User, *settings.OpenVPN.Password)
if err != nil {
l.crashed(ctx, fmt.Errorf("writing auth to file: %w", err))
continue
}
}
}

vpnInterface = settings.Wireguard.Interface
vpnRunner, serverName, err = setupWireguard(ctx, l.netLinker, l.fw,
providerConf, settings, l.ipv6Supported, subLogger)
Expand Down

0 comments on commit 3de07f8

Please sign in to comment.