mirror of
https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake.git
synced 2025-10-14 05:11:19 -04:00
Default to a maximum value of 1 Snowflake peer
This commit is contained in:
parent
6c6a2e44ab
commit
5927c2bdf9
1 changed files with 6 additions and 3 deletions
|
@ -8,7 +8,6 @@ specification. To use Snowflake, you must first create a client from a configura
|
||||||
config := snowflake_client.ClientConfig{
|
config := snowflake_client.ClientConfig{
|
||||||
BrokerURL: "https://snowflake-broker.example.com",
|
BrokerURL: "https://snowflake-broker.example.com",
|
||||||
FrontDomain: "https://friendlyfrontdomain.net",
|
FrontDomain: "https://friendlyfrontdomain.net",
|
||||||
Max: 1,
|
|
||||||
// ...
|
// ...
|
||||||
}
|
}
|
||||||
transport, err := snowflake_client.NewSnowflakeClient(config)
|
transport, err := snowflake_client.NewSnowflakeClient(config)
|
||||||
|
@ -91,7 +90,7 @@ type ClientConfig struct {
|
||||||
// and testing.
|
// and testing.
|
||||||
KeepLocalAddresses bool
|
KeepLocalAddresses bool
|
||||||
// Max is the maximum number of snowflake proxy peers that the client should attempt to
|
// Max is the maximum number of snowflake proxy peers that the client should attempt to
|
||||||
// connect to.
|
// connect to. Defaults to 1.
|
||||||
Max int
|
Max int
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -128,7 +127,11 @@ func NewSnowflakeClient(config ClientConfig) (*Transport, error) {
|
||||||
}
|
}
|
||||||
go updateNATType(iceServers, broker)
|
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
|
return transport, nil
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue