From c82f2d904d636f1270eae30653ff92a99bcdae6f Mon Sep 17 00:00:00 2001 From: "rui.zheng" Date: Thu, 2 Nov 2017 13:24:01 +0800 Subject: [PATCH] fix multiplex --- cmd/gost/main.go | 25 ++++++++----------------- 1 file changed, 8 insertions(+), 17 deletions(-) diff --git a/cmd/gost/main.go b/cmd/gost/main.go index 51db078..b8b7b20 100644 --- a/cmd/gost/main.go +++ b/cmd/gost/main.go @@ -137,11 +137,6 @@ func initChain() (*gost.Chain, error) { } else { tr = gost.SSHTunnelTransporter() } - - node.DialOptions = append(node.DialOptions, - gost.ChainDialOption(chain), - ) - chain = gost.NewChain() // cutoff the chain for multiplex case "quic": if !chain.IsEmpty() { return nil, errors.New("QUIC must be the first node in the proxy chain") @@ -153,22 +148,11 @@ func initChain() (*gost.Chain, error) { tr = gost.QUICTransporter(config) case "http2": tr = gost.HTTP2Transporter(tlsCfg) - node.DialOptions = append(node.DialOptions, - gost.ChainDialOption(chain), - ) - chain = gost.NewChain() // cutoff the chain for multiplex case "h2": tr = gost.H2Transporter(tlsCfg) - node.DialOptions = append(node.DialOptions, - gost.ChainDialOption(chain), - ) - chain = gost.NewChain() // cutoff the chain for multiplex case "h2c": tr = gost.H2CTransporter() - node.DialOptions = append(node.DialOptions, - gost.ChainDialOption(chain), - ) - chain = gost.NewChain() // cutoff the chain for multiplex + case "obfs4": if err := gost.Obfs4Init(node, false); err != nil { return nil, err @@ -180,6 +164,13 @@ func initChain() (*gost.Chain, error) { tr = gost.TCPTransporter() } + if tr.Multiplex() { + node.DialOptions = append(node.DialOptions, + gost.ChainDialOption(chain), + ) + chain = gost.NewChain() // cutoff the chain for multiplex + } + var connector gost.Connector switch node.Protocol { case "http2":