torproject / stem

Python controller library for Tor
https://stem.torproject.org/
GNU Lesser General Public License v3.0
257 stars 75 forks source link

Controller.from_port doesn't handle Docker Compose network #127

Closed grvn-ht closed 1 year ago

grvn-ht commented 1 year ago

Hey Stem Team! Really nice work ongoing here,

I would like to propose a new feature for: stem.control.Controller.from_port(address, port)

Right now address needs to be an IPV4, however, inside docker-compose, you can call a container by it's name.

Therefor we could imagine a class who overwrites the @staticmethod from_port:

class Docker_Controller(Controller): @staticmethod def from_port(address = 'tor', port = 9051): import stem.connection control_port = stem.socket.ControlPort(address, port) return Controller(control_port)

Here is an implementation's example: https://github.com/grvn-ht/torproxy_docker_compose

Hope it will be of help,

Regards

atagar commented 1 year ago

Hi G-ht, I'm glad you like the library!

I already added the feature you propose (IPv6 support in the from_port() method) but it's not in any releases. I moved on from Tor so Stem has become unmaintained.

As discussed on another ticket you'll need to contact 'gk at torproject dot org' if you'd care for this to change.

Cheers! -Damian

grvn-ht commented 1 year ago

Thank's for the answer, I will try to do it then!