Add and implement VPN preference
This patch adds a vp preference field to RTCConfig.
DEFAULT, // No VPN preference.
ONLY_USE_VPN, // only use VPN connections.
NEVER_USE_VPN, // never use VPN connections
PREFER_VPN, // use a VPN connection if possible, i.e VPN connections sorts higher than all other connections.
AVOID_VPN, // only use VPN if there is no other connections, i.e VPN connections sorts last.
Bug: webrtc:13097
Change-Id: I3f95bdfa9134e082c7d389f803bd08facfb70262
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/229591
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Jonas Oreland <jonaso@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#34842}
diff --git a/api/peer_connection_interface.h b/api/peer_connection_interface.h
index a3c420f..a9fd5e3 100644
--- a/api/peer_connection_interface.h
+++ b/api/peer_connection_interface.h
@@ -653,6 +653,14 @@
// The ping interval (ms) when the connection is stable and writable. This
// parameter overrides the default value in the ICE implementation if set.
absl::optional<int> stable_writable_connection_ping_interval_ms;
+
+ // Whether this PeerConnection will avoid VPNs (kAvoidVpn), prefer VPNs
+ // (kPreferVpn), only work over VPN (kOnlyUseVpn) or only work over non-VPN
+ // (kNeverUseVpn) interfaces. This controls which local interfaces the
+ // PeerConnection will prefer to connect over. Since VPN detection is not
+ // perfect, adherence to this preference cannot be guaranteed.
+ VpnPreference vpn_preference = VpnPreference::kDefault;
+
//
// Don't forget to update operator== if adding something.
//