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}
This commit is contained in:
committed by
Commit Bot
parent
fe79b34c11
commit
833979f7b8
@ -79,12 +79,17 @@ enum IceCandidatePairType {
|
||||
kIceCandidatePairPrflxSrflx,
|
||||
kIceCandidatePairPrflxRelay,
|
||||
|
||||
// The following 4 types tell whether local and remote hosts have private or
|
||||
// public IP addresses.
|
||||
// The following 9 types tell whether local and remote hosts have hostname,
|
||||
// private or public IP addresses.
|
||||
kIceCandidatePairHostPrivateHostPrivate,
|
||||
kIceCandidatePairHostPrivateHostPublic,
|
||||
kIceCandidatePairHostPublicHostPrivate,
|
||||
kIceCandidatePairHostPublicHostPublic,
|
||||
kIceCandidatePairHostNameHostName,
|
||||
kIceCandidatePairHostNameHostPrivate,
|
||||
kIceCandidatePairHostNameHostPublic,
|
||||
kIceCandidatePairHostPrivateHostName,
|
||||
kIceCandidatePairHostPublicHostName,
|
||||
kIceCandidatePairMax
|
||||
};
|
||||
|
||||
|
||||
@ -277,16 +277,32 @@ IceCandidatePairType GetIceCandidatePairCounter(
|
||||
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;
|
||||
|
||||
@ -3674,6 +3674,10 @@ TEST_P(PeerConnectionIntegrationTest,
|
||||
caller()->ice_connection_state(), kDefaultTimeout);
|
||||
EXPECT_EQ_WAIT(webrtc::PeerConnectionInterface::kIceConnectionConnected,
|
||||
callee()->ice_connection_state(), kDefaultTimeout);
|
||||
|
||||
EXPECT_EQ(1, webrtc::metrics::NumEvents(
|
||||
"WebRTC.PeerConnection.CandidatePairType_UDP",
|
||||
webrtc::kIceCandidatePairHostNameHostName));
|
||||
}
|
||||
|
||||
// Test that firewalling the ICE connection causes the clients to identify the
|
||||
|
||||
Reference in New Issue
Block a user