mirror of
https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake.git
synced 2025-10-13 20:11:19 -04:00
Implement SQS rendezvous in client and broker
This features adds an additional rendezvous method to send client offers and receive proxy answers through the use of Amazon SQS queues. https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake/-/issues/26151
This commit is contained in:
parent
d0529141ac
commit
8fb17de152
9 changed files with 472 additions and 4 deletions
|
@ -26,7 +26,9 @@ import (
|
|||
|
||||
const (
|
||||
brokerErrorUnexpected string = "Unexpected error, no answer."
|
||||
readLimit = 100000 //Maximum number of bytes to be read from an HTTP response
|
||||
rendezvousErrorMsg string = "One of SQS, AmpCache, or Domain Fronting rendezvous methods must be used."
|
||||
|
||||
readLimit = 100000 //Maximum number of bytes to be read from an HTTP response
|
||||
)
|
||||
|
||||
// RendezvousMethod represents a way of communicating with the broker: sending
|
||||
|
@ -88,14 +90,25 @@ func newBrokerChannelFromConfig(config ClientConfig) (*BrokerChannel, error) {
|
|||
|
||||
var rendezvous RendezvousMethod
|
||||
var err error
|
||||
if config.AmpCacheURL != "" {
|
||||
if config.SQSQueueURL != "" {
|
||||
if config.AmpCacheURL != "" || config.BrokerURL != "" {
|
||||
log.Fatalln("Multiple rendezvous methods specified. " + rendezvousErrorMsg)
|
||||
}
|
||||
if config.SQSAccessKeyID == "" || config.SQSSecretKey == "" {
|
||||
log.Fatalln("sqsakid and sqsskey must be specified to use SQS rendezvous method.")
|
||||
}
|
||||
log.Println("Through SQS queue at:", config.SQSQueueURL)
|
||||
rendezvous, err = newSQSRendezvous(config.SQSQueueURL, config.SQSAccessKeyID, config.SQSSecretKey, brokerTransport)
|
||||
} else if config.AmpCacheURL != "" && config.BrokerURL != "" {
|
||||
log.Println("Through AMP cache at:", config.AmpCacheURL)
|
||||
rendezvous, err = newAMPCacheRendezvous(
|
||||
config.BrokerURL, config.AmpCacheURL, config.FrontDomains,
|
||||
brokerTransport)
|
||||
} else {
|
||||
} else if config.BrokerURL != "" {
|
||||
rendezvous, err = newHTTPRendezvous(
|
||||
config.BrokerURL, config.FrontDomains, brokerTransport)
|
||||
} else {
|
||||
log.Fatalln("No rendezvous method was specified. " + rendezvousErrorMsg)
|
||||
}
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue