feat: reduce obfs gc overhead by reusing buffers

This commit is contained in:
Toby
2021-12-23 17:25:11 -08:00
parent 8bd5573c93
commit 9e5483c11b
6 changed files with 83 additions and 80 deletions

View File

@@ -53,10 +53,7 @@ func NewServer(addr string, protocol string, tlsConfig *tls.Config, quicConfig *
return nil, err
}
if obfuscator != nil {
pktConn = &obfsUDPConn{
Orig: udpConn,
Obfuscator: obfuscator,
}
pktConn = newObfsUDPConn(udpConn, obfuscator)
} else {
pktConn = udpConn
}
@@ -66,10 +63,7 @@ func NewServer(addr string, protocol string, tlsConfig *tls.Config, quicConfig *
return nil, err
}
if obfuscator != nil {
pktConn = &obfsPacketConn{
Orig: ftcpConn,
Obfuscator: obfuscator,
}
pktConn = newObfsPacketConn(ftcpConn, obfuscator)
} else {
pktConn = ftcpConn
}