Chore: udp resolve ip on local

This commit is contained in:
gVisor bot 2020-01-31 19:26:33 +08:00
parent 623b13a1d0
commit ea8ec7993f

View file

@ -175,6 +175,15 @@ func (t *Tunnel) handleUDPConn(packet *inbound.PacketAdapter) {
return return
} }
if metadata.DstIP == nil {
ip, err := t.resolveIP(metadata.Host)
if err != nil {
log.Warnln("[UDP] Resolve %s failed: %s, %#v", metadata.Host, err.Error(), metadata)
return
}
metadata.DstIP = ip
}
key := packet.LocalAddr().String() key := packet.LocalAddr().String()
pc := t.natTable.Get(key) pc := t.natTable.Get(key)