File size: 1,294 Bytes
7a3e60d
 
268124e
7a3e60d
367d714
7a3e60d
 
367d714
 
 
 
 
268124e
7a3e60d
3173582
7a3e60d
2d74271
 
 
 
 
 
 
 
 
3173582
7a3e60d
 
 
 
 
 
 
 
 
 
 
 
 
 
2d74271
ff94b41
3173582
ff94b41
 
 
3173582
ff94b41
3173582
ff94b41
 
 
7a3e60d
 
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
FROM alpine:latest

RUN set -ex && apk add --no-cache curl tar

ADD https://git.new/wcgo /usr/local/bin/wgcf
RUN chmod +x /usr/local/bin/wgcf

ADD https://git.new/wpgo /tmp/wpgo.tar.gz
RUN tar -xzf /tmp/wpgo.tar.gz -C /tmp && \
    mv /tmp/wireproxy /usr/local/bin/wpgo && \
    chmod +x /usr/local/bin/wpgo && \
    rm -rf /tmp/*

WORKDIR /config
RUN wgcf register --accept-tos >/dev/null 2>&1 && wgcf generate >/dev/null 2>&1

COPY api-server /app/api-server
RUN chmod +x /app/api-server

WORKDIR /app
EXPOSE 7860

RUN cat > /start.sh << 'EOF'
#!/bin/sh

cat > /wpgo.conf <<EOC 2>/dev/null
[Interface]
Address = $(grep -m1 Address /config/wgcf-profile.conf | cut -d' ' -f3)
DNS = 1.1.1.1
MTU = 1280
PrivateKey = $(grep PrivateKey /config/wgcf-profile.conf | cut -d' ' -f3)

[Peer]
PublicKey = $(grep PublicKey /config/wgcf-profile.conf | cut -d' ' -f3)
Endpoint = 162.159.192.1:2408
AllowedIPs = 0.0.0.0/0
PersistentKeepalive = 25

[SOCKS5]
BindAddress = 127.0.0.1:1080
EOC

wpgo -c /wpgo.conf >/dev/null 2>&1 &

sleep 3

echo "{\"server_host\":\"0.0.0.0\",\"server_port\":7860,\"server_key\":\"${SERVER_KEY}\",\"upstream_server\":\"socks5://127.0.0.1:1080\"}" >/dev/null 2>&1 > config.json

exec ./api-server -config config.json >/dev/null 2>&1
EOF

RUN chmod +x /start.sh

CMD ["/start.sh"]