Timed Random Port

Suggest, post, or discuss plugins for Deluge
Post Reply
AnomynousPierson
Member
Member
Posts: 12
Joined: Tue Aug 05, 2008 12:46 am

Timed Random Port

Post by AnomynousPierson »

I suggest a random port changer plugin.

When enabled the plugin would change the client to run on a different random port after a set amount of time. This would work best if it also caused the each torrent to re-announce to the tracker. I don't know if this would take care of any current ISP issues, but it may thwart issues we have yet to see.

If there was a bit of documentation on the subject I might would be inclined to try and code this myself despite the fact that I'm a python newb. :P
mvoncken
Developer
Developer
Posts: 225
Joined: Mon Sep 03, 2007 9:38 pm

Re: Timed Random Port

Post by mvoncken »

Here's a client script , you can put that in cron:

Code: Select all

#choose new random port
from deluge.ui.client import sclient
sclient.set_core_uri()
print "current_port:", sclient.get_listen_port()

#force port update by setting random to false first
sclient.set_config({"random_port":False})
sclient.set_config({"random_port":True})

print "new_port:", sclient.get_listen_port()

torrents = sclient.get_session_state()
sclient.force_reannounce(torrents)
print "reannounce done"
We do have some docs:
http://dev.deluge-torrent.org/wiki/Development/UiClient
http://dev.deluge-torrent.org/wiki/Development/Plugins
dev: webui, core, labels | irc:vonck7 |
AnomynousPierson
Member
Member
Posts: 12
Joined: Tue Aug 05, 2008 12:46 am

Re: Timed Random Port

Post by AnomynousPierson »

That looks like it would work great if the daemon ran in a DMZ(which would be very insecure). A specified port range or list of ports would be optimal, but I can imagine the code to do that would be considerably different from what you provided.

If changing the options for the daemon are as easy as you have made it look I may be able to code this myself.
....maybe. lol

thanks. :)
mvoncken
Developer
Developer
Posts: 225
Joined: Mon Sep 03, 2007 9:38 pm

Re: Timed Random Port

Post by mvoncken »

AnomynousPierson wrote:That looks like it would work great if the daemon ran in a DMZ(which would be very insecure).
You would run the script on the same machine as the daemon, the daemon refuses remote connections by default.
A specified port range or list of ports would be optimal, but I can imagine the code to do that would be considerably different from what you provided.
Not that different :

Code: Select all

from random import randrange
port = randrange(5000,6000)
sclient.set_config({"listen_ports":[port, port],"random_port":False})
dev: webui, core, labels | irc:vonck7 |
lytnus
New User
New User
Posts: 3
Joined: Thu Nov 27, 2008 12:19 am

Re: Timed Random Port

Post by lytnus »

Heya,

I'm a bit of a newbie in linux, running ubuntu 8.10, and was wondering how to make this script work? For some reason, the ports Deluge pick seem fine (and the test works) initially but seem to just stop working after some amount of time. To get my torrent speed back up I have to constantly select new ports, and a script to automate this would be very helpful!

Thanks,
James
Post Reply