Pull request: all: upd dnsproxy

Squashed commit of the following:

commit 65525439e8f8868d4bc2b444bad9e96f702dadda
Merge: a6c507977 2965d1fb6
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date:   Fri Dec 1 10:02:29 2023 +0200

    Merge remote-tracking branch 'origin/master' into upd-dnsproxy

commit a6c507977968c15ec024a36adfdbc1323505a574
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date:   Thu Nov 30 14:55:15 2023 +0200

    dnsforward: imp code

commit 5bd6805d54ec5908682481cd942dd1f088e576ff
Merge: 094a9c9b0 0e4e243e8
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date:   Thu Nov 30 10:56:58 2023 +0200

    Merge remote-tracking branch 'origin/master' into upd-dnsproxy

commit 094a9c9b091182dadcfcc3a7ef312c1032ac42df
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date:   Thu Nov 30 10:54:39 2023 +0200

    all: upd dnsproxy
This commit is contained in:
Dimitry Kolyshev
2023-12-01 11:12:03 +03:00
parent 2965d1fb6b
commit 75cb9d412a
5 changed files with 39 additions and 22 deletions

View File

@@ -540,11 +540,13 @@ type safeSearchResolver struct{}
var _ filtering.Resolver = safeSearchResolver{}
// LookupIP implements [filtering.Resolver] interface for safeSearchResolver.
// It returns the slice of net.IP with IPv4 and IPv6 instances.
//
// TODO(a.garipov): Support network.
func (r safeSearchResolver) LookupIP(_ context.Context, _, host string) (ips []net.IP, err error) {
addrs, err := Context.dnsServer.Resolve(host)
// It returns the slice of net.Addr with IPv4 and IPv6 instances.
func (r safeSearchResolver) LookupIP(
ctx context.Context,
network string,
host string,
) (ips []net.IP, err error) {
addrs, err := Context.dnsServer.Resolve(ctx, network, host)
if err != nil {
return nil, err
}
@@ -554,7 +556,7 @@ func (r safeSearchResolver) LookupIP(_ context.Context, _, host string) (ips []n
}
for _, a := range addrs {
ips = append(ips, a.IP)
ips = append(ips, a.AsSlice())
}
return ips, nil