Return to
David's Python Resources
Features
|
Screenshot
|
Background
|
Requirements
|
Manuals
|
Download
|
Support
pyshaper
A simple yet versatile program for managing your internet traffic in real time.
Features
pyshaper lets you set bandwidth minimum and maximum limits on several criteria:
remote host/port, and local host/port (most shaper apps have this)
pid of locally connected program
username under which local program is running
command line and arguments under which local program was launched
country in which remmote peer resides
With all these filtering criteria available, you can set up some pretty sophisticated filters.
For instance, you can use the 'by program' filtering to put bandwidth caps on peer2peer programs that often talk via several different protocols, to different ports (which evades most other traffic-shaping programs).
Or, you can set individual inbound and/or outbound limits based on specific countries (or all countries other than your own).
Configuration file syntax is pretty simple and straightforward. No arcane nuts'n'bolts TCP/IP grease-monkey bit-bashing knowledge needed. After a quick pass through the doco and examples, you'll be building your shaping configuration within a few short minutes.
Screenshot
pyshaper includes a graphical user interface which you can use to conveniently view/change throttle settings in real time. Note that pyshaper runs as a daemon, so can function perfectly in non-graphical environments.
Background
Development of pyshaper was driven by a number of factors:
Broadband internet access within New Zealand is abysmal, due to the local telco mafia controlling the local loop. You have to either put up with 128kb/s up/down (with 5-15GB monthly traffic), or suffer stupidly restrictive traffic caps (as little as 400MB/month) if you want faster connections
Existing traffic shaping software is either extremely limited or extremely complicated
I like to participate in a few different Peer2peer networks (eg Freenet, I2P etc - not your typical warez/MP3-type networks, but more privacy/anonymity networks), and I needed a simple way to stop these programs from blowing out my traffic
'tc' has a steep learning curve, and doesn't allow easy filtering on any criteria other than source/destination host/port.
I scoured the net, and came across the wondershaper script, as well as a prototype easy-shaper program called '
snitch
'. These programs helped me to start fathoming the occult mysteries of the arcane 'tc' utility (part of the iproute2 suite). tc in its present state is very lacking in doco and examples, so these programs helped heaps.
So, as is an Open Source motto -
If you can't find it,
write it!
- I realised I had to pull my finger out and write something myself.
Requirements
Linux 2.4.x, 2.5.x or 2.6.x
(tested on 2.6.4)
iproute2 software (with the 'tc' utility) (available with all decent Linux distros)
Python
2.2.2 or later
GeoIP
(optional, debian package
python-geoip
)
A few simple kernel settings, spelt out in the INSTALL file
In addition, if you want to run the optional GUI front-end, you'll need:
Tkinter (debian package
python-tk
)
Tk 8.4 or later -
http://www.tcl.tk
(debian package
tk8.4
(or 'tk8.5'...)
Python Megawidgets (PMW) -
http://pmw.sourceforge.net
(debian package
python-pmw
)
tcpdump (debian package
tcpdump
)
Documentation
Check out:
The
pyshaper manpage
The
pyshaper.conf manpage
Download
You can download pyshaper here as
pyshaper-0.1.3.tar.gz
Earlier versions:
pyshaper-0.1.2.tar.gz
pyshaper-0.1.1.tar.gz
Support
I'm busy as hell, so may or may not at any particular time be able to support you.
Drop me a line at
david at freenet dot org dot nz
, and I'll see what I can do.
(put the word 'pyshaper' in the subject, to get around my aggressive spam filter).
If you're using pyshaper in a commercial setting, and need quick specific support or customisation, a contribution of cash in my general direction will do wonders for stimulating my interest and energy. You're getting the software for free, so please don't be afraid of paying up a little for support.