def setUp(self): self.shaper_conf = { (self.server_addr[0], ): { 'upload': 256, 'download': 1024, 'delay': 5 }, (self.client_addr[0], ): { 'upload': 128, 'download': 512, 'delay': 30 }, } self.sh = Shaper() self.sh.set_shaping(self.shaper_conf)
'delay': 5, 'jitter': 5 }, ("127.0.0.3", ): { 'upload': 256, 'download': 512, 'delay': 20 }, ("127.0.0.4", ): { 'upload': 256, 'download': 512, 'delay': 20 }, } sh = Shaper() sh.set_shaping(ps) #print sh.ip_handles #sh.teardown_all() #up, down = sh.get_traffic("127.0.0.2") #print up, down # Please be aware that second call to set_shaping with the same IP will not change the settings # How to generate large range of IP adresses: #ps = {tuple([ "127.0.0.%d" % x for x in range(1,250) ]) : {'upload': 256, 'download': 1024, 'delay': 25}, # } #