Skip to content
This repository has been archived by the owner on Aug 27, 2020. It is now read-only.

Commit

Permalink
server tls
Browse files Browse the repository at this point in the history
  • Loading branch information
lzjluzijie committed Jul 15, 2018
1 parent fbd76b8 commit e61b1f2
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 4 deletions.
18 changes: 18 additions & 0 deletions server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import (
"net/http/httputil"
"net/url"

"crypto/tls"

"github.com/gin-gonic/gin"
"github.com/gorilla/websocket"
"github.com/juju/loggo"
Expand Down Expand Up @@ -113,5 +115,21 @@ func (server *WebSocksServer) Run() (err error) {
}
return
}

s.TLSConfig = &tls.Config{
CipherSuites: []uint16{
tls.TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305,
tls.TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305,
tls.TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,
tls.TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,
tls.TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,
tls.TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,
},
}

err = s.ListenAndServeTLS(server.Config.CertPath, server.Config.KeyPath)
if err != nil {
return err
}
return
}
8 changes: 4 additions & 4 deletions websocks.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,9 @@ func main() {
},
},
{
Name: "server",
//Aliases: []string{"s"},
Usage: "start websocks server",
Name: "server",
Aliases: []string{"s"},
Usage: "start websocks server",
Flags: []cli.Flag{
cli.StringFlag{
Name: "l",
Expand Down Expand Up @@ -213,7 +213,7 @@ func main() {
},
{
Name: "webserver",
Aliases: []string{"s"},
Aliases: []string{"w"},
Usage: "web ui server",
Action: func(c *cli.Context) (err error) {
app := &server.App{}
Expand Down

0 comments on commit e61b1f2

Please sign in to comment.