mirror of
https://github.com/cedar2025/hysteria.git
synced 2025-06-08 13:29:56 +00:00
Use correct address for packets from localRelayConn
This commit is contained in:
parent
51abb06911
commit
3b6a2bc56e
@ -327,10 +327,13 @@ func (s *Server) udpServer(clientConn *net.UDPConn, localRelayConn *net.UDPConn,
|
||||
go func() {
|
||||
buf := make([]byte, udpBufferSize)
|
||||
for {
|
||||
n, _, err := localRelayConn.ReadFrom(buf)
|
||||
n, from, err := localRelayConn.ReadFrom(buf)
|
||||
if n > 0 {
|
||||
d := socks5.NewDatagram(socks5.ATYPIPv4,
|
||||
[]byte{0x00, 0x00, 0x00, 0x00}, []byte{0x00, 0x00}, buf[:n])
|
||||
atyp, addr, port, err := socks5.ParseAddress(from.String())
|
||||
if err != nil {
|
||||
continue
|
||||
}
|
||||
d := socks5.NewDatagram(atyp, addr, port, buf[:n])
|
||||
_, _ = clientConn.WriteToUDP(d.Bytes(), clientAddr)
|
||||
}
|
||||
if err != nil {
|
||||
|
Loading…
x
Reference in New Issue
Block a user