Skip to content

Commit

Permalink
*: enable tls
Browse files Browse the repository at this point in the history
  • Loading branch information
nange committed Feb 25, 2020
1 parent 51ab713 commit 28bfc35
Show file tree
Hide file tree
Showing 5 changed files with 358 additions and 28 deletions.
5 changes: 3 additions & 2 deletions cmd/remote-server/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ func main() {
flag.BoolVar(&printVer, "version", false, "print version")
flag.StringVar(&configFile, "c", "config.json", "specify config file")
flag.StringVar(&cmdConfig.Password, "k", "", "password")
flag.StringVar(&cmdConfig.Server, "s", "", "server address")
flag.IntVar(&cmdConfig.ServerPort, "p", 0, "server port")
flag.IntVar(&cmdConfig.Timeout, "t", 300, "timeout in seconds")
flag.StringVar(&cmdConfig.Method, "m", "", "encryption method, default: aes-256-gcm")
Expand Down Expand Up @@ -60,8 +61,8 @@ func main() {
if err != nil {
log.Fatalf("init Easyss err:%+v", err)
}
if config.ServerPort == 0 || config.Password == "" {
log.Fatalln("server port and password should not empty")
if config.ServerPort == 0 || config.Password == "" || config.Server == "" {
log.Fatalln("server, port and password should not empty")
}

ss.Remote()
Expand Down
3 changes: 2 additions & 1 deletion easyss.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package easyss

import (
"crypto/tls"
"fmt"
"io"
"net"
Expand Down Expand Up @@ -57,7 +58,7 @@ func (ss *Easyss) GetLogFileFullPathName() string {

func (ss *Easyss) InitTcpPool() error {
factory := func() (net.Conn, error) {
return net.Dial("tcp", fmt.Sprintf("%s:%d", ss.config.Server, ss.config.ServerPort))
return tls.Dial("tcp", fmt.Sprintf("%s:%d", ss.config.Server, ss.config.ServerPort), nil)
}
pconfig := &easypool.PoolConfig{
InitialCap: 5,
Expand Down
13 changes: 3 additions & 10 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,16 @@ require (
github.com/jonboulle/clockwork v0.1.0 // indirect
github.com/lestrrat-go/file-rotatelogs v2.2.0+incompatible
github.com/lestrrat-go/strftime v0.0.0-20190725011945-5c849dd2c51d // indirect
github.com/mholt/certmagic v0.9.3
github.com/nange/easypool v0.0.0-20171214144419-9a3141943d02
github.com/nange/httpproxy v0.0.0-20180805034305-ff2c9c785a5d
github.com/onsi/ginkgo v1.10.2 // indirect
github.com/onsi/gomega v1.7.0 // indirect
github.com/patrickmn/go-cache v2.1.0+incompatible
github.com/pkg/errors v0.8.1
github.com/rakyll/statik v0.1.1
github.com/shurcooL/sanitized_anchor_name v1.0.0 // indirect
github.com/sirupsen/logrus v1.0.3
github.com/stretchr/testify v1.4.0 // indirect
github.com/sirupsen/logrus v1.4.2
github.com/tebeka/strftime v0.1.3 // indirect
github.com/txthinking/socks5 v0.0.0-20190404052647-254e122c4eaf
github.com/txthinking/x v0.0.0-20190708114625-99b19c1440b6 // indirect
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2
golang.org/x/net v0.0.0-20190311183353-d8887717615a // indirect
golang.org/x/sync v0.0.0-20190423024810-112230192c58 // indirect
gopkg.in/airbrake/gobrake.v2 v2.0.9 // indirect
gopkg.in/gemnasium/logrus-airbrake-hook.v2 v2.1.2 // indirect
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550
gopkg.in/russross/blackfriday.v2 v2.0.0 // indirect
)
Loading

0 comments on commit 28bfc35

Please sign in to comment.