envoyproxy / envoyproxy/envoy-mobile
Cronvoy: support explicit Socket tagging for TrafficStats
- Dominant language
- Java
- Stars
- 566
- Forks
- 85
- PR merge metrics
- No merged PRs in 30d
Description
EnvoyMobile must support explicit tagging of a Socket.
Android natively supports the [TrafficStats](https://developer.android.com/reference/android/net/TrafficStats) concept. This works by default without any intervention. However, Cronet can specify the Tag and the Uid, per request. This is part of the [Cronet Request Builder](https://chromium.googlesource.com/chromium/src/+/refs/heads/main/components/cronet/android/api/src/org/chromium/net/ExperimentalUrlRequest.java#52). This ends up explicitly tagging the underlying Socket(s) of the Stream.
Tagging a Socket with a specific Tag or Uid is not trivial - the C++ Engine must invoke a Java method like this: [AndroidNetworkLibrary.tagSocket](https://chromium.googlesource.com/chromium/src/net/+/refs/heads/main/android/java/src/org/chromium/net/AndroidNetworkLibrary.java#581). And here is an example of the C++ calling this method: [net::android::tagSocket](https://chromium.googlesource.com/chromium/src/+/main/net/android/network_library.cc#180)
__Note__: Setting a tag or uid disallows sharing of sockets with requests with other tags/uids, which may adversely effect performance by prohibiting connection sharing. In other words use of multiplexed sockets (e.g. HTTP/2 and QUIC) will only be allowed if all requests have the same socket tag/uid.
Contributor guide
Assessment
This issue has not been assessed yet.