mirror of
https://github.com/yggdrasil-network/yggdrasil-go
synced 2024-11-09 23:20:26 +03:00
Add support for running Yggdrasil as a Windows service (using minwinsvc)
This commit is contained in:
parent
8a12a88447
commit
c453770b85
25
README.md
25
README.md
@ -52,6 +52,19 @@ In the interest of testing the TCP machinery, it's set to create TCP connections
|
|||||||
#### Linux
|
#### Linux
|
||||||
|
|
||||||
- Should work out of the box on most Linux distributions with `iproute2` installed.
|
- Should work out of the box on most Linux distributions with `iproute2` installed.
|
||||||
|
- systemd service scripts are included in the `contrib/systemd/` folder so that it runs automatically in the background (using `/etc/yggdrasil.conf` for configuration):
|
||||||
|
- Copy the service files into `/etc/systemd/system`
|
||||||
|
- Copy `yggdrasil` into your `$PATH`, i.e. `/usr/bin`
|
||||||
|
- Enable the service:
|
||||||
|
```
|
||||||
|
systemctl enable yggdrasil
|
||||||
|
systemctl start yggdrasil
|
||||||
|
```
|
||||||
|
- Read the `yggdrasil` output:
|
||||||
|
```
|
||||||
|
systemctl status yggdrasil
|
||||||
|
journalctl -u yggdrasil
|
||||||
|
```
|
||||||
|
|
||||||
#### macOS
|
#### macOS
|
||||||
|
|
||||||
@ -63,6 +76,17 @@ In the interest of testing the TCP machinery, it's set to create TCP connections
|
|||||||
- Tested and working on Windows 7 and Windows 10, and should work on any recent versions of Windows, but it depends on the [OpenVPN TAP driver](https://openvpn.net/index.php/open-source/downloads.html) being installed first.
|
- Tested and working on Windows 7 and Windows 10, and should work on any recent versions of Windows, but it depends on the [OpenVPN TAP driver](https://openvpn.net/index.php/open-source/downloads.html) being installed first.
|
||||||
- Has been proven to work with both the [NDIS 5](https://swupdate.openvpn.org/community/releases/tap-windows-9.9.2_3.exe) (`tap-windows-9.9.2_3`) driver and the [NDIS 6](https://swupdate.openvpn.org/community/releases/tap-windows-9.21.2.exe) (`tap-windows-9.21.2`) driver, however there are substantial performance issues with the NDIS 6 driver therefore it is recommended to use the NDIS 5 driver instead.
|
- Has been proven to work with both the [NDIS 5](https://swupdate.openvpn.org/community/releases/tap-windows-9.9.2_3.exe) (`tap-windows-9.9.2_3`) driver and the [NDIS 6](https://swupdate.openvpn.org/community/releases/tap-windows-9.21.2.exe) (`tap-windows-9.21.2`) driver, however there are substantial performance issues with the NDIS 6 driver therefore it is recommended to use the NDIS 5 driver instead.
|
||||||
- Be aware that connectivity issues can occur on Windows if multiple IPv6 addresses from the `fd00::/8` prefix are assigned to the TAP interface. If this happens, then you may need to manually remove the old/unused addresses from the interface (though the code has a workaround in place to do this automatically in some cases).
|
- Be aware that connectivity issues can occur on Windows if multiple IPv6 addresses from the `fd00::/8` prefix are assigned to the TAP interface. If this happens, then you may need to manually remove the old/unused addresses from the interface (though the code has a workaround in place to do this automatically in some cases).
|
||||||
|
- Yggdrasil can be installed as a Windows service so that it runs automatically in the background. From an Administrator Command Prompt:
|
||||||
|
```
|
||||||
|
sc create yggdrasil binpath= "\"C:\path\to\yggdrasil.exe\" -useconffile \"C:\path\to\yggdrasil.conf\""
|
||||||
|
sc config yggdrasil displayname= "Yggdrasil Service"
|
||||||
|
sc config yggdrasil start= "auto"
|
||||||
|
sc start yggdrasil
|
||||||
|
```
|
||||||
|
- Alternatively, if you want the service to autoconfigure instead of using an `yggdrasil.conf`, replace the `sc create` line from above with:
|
||||||
|
```
|
||||||
|
sc create yggdrasil binpath= "\"C:\path\to\yggdrasil.exe\" -autoconf"
|
||||||
|
```
|
||||||
|
|
||||||
#### EdgeRouter
|
#### EdgeRouter
|
||||||
|
|
||||||
@ -114,4 +138,3 @@ Both of these optimizations are not present in the current implementation, as th
|
|||||||
This code is released under the terms of the LGPLv3, but with an added exception that was shamelessly taken from [godeb](https://github.com/niemeyer/godeb).
|
This code is released under the terms of the LGPLv3, but with an added exception that was shamelessly taken from [godeb](https://github.com/niemeyer/godeb).
|
||||||
Under certain circumstances, this exception permits distribution of binaries that are (statically or dynamically) linked with this code, without requiring the distribution of Minimal Corresponding Source or Minimal Application Code.
|
Under certain circumstances, this exception permits distribution of binaries that are (statically or dynamically) linked with this code, without requiring the distribution of Minimal Corresponding Source or Minimal Application Code.
|
||||||
For more details, see: [LICENSE](LICENSE).
|
For more details, see: [LICENSE](LICENSE).
|
||||||
|
|
||||||
|
1
build
1
build
@ -1,6 +1,7 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
export GOPATH=$PWD
|
export GOPATH=$PWD
|
||||||
echo "Downloading..."
|
echo "Downloading..."
|
||||||
|
go get -d -v
|
||||||
go get -d -v yggdrasil
|
go get -d -v yggdrasil
|
||||||
for file in *.go ; do
|
for file in *.go ; do
|
||||||
echo "Building: $file"
|
echo "Building: $file"
|
||||||
|
13
yggdrasil.go
13
yggdrasil.go
@ -21,6 +21,8 @@ import "golang.org/x/net/ipv6"
|
|||||||
|
|
||||||
import . "yggdrasil"
|
import . "yggdrasil"
|
||||||
|
|
||||||
|
import _ "github.com/kardianos/minwinsvc"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is a very crude wrapper around src/yggdrasil
|
* This is a very crude wrapper around src/yggdrasil
|
||||||
* It can generate a new config (--genconf)
|
* It can generate a new config (--genconf)
|
||||||
@ -228,6 +230,7 @@ func (n *node) announce() {
|
|||||||
var pprof = flag.Bool("pprof", false, "Run pprof, see http://localhost:6060/debug/pprof/")
|
var pprof = flag.Bool("pprof", false, "Run pprof, see http://localhost:6060/debug/pprof/")
|
||||||
var genconf = flag.Bool("genconf", false, "print a new config to stdout")
|
var genconf = flag.Bool("genconf", false, "print a new config to stdout")
|
||||||
var useconf = flag.Bool("useconf", false, "read config from stdin")
|
var useconf = flag.Bool("useconf", false, "read config from stdin")
|
||||||
|
var useconffile = flag.String("useconffile", "", "read config from specified file path")
|
||||||
var autoconf = flag.Bool("autoconf", false, "automatic mode (dynamic IP, peer with IPv6 neighbors)")
|
var autoconf = flag.Bool("autoconf", false, "automatic mode (dynamic IP, peer with IPv6 neighbors)")
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
@ -236,8 +239,14 @@ func main() {
|
|||||||
switch {
|
switch {
|
||||||
case *autoconf:
|
case *autoconf:
|
||||||
cfg = generateConfig()
|
cfg = generateConfig()
|
||||||
case *useconf:
|
case *useconffile != "" || *useconf:
|
||||||
config, err := ioutil.ReadAll(os.Stdin)
|
var config []byte
|
||||||
|
var err error
|
||||||
|
if *useconffile != "" {
|
||||||
|
config, err = ioutil.ReadFile(*useconffile)
|
||||||
|
} else {
|
||||||
|
config, err = ioutil.ReadAll(os.Stdin)
|
||||||
|
}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user