diff options
author | kali kaneko (leap communications) <kali@leap.se> | 2021-05-16 21:21:30 +0200 |
---|---|---|
committer | kali kaneko (leap communications) <kali@leap.se> | 2021-05-17 17:52:44 +0200 |
commit | 4eee08d520b73fb96a43cf4888972e502c6c1fa3 (patch) | |
tree | 24cd97c658b7a369389f3980aa6a986bf78b72e2 /pkg/vpn/status.go | |
parent | b5b55b0b54588ad95d66fc7acfab0b9cb76c93e6 (diff) |
[feat] store pt gateway for connection info
Diffstat (limited to 'pkg/vpn/status.go')
-rw-r--r-- | pkg/vpn/status.go | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/pkg/vpn/status.go b/pkg/vpn/status.go index 647cf27..0b04c3b 100644 --- a/pkg/vpn/status.go +++ b/pkg/vpn/status.go @@ -74,12 +74,17 @@ func (b *Bitmask) eventHandler(eventCh <-chan openvpn.Event) { } if statusName == "CONNECTED" { ip := strings.Split(stateEvent.String(), ": ")[1] - gw, err := b.bonafide.GetGatewayByIP(ip) - if err == nil { - b.onGateway = gw - log.Println("Connected to gateway:", b.onGateway.Host) + if ip == "127.0.0.1" { + // we're using pluggable transports + b.onGateway = b.ptGateway } else { - log.Println("ERROR: connected to unknown gateway", ip) + gw, err := b.bonafide.GetGatewayByIP(ip) + if err == nil { + b.onGateway = gw + log.Println("Connected to gateway:", b.onGateway.Host) + } else { + log.Println("ERROR: connected to unknown gateway", ip) + } } } } |