go get 总是报 “ TLS handshake timeout” 错误

Author: mooooflyCreated Jun 18, 2019Updated Sep 12, 2019

问题描述

local 侧监听 127.0.0.1:8123

2019/06/18 09:43:27 available remote server x.xx.xx.xx:8388
2019/06/18 09:43:27 starting local socks5 server at 127.0.0.1:8123 ...

通过 proxy 进行 go get 代码下载,报 “net/http: TLS handshake timeout”

$go get -v -u golang.org/x/time
Fetching https://golang.org/x/time?go-get=1
https fetch failed: Get https://golang.org/x/time?go-get=1: net/http: TLS handshake timeout
package golang.org/x/time: unrecognized import path "golang.org/x/time" (https fetch: Get https://golang.org/x/time?go-get=1: net/http: TLS handshake timeout)

对应的 ss local 的 debug 日志

[DEBUG] 10:02:41 socks connect from 127.0.0.1:56044
[DEBUG] 10:02:41 connected to golang.org:443 via xx.xx.xx.xx:8388
[DEBUG] 10:02:51 closed connection to golang.org:443

通过 curl 进行 fq 确认

$curl cip.cc
IP      : 198.13.45.154
地址    : 日本  东京都  东京
运营商  : choopa.com

数据二  : 日本 | 东京vultr数据中心

数据三  : 日本东京都东京

URL     : http://www.cip.cc/xx.xx.xx.xx

对应的 ss local 的 debug 日志

[DEBUG] 10:03:04 socks connect from 127.0.0.1:56050
[DEBUG] 10:03:04 connected to cip.cc:80 via xx.xx.xx.xx:8388
[DEBUG] 10:03:05 closed connection to cip.cc:80

对比来看,似乎和经过 proxy 访问时所耗费的时间有一定关系;

  • 执行 go get 时,10s 后主动关闭连接
  • 执行 curl 时,1s 后主动关闭连接

版本

  • shadowsocks-local-linux64-1.2.2
  • shadowsocks-server-linux64-1.2.2

配置文件

$cat config.json
{
    "server":"xx.xx.xx.xx",
    "server_port":8388,
    "local_port":8123,
    "local_address":"127.0.0.1",
    "password":"........",
    "method": "aes-256-cfb",
    "timeout":600
}

求教,还有什么配置可以进行调整

补充

在执行 go get 时,还会报其他类型的错误

Fetching https://golang.org/x/time?go-get=1
https fetch failed: Get https://golang.org/x/time?go-get=1: unexpected EOF
package golang.org/x/time: unrecognized import path "golang.org/x/time" (https fetch: Get https://golang.org/x/time?go-get=1: unexpected EOF)
Fetching https://golang.org/x/time?go-get=1
Parsing meta tags from https://golang.org/x/time?go-get=1 (status code 200)
get "golang.org/x/time": found meta tag get.metaImport{Prefix:"golang.org/x/time", VCS:"git", RepoRo                                                                                          ot:"https://go.googlesource.com/time"} at https://golang.org/x/time?go-get=1
golang.org/x/time (download)
# cd .; git clone https://go.googlesource.com/time /go/src/golang.org/x/time
Cloning into '/go/src/golang.org/x/time'...
fatal: unable to access 'https://go.googlesource.com/time/': gnutls_handshake() failed: The TLS conn                                                                                          ection was non-properly terminated.
package golang.org/x/time: exit status 128

似乎所有错误都和网络链接断开有关

Source: shadowsocks/shadowsocks-go