aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/manager
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2019-08-24 10:14:16 +0200
committerJason A. Donenfeld <Jason@zx2c4.com>2019-08-24 10:59:52 +0200
commit5eae61a48e48d90a57810355e673170b88247a49 (patch)
treecfee428900f6fb08015620c12c3f18b3583458ac /manager
parentversion: bump (diff)
downloadwireguard-windows-5eae61a48e48d90a57810355e673170b88247a49.tar.xz
wireguard-windows-5eae61a48e48d90a57810355e673170b88247a49.zip
tunnel: move Run into own module to reduce file size
Diffstat (limited to '')
-rw-r--r--manager/install.go22
-rw-r--r--manager/ipc_server.go7
-rw-r--r--manager/service.go4
-rw-r--r--manager/tunneltracker.go2
-rw-r--r--services/names.go (renamed from manager/names.go)2
5 files changed, 13 insertions, 24 deletions
diff --git a/manager/install.go b/manager/install.go
index 69a9ad3c..cff1289a 100644
--- a/manager/install.go
+++ b/manager/install.go
@@ -15,7 +15,7 @@ import (
"golang.org/x/sys/windows/svc/mgr"
"golang.zx2c4.com/wireguard/windows/conf"
- "golang.zx2c4.com/wireguard/windows/tunnel"
+ "golang.zx2c4.com/wireguard/windows/services"
)
var cachedServiceManager *mgr.Mgr
@@ -105,10 +105,6 @@ func UninstallManager() error {
return err2
}
-func RunManager() error {
- return svc.Run("WireGuardManager", &managerService{})
-}
-
func InstallTunnel(configPath string) error {
m, err := serviceManager()
if err != nil {
@@ -124,7 +120,7 @@ func InstallTunnel(configPath string) error {
return err
}
- serviceName, err := ServiceNameOfTunnel(name)
+ serviceName, err := services.ServiceNameOfTunnel(name)
if err != nil {
return err
}
@@ -177,7 +173,7 @@ func UninstallTunnel(name string) error {
if err != nil {
return err
}
- serviceName, err := ServiceNameOfTunnel(name)
+ serviceName, err := services.ServiceNameOfTunnel(name)
if err != nil {
return err
}
@@ -193,15 +189,3 @@ func UninstallTunnel(name string) error {
}
return err2
}
-
-func RunTunnel(confPath string) error {
- name, err := conf.NameFromPath(confPath)
- if err != nil {
- return err
- }
- serviceName, err := ServiceNameOfTunnel(name)
- if err != nil {
- return err
- }
- return svc.Run(serviceName, &tunnel.Service{confPath})
-}
diff --git a/manager/ipc_server.go b/manager/ipc_server.go
index 18ff858b..7691adb8 100644
--- a/manager/ipc_server.go
+++ b/manager/ipc_server.go
@@ -22,6 +22,7 @@ import (
"golang.zx2c4.com/wireguard/ipc/winpipe"
"golang.zx2c4.com/wireguard/windows/conf"
+ "golang.zx2c4.com/wireguard/windows/services"
"golang.zx2c4.com/wireguard/windows/updater"
)
@@ -49,7 +50,7 @@ func (s *ManagerService) RuntimeConfig(tunnelName string, config *conf.Config) e
if err != nil {
return err
}
- pipePath, err := PipePathOfTunnel(storedConfig.Name)
+ pipePath, err := services.PipePathOfTunnel(storedConfig.Name)
if err != nil {
return err
}
@@ -131,7 +132,7 @@ func (s *ManagerService) Stop(tunnelName string, _ *uintptr) error {
}
func (s *ManagerService) WaitForStop(tunnelName string, _ *uintptr) error {
- serviceName, err := ServiceNameOfTunnel(tunnelName)
+ serviceName, err := services.ServiceNameOfTunnel(tunnelName)
if err != nil {
return err
}
@@ -159,7 +160,7 @@ func (s *ManagerService) Delete(tunnelName string, _ *uintptr) error {
}
func (s *ManagerService) State(tunnelName string, state *TunnelState) error {
- serviceName, err := ServiceNameOfTunnel(tunnelName)
+ serviceName, err := services.ServiceNameOfTunnel(tunnelName)
if err != nil {
return err
}
diff --git a/manager/service.go b/manager/service.go
index 44b5456e..3b71bbff 100644
--- a/manager/service.go
+++ b/manager/service.go
@@ -341,3 +341,7 @@ loop:
}
return
}
+
+func Run() error {
+ return svc.Run("WireGuardManager", &managerService{})
+}
diff --git a/manager/tunneltracker.go b/manager/tunneltracker.go
index 72942036..0f222aac 100644
--- a/manager/tunneltracker.go
+++ b/manager/tunneltracker.go
@@ -31,7 +31,7 @@ func trackExistingTunnels() error {
return err
}
for _, name := range names {
- serviceName, err := ServiceNameOfTunnel(name)
+ serviceName, err := services.ServiceNameOfTunnel(name)
if err != nil {
continue
}
diff --git a/manager/names.go b/services/names.go
index bebf0cae..3b9003d0 100644
--- a/manager/names.go
+++ b/services/names.go
@@ -3,7 +3,7 @@
* Copyright (C) 2019 WireGuard LLC. All Rights Reserved.
*/
-package manager
+package services
import (
"errors"