Minor fixes

This commit is contained in:
世界 2022-07-07 21:39:44 +08:00
parent 6d16497f03
commit 6a0987c52a
No known key found for this signature in database
GPG key ID: CD109927C34A63C4
5 changed files with 20 additions and 9 deletions

View file

@ -202,7 +202,8 @@ func HandleConnection0(ctx context.Context, conn net.Conn, version byte, authent
metadata.Destination = request.Destination
return handler.NewConnection(ctx, conn, metadata)
case socks5.CommandUDPAssociate:
udpConn, err := net.ListenUDP(M.NetworkFromNetAddr("udp", M.AddrFromNetAddr(conn.LocalAddr())), net.UDPAddrFromAddrPort(netip.AddrPortFrom(M.AddrFromNetAddr(conn.LocalAddr()), 0)))
var udpConn *net.UDPConn
udpConn, err = net.ListenUDP(M.NetworkFromNetAddr("udp", M.AddrFromNetAddr(conn.LocalAddr())), net.UDPAddrFromAddrPort(netip.AddrPortFrom(M.AddrFromNetAddr(conn.LocalAddr()), 0)))
if err != nil {
return err
}
@ -224,7 +225,7 @@ func HandleConnection0(ctx context.Context, conn net.Conn, version byte, authent
close(done)
}()
err = common.Error(io.Copy(io.Discard, conn))
return E.New(innerError, err)
return E.Errors(innerError, err)
default:
err = socks5.WriteResponse(conn, socks5.Response{
ReplyCode: socks5.ReplyCodeUnsupported,