haugene / docker-transmission-openvpn

Docker container running Transmission torrent client with WebUI over an OpenVPN tunnel
GNU General Public License v3.0
4.1k stars 1.21k forks source link

Custom script to detect container's IP #513

Closed tir38 closed 6 years ago

tir38 commented 6 years ago

The custom pre/post Transmission scripts are run on the container not host, right? I'm trying to achieve something like #323 with transmission-pre-start.sh:

#!/bin/bash

echo "Your external IP address is: "
curl -s http://whatismyip.akamai.com/
echo ""

But this is spitting out my host IP, not my container's VPN IP. I'm sure the VPN is working because I can use http://ipmagnet.services.cbcdn.com/ to see Transmission is running through VNP

mrjackyliang commented 6 years ago

Use this to check the IP locally: ip -4 addr show tun0 | grep -oP '(?<=inet\s)\d+(\.\d+){3}'

Use this to check the IP through an API: curl -sS --interface tun0 http://ipinfo.io/ip

TMaddox commented 6 years ago

A quick and easy workaround I am using: https://torguard.net/checkmytorrentipaddress.php

just add it to your transmission