mirror of
https://github.com/fatedier/frp.git
synced 2024-12-13 10:11:04 +01:00
Merge pull request #1420 from Hurricanezwf/fix-bad-xtcp-encryption
fix #1347: bad encryption and compression when use xtcp
This commit is contained in:
commit
5dc8175fc8
@ -292,18 +292,6 @@ func (sv *XtcpVisitor) handleConn(userConn frpNet.Conn) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if sv.cfg.UseEncryption {
|
|
||||||
remote, err = frpIo.WithEncryption(remote, []byte(sv.cfg.Sk))
|
|
||||||
if err != nil {
|
|
||||||
sv.Error("create encryption stream error: %v", err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if sv.cfg.UseCompression {
|
|
||||||
remote = frpIo.WithCompression(remote)
|
|
||||||
}
|
|
||||||
|
|
||||||
fmuxCfg := fmux.DefaultConfig()
|
fmuxCfg := fmux.DefaultConfig()
|
||||||
fmuxCfg.KeepAliveInterval = 5 * time.Second
|
fmuxCfg.KeepAliveInterval = 5 * time.Second
|
||||||
fmuxCfg.LogOutput = ioutil.Discard
|
fmuxCfg.LogOutput = ioutil.Discard
|
||||||
@ -319,6 +307,18 @@ func (sv *XtcpVisitor) handleConn(userConn frpNet.Conn) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
frpIo.Join(userConn, muxConn)
|
var muxConnRWCloser io.ReadWriteCloser = muxConn
|
||||||
|
if sv.cfg.UseEncryption {
|
||||||
|
muxConnRWCloser, err = frpIo.WithEncryption(muxConnRWCloser, []byte(sv.cfg.Sk))
|
||||||
|
if err != nil {
|
||||||
|
sv.Error("create encryption stream error: %v", err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if sv.cfg.UseCompression {
|
||||||
|
muxConnRWCloser = frpIo.WithCompression(muxConnRWCloser)
|
||||||
|
}
|
||||||
|
|
||||||
|
frpIo.Join(userConn, muxConnRWCloser)
|
||||||
sv.Debug("join connections closed")
|
sv.Debug("join connections closed")
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user