From de6d34aa277af9c8dccfb999a4b53672c0d8ba76 Mon Sep 17 00:00:00 2001 From: gVisor bot Date: Wed, 27 Feb 2019 01:02:43 +0800 Subject: [PATCH] Migration: go 1.12 --- .travis.yml | 2 +- README.md | 2 +- adapters/outbound/http.go | 2 -- adapters/outbound/socks5.go | 2 -- constant/path.go | 13 +++---------- main.go | 3 +++ 6 files changed, 8 insertions(+), 16 deletions(-) diff --git a/.travis.yml b/.travis.yml index 6fa211d4..32d4e3db 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,7 @@ language: go sudo: false go: - - "1.11" + - '1.12' install: - "go mod download" env: diff --git a/README.md b/README.md index 889e0e69..3ec9cef8 100644 --- a/README.md +++ b/README.md @@ -36,7 +36,7 @@ go get -u -v github.com/Dreamacro/clash Pre-built binaries are available: [release](https://github.com/Dreamacro/clash/releases) -Requires Go >= 1.11. +Requires Go >= 1.12. ## Daemon diff --git a/adapters/outbound/http.go b/adapters/outbound/http.go index 48568836..cf1fb748 100644 --- a/adapters/outbound/http.go +++ b/adapters/outbound/http.go @@ -101,8 +101,6 @@ func NewHttp(option HttpOption) *Http { tlsConfig = &tls.Config{ InsecureSkipVerify: option.SkipCertVerify, ClientSessionCache: getClientSessionCache(), - MinVersion: tls.VersionTLS11, - MaxVersion: tls.VersionTLS12, ServerName: option.Server, } } diff --git a/adapters/outbound/socks5.go b/adapters/outbound/socks5.go index 2b4613d6..97e883e4 100644 --- a/adapters/outbound/socks5.go +++ b/adapters/outbound/socks5.go @@ -118,8 +118,6 @@ func NewSocks5(option Socks5Option) *Socks5 { tlsConfig = &tls.Config{ InsecureSkipVerify: option.SkipCertVerify, ClientSessionCache: getClientSessionCache(), - MinVersion: tls.VersionTLS11, - MaxVersion: tls.VersionTLS12, ServerName: option.Server, } } diff --git a/constant/path.go b/constant/path.go index ad7b847d..5d08e36c 100644 --- a/constant/path.go +++ b/constant/path.go @@ -2,7 +2,6 @@ package constant import ( "os" - "os/user" P "path" ) @@ -16,17 +15,11 @@ type path struct { } func init() { - currentUser, err := user.Current() - var homedir string + homedir, err := os.UserHomeDir() if err != nil { - dir := os.Getenv("HOME") - if dir == "" { - dir, _ = os.Getwd() - } - homedir = dir - } else { - homedir = currentUser.HomeDir + homedir, _ = os.Getwd() } + homedir = P.Join(homedir, ".config", Name) Path = &path{homedir: homedir} } diff --git a/main.go b/main.go index be91250a..77330101 100644 --- a/main.go +++ b/main.go @@ -24,6 +24,9 @@ func init() { } func main() { + // enable tls 1.3 and remove when go 1.13 + os.Setenv("GODEBUG", os.Getenv("GODEBUG")+",tls13=1") + if homedir != "" { if !filepath.IsAbs(homedir) { currentDir, _ := os.Getwd()