chore(vpn): rename openvpn* to vpn* variables

This commit is contained in:
Quentin McGaw
2025-11-07 15:26:24 +00:00
parent 4d2b8787e0
commit ffb0bec4da

View File

@@ -56,14 +56,14 @@ func (l *Loop) Run(ctx context.Context, done chan<- struct{}) {
password: settings.Provider.PortForwarding.Password, password: settings.Provider.PortForwarding.Password,
} }
openvpnCtx, openvpnCancel := context.WithCancel(context.Background()) vpnCtx, vpnCancel := context.WithCancel(context.Background())
waitError := make(chan error) waitError := make(chan error)
tunnelReady := make(chan struct{}) tunnelReady := make(chan struct{})
go vpnRunner.Run(openvpnCtx, waitError, tunnelReady) go vpnRunner.Run(vpnCtx, waitError, tunnelReady)
if err := l.waitForError(ctx, waitError); err != nil { if err := l.waitForError(ctx, waitError); err != nil {
openvpnCancel() vpnCancel()
l.crashed(ctx, err) l.crashed(ctx, err)
continue continue
} }
@@ -75,10 +75,10 @@ func (l *Loop) Run(ctx context.Context, done chan<- struct{}) {
for stayHere { for stayHere {
select { select {
case <-tunnelReady: case <-tunnelReady:
go l.onTunnelUp(openvpnCtx, ctx, tunnelUpData) go l.onTunnelUp(vpnCtx, ctx, tunnelUpData)
case <-ctx.Done(): case <-ctx.Done():
l.cleanup() l.cleanup()
openvpnCancel() vpnCancel()
<-waitError <-waitError
close(waitError) close(waitError)
return return
@@ -86,7 +86,7 @@ func (l *Loop) Run(ctx context.Context, done chan<- struct{}) {
l.userTrigger = true l.userTrigger = true
l.logger.Info("stopping") l.logger.Info("stopping")
l.cleanup() l.cleanup()
openvpnCancel() vpnCancel()
<-waitError <-waitError
// do not close waitError or the waitError // do not close waitError or the waitError
// select case will trigger // select case will trigger
@@ -99,7 +99,7 @@ func (l *Loop) Run(ctx context.Context, done chan<- struct{}) {
l.statusManager.Lock() // prevent SetStatus from running in parallel l.statusManager.Lock() // prevent SetStatus from running in parallel
l.cleanup() l.cleanup()
openvpnCancel() vpnCancel()
l.statusManager.SetStatus(constants.Crashed) l.statusManager.SetStatus(constants.Crashed)
l.logAndWait(ctx, err) l.logAndWait(ctx, err)
stayHere = false stayHere = false
@@ -107,6 +107,6 @@ func (l *Loop) Run(ctx context.Context, done chan<- struct{}) {
l.statusManager.Unlock() l.statusManager.Unlock()
} }
} }
openvpnCancel() vpnCancel()
} }
} }