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

Rename server-side GetTactics to GetTacticsPayload

Rod Hynes 1 год назад
Родитель
Сommit
6a6cbce351
3 измененных файлов с 12 добавлено и 11 удалено
  1. 7 6
      psiphon/common/inproxy/broker.go
  2. 1 1
      psiphon/common/inproxy/inproxy_test.go
  3. 4 4
      psiphon/server/meek.go

+ 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.
 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
 // and provides WebRTC signaling functionalty.
@@ -145,8 +146,8 @@ type BrokerConfig struct {
 	// APIParameterValidator is a callback that formats base API metrics.
 	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
 	// 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.
 
 	var tacticsPayload []byte
-	tacticsPayload, newTacticsTag, err = b.config.GetTactics(geoIPData, apiParams)
+	tacticsPayload, newTacticsTag, err = b.config.GetTacticsPayload(geoIPData, apiParams)
 	if err != nil {
 		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)
 		},
 
-		GetTactics: func(_ common.GeoIPData, _ common.APIParameters) ([]byte, string, error) {
+		GetTacticsPayload: func(_ common.GeoIPData, _ common.APIParameters) ([]byte, string, error) {
 			// Exercise both new and unchanged tactics
 			if prng.FlipCoin() {
 				return testNewTacticsPayload, testNewTacticsTag, nil

+ 4 - 4
psiphon/server/meek.go

@@ -357,7 +357,7 @@ func NewMeekServer(
 				APIParameterValidator:          getInproxyBrokerAPIParameterValidator(support.Config),
 				APIParameterLogFieldFormatter:  getInproxyBrokerAPIParameterLogFieldFormatter(),
 				IsValidServerEntryTag:          support.PsinetDatabase.IsValidServerEntryTag,
-				GetTactics:                     meekServer.inproxyBrokerGetTactics,
+				GetTacticsPayload:              meekServer.inproxyBrokerGetTacticsPayload,
 				PrivateKey:                     sessionPrivateKey,
 				ObfuscationRootSecret:          obfuscationRootSecret,
 				ServerEntrySignaturePublicKey:  support.Config.InproxyBrokerServerEntrySignaturePublicKey,
@@ -1887,14 +1887,14 @@ func (server *MeekServer) inproxyBrokerAllowDomainFrontedDestinations(clientGeoI
 	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.
 //
 // 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
 // handler.
-func (server *MeekServer) inproxyBrokerGetTactics(
+func (server *MeekServer) inproxyBrokerGetTacticsPayload(
 	geoIPData common.GeoIPData,
 	apiParameters common.APIParameters) ([]byte, string, error) {