Merge pull request #52 from peter-tank/dev

fix: server side `double_tls`
This commit is contained in:
Page Fault
2020-05-15 15:27:39 +00:00
committed by GitHub
3 changed files with 17 additions and 5 deletions
+11
View File
@@ -331,6 +331,17 @@ func loadServerConfig(config *GlobalConfig) error {
}
config.TLS.HTTPResponse = payload
}
if config.Websocket.DoubleTLS {
if config.Websocket.TLS.CertPath == "" {
log.Warn("Empty double TLS settings, using default ssl settings")
config.Websocket.TLS = config.TLS
}
if err := loadCertAndKey(&config.Websocket.TLS); err != nil {
return err
}
}
return nil
}
+4 -4
View File
@@ -294,10 +294,10 @@ func NewInboundWebsocket(ctx context.Context, conn net.Conn, config *conf.Global
return transport, nil
}
tlsConfig := &tls.Config{
Certificates: config.TLS.KeyPair,
CipherSuites: config.TLS.CipherSuites,
PreferServerCipherSuites: config.TLS.PreferServerCipher,
SessionTicketsDisabled: !config.TLS.SessionTicket,
Certificates: config.Websocket.TLS.KeyPair,
CipherSuites: config.Websocket.TLS.CipherSuites,
PreferServerCipherSuites: config.Websocket.TLS.PreferServerCipher,
SessionTicketsDisabled: !config.Websocket.TLS.SessionTicket,
}
tlsConn := tls.Server(transport, tlsConfig)
protocol.SetRandomizedTimeout(tlsConn)
+2 -1
View File
@@ -3,6 +3,7 @@ package version
import (
"flag"
"fmt"
"runtime"
"github.com/p4gefau1t/trojan-go/common"
)
@@ -22,7 +23,7 @@ func (*versionOption) Priority() int {
func (c *versionOption) Handle() error {
if *c.arg {
fmt.Println("Trojan-Go", common.Version)
fmt.Println("Trojan-Go", common.Version, fmt.Sprintf("(%s %s/%s)", runtime.Version(), runtime.GOOS, runtime.GOARCH))
fmt.Println("Developed by PageFault (p4gefau1t)")
fmt.Println("Lisensed under GNU General Public License v3")
fmt.Println("GitHub Repository: https://github.com/p4gefau1t/trojan-go")