From 1d48e2ac4edc66e8508d2b52d01b818cc0cbcdfa Mon Sep 17 00:00:00 2001 From: Ruakij Date: Sat, 1 Apr 2023 11:54:45 +0200 Subject: [PATCH] Add documentation --- README.md | 87 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 87 insertions(+) diff --git a/README.md b/README.md index a0b5bee..ac10ca7 100644 --- a/README.md +++ b/README.md @@ -5,3 +5,90 @@ Converts and adds IPv4- to IPv6-Adresses and AllowedIP-Entries for wireguard-int
+ +- [1. Overview](#1-overview) +- [2. Install](#2-install) + - [2.1. From Binary](#21-from-binary) + - [2.2. From sources](#22-from-sources) +- [3. Setup](#3-setup) + - [3.1. Environment](#31-environment) + - [3.2. Examples](#32-examples) +- [4. License](#4-license) + + +
+ +# 1. Overview + +The program will convert IPv4-only wireguard-interfaces to IPv6. It converts and adds the Address of the Interface and AllowedIPs-Entries with optional filters. + +IPv6-Adresses are generated based on the IPv4-Adress. + +Beware: This program needs `NET_ADMIN` privileges for setting Adresses and to access the wireguard-daemon. + +
+ +# 2. Install + +## 2.1. From Binary + +1. Download the appripriate binary for your system from the Release-page (or build from sources) +2. Save at an appropriate location e.g. `/usr/bin/local/wg-ipv6-converter` +3. Make executeable: `chmod +x /usr/bin/local/wg-ipv6-converter` + +
+ +## 2.2. From sources + +Clone the repository and compile using `go build ./cmd/app` + +
+ +# 3. Setup +## 3.1. Environment + +Variable|Description|Default +-|-|- +`INTERFACE`* | Wireguard-Interface Name | +`IPV6_FORMAT` | Format to use for converting v4 to v6
The CIDR-Mask gets translated using 128 - 24 - Mask
e.g. `10.0.100.5/16` -> `fc12::0a00:6405/96` | `fc12::%02x%02x:%02x%02x/%d` +`RECHECK_INTERVAL` | Interval in seconds to recheck AllowedIPs entries in case something changed | 300 + +*\* Required* + +
+ +## 3.2. Examples + +### 3.2.1. Netbird + +Netbird is at the moment only IPv4-compatible, with this program running where necessary, some basic IPv6-setup can be archieved. + +```bash +INTERFACE="wt0" ./wg-ipv6-converter +``` +Or using a systemd-service based on the example: +```bash +[Unit] +Description=WireGuard IPv6 converter for netbird +BindsTo=netbird.service + +[Service] +Type=simple +ExecStart=/usr/local/bin/wg-ipv6-converter +Restart=always +RestartSec=60 +StandardOutput=syslog +StandardError=syslog + +Environment="INTERFACE=wt0" + +[Install] +WantedBy=multi-user.target +``` + +
+ +# 4. License + +This project is licenced under GPLv3. +See [LICENSE](LICENSE) for more details.