Peeking out from the engine room, I’m delighted to announce Stem 1.7. A full year’s accumulation of fixes and improvements.
What is Stem, you ask? For those who aren’t familiar with it Stem is a Python library for interacting with Tor. With it you can script against your relay, descriptor data, or even write applications like Nyx.
So what’s new in this release?
ORPort Descriptor Downloads
Stem can now download descriptors through ORPorts just like Tor!
reply = stem.descriptor.remote.get_server_descriptors( endpoints = (stem.ORPort('188.8.131.52', 9101),), )
This is just the tip of the iceberg for the ORPorts capabilities we hope Stem will have. Whats next, python tor clients? Relays? Stay tuned!
In collaboration with teor, Stem now provides authority and fallback directory information through our new stem.directory module…
import stem.directory COLUMN_FORMAT = '%-17s%-20s%-10s%-10s' try: authorities = stem.directory.Authority.from_remote() except IOError as exc: print('%s\n' % exc) authorities = stem.directory.Authority.from_cache() print(COLUMN_FORMAT % ('Name', 'Address', 'ORPort', 'DirPort')) for authority in authorities.values(): print(COLUMN_FORMAT % (authority.nickname, authority.address, authority.or_port, authority.dir_port))
% python demo.py Name Address ORPort DirPort maatuska 184.108.40.206 80 443 tor26 220.127.116.11 443 80 Bifroest 18.104.22.168 443 80 longclaw 22.214.171.124 443 80 dizum 126.96.36.199 443 80 bastet 188.8.131.52 443 80 gabelmoo 184.108.40.206 443 80 moria1 220.127.116.11 9101 9131 dannenberg 18.104.22.168 443 80 Faravahar 22.214.171.124 443 80
Stem now supports Tor’s new ZSTD and LZMA compression. ZSTD and LZMA’s higher compression ratio comes at a CPU cost and are less available, so when using these to save bandwidth you should provide a fallback…
reply = stem.descriptor.remote.get_server_descriptors( compression = ( Compression.LZMA, # higher compression but often unavailable Compression.GZIP, # decent compression and always available ) )