aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/services/names.go
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
commit4a296b50f7f8925fa08def99a6399a887312aee4 (patch)
treecfee428900f6fb08015620c12c3f18b3583458ac /services/names.go
parentversion: bump (diff)
downloadwireguard-windows-4a296b50f7f8925fa08def99a6399a887312aee4.tar.xz
wireguard-windows-4a296b50f7f8925fa08def99a6399a887312aee4.zip
tunnel: move Run into own module to reduce file size
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'services/names.go')
-rw-r--r--services/names.go26
1 files changed, 26 insertions, 0 deletions
diff --git a/services/names.go b/services/names.go
new file mode 100644
index 00000000..3b9003d0
--- /dev/null
+++ b/services/names.go
@@ -0,0 +1,26 @@
+/* SPDX-License-Identifier: MIT
+ *
+ * Copyright (C) 2019 WireGuard LLC. All Rights Reserved.
+ */
+
+package services
+
+import (
+ "errors"
+
+ "golang.zx2c4.com/wireguard/windows/conf"
+)
+
+func ServiceNameOfTunnel(tunnelName string) (string, error) {
+ if !conf.TunnelNameIsValid(tunnelName) {
+ return "", errors.New("Tunnel name is not valid")
+ }
+ return "WireGuardTunnel$" + tunnelName, nil
+}
+
+func PipePathOfTunnel(tunnelName string) (string, error) {
+ if !conf.TunnelNameIsValid(tunnelName) {
+ return "", errors.New("Tunnel name is not valid")
+ }
+ return "\\\\.\\pipe\\WireGuard\\" + tunnelName, nil
+}