Просмотр исходного кода

Add server_tunnel.inproxy_proxy_is_priority

Rod Hynes 11 месяцев назад
Родитель
Сommit
4d3d6d64d1

+ 2 - 0
psiphon/common/inproxy/api.go

@@ -507,6 +507,7 @@ type BrokerServerReport struct {
 	ClientIP                    string           `cbor:"9,keyasint,omitempty"`
 	ProxyIP                     string           `cbor:"10,keyasint,omitempty"`
 	ProxyMetrics                *ProxyMetrics    `cbor:"11,keyasint,omitempty"`
+	ProxyIsPriority             bool             `cbor:"12,keyasint,omitempty"`
 
 	// These legacy fields are now sent in ProxyMetrics.
 	ProxyNATType          NATType          `cbor:"5,keyasint,omitempty"`
@@ -1000,6 +1001,7 @@ func (report *BrokerServerReport) ValidateAndGetLogFields(
 	logFields["inproxy_matched_personal_compartments"] = report.MatchedPersonalCompartments
 	logFields["inproxy_client_nat_type"] = report.ClientNATType
 	logFields["inproxy_client_port_mapping_types"] = report.ClientPortMappingTypes
+	logFields["inproxy_proxy_is_priority"] = report.ProxyIsPriority
 
 	// TODO:
 	// - log IPv4 vs. IPv6 information

+ 2 - 1
psiphon/common/inproxy/broker.go

@@ -1174,8 +1174,9 @@ func (b *Broker) handleClientOffer(
 			ClientPortMappingTypes:      clientMatchOffer.Properties.PortMappingTypes,
 			ClientIP:                    clientIP,
 			ProxyIP:                     proxyAnswer.ProxyIP,
-			ProxyMetrics:                proxyMatchAnnouncement.ProxyMetrics,
 			// ProxyMetrics includes proxy NAT and port mapping types.
+			ProxyMetrics:    proxyMatchAnnouncement.ProxyMetrics,
+			ProxyIsPriority: proxyMatchAnnouncement.Properties.IsPriority,
 		})
 	if err != nil {
 		return nil, errors.Trace(err)

+ 1 - 0
psiphon/server/server_test.go

@@ -2647,6 +2647,7 @@ func checkExpectedServerTunnelLogFields(
 			"inproxy_proxy_limit_downstream_bytes_per_second",
 			"inproxy_proxy_peak_upstream_bytes_per_second",
 			"inproxy_proxy_peak_downstream_bytes_per_second",
+			"inproxy_proxy_is_priority",
 
 			// These ProxyMetrics fields are not populated in this test:
 			// "inproxy_proxy_client_build_rev",