Skip to content

crypto/tls: Dial error message does not give much context #34197

@hramrach

Description

@hramrach

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

go version go1.11.13 linux/amd64

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

go env Output
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/mbirc/.cache/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/mbirc/go"
GOPROXY=""
GORACE=""
GOROOT="/usr/lib64/go/1.11"
GOTMPDIR=""
GOTOOLDIR="/usr/lib64/go/1.11/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
CXX="g++"
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 -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build241684230=/tmp/go-build -gno-record-gcc-switches"

What did you do?

tls-client.go code
package main

import (
"crypto/tls"
"os"
"log"
)

func main() {
args:= os.Args

config := tls.Config{}
conn, err := tls.Dial("tcp", args[1] + ":" + args[2], &config)
if err != nil {
    log.Fatalf("client: dial: %s", err)
}
defer conn.Close()
log.Println("client: connected to: ", conn.RemoteAddr())

}


This does not work for the successful case but in error case it prints:

client: dial: remote error: tls: handshake failure

What did you expect to see?

Message that allows diagnosing the failure. Why has it failed to connect? Other clients connect fine.

What did you see instead?

Unexplained failure.

Metadata

Metadata

Assignees

No one assigned

    Labels

    NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions