Browse Source

Rename server-side GetTactics to GetTacticsPayload

Rod Hynes 1 year ago
parent
commit
6a6cbce351

+ 7 - 6
psiphon/common/inproxy/broker.go

@@ -62,9 +62,10 @@ type LookupGeoIP func(IP string) common.GeoIPData
 // timeouts including long-polling for proxy announcements.
 // timeouts including long-polling for proxy announcements.
 type ExtendTransportTimeout func(timeout time.Duration)
 type ExtendTransportTimeout func(timeout time.Duration)
 
 
-// GetTactics is a callback which returns the appropriate tactics for the
-// specified client/proxy GeoIP data and API parameters.
-type GetTactics func(common.GeoIPData, common.APIParameters) ([]byte, string, error)
+// GetTacticsPayload is a callback which returns the appropriate tactics
+// payload for the specified client/proxy GeoIP data and API parameters.
+type GetTacticsPayload func(
+	common.GeoIPData, common.APIParameters) ([]byte, string, error)
 
 
 // Broker is the in-proxy broker component, which matches clients and proxies
 // Broker is the in-proxy broker component, which matches clients and proxies
 // and provides WebRTC signaling functionalty.
 // and provides WebRTC signaling functionalty.
@@ -145,8 +146,8 @@ type BrokerConfig struct {
 	// APIParameterValidator is a callback that formats base API metrics.
 	// APIParameterValidator is a callback that formats base API metrics.
 	APIParameterLogFieldFormatter common.APIParameterLogFieldFormatter
 	APIParameterLogFieldFormatter common.APIParameterLogFieldFormatter
 
 
-	// GetTactics provides a tactics lookup service.
-	GetTactics GetTactics
+	// GetTacticsPayload provides a tactics lookup service.
+	GetTacticsPayload GetTacticsPayload
 
 
 	// IsValidServerEntryTag is a callback which checks if the specified
 	// IsValidServerEntryTag is a callback which checks if the specified
 	// server entry tag is on the list of valid and active Psiphon server
 	// server entry tag is on the list of valid and active Psiphon server
@@ -559,7 +560,7 @@ func (b *Broker) handleProxyAnnounce(
 	// proxy can store and apply the new tactics before announcing again.
 	// proxy can store and apply the new tactics before announcing again.
 
 
 	var tacticsPayload []byte
 	var tacticsPayload []byte
-	tacticsPayload, newTacticsTag, err = b.config.GetTactics(geoIPData, apiParams)
+	tacticsPayload, newTacticsTag, err = b.config.GetTacticsPayload(geoIPData, apiParams)
 	if err != nil {
 	if err != nil {
 		return nil, errors.Trace(err)
 		return nil, errors.Trace(err)
 	}
 	}

+ 1 - 1
psiphon/common/inproxy/inproxy_test.go

@@ -252,7 +252,7 @@ func runTestInproxy(doMustUpgrade bool) error {
 			return common.LogFields(params)
 			return common.LogFields(params)
 		},
 		},
 
 
-		GetTactics: func(_ common.GeoIPData, _ common.APIParameters) ([]byte, string, error) {
+		GetTacticsPayload: func(_ common.GeoIPData, _ common.APIParameters) ([]byte, string, error) {
 			// Exercise both new and unchanged tactics
 			// Exercise both new and unchanged tactics
 			if prng.FlipCoin() {
 			if prng.FlipCoin() {
 				return testNewTacticsPayload, testNewTacticsTag, nil
 				return testNewTacticsPayload, testNewTacticsTag, nil

+ 4 - 4
psiphon/server/meek.go

@@ -357,7 +357,7 @@ func NewMeekServer(
 				APIParameterValidator:          getInproxyBrokerAPIParameterValidator(support.Config),
 				APIParameterValidator:          getInproxyBrokerAPIParameterValidator(support.Config),
 				APIParameterLogFieldFormatter:  getInproxyBrokerAPIParameterLogFieldFormatter(),
 				APIParameterLogFieldFormatter:  getInproxyBrokerAPIParameterLogFieldFormatter(),
 				IsValidServerEntryTag:          support.PsinetDatabase.IsValidServerEntryTag,
 				IsValidServerEntryTag:          support.PsinetDatabase.IsValidServerEntryTag,
-				GetTactics:                     meekServer.inproxyBrokerGetTactics,
+				GetTacticsPayload:              meekServer.inproxyBrokerGetTacticsPayload,
 				PrivateKey:                     sessionPrivateKey,
 				PrivateKey:                     sessionPrivateKey,
 				ObfuscationRootSecret:          obfuscationRootSecret,
 				ObfuscationRootSecret:          obfuscationRootSecret,
 				ServerEntrySignaturePublicKey:  support.Config.InproxyBrokerServerEntrySignaturePublicKey,
 				ServerEntrySignaturePublicKey:  support.Config.InproxyBrokerServerEntrySignaturePublicKey,
@@ -1887,14 +1887,14 @@ func (server *MeekServer) inproxyBrokerAllowDomainFrontedDestinations(clientGeoI
 	return server.lookupAllowTactic(clientGeoIPData, parameters.InproxyAllowDomainFrontedDestinations)
 	return server.lookupAllowTactic(clientGeoIPData, parameters.InproxyAllowDomainFrontedDestinations)
 }
 }
 
 
-// inproxyBrokerGetTactics is a callback used by the in-proxy broker to
+// inproxyBrokerGetTacticsPayload is a callback used by the in-proxy broker to
 // provide tactics to proxies.
 // provide tactics to proxies.
 //
 //
 // The proxy sends its current tactics tag in apiParameters, and, when there
 // The proxy sends its current tactics tag in apiParameters, and, when there
-// are new tactics, inproxyBrokerGetTactics returns the payload and the new
+// are new tactics, inproxyBrokerGetTacticsPayload returns the payload and the new
 // tactics tag. The broker should log new_tactics_tag in its ProxyAnnounce
 // tactics tag. The broker should log new_tactics_tag in its ProxyAnnounce
 // handler.
 // handler.
-func (server *MeekServer) inproxyBrokerGetTactics(
+func (server *MeekServer) inproxyBrokerGetTacticsPayload(
 	geoIPData common.GeoIPData,
 	geoIPData common.GeoIPData,
 	apiParameters common.APIParameters) ([]byte, string, error) {
 	apiParameters common.APIParameters) ([]byte, string, error) {