mirror of
https://github.com/ilteoood/docker-surfshark.git
synced 2025-12-24 06:08:07 +01:00
feat: SURFSHARK_CONFIGS_ENDPOINT
This commit is contained in:
@@ -8,6 +8,7 @@ ENV SURFSHARK_USER=
|
|||||||
ENV SURFSHARK_PASSWORD=
|
ENV SURFSHARK_PASSWORD=
|
||||||
ENV SURFSHARK_COUNTRY=
|
ENV SURFSHARK_COUNTRY=
|
||||||
ENV SURFSHARK_CITY=
|
ENV SURFSHARK_CITY=
|
||||||
|
ENV SURFSHARK_CONFIGS_ENDPOINT=https://my.surfshark.com/vpn/api/v1/server/configurations
|
||||||
ENV OPENVPN_OPTS=
|
ENV OPENVPN_OPTS=
|
||||||
ENV CONNECTION_TYPE=tcp
|
ENV CONNECTION_TYPE=tcp
|
||||||
ENV LAN_NETWORK=
|
ENV LAN_NETWORK=
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ The container is configurable using different environment variables:
|
|||||||
|SURFSHARK_PASSWORD|Yes|Password provided by SurfShark|
|
|SURFSHARK_PASSWORD|Yes|Password provided by SurfShark|
|
||||||
|SURFSHARK_COUNTRY|No|The country, supported by SurfShark, in which you want to connect|
|
|SURFSHARK_COUNTRY|No|The country, supported by SurfShark, in which you want to connect|
|
||||||
|SURFSHARK_CITY|No|The city of the country in which you want to connect|
|
|SURFSHARK_CITY|No|The city of the country in which you want to connect|
|
||||||
|
|SURFSHARK_CONFIGS_ENDPOINT|No|The endpoint to be used to read Surfshark's configuration zip|
|
||||||
|OPENVPN_OPTS|No|Any additional options for OpenVPN|
|
|OPENVPN_OPTS|No|Any additional options for OpenVPN|
|
||||||
|CONNECTION_TYPE|No|The connection type that you want to use: tcp, udp|
|
|CONNECTION_TYPE|No|The connection type that you want to use: tcp, udp|
|
||||||
|LAN_NETWORK|No|Lan network used to access the web ui of attached containers. Can be comma seperated for multiple subnets Comment out or leave blank: example 192.168.0.0/24|
|
|LAN_NETWORK|No|Lan network used to access the web ui of attached containers. Can be comma seperated for multiple subnets Comment out or leave blank: example 192.168.0.0/24|
|
||||||
|
|||||||
10
startup.sh
10
startup.sh
@@ -1,20 +1,20 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
rm -rf ovpn_configs*
|
rm -rf ovpn_configs*
|
||||||
if [ -z "${OVPN_CONFIGS}" ]; then
|
if [ -z "${OVPN_CONFIGS}" ]; then
|
||||||
wget -O ovpn_configs.zip https://my.surfshark.com/vpn/api/v1/server/configurations
|
|
||||||
OVPN_CONFIGS=ovpn_configs.zip
|
OVPN_CONFIGS=ovpn_configs.zip
|
||||||
|
wget -O ${OVPN_CONFIGS} "${SURFSHARK_CONFIGS_ENDPOINT}"
|
||||||
fi
|
fi
|
||||||
unzip "${OVPN_CONFIGS}" -d ovpn_configs
|
unzip "${OVPN_CONFIGS}" -d ovpn_configs
|
||||||
cd ovpn_configs
|
cd ovpn_configs
|
||||||
VPN_FILE=$(ls *"${SURFSHARK_COUNTRY}"-* | grep "${SURFSHARK_CITY}" | grep "${CONNECTION_TYPE}" | shuf | head -n 1)
|
VPN_FILE=$(ls *"${SURFSHARK_COUNTRY}"-* | grep "${SURFSHARK_CITY}" | grep "${CONNECTION_TYPE}" | shuf | head -n 1)
|
||||||
echo Chose: ${VPN_FILE}
|
echo Chose: "${VPN_FILE}"
|
||||||
printf "${SURFSHARK_USER}\n${SURFSHARK_PASSWORD}" > vpn-auth.txt
|
printf "${SURFSHARK_USER}\n${SURFSHARK_PASSWORD}" > vpn-auth.txt
|
||||||
|
|
||||||
if [ -n ${LAN_NETWORK} ]
|
if [ -n "${LAN_NETWORK}" ]
|
||||||
then
|
then
|
||||||
DEFAULT_GATEWAY=$(ip -4 route list 0/0 | cut -d ' ' -f 3)
|
DEFAULT_GATEWAY=$(ip -4 route list 0/0 | cut -d ' ' -f 3)
|
||||||
|
|
||||||
splitSubnets=$(echo ${LAN_NETWORK} | tr "," "\n")
|
splitSubnets=$(echo "${LAN_NETWORK}" | tr "," "\n")
|
||||||
|
|
||||||
for subnet in $splitSubnets
|
for subnet in $splitSubnets
|
||||||
do
|
do
|
||||||
@@ -46,7 +46,7 @@ if [ "${ENABLE_SOCKS_SERVER}" = "true" ]; then
|
|||||||
OPTIONAL_SOCKS_SCRIPT="--up /vpn/sockd.sh"
|
OPTIONAL_SOCKS_SCRIPT="--up /vpn/sockd.sh"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
openvpn --config $VPN_FILE --auth-user-pass vpn-auth.txt --mute-replay-warnings $OPENVPN_OPTS --script-security 2 ${OPTIONAL_SOCKS_SCRIPT}
|
openvpn --config "$VPN_FILE" --auth-user-pass vpn-auth.txt --mute-replay-warnings "$OPENVPN_OPTS" --script-security 2 "${OPTIONAL_SOCKS_SCRIPT}"
|
||||||
|
|
||||||
if [ "${ENABLE_KILL_SWITCH}" = "true" ]; then
|
if [ "${ENABLE_KILL_SWITCH}" = "true" ]; then
|
||||||
ufw reset
|
ufw reset
|
||||||
|
|||||||
Reference in New Issue
Block a user