From 4a296b50f7f8925fa08def99a6399a887312aee4 Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Sat, 24 Aug 2019 10:14:16 +0200 Subject: tunnel: move Run into own module to reduce file size Signed-off-by: Jason A. Donenfeld --- services/names.go | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 services/names.go (limited to 'services/names.go') 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 +} -- cgit v1.2.3-59-g8ed1b