Skip to content

net/http: can't handle Onion domains #42283

Closed
@melroy89

Description

@melroy89

What version of Go are you using (go version)?

go1.13.8 linux/amd64

Does this issue reproduce with the latest release?

Yes

What operating system and processor architecture are you using (go env)?

go env Output
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/melroy/.cache/go-build"
GOENV="/home/melroy/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/melroy/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/lib/go-1.13"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/lib/go-1.13/pkg/tool/linux_amd64"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/home/melroy/Documents/drone/go.mod"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build611413724=/tmp/go-build -gno-record-gcc-switches"

What did you do?

While using the Go net/http package, try to connect to an valid onion address.

In my case I'm using Drone a CI tool in Docker written in Golang. Drone tries via Oauth2 to connect to the Git server (eg. Gitea), but the POST request on http://mydomain.onion/login/oauth/access_token for Gitea fails: no suitable address found. See code lines below for more details what Drone is doing.

Usage example: Code line of HTTP package usage in Drone.
Usage example 2: Call to Oauth2 package
--> Code line of HTTP usage in Oauth2 package of Drone

What did you expect to see?

I would expect that Golang is able to connect to onion domains by using the http package, WITHOUT errors.

What did you see instead?

dial tcp: address xxxx.onion: no suitable address found 

Output of Drone:

ERRO[0026] oauth: cannot exchange code: secret: Post "http://xxx.onion/login/oauth/access_token": dial tcp: address xxxx.onion: no suitable address found 
DEBU[0026] cannot authenticate user: Post "http://yyy.onion/login/oauth/access_token": dial tcp: address yyy.onion: no suitable address found 
DEBU[0026]                                               fields.time="2020-10-29T21:49:40Z" latency=1.611572ms method=GET remote="172.19.0.1:40842" request="/login?code=secret%3D&state=secret" request-id=secret

More reports

I'm not the only one suffering from this problem. Maybe not fully related, but somebody that tries to use go get by using a onion domain to fetch packages: https://www.reddit.com/r/techsupport/comments/981frd/need_help_with_golang_and_tor/
It could be touching the same code base in Go?

Thanks.

Regards,
Melroy van den Berg

Metadata

Metadata

Assignees

No one assigned

    Labels

    FeatureRequestIssues asking for a new feature that does not need a proposal.FrozenDueToAgeNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions