aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2019-06-06 15:44:29 +0200
committerJason A. Donenfeld <Jason@zx2c4.com>2019-06-07 11:31:53 +0200
commit14dfc4e3e1925fcc3d303100c44ef4c321427c6b (patch)
treedd1e16a34fafff9635381e21e99c65421ed5cbf4
parenttunnel: perform full stop on shutdown (diff)
downloadwireguard-windows-14dfc4e3e1925fcc3d303100c44ef4c321427c6b.tar.xz
wireguard-windows-14dfc4e3e1925fcc3d303100c44ef4c321427c6b.zip
global: cleanup TODO comment spacing
-rw-r--r--manager/install.go2
-rw-r--r--manager/ipc_server.go6
-rw-r--r--manager/service.go2
-rw-r--r--tunnel/defaultroutemonitor.go2
-rw-r--r--tunnel/firewall/blocker.go2
-rw-r--r--tunnel/firewall/syscall_windows.go2
-rw-r--r--tunnel/ifaceconfig.go4
-rw-r--r--tunnel/service.go2
-rw-r--r--ui/editdialog.go2
-rw-r--r--ui/iconprovider.go6
-rw-r--r--ui/listview.go4
-rw-r--r--ui/tray.go2
-rw-r--r--ui/tunnelspage.go4
-rw-r--r--updater/downloader.go8
-rw-r--r--updater/msirunner_windows.go4
15 files changed, 26 insertions, 26 deletions
diff --git a/manager/install.go b/manager/install.go
index 2eddbbb..00ed1f4 100644
--- a/manager/install.go
+++ b/manager/install.go
@@ -43,7 +43,7 @@ func InstallManager() error {
return nil
}
- //TODO: Do we want to bail if executable isn't being run from the right location?
+ // TODO: Do we want to bail if executable isn't being run from the right location?
serviceName := "WireGuardManager"
service, err := m.OpenService(serviceName)
diff --git a/manager/ipc_server.go b/manager/ipc_server.go
index a460a27..18ff858 100644
--- a/manager/ipc_server.go
+++ b/manager/ipc_server.go
@@ -205,8 +205,8 @@ func (s *ManagerService) Create(tunnelConfig conf.Config, tunnel *Tunnel) error
}
*tunnel = Tunnel{tunnelConfig.Name}
return nil
- //TODO: handle already existing situation
- //TODO: handle already running and existing situation
+ // TODO: handle already existing situation
+ // TODO: handle already running and existing situation
}
func (s *ManagerService) Tunnels(_ uintptr, tunnels *[]Tunnel) error {
@@ -219,7 +219,7 @@ func (s *ManagerService) Tunnels(_ uintptr, tunnels *[]Tunnel) error {
(*tunnels)[i].Name = names[i]
}
return nil
- //TODO: account for running ones that aren't in the configuration store somehow
+ // TODO: account for running ones that aren't in the configuration store somehow
}
func (s *ManagerService) Quit(stopTunnelsOnQuit bool, alreadyQuit *bool) error {
diff --git a/manager/service.go b/manager/service.go
index ba7208d..d6c7d92 100644
--- a/manager/service.go
+++ b/manager/service.go
@@ -159,7 +159,7 @@ func (service *managerService) Execute(args []string, r <-chan svc.ChangeRequest
first = false
}
- //TODO: we lock the OS thread so that these inheritable handles don't escape into other processes that
+ // TODO: we lock the OS thread so that these inheritable handles don't escape into other processes that
// might be running in parallel Go routines. But the Go runtime is strange and who knows what's really
// happening with these or what is inherited. We need to do some analysis to be certain of what's going on.
runtime.LockOSThread()
diff --git a/tunnel/defaultroutemonitor.go b/tunnel/defaultroutemonitor.go
index e1692bc..e944071 100644
--- a/tunnel/defaultroutemonitor.go
+++ b/tunnel/defaultroutemonitor.go
@@ -104,7 +104,7 @@ func monitorDefaultRoutes(device *device.Device, autoMTU bool, tun *tun.NativeTu
if err != nil {
return err
}
- tun.ForceMTU(int(iface.NLMTU)) //TODO: it sort of breaks the model with v6 mtu and v4 mtu being different. Just set v4 one for now.
+ tun.ForceMTU(int(iface.NLMTU)) // TODO: it sort of breaks the model with v6 mtu and v4 mtu being different. Just set v4 one for now.
iface, err = ourLUID.IPInterface(windows.AF_INET6)
if err == nil { // People seem to like to disable IPv6, so we make this non-fatal.
iface.NLMTU = mtu - 80
diff --git a/tunnel/firewall/blocker.go b/tunnel/firewall/blocker.go
index e02fd05..605b47b 100644
--- a/tunnel/firewall/blocker.go
+++ b/tunnel/firewall/blocker.go
@@ -73,7 +73,7 @@ func registerBaseObjects(session uintptr) (*baseObjects, error) {
}
err = fwpmProviderAdd0(session, &provider, 0)
if err != nil {
- //TODO: cleanup entire call chain of these if failure?
+ // TODO: cleanup entire call chain of these if failure?
return nil, wrapErr(err)
}
}
diff --git a/tunnel/firewall/syscall_windows.go b/tunnel/firewall/syscall_windows.go
index 0f247d8..195137a 100644
--- a/tunnel/firewall/syscall_windows.go
+++ b/tunnel/firewall/syscall_windows.go
@@ -35,7 +35,7 @@ package firewall
// https://docs.microsoft.com/en-us/windows/desktop/api/fwpmu/nf-fwpmu-fwpmprovideradd0
//sys fwpmProviderAdd0(engineHandle uintptr, provider *wtFwpmProvider0, sd uintptr) (err error) [failretval!=0] = fwpuclnt.FwpmProviderAdd0
-//TODO: Add these to x/sys/windows:
+// TODO: Add these to x/sys/windows:
// https://docs.microsoft.com/en-us/windows/desktop/api/securitybaseapi/nf-securitybaseapi-getsididentifierauthority
//sys getSidIdentifierAuthority(sid *windows.SID) (authority *windows.SidIdentifierAuthority) = advapi32.GetSidIdentifierAuthority
diff --git a/tunnel/ifaceconfig.go b/tunnel/ifaceconfig.go
index 2cc90e7..a71b612 100644
--- a/tunnel/ifaceconfig.go
+++ b/tunnel/ifaceconfig.go
@@ -25,7 +25,7 @@ func cleanupAddressesOnDisconnectedInterfaces(addresses []net.IPNet) {
return
}
includedInAddresses := func(a net.IPNet) bool {
- //TODO: this makes the whole algorithm O(n^2). But we can't stick net.IPNet in a Go hashmap. Bummer!
+ // TODO: this makes the whole algorithm O(n^2). But we can't stick net.IPNet in a Go hashmap. Bummer!
for _, addr := range addresses {
ip := addr.IP
if ip4 := ip.To4(); ip4 != nil {
@@ -226,7 +226,7 @@ func enableFirewall(conf *conf.Config, tun *tun.NativeTun) error {
}
func waitForFamilies(tun *tun.NativeTun) {
- //TODO: This whole thing is a disgusting hack that shouldn't be neccessary.
+ // TODO: This whole thing is a disgusting hack that shouldn't be neccessary.
f := func(luid winipcfg.LUID, family winipcfg.AddressFamily, maxRetries int) {
for i := 0; i < maxRetries; i++ {
diff --git a/tunnel/service.go b/tunnel/service.go
index 5c1cc13..97ffb55 100644
--- a/tunnel/service.go
+++ b/tunnel/service.go
@@ -184,7 +184,7 @@ func (service *Service) Execute(args []string, r <-chan svc.ChangeRequest, chang
dev.Up()
log.Println("Waiting for TCP/IP to attach to interface")
- waitForFamilies(nativeTun) //TODO: move this sort of thing into tun/wintun/CreateInterface
+ waitForFamilies(nativeTun) // TODO: move this sort of thing into tun/wintun/CreateInterface
log.Println("Monitoring default routes")
routeChangeCallback, err = monitorDefaultRoutes(dev, conf.Interface.MTU == 0, nativeTun)
diff --git a/ui/editdialog.go b/ui/editdialog.go
index 27c22eb..f1d7fac 100644
--- a/ui/editdialog.go
+++ b/ui/editdialog.go
@@ -118,7 +118,7 @@ func runTunnelEditDialog(owner walk.Form, tunnel *manager.Tunnel, clone bool) *c
}
if tunnel != nil && !clone {
- dlg.nameEdit.SetFocus() //TODO: This works around a walk issue with scrolling in weird ways <https://github.com/lxn/walk/issues/505>. We should fix this in walk instead of here.
+ dlg.nameEdit.SetFocus() // TODO: This works around a walk issue with scrolling in weird ways <https://github.com/lxn/walk/issues/505>. We should fix this in walk instead of here.
dlg.Starting().Attach(func() {
dlg.syntaxEdit.SetFocus()
diff --git a/ui/iconprovider.go b/ui/iconprovider.go
index 9a9d7ae..c38eac6 100644
--- a/ui/iconprovider.go
+++ b/ui/iconprovider.go
@@ -36,7 +36,7 @@ func iconWithOverlayForState(state manager.TunnelState, size int) (icon walk.Ima
}
if state == manager.TunnelStopped {
- return wireguardIcon, err //TODO: if we find something prettier than the gray dot, then remove this clause
+ return wireguardIcon, err // TODO: if we find something prettier than the gray dot, then remove this clause
}
iconSize := wireguardIcon.Size()
@@ -74,9 +74,9 @@ func iconForState(state manager.TunnelState, size int) (icon *walk.Icon, err err
case manager.TunnelStarted:
icon, err = loadSystemIcon("imageres", 101, size)
case manager.TunnelStopped:
- icon, err = walk.NewIconFromResourceWithSize("dot-gray.ico", walk.Size{size, size}) //TODO: replace with real icon
+ icon, err = walk.NewIconFromResourceWithSize("dot-gray.ico", walk.Size{size, size}) // TODO: replace with real icon
default:
- icon, err = loadSystemIcon("shell32", 238, size) //TODO: this doesn't look that great overlayed on the app icon
+ icon, err = loadSystemIcon("shell32", 238, size) // TODO: this doesn't look that great overlayed on the app icon
}
if err == nil {
cachedIconsForWidthAndState[widthAndState{size, state}] = icon
diff --git a/ui/listview.go b/ui/listview.go
index 71e5df4..9a15e72 100644
--- a/ui/listview.go
+++ b/ui/listview.go
@@ -198,10 +198,10 @@ func (tv *ListView) Load(asyncUI bool) {
for tunnel := range oldTunnels {
if !newTunnels[tunnel] {
for i, t := range tv.model.tunnels {
- //TODO: this is inefficient. Use a map here instead.
+ // TODO: this is inefficient. Use a map here instead.
if t.Name == tunnel.Name {
tv.model.tunnels = append(tv.model.tunnels[:i], tv.model.tunnels[i+1:]...)
- tv.model.PublishRowsRemoved(i, i) //TODO: Do we have to call that everytime or can we pass a range?
+ tv.model.PublishRowsRemoved(i, i) // TODO: Do we have to call that everytime or can we pass a range?
delete(tv.model.lastObservedState, t)
break
}
diff --git a/ui/tray.go b/ui/tray.go
index c08c06c..26e06c4 100644
--- a/ui/tray.go
+++ b/ui/tray.go
@@ -294,7 +294,7 @@ func (tray *Tray) SetTunnelState(tunnel *manager.Tunnel, state manager.TunnelSta
case manager.TunnelStopped:
tunnelAction.SetChecked(false)
if wasChecked && showNotifications {
- icon, _ := loadSystemIcon("imageres", 26, 128) //TODO: this icon isn't very good...
+ icon, _ := loadSystemIcon("imageres", 26, 128) // TODO: this icon isn't very good...
tray.ShowCustom("WireGuard Deactivated", fmt.Sprintf("The %s tunnel has been deactivated.", tunnel.Name), icon)
}
}
diff --git a/ui/tunnelspage.go b/ui/tunnelspage.go
index 11b2acd..bbeb203 100644
--- a/ui/tunnelspage.go
+++ b/ui/tunnelspage.go
@@ -55,7 +55,7 @@ func NewTunnelsPage() (*TunnelsPage, error) {
vlayout.SetSpacing(0)
tp.listContainer.SetLayout(vlayout)
- //TODO: deal with remaining disposables in case the next line fails
+ // TODO: deal with remaining disposables in case the next line fails
if tp.listView, err = NewListView(tp.listContainer); err != nil {
return nil, err
@@ -97,7 +97,7 @@ func NewTunnelsPage() (*TunnelsPage, error) {
disposables.Spare()
- //TODO: expose walk.TableView.itemCountChangedPublisher.Event()
+ // TODO: expose walk.TableView.itemCountChangedPublisher.Event()
tp.listView.Property("ItemCount").Changed().Attach(tp.onTunnelsChanged)
tp.listView.SelectedIndexesChanged().Attach(tp.onSelectedTunnelsChanged)
tp.listView.ItemActivated().Attach(tp.onTunnelsViewItemActivated)
diff --git a/updater/downloader.go b/updater/downloader.go
index f9b7083..a12b503 100644
--- a/updater/downloader.go
+++ b/updater/downloader.go
@@ -106,7 +106,7 @@ func DownloadVerifyAndExecute(userToken uintptr) (progress chan DownloadProgress
file.Seek(0, io.SeekStart)
file.Truncate(0)
file.Close()
- os.Remove(name) //TODO: Do we have any sort of TOCTOU here?
+ os.Remove(name) // TODO: Do we have any sort of TOCTOU here?
}
}()
@@ -145,7 +145,7 @@ func DownloadVerifyAndExecute(userToken uintptr) (progress chan DownloadProgress
return
}
- //TODO: it would be nice to rename in place from "file.msi.unverified" to "file.msi", but Windows TOCTOU stuff
+ // TODO: it would be nice to rename in place from "file.msi.unverified" to "file.msi", but Windows TOCTOU stuff
// is hard, so we'll come back to this later.
name := file.Name()
file.Close()
@@ -153,14 +153,14 @@ func DownloadVerifyAndExecute(userToken uintptr) (progress chan DownloadProgress
progress <- DownloadProgress{Activity: "Verifying authenticode signature"}
if !version.VerifyAuthenticode(name) {
- os.Remove(name) //TODO: Do we have any sort of TOCTOU here?
+ os.Remove(name) // TODO: Do we have any sort of TOCTOU here?
progress <- DownloadProgress{Error: errors.New("The downloaded update does not have an authentic authenticode signature")}
return
}
progress <- DownloadProgress{Activity: "Installing update"}
err = runMsi(name, userToken)
- os.Remove(name) //TODO: Do we have any sort of TOCTOU here?
+ os.Remove(name) // TODO: Do we have any sort of TOCTOU here?
if err != nil {
progress <- DownloadProgress{Error: err}
return
diff --git a/updater/msirunner_windows.go b/updater/msirunner_windows.go
index 84ddde2..62ec1cd 100644
--- a/updater/msirunner_windows.go
+++ b/updater/msirunner_windows.go
@@ -69,11 +69,11 @@ func msiTempFile() (*os.File, error) {
Length: uint32(len(sd)),
SecurityDescriptor: uintptr(unsafe.Pointer(&sd[0])),
}
- //TODO: os.TempDir() returns C:\windows\temp when calling from this context. Supposedly this is mostly secure
+ // TODO: os.TempDir() returns C:\windows\temp when calling from this context. Supposedly this is mostly secure
// against TOCTOU, but who knows! Look into this!
name := filepath.Join(os.TempDir(), hex.EncodeToString(randBytes[:]))
name16 := windows.StringToUTF16Ptr(name)
- //TODO: it would be nice to specify delete_on_close, but msiexec.exe doesn't open its files with read sharing.
+ // TODO: it would be nice to specify delete_on_close, but msiexec.exe doesn't open its files with read sharing.
fileHandle, err := windows.CreateFile(name16, windows.GENERIC_WRITE, windows.FILE_SHARE_READ, sa, windows.CREATE_NEW, windows.FILE_ATTRIBUTE_NORMAL, 0)
runtime.KeepAlive(sd)
if err != nil {