Răsfoiți Sursa

Check for PSIPHON_ENABLE_INPROXY in personal pairing mode

Rod Hynes 1 an în urmă
părinte
comite
8d4e2faeb6
1 a modificat fișierele cu 13 adăugiri și 0 ștergeri
  1. 13 0
      psiphon/config.go

+ 13 - 0
psiphon/config.go

@@ -39,6 +39,7 @@ import (
 
 	"github.com/Psiphon-Labs/psiphon-tunnel-core/psiphon/common"
 	"github.com/Psiphon-Labs/psiphon-tunnel-core/psiphon/common/errors"
+	"github.com/Psiphon-Labs/psiphon-tunnel-core/psiphon/common/inproxy"
 	"github.com/Psiphon-Labs/psiphon-tunnel-core/psiphon/common/parameters"
 	"github.com/Psiphon-Labs/psiphon-tunnel-core/psiphon/common/protocol"
 	"github.com/Psiphon-Labs/psiphon-tunnel-core/psiphon/common/resolver"
@@ -1411,6 +1412,18 @@ func (config *Config) Commit(migrateFromLegacyFields bool) error {
 		return errors.TraceNew("invalid overlapping personal compartment IDs")
 	}
 
+	if len(config.InproxyProxyPersonalCompartmentID) > 0 &&
+		!inproxy.Enabled() {
+
+		// When in-proxy personal pairing mode is on, fail if the build was
+		// made without the PSIPHON_ENABLE_INPROXY build tag.
+		//
+		// Note that this check could also be enforced in the case of a
+		// LimitTunnelProtocols.IsOnlyInproxyTunnelProtocols configuration,
+		// but that can be overridden by tactics so we allow it.
+		return errors.TraceNew("build does not enable required in-proxy functionality")
+	}
+
 	// This constraint is expected by logic in Controller.runTunnels().
 
 	if config.PacketTunnelTunFileDescriptor > 0 && config.TunnelPoolSize != 1 {