Last active
April 12, 2023 12:08
-
-
Save FieldofClay/12e83d0b5aaa80bde436621f89cd50a7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# updates the peer port of locally running transmission v4 daemon with the port output from ProtonVPN's NAT-PNP | |
# update the location of natpmp_client.py and double check your wireguard peer IP | |
# Get public port number using natpmp_client.py | |
public_port=$(python /path/to/py-natpmp/natpmp/natpmp_client.py -g 10.2.0.1 0 0 | awk -F 'public port ' '{print $2}'| cut -d',' -f1) | |
# Get current peer listening port in Transmission | |
current_port=$(transmission-remote -si | awk -F 'Listenport: ' '{print $2}' | cut -d' ' -f1 | grep -v -e '^$') | |
# Compare the two ports | |
if [ "$public_port" -ne "$current_port" ]; then | |
# Update peer listening port in Transmission | |
transmission-remote -p "$public_port" | |
echo "Peer listening port updated to $public_port" | |
else | |
echo "Peer listening port is already set to $current_port" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment