facebookarchive/doh-proxy

Cannot bind if no --listen-address parameter

Closed this issue · 2 comments

I am running the stub in a docker container where the internal IP address sometimes changes. I would like the stub to listen on any IP addresses.
If I omit the --listen-address parameter, the stub won't start with the error:

OSError: [Errno 99] Address not available

If I bind to ::1, obviously the docker-proxy won't be able to talk to it.
If I add --listen-address 172.17.0.12, it works flawlessy.

Can I use any wildcard in the --listen-address parameter? The best would be if the default value would be to bind to all interfaces.

@andrasg

I am running the stub in a docker container where the internal IP address sometimes changes. I would like the stub to listen on any IP addresses.

I am not sure what you are trying to achieve. The stub is supposed to run on the local host and set in /etc/resolv.conf so it can be used transparently by applicartions. https://facebookexperimental.github.io/doh-proxy/tutorials/simple-setup.html#running-the-client-stub

The default is ::1

OSError: [Errno 99] Address not available

That would mean the container is not IPv6 enable. Correct?

If I bind to ::1, obviously the docker-proxy won't be able to talk to it.

I don't know much of the details of docker, so can tell, but are you saying that if you provide --listen-address ::1 it works? Your previous error message let me believe that not.

Can I use any wildcard in the --listen-address parameter?

Yes you should. Have you tried? --listen-address :: for v6 or --listen-address 0.0.0.0 for v4 should do just that.

The best would be if the default value would be to bind to all interfaces.

I don't agree with this. Binding to localhost is a sane default IMHO for a stub. If it bound to all interface by default, one may expose the service outside of the host, which is not what the stub is supposed to do.

@andrasg I believe your problem should be solved by using either :: or 0.0.0.0. I will be closing this issue for now as --listen-address just seem to work as intended.