Closed
Description
Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (go version
)?
go version go1.11beta2 darwin/amd64
Does this issue reproduce with the latest release?
Yes, tested on
go version devel +4f9ae7739b Tue Jul 24 14:29:38 2018 +0000 darwin/amd64
What operating system and processor architecture are you using (go env
)?
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/artyom/Library/Caches/go-build"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/artyom/go"
GOPROXY=""
GORACE=""
GOROOT="/Users/artyom/Repositories/go"
GOTMPDIR=""
GOTOOLDIR="/Users/artyom/Repositories/go/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD=""
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 -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/lb/3rk8rqs53czgb4v35w_342xc0000gn/T/go-build210171313=/tmp/go-build -gno-record-gcc-switches -fno-common"
What did you do?
https://play.golang.org/p/g1be5wdYdgy
This is an example of using Cloudflare's DNS-over-TLS. This code works in go1.10.3
What did you expect to see?
repro ¶ time ./repro-go1.10.3
resolver dial returned
resolver dial returned
[{93.184.216.34 } {2606:2800:220:1:248:1893:25c8:1946 }]
real 0m0.417s
user 0m0.199s
sys 0m0.054s
What did you see instead?
repro ¶ time ./repro-go1.11beta2
resolver dial returned
resolver dial returned
resolver dial returned
resolver dial returned
i/o timeout
real 0m10.057s
user 0m0.250s
sys 0m0.053s
1 repro ¶ time ./repro-go+4f9ae7739b
resolver dial returned
resolver dial returned
resolver dial returned
resolver dial returned
i/o timeout
real 0m10.067s
user 0m0.242s
sys 0m0.054s
Caught this issue first on linux/arm binary built with go version go1.11beta2 darwin/amd64.
Metadata
Metadata
Assignees
Type
Projects
Relationships
Development
No branches or pull requests
Activity
artyom commentedon Jul 24, 2018
I modified example to log (unencrypted) data passed over TLS connections: https://play.golang.org/p/Lhb8bOP7pw6
Here's what results look like:
This is for tip:
artyom commentedon Jul 24, 2018
Bisected this to 672729e
artyom commentedon Jul 24, 2018
CC @mdempsky @iangudger
iangudger commentedon Jul 24, 2018
That code is broken. It always returns a TCP connection even if a UDP one is requested. The TCP and UDP DNS protocols are different.
artyom commentedon Jul 24, 2018
@iangudger from the second paragraph of the doc for net.Resolver.Dial I assumed that UDP wire protocol is only used if Dial returned net.PacketConn, which tls.Conn does not implement, so RFC 7766 path expected here.
What am I missing here?
iangudger commentedon Jul 24, 2018
Wow, that is dumb. I will throw together a patch to fix compatibility.
andybons commentedon Jul 24, 2018
Assigning as release-blocking due to it being a regression.
bradfitz commentedon Jul 24, 2018
Or by design. 🤷
gopherbot commentedon Jul 24, 2018
Change https://golang.org/cl/125735 mentions this issue:
net: fix handling of Conns created by Resolver.Dial
mikioh commentedon Jul 25, 2018
I think this is one of the design flaws of the net package API surface, unfortunately, from the beginning. Looks like representing various characteristics in a single interface, like net.Conn, is not good for people who don't care about the hidden hierarchy on the interface. Surely, we need a good solution, at least for application-layer transport API still increasing complexity by adding fancy features; security (TLS 1.3, 1.4 or above), multipath (MPTCP, QUIC), newly flow and congestion controls and platform-dependent control knobs, in Go 2.