aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/ui
diff options
context:
space:
mode:
authorSteven Honson <steven@honson.id.au>2019-05-11 21:54:19 +1000
committerJason A. Donenfeld <Jason@zx2c4.com>2019-05-11 17:33:22 +0200
commit0ccf7ad37fe98c22220e9f2bf557107c17f88a76 (patch)
treedbea108e24ae30fb8bae73ab2fbe582e60a669bd /ui
parentui: optimise window sizing for a single peer (diff)
downloadwireguard-windows-0ccf7ad37fe98c22220e9f2bf557107c17f88a76.tar.xz
wireguard-windows-0ccf7ad37fe98c22220e9f2bf557107c17f88a76.zip
ui: use ipc client to list existing tunnels
The manager service and ui application may be running as different users, and therefore use different configurations directories. Using the ipc client ensures that tunnels are listed from the perspective of the service. Signed-off-by: Steven Honson <steven@honson.id.au> Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'ui')
-rw-r--r--ui/editdialog.go7
1 files changed, 4 insertions, 3 deletions
diff --git a/ui/editdialog.go b/ui/editdialog.go
index ac441f32..ba868893 100644
--- a/ui/editdialog.go
+++ b/ui/editdialog.go
@@ -257,13 +257,14 @@ func (dlg *EditDialog) onSaveButtonClicked() {
return
}
- names, err := conf.ListConfigNames()
+ existingTunnelList, err := service.IPCClientTunnels()
if err != nil {
walk.MsgBox(dlg, "Unable to list existing tunnels", err.Error(), walk.MsgBoxIconError)
return
}
- for _, name := range names {
- if strings.ToLower(name) == strings.ToLower(newName) {
+ newNameLower := strings.ToLower(newName)
+ for _, tunnel := range existingTunnelList {
+ if strings.ToLower(tunnel.Name) == newNameLower {
walk.MsgBox(dlg, "Tunnel already exists", fmt.Sprintf("Another tunnel already exists with the name ā€˜%sā€™.", newName), walk.MsgBoxIconWarning)
return
}