Chore: udp resolve ip on local

This commit is contained in:
Dreamacro 2020-01-31 19:26:33 +08:00
parent b0f9c6afa8
commit 72c0af9739

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)