diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2016-07-05 16:01:31 +0200 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2016-07-05 16:01:31 +0200 |
commit | f7ff6390bb898f343ef7b1590b6a9d56a296af8c (patch) | |
tree | aacdd65b3d7d97e2b8a1c1ae6aba93ff5c65ae42 /contrib/client-server-example/server.sh | |
parent | receive: protect against impossible conditions (diff) | |
download | wireguard-monolithic-historical-f7ff6390bb898f343ef7b1590b6a9d56a296af8c.tar.xz wireguard-monolithic-historical-f7ff6390bb898f343ef7b1590b6a9d56a296af8c.zip |
contrib: organize example scripts and add synergy
Diffstat (limited to 'contrib/client-server-example/server.sh')
-rwxr-xr-x | contrib/client-server-example/server.sh | 14 |
1 files changed, 0 insertions, 14 deletions
diff --git a/contrib/client-server-example/server.sh b/contrib/client-server-example/server.sh deleted file mode 100755 index e37861f..0000000 --- a/contrib/client-server-example/server.sh +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/bash -if [[ -z $NCAT_REMOTE_ADDR ]]; then - ip link del dev wg0 2>/dev/null - set -e - ip link add dev wg0 type wireguard - ip address add 192.168.4.1/24 dev wg0 - wg set wg0 private-key <(wg genkey) listen-port 12912 - ip link set up dev wg0 - exec ncat -e "$(readlink -f "$0")" -k -l -p 42912 -v -fi -read -r public_key -[[ $(wg show wg0 | grep peer | wc -l) -ge 253 ]] && wg set wg0 peer $(wg show wg0 latest-handshakes | sort -k 2 -b -n | head -n 1 | cut -f 1) remove -next_ip=$(all="$(wg show wg0 allowed-ips)"; for ((i=2; i<=254; i++)); do ip="192.168.4.$i"; [[ $all != *$ip/32* ]] && echo $ip && break; done) -wg set wg0 peer "$public_key" allowed-ips $next_ip/32 2>/dev/null && echo "OK:$(wg show wg0 private-key | wg pubkey):$(wg show wg0 listen-port):$next_ip" || echo ERROR |