From a81cc9b36ee3b511b85d165035515428f06aba74 Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Mon, 1 Apr 2019 09:50:45 +0200 Subject: ui: abstract test interface name --- ui/ui.go | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'ui/ui.go') 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) } -- cgit v1.2.3-59-g8ed1b