This commit is contained in:
Kirigaya Kazuto 2021-07-13 06:06:48 +00:00
parent 6bdc1f34f1
commit a2c1b918ca
2 changed files with 6 additions and 2 deletions

View File

@ -1,8 +1,9 @@
#!/bin/bash #!/bin/bash
set -e
export WG_MYPRIK=$(wg genkey) export WG_MYPRIK=$(wg genkey)
export WG_MYPUBK=$(echo $WG_MYPRIK | wg pubkey) export WG_MYPUBK=$(echo $WG_MYPRIK | wg pubkey)
python3 tool_create.py python3 tool_create.py
python3 tool_generate.py python3 tool_generate.py
chmod +x start.sh

View File

@ -13,6 +13,7 @@ except Exception:
udp_clients = config["udp2raw"]["client"] udp_clients = config["udp2raw"]["client"]
udp_servers = config["udp2raw"]["server"] udp_servers = config["udp2raw"]["server"]
print("Generating wireguard config...")
with open("{}.conf".format(config["interface"]), "w", encoding='utf-8') as f: with open("{}.conf".format(config["interface"]), "w", encoding='utf-8') as f:
f.write('''[Interface] f.write('''[Interface]
Address = {} Address = {}
@ -31,9 +32,11 @@ AllowedIPs = {}
if info["keepalive"]: if info["keepalive"]:
f.write("PersistentKeepalive = {}".format(info["keepalive"])) f.write("PersistentKeepalive = {}".format(info["keepalive"]))
print("Generating start script...")
with open("start.sh", "w", encoding='utf-8') as f: with open("start.sh", "w", encoding='utf-8') as f:
f.write('''#!/bin/bash f.write('''#!/bin/bash
set -x set -e
cp {}.conf /etc/wireguard/ cp {}.conf /etc/wireguard/
tmux new-session -s tunnel -d tmux new-session -s tunnel -d