diff --git a/udp.go b/udp.go index f5fe64b..02dbfda 100644 --- a/udp.go +++ b/udp.go @@ -47,7 +47,13 @@ func (s *UDPConn) WriteTo(b []byte, addr net.Addr) (int, error) { atyp, host, port := socksAddr.Socks() datagram := NewDatagram(atyp, host, port, b) - return s.PacketConn.WriteTo(datagram.Bytes(), s.ServerAddr) + + n, err := s.PacketConn.WriteTo(datagram.Bytes(), s.ServerAddr) + if n < 10 { + n = 10 + } + + return n - 10, err } func (s *UDPConn) Write(b []byte) (int, error) {