Fix connecting to quic outbound with domain address

This commit is contained in:
yuhan6665 2023-12-24 21:07:56 -05:00
parent b0bf0d7fd5
commit eacdda3c93

View file

@ -208,12 +208,21 @@ func Dial(ctx context.Context, dest net.Destination, streamSettings *internet.Me
IP: dest.Address.IP(), IP: dest.Address.IP(),
Port: int(dest.Port), Port: int(dest.Port),
} }
} else { } else {
addr, err := net.ResolveUDPAddr("udp", dest.NetAddr()) dialerIp := internet.DestIpAddress()
if err != nil { if dialerIp != nil {
return nil, err destAddr = &net.UDPAddr{
IP: dialerIp,
Port: int(dest.Port),
}
newError("quic Dial use dialer dest addr: ", destAddr).WriteToLog()
} else {
addr, err := net.ResolveUDPAddr("udp", dest.NetAddr())
if err != nil {
return nil, err
}
destAddr = addr
} }
destAddr = addr
} }
config := streamSettings.ProtocolSettings.(*Config) config := streamSettings.ProtocolSettings.(*Config)