I have a docker-compose file which runs a tor node and I also have a simple Go script which attempts to use torgo to connect to said tor node.
I run the docker-compose and then I run a simple curl command to check that the SOCKS5 proxy is working, all is fine:
$ curl --socks5 127.0.0.1:9050 https://check.torproject.org/api/ip
{"IsTor":true,"IP":"185.83.214.69"}
But if I run my Go script to try and connect with port 9051
to get a controller instance, every attempt fails with error EOF
.
I've also tried connecting via telnet
and receive errors there as well:
$ telnet 127.0.0.1 9051
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
Connection closed by foreign host.
I've tried a number of different things at this point, too many to recall right now but things including, different docker images, mounting my own torrc
config with auth enabled and various other parameters, etc. Nothing is working...
What am I missing? How can I connect to the ControlPort
?
docker-compose
version: "3.8"
services:
torproxy:
restart: always
image: dperson/torproxy:latest
ports:
- "9050:9050" # Tor proxy
- "9051:9051" # Tor control port
- "8118:8118" # Privoxy
main.go
package main
import (
"github.com/wybiral/torgo"
"log"
)
func main() {
addr := "127.0.0.1:9051"
c, err := torgo.NewController(addr)
if err != nil {
log.Fatalf("failed to create tor controller: %s", err)
}
log.Println(c)
}