commit 5927c2bdf9266f70856602a666928da397f19bdb
Author: Cecylia Bocovich <coh...@torproject.org>
Date:   Wed Sep 29 15:48:31 2021 -0400

    Default to a maximum value of 1 Snowflake peer
---
 client/lib/snowflake.go | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/client/lib/snowflake.go b/client/lib/snowflake.go
index 3ac75b0..0096759 100644
--- a/client/lib/snowflake.go
+++ b/client/lib/snowflake.go
@@ -8,7 +8,6 @@ specification. To use Snowflake, you must first create a client 
from a configura
        config := snowflake_client.ClientConfig{
                BrokerURL:   "https://snowflake-broker.example.com";,
                FrontDomain: "https://friendlyfrontdomain.net";,
-               Max: 1,
                // ...
        }
        transport, err := snowflake_client.NewSnowflakeClient(config)
@@ -91,7 +90,7 @@ type ClientConfig struct {
        // and testing.
        KeepLocalAddresses bool
        // Max is the maximum number of snowflake proxy peers that the client 
should attempt to
-       // connect to.
+       // connect to. Defaults to 1.
        Max int
 }
 
@@ -128,7 +127,11 @@ func NewSnowflakeClient(config ClientConfig) (*Transport, 
error) {
        }
        go updateNATType(iceServers, broker)
 
-       transport := &Transport{dialer: NewWebRTCDialer(broker, iceServers, 
config.Max)}
+       max := 1
+       if config.Max > max {
+               max = config.Max
+       }
+       transport := &Transport{dialer: NewWebRTCDialer(broker, iceServers, 
max)}
 
        return transport, nil
 }

_______________________________________________
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits

Reply via email to