xref: /aosp_15_r20/prebuilts/android-emulator/linux-x86_64/lib/ice_config.proto (revision d870e0501505f2fc9999364ffe386a6b6151adc1)
1syntax = "proto3";
2
3package android.emulation.control.v2;
4
5import "google/protobuf/duration.proto";
6
7// ICE Server configuration based on the RTCIceServer type in the WebRTC W3C
8// specification: https://www.w3.org/TR/webrtc/#rtciceserver-dictionary.
9message IceServerList {
10    // STUN or TURN URI(s) as defined in [rfc7064] and [rfc7065] or other URI
11    // types.
12    repeated string urls = 1;
13
14    // If this IceServer object represents a TURN server, then this attribute
15    // specifies the credential to use with that TURN server.
16    string username = 2;
17
18    // If this IceServer object represents a TURN server, then this attribute
19    // specifies the credential to use with that TURN server.
20    string credential = 3;
21
22    // The TLS certificate policy to use for TLS urls.
23    TlsCertPolicy.Value tls_cert_policy = 4;
24
25    // If the URIs in urls only contain IP addresses, this field can be used to
26    // indicate the hostname. If specified, it should be used for TLS SNI and
27    // certificate validation for any applicable URLs. For urls that themselves
28    // contains the hostname, this can be ignored.
29    string hostname = 5;
30
31    // List of protocols to be used in the TLS ALPN extension.
32    repeated string tls_alpn_protocols = 6;
33
34    // List of elliptic curves to be used in the TLS elliptic curves extension.
35    // Only curves supported by OpenSSL should be used (e.g. "P-256", "X25519").
36    repeated string tls_elliptic_curves = 7;
37
38    // Setting for STUN alternative magic cookie.
39    StunAltMagicSetting.Type stun_alt_magic = 9;
40
41    // Maximum rate in kilobits per second (kilo = 1000).
42    // Can be used as hint to the bandwidth estimator to improve media quality.
43    // If less than or equal to zero, the maximum send rate is not specified.
44    int64 max_rate_kbps = 10;
45
46    reserved 8;
47}
48
49// ICE server configuration.
50// Each configuration is ephemeral and should not be shared across WebRTC
51// peer connections or cached for later use.
52message IceServerConfig {
53    // Duration the config is valid for.
54    google.protobuf.Duration lifetime_duration = 1;
55
56    // ICE servers to be used by the client to establish a connection.
57    // E.g.:
58    // [ { "urls": "stun:stun1.example.net" }, { "urls":
59    // "turn:turn.example.org", "username": "user", "credential": "myPassword" }
60    // ]
61    repeated IceServerList ice_servers = 2;
62
63    // Corresponds to: https://www.w3.org/TR/webrtc/#rtcicetransportpolicy-enum
64    // The recommended ICE transport policy to use in the RTC configuration.
65    string ice_transport_policy = 6;
66
67    // Possible detected network provider interference with ice_servers
68    // connectivity. This is an estimation which might be inaccurate.
69    BlockStatus.Value block_status = 3;
70
71    // Extra ice servers that can be present when block_status indicates
72    // POSSIBLY_BLOCKED and which might be able to provide better connectivity
73    // than ice_servers in that scenario. However the network quality is likely
74    // to be strictly worse. Applications are recommended to use these servers
75    // instead of ice_servers to be robust against blocking. However these ice
76    // servers also currently requires applications to disable TLS validation.
77    // This is because TURNS is used for obfuscation instead of security, and no
78    // valid certificate is returned since valid certificates can be blocked.
79    repeated IceServerList unblock_ice_servers = 4;
80
81    // Extra optional configuration for unblocking purposes.
82    UnblockConfig unblock_config = 7;
83
84    reserved 5, 8;
85}
86
87// Extra unblocking configuration.
88message UnblockConfig {
89    // Minimum length to pad STUN messages.
90    int32 min_pad_length = 1;
91    // Maximum length to pad STUN messages.
92    int32 max_pad_length = 2;
93    // The minimum payload size of channel data. Smaller messages should be sent
94    // as TURN send indications. Since channel data messages are not easily
95    // padded it is useful to avoid sending some smaller messages as channel
96    // data.
97    int32 min_channel_data_payload_size = 3;
98    // Pad ICE STUN ping requests and responses.
99    bool pad_ice_stun_ping = 4;
100    // Enable padding.
101    bool enable_padding = 5;
102}
103
104// Reported connectivity of client network
105message BlockStatus {
106    enum Value {
107        // Connectivity status is unspecified.
108        STATUS_UNSPECIFIED = 0;
109        // Connectivity to ICE servers is unimpaired.
110        NOT_BLOCKED = 1;
111        // Connectivity to ICE servers is possibly blocked.
112        POSSIBLY_BLOCKED = 2;
113    }
114}
115
116// TLS certificate policy.
117message TlsCertPolicy {
118    enum Value {
119        // For TLS based protocols, ensure the connection is secure by not
120        // circumventing certificate validation. This is the default and should
121        // be used when unspecified.
122        DEFAULT_SECURE = 0;
123        // For TLS based protocols, disregard security completely by skipping
124        // certificate validation. This is insecure and should never be used
125        // unless security is irrelevant in that particular context.
126        INSECURE_NO_CHECK = 1;
127    }
128}
129
130// Setting for StunAltMagic.
131message StunAltMagicSetting {
132    enum Type {
133        // Use default.
134        DEFAULT = 0;
135        // Use normal stun magic.
136        DISABLED = 1;
137        // Use stun alt magic.
138        ENABLED = 2;
139    }
140}
141