extension-wireguard 730 B

1234567891011
  1. {
  2. "Network": "10.50.0.0/16",
  3. "Backend": {
  4. "Type": "extension",
  5. "PreStartupCommand": "wg genkey | tee privatekey | wg pubkey",
  6. "PostStartupCommand": "export SUBNET_IP=`echo $SUBNET | cut -d'/' -f 1`; ip link del flannel-wg 2>/dev/null; ip link add flannel-wg type wireguard && wg set flannel-wg listen-port 51820 private-key privatekey && ip addr add $SUBNET_IP/32 dev flannel-wg && ip link set flannel-wg up && ip route add $NETWORK dev flannel-wg",
  7. "ShutdownCommand": "ip link del flannel-wg",
  8. "SubnetAddCommand": "read PUBLICKEY; wg set flannel-wg peer $PUBLICKEY endpoint $PUBLIC_IP:51820 allowed-ips $SUBNET",
  9. "SubnetRemoveCommand": "read PUBLICKEY; wg set flannel-wg peer $PUBLICKEY remove"
  10. }
  11. }