1// Copyright 2015 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5syntax = "proto2";
6
7option optimize_for = LITE_RUNTIME;
8
9package data_reduction_proxy;
10
11// The client configuration information for using the Data Saver service.
12message ClientConfig {
13  // An opaque per-session key assigned by the server which permits use of the
14  // Data Saver HTTP proxy servers.
15  optional string session_key = 1;
16  // The time at which the client should request a new configuration. The
17  // session_key is guaranteed to be valid through this time and may be valid
18  // for some time thereafter.
19  optional Timestamp DEPRECATED_refresh_time = 2 [deprecated = true];
20  // The proxy configuration the client should use to connect to the Data Saver
21  // service.
22  optional ProxyConfig proxy_config = 3;
23  // The duration after which the client should request a new configuration. The
24  // session_key is guaranteed to be valid through this time and may be valid
25  // for some time thereafter. If both refresh_duration and refresh_time are
26  // present, refresh_duration should take priority.
27  optional Duration refresh_duration = 4;
28  // Configuration information for reporting pageload metrics.
29  optional PageloadMetricsConfig pageload_metrics_config = 5;
30  // Prevents the host base and user base blacklisting behaviors for lite pages
31  // and server LoFi.
32  optional bool ignore_long_term_black_list_rules = 7;
33  // The configuration that the client should use to connect to the prefetch
34  // proxy.
35  optional PrefetchProxyConfig prefetch_proxy_config = 8;
36}
37
38// The configuration for reporting pageload metrics.
39message PageloadMetricsConfig {
40  // The fraction of pageloads for which to report pageload metrics.
41  optional float reporting_fraction = 1;
42}
43
44// N.B.:
45// The configuration service that sends the ClientConfig uses Timestamp and
46// Duration to conform to Google API standards. These proto messages should
47// live in a shared location in the Chromium tree, but for now we duplicate
48// them here.
49
50// A Timestamp represents a point in time independent of any time zone
51// or calendar, represented as seconds and fractions of seconds at
52// nanosecond resolution in UTC Epoch time.
53message Timestamp {
54  // Represents seconds of UTC time since Unix epoch
55  // 1970-01-01T00:00:00Z. Must be from from 0001-01-01T00:00:00Z to
56  // 9999-12-31T23:59:59Z inclusive.
57  optional int64 seconds = 1;
58
59  // Non-negative fractions of a second at nanosecond resolution. Negative
60  // second values with fractions must still have non-negative nanos values
61  // that count forward in time. Must be from 0 to 999,999,999
62  // inclusive.
63  optional int32 nanos = 2;
64}
65
66// A Duration represents a signed, fixed-length span of time represented
67// as a count of seconds and fractions of seconds at nanosecond
68// resolution. It is independent of any calendar and concepts like "day"
69// or "month". It is related to Timestamp in that the difference between
70// two Timestamp values is a Duration and it can be added or subtracted
71// from a Timestamp. Range is approximately +-10,000 years.
72message Duration {
73  // Signed seconds of the span of time. Must be from -315,576,000,000
74  // to +315,576,000,000 inclusive.
75  optional int64 seconds = 1;
76
77  // Signed fractions of a second at nanosecond resolution of the span
78  // of time. Durations less than one second are represented with a 0
79  // `seconds` field and a positive or negative `nanos` field. For durations
80  // of one second or more, a non-zero value for the `nanos` field must be
81  // of the same sign as the `seconds` field. Must be from -999,999,999
82  // to +999,999,999 inclusive.
83  optional int32 nanos = 2;
84}
85
86// Data Saver proxy configuration.
87message ProxyConfig {
88  // Provides proxy server information for HTTP URIs.
89  repeated ProxyServer http_proxy_servers = 1;
90}
91
92// Configuration information for a specific proxy server.
93message ProxyServer {
94  // The scheme of the proxy server.
95  enum ProxyScheme {
96    // The proxy scheme is unspecified.
97    UNSPECIFIED = 0;
98    // HTTP
99    HTTP = 1;
100    // HTTPS
101    HTTPS = 2;
102    // HTTPS over QUIC
103    DEPRECATED_QUIC = 3 [deprecated = true];
104  }
105
106  // The deployment type of the proxy server.
107  enum DeprecatedProxyType {
108    // The proxy type is unspecified.
109    UNSPECIFIED_TYPE = 0;
110    // Core Google datacenter.
111    CORE = 1;
112  }
113
114  // The scheme for the proxy server.
115  optional ProxyScheme scheme = 1;
116  // The host name for the proxy server.
117  optional string host = 2;
118  // The port number for the proxy server.
119  optional int32 port = 3;
120  // The type for the proxy server.
121  optional DeprecatedProxyType deprecated_type = 4 [deprecated = true];
122}
123
124// Information about the device the user is on.
125message ConfigDeviceInfo {
126  // Kilobytes of total device memory.
127  optional int64 total_device_memory_kb = 1;
128}
129
130// Configuration information for the prefetch proxy service.
131message PrefetchProxyConfig {
132  // Definition of the type and location of prefetch proxy to use.
133  message Proxy {
134    // The type of the proxy server.
135    enum Type {
136      // The proxy type is unspecified.
137      UNSPECIFIED_TYPE = 0;
138      // CONNECT proxy
139      CONNECT = 1;
140    }
141
142    // The scheme of the proxy.
143    enum Scheme {
144      UNSPECIFIED_SCHEME = 0;
145      HTTP = 1;
146      HTTPS = 2;
147    }
148
149    optional Type type = 1;
150
151    // Hostname and port of the prefetch proxy.
152    optional string host = 2;
153    optional int32 port = 3;
154    optional Scheme scheme = 4;
155  }
156
157  // The proxy servers that the client should connect to for the
158  // prefetch proxy service. Listed in order of preference.
159  repeated Proxy proxy_list = 1;
160}
161
162// Request object to create a client configuration object.
163message CreateClientConfigRequest {
164  // An enum representing the type of user regarding whether they are dogfooding
165  // Chrome.
166  enum DogfoodGroup {
167    // The user dogfood group is not specified.
168    UNSPECIFIED = 0;
169    // The user is not a Chrome dogfooder.
170    NONDOGFOOD = 1;
171    // The user is a Chrome dogfooder.
172    DOGFOOD = 2;
173  }
174
175  // A previous per-session key that was assigned by the service.
176  optional string session_key = 1;
177
178  // Build version information.
179  optional VersionInfo version_info = 2;
180
181  // The MCC/MNC of the telephony network operator. Represented as a string of
182  // the two numbers concatenated. E.g., "310260" for T-Mobile. Empty string if
183  // the user is not on android or if the user is on WiFi.
184  // Added in M65.
185  optional string telephony_network_operator = 3;
186
187  // The DogfoodGroup of the user.
188  // Added in M65.
189  optional DogfoodGroup dogfood_group = 4;
190
191  // Added in M65.
192  optional ConfigDeviceInfo device_info = 5;
193}
194
195// Build version information.
196message VersionInfo {
197  // The client's platform type. See
198  // components/data_reduction_proxy/core/common/data_reduction_proxy_util.h for
199  // allowed strings in CLIENT_ENUMS_LIST.
200  optional string client = 1;
201
202  // The build number, e.g. 2171
203  optional int32 build = 2;
204
205  // The patch number of the chromium client: always a non-negative integer.
206  optional int32 patch = 3;
207
208  // The production channel, e.g. "canary", "dev", "beta", "stable".
209  optional string channel = 4;
210}
211