aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/ui
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2019-04-01 09:50:45 +0200
committerJason A. Donenfeld <Jason@zx2c4.com>2019-04-01 09:50:45 +0200
commit6dea1b3e69ac2f2e8b0cadd2837dd1072acc329b (patch)
tree5072a74a82cb62721c9ca75e6cae89d7633d857b /ui
parentui: Remove WM_SIZING hack from ConfView, fixed bug in walk (diff)
downloadwireguard-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')
-rw-r--r--ui/ui.go10
1 files changed, 6 insertions, 4 deletions
diff --git a/ui/ui.go b/ui/ui.go
index 3f8f53a1..08227a99 100644
--- a/ui/ui.go
+++ b/ui/ui.go
@@ -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)
}