Maintain backward compatability with old clients

Introduce a new commandline and SOCKS argument for comma-separated
domain fronts rather than repurposing the old one so that we can
maintain backwards compatability with users running old versions of the
client. A new bridge line shared on circumvention settings could have
both the front= and fronts= options set.
This commit is contained in:
Cecylia Bocovich 2023-10-03 10:35:17 -04:00
parent 9fdfb3d1b5
commit d434549df8
No known key found for this signature in database
GPG key ID: 009DE379FD9B7B90
2 changed files with 12 additions and 4 deletions

View file

@ -80,7 +80,9 @@ 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("front"); ok {
if arg, ok := conn.Req.Args.Get("fronts"); ok {
config.FrontDomains = strings.Split(strings.TrimSpace(arg), ",")
} else if arg, ok := conn.Req.Args.Get("front"); ok {
config.FrontDomains = strings.Split(strings.TrimSpace(arg), ",")
}
if arg, ok := conn.Req.Args.Get("ice"); ok {
@ -151,7 +153,8 @@ func socksAcceptLoop(ln *pt.SocksListener, config sf.ClientConfig, shutdown chan
func main() {
iceServersCommas := flag.String("ice", "", "comma-separated list of ICE servers")
brokerURL := flag.String("url", "", "URL of signaling broker")
frontDomainsCommas := flag.String("front", "", "comma-separated list of front domains")
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")
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")
@ -208,6 +211,11 @@ func main() {
iceAddresses := strings.Split(strings.TrimSpace(*iceServersCommas), ",")
frontDomains := strings.Split(strings.TrimSpace(*frontDomainsCommas), ",")
// Maintain backwards compatability with legacy commandline option
if (len(frontDomains) == 0) && (*frontDomain != "") {
frontDomains = []string{*frontDomain}
}
config := sf.ClientConfig{
BrokerURL: *brokerURL,
AmpCacheURL: *ampCacheURL,