diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2019-04-01 09:50:45 +0200 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2019-04-01 09:50:45 +0200 |
commit | 6dea1b3e69ac2f2e8b0cadd2837dd1072acc329b (patch) | |
tree | 5072a74a82cb62721c9ca75e6cae89d7633d857b /ui/ui.go | |
parent | ui: Remove WM_SIZING hack from ConfView, fixed bug in walk (diff) | |
download | wireguard-windows-6dea1b3e69ac2f2e8b0cadd2837dd1072acc329b.tar.xz wireguard-windows-6dea1b3e69ac2f2e8b0cadd2837dd1072acc329b.zip |
ui: abstract test interface name
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'ui/ui.go')
-rw-r--r-- | ui/ui.go | 10 |
1 files changed, 6 insertions, 4 deletions
@@ -17,6 +17,8 @@ import ( "time" ) +const testInterfaceName = "test" + const demoConfig = `[Interface] PrivateKey = 6KpcbNFK4tKBciKBT2Rj6Z/sHBqxdV+p+nuNA5AlWGI= Address = 192.168.4.84/24 @@ -85,7 +87,7 @@ func RunUI() { didFind := false if err == nil { for _, tunnel := range tunnels { - if tunnel.Name == "test" { + if tunnel.Name == testInterfaceName { storedConfig, err := tunnel.StoredConfig() if err == nil { se.SetText(storedConfig.ToWgQuick()) @@ -160,7 +162,7 @@ func RunUI() { restoreState = false return } - c, err := conf.FromWgQuick(se.Text(), "test") + c, err := conf.FromWgQuick(se.Text(), testInterfaceName) if err != nil { walk.MsgBox(mw, "Invalid configuration", err.Error(), walk.MsgBoxIconError) return @@ -212,7 +214,7 @@ func RunUI() { }) setServiceState := func(tunnel *service.Tunnel, state service.TunnelState, showNotifications bool) { - if tunnel.Name != "test" { + if tunnel.Name != testInterfaceName { return } mw.SetSuspended(true) @@ -281,7 +283,7 @@ func RunUI() { if err != nil { continue } - if tunnel.Name == "test" && state != service.TunnelStopped { + if tunnel.Name == testInterfaceName && state != service.TunnelStopped { runningTunnel = &tunnel setServiceState(&tunnel, state, false) } |