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:
Michael Pu 2023-11-18 20:43:28 -05:00 committed by Cecylia Bocovich
parent d0529141ac
commit 8fb17de152
No known key found for this signature in database
GPG key ID: 009DE379FD9B7B90
9 changed files with 472 additions and 4 deletions

View file

@ -16,6 +16,8 @@ import (
"sync"
"syscall"
"gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake/v2/common/proxy"
pt "gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/goptlib"
sf "gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake/v2/client/lib"
@ -82,6 +84,15 @@ func socksAcceptLoop(ln *pt.SocksListener, config sf.ClientConfig, shutdown chan
if arg, ok := conn.Req.Args.Get("ampcache"); ok {
config.AmpCacheURL = arg
}
if arg, ok := conn.Req.Args.Get("sqsqueue"); ok {
config.SQSQueueURL = arg
}
if arg, ok := conn.Req.Args.Get("sqsakid"); ok {
config.SQSAccessKeyID = arg
}
if arg, ok := conn.Req.Args.Get("sqsskey"); ok {
config.SQSSecretKey = arg
}
if arg, ok := conn.Req.Args.Get("fronts"); ok {
if arg != "" {
config.FrontDomains = strings.Split(strings.TrimSpace(arg), ",")
@ -160,6 +171,9 @@ func main() {
frontDomain := flag.String("front", "", "front domain")
frontDomainsCommas := flag.String("fronts", "", "comma-separated list of front domains")
ampCacheURL := flag.String("ampcache", "", "URL of AMP cache to use as a proxy for signaling")
sqsQueueURL := flag.String("sqsqueue", "", "URL of SQS Queue to use as a proxy for signaling")
sqsAccessKeyId := flag.String("sqsakid", "", "Access Key ID for credentials to access SQS Queue ")
sqsSecretKey := flag.String("sqsskey", "", "Secret Key for credentials to access SQS Queue")
logFilename := flag.String("log", "", "name of log file")
logToStateDir := flag.Bool("log-to-state-dir", false, "resolve the log file relative to tor's pt state dir")
keepLocalAddresses := flag.Bool("keep-local-addresses", false, "keep local LAN address ICE candidates")
@ -227,6 +241,9 @@ func main() {
config := sf.ClientConfig{
BrokerURL: *brokerURL,
AmpCacheURL: *ampCacheURL,
SQSQueueURL: *sqsQueueURL,
SQSAccessKeyID: *sqsAccessKeyId,
SQSSecretKey: *sqsSecretKey,
FrontDomains: frontDomains,
ICEAddresses: iceAddresses,
KeepLocalAddresses: *keepLocalAddresses || *oldKeepLocalAddresses,