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:
Cecylia Bocovich 2023-09-23 10:46:46 -04:00
parent 5cdf52c813
commit 9fdfb3d1b5
No known key found for this signature in database
GPG key ID: 009DE379FD9B7B90
7 changed files with 65 additions and 48 deletions

View file

@ -64,8 +64,8 @@ func createBrokerTransport() http.RoundTripper {
func newBrokerChannelFromConfig(config ClientConfig) (*BrokerChannel, error) {
log.Println("Rendezvous using Broker at:", config.BrokerURL)
if config.FrontDomain != "" {
log.Println("Domain fronting using:", config.FrontDomain)
if len(config.FrontDomains) != 0 {
log.Printf("Domain fronting using a randomly selected domain from: %v", config.FrontDomains)
}
brokerTransport := createBrokerTransport()
@ -86,11 +86,11 @@ func newBrokerChannelFromConfig(config ClientConfig) (*BrokerChannel, error) {
if config.AmpCacheURL != "" {
log.Println("Through AMP cache at:", config.AmpCacheURL)
rendezvous, err = newAMPCacheRendezvous(
config.BrokerURL, config.AmpCacheURL, config.FrontDomain,
config.BrokerURL, config.AmpCacheURL, config.FrontDomains,
brokerTransport)
} else {
rendezvous, err = newHTTPRendezvous(
config.BrokerURL, config.FrontDomain, brokerTransport)
config.BrokerURL, config.FrontDomains, brokerTransport)
}
if err != nil {
return nil, err