Migration: go 1.12

This commit is contained in:
Dreamacro 2019-02-27 01:02:43 +08:00
parent 815e80f720
commit d75f9ff783
6 changed files with 8 additions and 16 deletions

View file

@ -1,7 +1,7 @@
language: go language: go
sudo: false sudo: false
go: go:
- "1.11" - '1.12'
install: install:
- "go mod download" - "go mod download"
env: env:

View file

@ -36,7 +36,7 @@ go get -u -v github.com/Dreamacro/clash
Pre-built binaries are available: [release](https://github.com/Dreamacro/clash/releases) Pre-built binaries are available: [release](https://github.com/Dreamacro/clash/releases)
Requires Go >= 1.11. Requires Go >= 1.12.
## Daemon ## Daemon

View file

@ -101,8 +101,6 @@ func NewHttp(option HttpOption) *Http {
tlsConfig = &tls.Config{ tlsConfig = &tls.Config{
InsecureSkipVerify: option.SkipCertVerify, InsecureSkipVerify: option.SkipCertVerify,
ClientSessionCache: getClientSessionCache(), ClientSessionCache: getClientSessionCache(),
MinVersion: tls.VersionTLS11,
MaxVersion: tls.VersionTLS12,
ServerName: option.Server, ServerName: option.Server,
} }
} }

View file

@ -118,8 +118,6 @@ func NewSocks5(option Socks5Option) *Socks5 {
tlsConfig = &tls.Config{ tlsConfig = &tls.Config{
InsecureSkipVerify: option.SkipCertVerify, InsecureSkipVerify: option.SkipCertVerify,
ClientSessionCache: getClientSessionCache(), ClientSessionCache: getClientSessionCache(),
MinVersion: tls.VersionTLS11,
MaxVersion: tls.VersionTLS12,
ServerName: option.Server, ServerName: option.Server,
} }
} }

View file

@ -2,7 +2,6 @@ package constant
import ( import (
"os" "os"
"os/user"
P "path" P "path"
) )
@ -16,17 +15,11 @@ type path struct {
} }
func init() { func init() {
currentUser, err := user.Current() homedir, err := os.UserHomeDir()
var homedir string
if err != nil { if err != nil {
dir := os.Getenv("HOME") homedir, _ = os.Getwd()
if dir == "" {
dir, _ = os.Getwd()
}
homedir = dir
} else {
homedir = currentUser.HomeDir
} }
homedir = P.Join(homedir, ".config", Name) homedir = P.Join(homedir, ".config", Name)
Path = &path{homedir: homedir} Path = &path{homedir: homedir}
} }

View file

@ -24,6 +24,9 @@ func init() {
} }
func main() { func main() {
// enable tls 1.3 and remove when go 1.13
os.Setenv("GODEBUG", os.Getenv("GODEBUG")+",tls13=1")
if homedir != "" { if homedir != "" {
if !filepath.IsAbs(homedir) { if !filepath.IsAbs(homedir) {
currentDir, _ := os.Getwd() currentDir, _ := os.Getwd()