I2Psnark With Docker
Since it turned out that I can’t set up qbittorrent not to use clearnet traffic at all in favour of I2P, I decided to use I2Psnark, which is the standard I2P torrent client. The dockerfile is taken from https://codeberg.org/Strict3443/i2psnark-docker
After cloning the git repo you have to set your I2P proxy IP (since I am using it on the same machine that I use as an I2P router, I am putting in 127.0.0.1 - it may vary if you want to use an external machine for that):
- I2CP_HOST=127.0.0.1 # *REQUIRED* I2CP hostname (Ex. 169.154.251.221)
Now run the docker container. If you get an error on wget command, check https://i2pplus.github.io, copy the clearnet download link to I2Psnark standalone and paste the link in the dockerfile in place of the old one, then change all references to the old version to the new version.
You can now connect to the console using
ssh -fTNL 8002:127.0.0.1:8002 user@example.com
And then connecting to localhost:8002 in your browser. If you have any errors, make sure you enabled I2CP in your I2P router config.
(the following should not be applied since i2psnark doesn’t have an authentication method)
Next, configure your nginx to route traffic from torrent.example.com to 127.0.0.1:8002 (default port for I2Psnark console)
server {
listen 80;
server_name torrent.example.com;
#access_log /var/log/nginx/access.log;
location / {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_pass http://127.0.0.1:8002; # change it to a different port if non-default is used
proxy_read_timeout 90;
proxy_redirect http://127.0.0.1:8002 http://torrent.example.com;
}
}
Then, create a link in your sites-enabled:
sudo ln -s /etc/nginx/sites-available/torrent /etc/nginx/sites-enabled/torrent
After reloading nginx, you should be able to visit the I2Psnark console in your browser