Adding metrics for hostname candidate use.
These metrics by themselves won't be as useful, unless they can be correlated to the use of the
feature 'WebRtcHideLocalIpsWithMdns'. This can be done by running a finch experiment where we turn
the feature on for a % of users, we can then compare these metrics for users with and without
the feature turned on.
A complementary change is required in Chrome:
tools/metrics/histograms/enums.xml
Bug: webrtc:9605 webrtc:10091 chromium:914452
Change-Id: Ibc6d16dec95a8e3943ce40063c02903769fe1cb4
Reviewed-on: https://webrtc-review.googlesource.com/c/113321
Commit-Queue: Jeroen de Borst <jeroendb@webrtc.org>
Reviewed-by: Steve Anton <steveanton@webrtc.org>
Reviewed-by: Seth Hampson <shampson@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#26003}
diff --git a/pc/peerconnection.cc b/pc/peerconnection.cc
index c9f2302..6c92816 100644
--- a/pc/peerconnection.cc
+++ b/pc/peerconnection.cc
@@ -277,16 +277,32 @@
const auto& relay = RELAY_PORT_TYPE;
const auto& prflx = PRFLX_PORT_TYPE;
if (l == host && r == host) {
+ bool local_hostname =
+ !local.address().hostname().empty() && local.address().IsUnresolvedIP();
+ bool remote_hostname = !remote.address().hostname().empty() &&
+ remote.address().IsUnresolvedIP();
bool local_private = IPIsPrivate(local.address().ipaddr());
bool remote_private = IPIsPrivate(remote.address().ipaddr());
- if (local_private) {
- if (remote_private) {
+ if (local_hostname) {
+ if (remote_hostname) {
+ return kIceCandidatePairHostNameHostName;
+ } else if (remote_private) {
+ return kIceCandidatePairHostNameHostPrivate;
+ } else {
+ return kIceCandidatePairHostNameHostPublic;
+ }
+ } else if (local_private) {
+ if (remote_hostname) {
+ return kIceCandidatePairHostPrivateHostName;
+ } else if (remote_private) {
return kIceCandidatePairHostPrivateHostPrivate;
} else {
return kIceCandidatePairHostPrivateHostPublic;
}
} else {
- if (remote_private) {
+ if (remote_hostname) {
+ return kIceCandidatePairHostPublicHostName;
+ } else if (remote_private) {
return kIceCandidatePairHostPublicHostPrivate;
} else {
return kIceCandidatePairHostPublicHostPublic;