Update headroom usage

This commit is contained in:
世界 2022-08-11 21:58:26 +08:00
parent a91eacdd01
commit 7e47fd1a99
No known key found for this signature in database
GPG key ID: CD109927C34A63C4
8 changed files with 45 additions and 13 deletions

View file

@ -310,10 +310,22 @@ func (c *clientPacketConn) WriteTo(p []byte, addr net.Addr) (n int, err error) {
return len(p), nil
}
func (c *clientPacketConn) Headroom() int {
func (c *clientPacketConn) FrontHeadroom() int {
return c.keySaltLength + M.MaxSocksaddrLength
}
func (c *clientPacketConn) RearHeadroom() int {
return Overhead
}
func (c *clientPacketConn) ReaderMTU() int {
return MaxPacketSize
}
func (c *clientPacketConn) WriterMTU() int {
return MaxPacketSize
}
func (c *clientPacketConn) Upstream() any {
return c.Conn
}

View file

@ -208,6 +208,10 @@ func (c *serverConn) Upstream() any {
return c.Conn
}
func (s *Service) ReaderMTU() int {
return MaxPacketSize
}
func (s *Service) WriteIsThreadUnsafe() {
}
@ -280,10 +284,18 @@ func (w *serverPacketWriter) WritePacket(buffer *buf.Buffer, destination M.Socks
return w.source.WritePacket(buffer, M.SocksaddrFromNet(w.nat.LocalAddr()))
}
func (w *serverPacketWriter) Headroom() int {
func (w *serverPacketWriter) FrontHeadroom() int {
return w.keySaltLength + M.MaxSocksaddrLength
}
func (w *serverPacketWriter) RearHeadroom() int {
return Overhead
}
func (w *serverPacketWriter) WriterMTU() int {
return MaxPacketSize
}
func (w *serverPacketWriter) Upstream() any {
return w.source
}