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

@ -11,6 +11,7 @@
#ifndef RTC_BASE_ASYNC_RESOLVER_INTERFACE_H_
#define RTC_BASE_ASYNC_RESOLVER_INTERFACE_H_
#include "rtc_base/checks.h"
#include "rtc_base/socket_address.h"
#include "rtc_base/system/rtc_export.h"
#include "rtc_base/third_party/sigslot/sigslot.h"
@ -25,6 +26,12 @@ class RTC_EXPORT AsyncResolverInterface {
// Start address resolution of the hostname in `addr`.
virtual void Start(const SocketAddress& addr) = 0;
// Start address resolution of the hostname in `addr` matching `family`.
virtual void Start(const SocketAddress& addr, int family) {
// TODO(webrtc:14319) make pure virtual when all subclasses have been
// updated.
RTC_DCHECK_NOTREACHED();
}
// Returns true iff the address from `Start` was successfully resolved.
// If the address was successfully resolved, sets `addr` to a copy of the
// address from `Start` with the IP address set to the top most resolved