Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add script to update Transmission peer port #2611

Open
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

juanlufont
Copy link

@juanlufont juanlufont commented Dec 1, 2024

The script transmission-port-update.sh updates the peer port used by the torrent client Transmission using its API. The peer port is the port used and announced by Transmission to accept incoming connections. You can use this script to set a VPN forwarded port as the current listening port for Transmission.

The script uses only shell scripting and can run out of the box within the current gluetun docker image, it only relies on the command wget, which is already included by default in the image.

The script `transmission-port-update.sh` updates the _peer port_ used by
the torrent client Transmission. The peer port is the port used and
announced by Transmission to accept incoming connections.
@ku1ik
Copy link

ku1ik commented Dec 28, 2024

I've used this script and it worked on the first try. Thank you!

@ku1ik
Copy link

ku1ik commented Jan 22, 2025

Just reporting that I've been using this for over a month and it's been working flawlessly 👌

- better error handling
- support for comma-separated list of ports (use only first one)
- style corrections
- improved messages
Copy link
Owner

@qdm12 qdm12 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the review of the PR (and the wiki PR 👍 ) Just a few minor things to do if possible 🙏 thanks!


# default values
DEFAULT_URL="http://localhost:9091/transmission/rpc"
WGET_OPTS="--quiet"
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit just have this as --quiet directly without a variable, to reduce the "API surface" of the script. One can always ask if they need different wget options, and we can add it as a flag.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have moved --quiet flag out of WGET_OPTS but I am keeping the variable to store there, if needed, the API credentials and some extra flags they require. Is this ok?

juanlufont and others added 3 commits January 27, 2025 12:05
Co-authored-by: Quentin McGaw <quentin.mcgaw@gmail.com>
Co-authored-by: Quentin McGaw <quentin.mcgaw@gmail.com>
@iridial
Copy link

iridial commented Mar 8, 2025

I did some tests in k3s with gluetun v3.40 running as initContainer for transmission, and using VPN_PORT_FORWARDING_UP_COMMAND as trigger to call the script using: '/bin/sh -c "/scripts/transmission-port-update.sh --port {{PORTS}}"'.
The transmission container takes more time to be available to receive the port forward update request, and this leads the initial call of the script to fail.
I suggest to include an initial check if transmission api service is available, and if not, retry once more after configurable timeout with /bin/sleep <value>.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants