mirror of
https://github.com/XTLS/Xray-core.git
synced 2024-11-22 08:31:28 +00:00
Fix SockOpt does not work in UDP
This commit is contained in:
parent
3a99520370
commit
303beff5dd
|
@ -66,6 +66,18 @@ func (d *DefaultSystemDialer) Dial(ctx context.Context, src net.Address, dest ne
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
if sockopt != nil || len(d.controllers) > 0 {
|
||||||
|
file, err := packetConn.(*net.UDPConn).File()
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
fd := file.Fd()
|
||||||
|
if sockopt != nil {
|
||||||
|
if err := applyOutboundSocketOptions("udp", dest.NetAddr(), fd, sockopt); err != nil {
|
||||||
|
newError("failed to apply socket options").Base(err).WriteToLog(session.ExportIDToError(ctx))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
return &PacketConnWrapper{
|
return &PacketConnWrapper{
|
||||||
Conn: packetConn,
|
Conn: packetConn,
|
||||||
Dest: destAddr,
|
Dest: destAddr,
|
||||||
|
|
Loading…
Reference in a new issue