Fix WriteTo length

This commit is contained in:
Anton Zadvorny 2021-07-10 11:32:55 +03:00
parent 786f71c7f7
commit 17ecf10f79

8
udp.go
View File

@ -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) {