Add headroom interface

This commit is contained in:
世界 2022-07-30 17:34:28 +08:00
parent 91d2780bfc
commit a91eacdd01
No known key found for this signature in database
GPG key ID: CD109927C34A63C4
8 changed files with 65 additions and 3 deletions

View file

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

View file

@ -280,6 +280,10 @@ 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 {
return w.keySaltLength + M.MaxSocksaddrLength
}
func (w *serverPacketWriter) Upstream() any {
return w.source
}