remove unneeded code to prevent errors, add readme
This commit is contained in:
parent
bdadd7898a
commit
7d9a377d6c
|
@ -0,0 +1,5 @@
|
||||||
|
# qBittorrent-natpmp
|
||||||
|
I forked the original project to make it compatible with the [linuxserver/docker-wireguard](https://github.com/linuxserver/docker-wireguard) container.
|
||||||
|
|
||||||
|
## Not using gluetun
|
||||||
|
Since I only use wireguard (a silent protocol) forced health checks on the wireguard container are pointless. On top of this I've had problems with the firewalling done by the gluetun container. Rather than troubleshooting that I just deleted a bunch of code from soxfor's container to make it compatible with my preferred vpn container.
|
|
@ -43,27 +43,6 @@ qbt_isreachable() {
|
||||||
nc -4 -vw 5 ${QBITTORRENT_SERVER} ${QBITTORRENT_PORT} &>/dev/null 2>&1
|
nc -4 -vw 5 ${QBITTORRENT_SERVER} ${QBITTORRENT_PORT} &>/dev/null 2>&1
|
||||||
}
|
}
|
||||||
|
|
||||||
fw_delrule() {
|
|
||||||
if (docker exec "${VPN_CT_NAME}" /sbin/iptables -L INPUT -n | grep -qP "^ACCEPT.*${configured_port}.*"); then
|
|
||||||
# shellcheck disable=SC2086
|
|
||||||
docker exec "${VPN_CT_NAME}" /sbin/iptables -D INPUT -i "${VPN_IF_NAME}" -p tcp --dport ${configured_port} -j ACCEPT
|
|
||||||
# shellcheck disable=SC2086
|
|
||||||
docker exec "${VPN_CT_NAME}" /sbin/iptables -D INPUT -i "${VPN_IF_NAME}" -p udp --dport ${configured_port} -j ACCEPT
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
fw_addrule() {
|
|
||||||
if ! (docker exec "${VPN_CT_NAME}" /sbin/iptables -L INPUT -n | grep -qP "^ACCEPT.*${active_port}.*"); then
|
|
||||||
# shellcheck disable=SC2086
|
|
||||||
docker exec "${VPN_CT_NAME}" /sbin/iptables -A INPUT -i "${VPN_IF_NAME}" -p tcp --dport ${active_port} -j ACCEPT
|
|
||||||
# shellcheck disable=SC2086
|
|
||||||
docker exec "${VPN_CT_NAME}" /sbin/iptables -A INPUT -i "${VPN_IF_NAME}" -p udp --dport ${active_port} -j ACCEPT
|
|
||||||
return 0
|
|
||||||
else
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
get_portmap() {
|
get_portmap() {
|
||||||
res=0
|
res=0
|
||||||
public_ip=$(getpublicip)
|
public_ip=$(getpublicip)
|
||||||
|
@ -88,9 +67,6 @@ get_portmap() {
|
||||||
# shellcheck disable=SC2086
|
# shellcheck disable=SC2086
|
||||||
if [ ${configured_port} != ${active_port} ]; then
|
if [ ${configured_port} != ${active_port} ]; then
|
||||||
if qbt_changeport "${qbt_sid}" ${active_port}; then
|
if qbt_changeport "${qbt_sid}" ${active_port}; then
|
||||||
if fw_delrule; then
|
|
||||||
echo "$(timestamp) | IPTables rule deleted for port ${configured_port} on ${VPN_CT_NAME} container"
|
|
||||||
fi
|
|
||||||
echo "$(timestamp) | Port Changed to: $(findconfiguredport ${qbt_sid})"
|
echo "$(timestamp) | Port Changed to: $(findconfiguredport ${qbt_sid})"
|
||||||
else
|
else
|
||||||
echo "$(timestamp) | Port Change failed."
|
echo "$(timestamp) | Port Change failed."
|
||||||
|
@ -100,10 +76,6 @@ get_portmap() {
|
||||||
echo "$(timestamp) | Port OK (Act: ${active_port} Cfg: ${configured_port})"
|
echo "$(timestamp) | Port OK (Act: ${active_port} Cfg: ${configured_port})"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if fw_addrule; then
|
|
||||||
echo "$(timestamp) | IPTables rule added for port ${active_port} on ${VPN_CT_NAME} container"
|
|
||||||
fi
|
|
||||||
|
|
||||||
return $res
|
return $res
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue