cache: add dns cache in udp packet sender

reduce the cost of re-resolving DNS for each packet received and prevent the target IP from jumping between multiple resolution results
This commit is contained in:
wwqgtxx
2024-09-26 22:21:59 +08:00
parent 4fa15c6334
commit 43cb48231a
3 changed files with 31 additions and 18 deletions

View File

@@ -298,7 +298,11 @@ type PacketSender interface {
// Send will send PacketAdapter nonblocking
// the implement must call UDPPacket.Drop() inside Send
Send(PacketAdapter)
// Process is a blocking loop to send PacketAdapter to PacketConn and update the WriteBackProxy
Process(PacketConn, WriteBackProxy)
// ResolveUDP do a local resolve UDP dns blocking if metadata is not resolved
ResolveUDP(*Metadata) error
// Close stop the Process loop
Close()
}