Minimal dependencies & Fixes

This commit is contained in:
世界 2022-05-27 14:45:41 +08:00
parent 48809b0a99
commit fa7811b49c
No known key found for this signature in database
GPG key ID: CD109927C34A63C4
13 changed files with 237 additions and 191 deletions

View file

@ -319,7 +319,7 @@ func (c *clientPacketConn) ReadFrom(p []byte) (n int, addr net.Addr, err error)
if err != nil {
return
}
b := buf.With(p[:n])
b := buf.As(p[:n])
err = c.DecodePacket(b)
if err != nil {
return
@ -337,6 +337,7 @@ func (c *clientPacketConn) WriteTo(p []byte, addr net.Addr) (n int, err error) {
_buffer := buf.StackNew()
defer runtime.KeepAlive(_buffer)
buffer := common.Dup(_buffer)
buffer.WriteRandom(c.keySaltLength)
err = M.SocksaddrSerializer.WriteAddrPort(buffer, M.SocksaddrFromNet(addr))
if err != nil {
return