mirror of
https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake.git
synced 2025-10-13 20:11:19 -04:00
Randomly select front domain from comma-separated list
This commmit changes the command-line and Bridge line arguments to take a comma-separated list of front domains. The change is backwards compatible with old Bridge and ClientTransportPlugin lines. At rendezvous time, a front domain will be randomly chosen from the list.
This commit is contained in:
parent
5cdf52c813
commit
9fdfb3d1b5
7 changed files with 65 additions and 48 deletions
|
@ -85,11 +85,14 @@ type ClientConfig struct {
|
|||
// AmpCacheURL is the full URL of a valid AMP cache. A nonzero value indicates
|
||||
// that AMP cache will be used as the rendezvous method with the broker.
|
||||
AmpCacheURL string
|
||||
// FrontDomain is a the full URL of an optional front domain that can be used with either
|
||||
// FrontDomain is the full URL of an optional front domain that can be used with either
|
||||
// the AMP cache or HTTP domain fronting rendezvous method.
|
||||
FrontDomain string
|
||||
// ICEAddresses are a slice of ICE server URLs that will be used for NAT traversal and
|
||||
// the creation of the client's WebRTC SDP offer.
|
||||
FrontDomains []string
|
||||
// ICEAddresses are a slice of ICE server URLs that will be used for NAT traversal and
|
||||
// the creation of the client's WebRTC SDP offer.
|
||||
ICEAddresses []string
|
||||
// KeepLocalAddresses is an optional setting that will prevent the removal of local or
|
||||
// invalid addresses from the client's SDP offer. This is useful for local deployments
|
||||
|
@ -134,6 +137,11 @@ func NewSnowflakeClient(config ClientConfig) (*Transport, error) {
|
|||
log.Printf("url: %v", strings.Join(server.URLs, " "))
|
||||
}
|
||||
|
||||
// Maintain backwards compatability with old FrontDomain field of ClientConfig
|
||||
if (len(config.FrontDomains) == 0) && (config.FrontDomain != "") {
|
||||
config.FrontDomains = []string{config.FrontDomain}
|
||||
}
|
||||
|
||||
// Rendezvous with broker using the given parameters.
|
||||
broker, err := newBrokerChannelFromConfig(config)
|
||||
if err != nil {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue