mirror of
https://github.com/daeuniverse/dae.git
synced 2024-12-23 01:04:40 +07:00
fix: ResolveNetip should use child context to prevent resend after func exit
This commit is contained in:
parent
55bd309b6b
commit
7f5e4f8349
@ -37,6 +37,8 @@ func SystemDns() (dns netip.AddrPort, err error) {
|
||||
}
|
||||
|
||||
func ResolveNetip(ctx context.Context, d proxy.Dialer, dns netip.AddrPort, host string, typ dnsmessage.Type) (addrs []netip.Addr, err error) {
|
||||
ctx, cancel := context.WithCancel(ctx)
|
||||
defer cancel()
|
||||
if addr, err := netip.ParseAddr(host); err == nil {
|
||||
if (addr.Is4() || addr.Is4In6()) && typ == dnsmessage.TypeA {
|
||||
return []netip.Addr{addr}, nil
|
||||
|
Loading…
Reference in New Issue
Block a user