Commit c82f2d90 authored by rui.zheng's avatar rui.zheng

fix multiplex

parent 7c2a5faa
...@@ -137,11 +137,6 @@ func initChain() (*gost.Chain, error) { ...@@ -137,11 +137,6 @@ func initChain() (*gost.Chain, error) {
} else { } else {
tr = gost.SSHTunnelTransporter() tr = gost.SSHTunnelTransporter()
} }
node.DialOptions = append(node.DialOptions,
gost.ChainDialOption(chain),
)
chain = gost.NewChain() // cutoff the chain for multiplex
case "quic": case "quic":
if !chain.IsEmpty() { if !chain.IsEmpty() {
return nil, errors.New("QUIC must be the first node in the proxy chain") return nil, errors.New("QUIC must be the first node in the proxy chain")
...@@ -153,22 +148,11 @@ func initChain() (*gost.Chain, error) { ...@@ -153,22 +148,11 @@ func initChain() (*gost.Chain, error) {
tr = gost.QUICTransporter(config) tr = gost.QUICTransporter(config)
case "http2": case "http2":
tr = gost.HTTP2Transporter(tlsCfg) tr = gost.HTTP2Transporter(tlsCfg)
node.DialOptions = append(node.DialOptions,
gost.ChainDialOption(chain),
)
chain = gost.NewChain() // cutoff the chain for multiplex
case "h2": case "h2":
tr = gost.H2Transporter(tlsCfg) tr = gost.H2Transporter(tlsCfg)
node.DialOptions = append(node.DialOptions,
gost.ChainDialOption(chain),
)
chain = gost.NewChain() // cutoff the chain for multiplex
case "h2c": case "h2c":
tr = gost.H2CTransporter() tr = gost.H2CTransporter()
node.DialOptions = append(node.DialOptions,
gost.ChainDialOption(chain),
)
chain = gost.NewChain() // cutoff the chain for multiplex
case "obfs4": case "obfs4":
if err := gost.Obfs4Init(node, false); err != nil { if err := gost.Obfs4Init(node, false); err != nil {
return nil, err return nil, err
...@@ -180,6 +164,13 @@ func initChain() (*gost.Chain, error) { ...@@ -180,6 +164,13 @@ func initChain() (*gost.Chain, error) {
tr = gost.TCPTransporter() 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 var connector gost.Connector
switch node.Protocol { switch node.Protocol {
case "http2": case "http2":
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment