mirror of
https://github.com/p4gefau1t/trojan-go.git
synced 2024-04-21 12:21:34 +00:00
Merge pull request #52 from peter-tank/dev
fix: server side `double_tls`
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
|
||||
@@ -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
@@ -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")
|
||||
|
||||
Reference in New Issue
Block a user