-
Notifications
You must be signed in to change notification settings - Fork 33
/
action.yml
81 lines (72 loc) · 3.07 KB
/
action.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
# action.yml
name: 'Install WARP'
author: 'fscarmen <[email protected]>'
description: 'Install Cloudflare Warp on Github actions'
inputs:
stack:
description: 'Choose WARP stacks: IPv4/IPv6 only or dualstacks.'
required: false
default: 'dual'
mode:
description: 'Choose WARP mode: wireguard or client.'
required: false
default: 'wireguard'
runs:
using: composite
steps:
- name: Install WARP
run: |
if [ "${{ inputs.mode }}" == 'client' ]; then
echo "WARP mode: client warp+doh."
sudo apt-get -y update
curl -fsSL https://pkg.cloudflareclient.com/pubkey.gpg | sudo gpg --yes --dearmor --output /usr/share/keyrings/cloudflare-warp-archive-keyring.gpg
echo "deb [arch=amd64 signed-by=/usr/share/keyrings/cloudflare-warp-archive-keyring.gpg] https://pkg.cloudflareclient.com/ $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/cloudflare-client.list
sudo apt-get update
sudo apt-get install -y cloudflare-warp
sudo warp-cli --accept-tos registration new
sudo warp-cli --accept-tos mode warp+doh
if [ "${{ inputs.stack }}" == 'ipv4' ]; then
sudo warp-cli --accept-tos tunnel ip add-range ::0/0
elif [ "${{ inputs.stack }}" == 'ipv6' ]; then
sudo warp-cli --accept-tos tunnel ip add-range 0.0.0.0/0
fi
sudo warp-cli --accept-tos connect
elif [ "${{ inputs.mode }}" == 'wireguard' ]; then
echo "WARP mode: wireguard."
sudo apt-get -y update
sudo apt-get -y install --no-install-recommends net-tools iproute2 openresolv dnsutils iptables wireguard-tools
LAN=$(ip route get 192.168.193.10 | grep -oP 'src \K\S+')
CONFIG="[Interface]
PrivateKey = cKE7LmCF61IhqqABGhvJ44jWXp8fKymcMAEVAzbDF2k=
Address = 172.16.0.2/32
Address = fd01:5ca1:ab1e:823e:e094:eb1c:ff87:1fab/128
PostUp = ip -4 rule add from $LAN lookup main
PostDown = ip -4 rule delete from $LAN lookup main
DNS = 8.8.8.8,8.8.4.4
MTU = 1280
[Peer]
PublicKey = bmXOC+F1FxEMF9dyiK2H5/1SUtzH0JuVo51h2wPfgyo=
"
if [ "${{ inputs.stack }}" == 'ipv4' ]; then
CONFIG+="AllowedIPs = 0.0.0.0/0
"
elif [ "${{ inputs.stack }}" == 'ipv6' ]; then
CONFIG+="AllowedIPs = ::/0
"
else
CONFIG+="AllowedIPs = 0.0.0.0/0
AllowedIPs = ::/0
"
fi
CONFIG+="Endpoint = 162.159.193.10:2408"
echo "$CONFIG" | sed "s/^[ ]\+//g" | sudo tee /etc/wireguard/warp.conf
sudo wg-quick up warp
else
echo -e "WARP mode: ${{ inputs.mode }}.\nYou can choose client or wireguard."
exit 1
fi
sleep 1
echo -e "===============================\nIP:"
echo "IPv4: $(sudo curl -s4m8 --retry 3 -A Mozilla https://api.ip.sb/geoip)"
echo "IPv6: $(sudo curl -s6m8 --retry 3 -A Mozilla https://api.ip.sb/geoip)"
shell: bash