Rod Hynes 6 лет назад
Родитель
Сommit
b181cd73dc
3 измененных файлов с 18 добавлено и 12 удалено
  1. 14 11
      psiphon/config.go
  2. 1 0
      psiphon/server/server_test.go
  3. 3 1
      psiphon/serverApi.go

+ 14 - 11
psiphon/config.go

@@ -390,10 +390,6 @@ type Config struct {
 	// is used. This value is typical overridden for testing.
 	// is used. This value is typical overridden for testing.
 	FetchUpgradeRetryPeriodMilliseconds *int
 	FetchUpgradeRetryPeriodMilliseconds *int
 
 
-	// EmitBytesTransferred indicates whether to emit periodic notices showing
-	// bytes sent and received.
-	EmitBytesTransferred bool
-
 	// TrustedCACertificatesFilename specifies a file containing trusted CA
 	// TrustedCACertificatesFilename specifies a file containing trusted CA
 	// certs. When set, this toggles use of the trusted CA certs, specified in
 	// certs. When set, this toggles use of the trusted CA certs, specified in
 	// TrustedCACertificatesFilename, for tunneled TLS connections that expect
 	// TrustedCACertificatesFilename, for tunneled TLS connections that expect
@@ -430,14 +426,26 @@ type Config struct {
 	// distributed or displayed to users. Default is off.
 	// distributed or displayed to users. Default is off.
 	EmitDiagnosticNetworkParameters bool
 	EmitDiagnosticNetworkParameters bool
 
 
-	// RateLimits specify throttling configuration for the tunnel.
-	RateLimits common.RateLimits
+	// EmitBytesTransferred indicates whether to emit periodic notices showing
+	// bytes sent and received.
+	EmitBytesTransferred bool
 
 
 	// EmitSLOKs indicates whether to emit notices for each seeded SLOK. As
 	// EmitSLOKs indicates whether to emit notices for each seeded SLOK. As
 	// this could reveal user browsing activity, it's intended for debugging
 	// this could reveal user browsing activity, it's intended for debugging
 	// and testing only.
 	// and testing only.
 	EmitSLOKs bool
 	EmitSLOKs bool
 
 
+	// EmitTapdanceLogs indicates whether to emit gotapdance log messages
+	// to stdout. Note that gotapdance log messages do not conform to the
+	// Notice format standard. Default is off.
+	EmitTapdanceLogs bool
+
+	// EmitServerAlerts indicates whether to emit notices for server alerts.
+	EmitServerAlerts bool
+
+	// RateLimits specify throttling configuration for the tunnel.
+	RateLimits common.RateLimits
+
 	// PacketTunnelTunDeviceFileDescriptor specifies a tun device file
 	// PacketTunnelTunDeviceFileDescriptor specifies a tun device file
 	// descriptor to use for running a packet tunnel. When this value is > 0,
 	// descriptor to use for running a packet tunnel. When this value is > 0,
 	// a packet tunnel is established through the server and packets are
 	// a packet tunnel is established through the server and packets are
@@ -472,11 +480,6 @@ type Config struct {
 	// Required for the exchange functionality.
 	// Required for the exchange functionality.
 	ExchangeObfuscationKey string
 	ExchangeObfuscationKey string
 
 
-	// EmitTapdanceLogs indicates whether to emit gotapdance log messages
-	// to stdout. Note that gotapdance log messages do not conform to the
-	// Notice format standard. Default is off.
-	EmitTapdanceLogs bool
-
 	// TransformHostNameProbability is for testing purposes.
 	// TransformHostNameProbability is for testing purposes.
 	TransformHostNameProbability *float64
 	TransformHostNameProbability *float64
 
 

+ 1 - 0
psiphon/server/server_test.go

@@ -848,6 +848,7 @@ func runServer(t *testing.T, runConfig *runServerConfig) {
 	clientConfig.LocalSocksProxyPort = localSOCKSProxyPort
 	clientConfig.LocalSocksProxyPort = localSOCKSProxyPort
 	clientConfig.LocalHttpProxyPort = localHTTPProxyPort
 	clientConfig.LocalHttpProxyPort = localHTTPProxyPort
 	clientConfig.EmitSLOKs = true
 	clientConfig.EmitSLOKs = true
+	clientConfig.EmitServerAlerts = true
 
 
 	if !runConfig.omitAuthorization {
 	if !runConfig.omitAuthorization {
 		clientConfig.Authorizations = []string{clientAuthorization}
 		clientConfig.Authorizations = []string{clientAuthorization}

+ 3 - 1
psiphon/serverApi.go

@@ -1061,7 +1061,9 @@ func HandleAlertRequest(
 		return errors.Trace(err)
 		return errors.Trace(err)
 	}
 	}
 
 
-	NoticeServerAlert(alertRequest)
+	if tunnel.config.EmitServerAlerts {
+		NoticeServerAlert(alertRequest)
+	}
 
 
 	return nil
 	return nil
 }
 }