فهرست منبع

Inproxy: add client-side check for at least one compartment ID

- Broker already checks; this saves a round trip
Rod Hynes 1 سال پیش
والد
کامیت
675bc6c6d6
1فایلهای تغییر یافته به همراه5 افزوده شده و 1 حذف شده
  1. 5 1
      psiphon/inproxy.go

+ 5 - 1
psiphon/inproxy.go

@@ -241,12 +241,16 @@ func NewInproxyBrokerClientInstance(
 	p := config.GetParameters().Get()
 	defer p.Close()
 
-	// Select common or personal compartment IDs.
+	// Select common or personal compartment IDs. Clients must provide at
+	// least on compartment ID.
 
 	commonCompartmentIDs, personalCompartmentIDs, err := prepareCompartmentIDs(config, p, isProxy)
 	if err != nil {
 		return nil, errors.Trace(err)
 	}
+	if !isProxy && len(commonCompartmentIDs) == 0 && len(personalCompartmentIDs) == 0 {
+		return nil, errors.TraceNew("no compartment IDs")
+	}
 
 	// Select the broker to use, optionally favoring brokers with replay data.
 	// In the InproxyBrokerSpecs calls, the first non-empty tactics parameter