Support DNS resolution matching a specified IP family.

The input SocketAddress for STUN host lookup is constructed with just
the hostname, so the family is AF_UNSPEC. So added an overload with a
target family to distinguish this from the family of the input addr.

Bug: webrtc:14319, webrtc:14131
Change-Id: Ia5ac5aa2e894e0c4dfb4417e3e8a76a6cec3ea71
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/270624
Reviewed-by: Tomas Gunnarsson <tommi@webrtc.org>
Commit-Queue: Sameer Vijaykar <samvi@google.com>
Reviewed-by: Jonas Oreland <jonaso@webrtc.org>
Reviewed-by: Jonas Oreland <jonaso@google.com>
Cr-Commit-Position: refs/heads/main@{#37750}
This commit is contained in:
Sameer Vijaykar
2022-08-11 11:52:57 +02:00
committed by WebRTC LUCI CQ
parent 12053ec64a
commit b787e26369
11 changed files with 73 additions and 8 deletions

View File

@ -34,6 +34,10 @@ class MockAsyncDnsResolver : public AsyncDnsResolverInterface {
Start,
(const rtc::SocketAddress&, std::function<void()>),
(override));
MOCK_METHOD(void,
Start,
(const rtc::SocketAddress&, int family, std::function<void()>),
(override));
MOCK_METHOD(AsyncDnsResolverResult&, result, (), (const, override));
};
@ -43,6 +47,10 @@ class MockAsyncDnsResolverFactory : public AsyncDnsResolverFactoryInterface {
CreateAndResolve,
(const rtc::SocketAddress&, std::function<void()>),
(override));
MOCK_METHOD(std::unique_ptr<webrtc::AsyncDnsResolverInterface>,
CreateAndResolve,
(const rtc::SocketAddress&, int, std::function<void()>),
(override));
MOCK_METHOD(std::unique_ptr<webrtc::AsyncDnsResolverInterface>,
Create,
(),