diff --git a/proxy/lib/snowflake.go b/proxy/lib/snowflake.go index b41fba4..176898a 100644 --- a/proxy/lib/snowflake.go +++ b/proxy/lib/snowflake.go @@ -56,9 +56,10 @@ const ( DefaultPollInterval = 5 * time.Second DefaultBrokerURL = "https://snowflake-broker.torproject.net/" DefaultNATProbeURL = "https://snowflake-broker.torproject.net:8443/probe" - DefaultRelayURL = "wss://snowflake.torproject.net/" - DefaultSTUNURL = "stun:stun.l.google.com:19302" - DefaultProxyType = "standalone" + // This is rather a "DefaultDefaultRelayURL" + DefaultRelayURL = "wss://snowflake.torproject.net/" + DefaultSTUNURL = "stun:stun.l.google.com:19302" + DefaultProxyType = "standalone" ) const ( @@ -125,7 +126,9 @@ type SnowflakeProxy struct { BrokerURL string // KeepLocalAddresses indicates whether local SDP candidates will be sent to the broker KeepLocalAddresses bool - // RelayURL is the URL of the Snowflake server that all traffic will be relayed to + // RelayURL is the default `URL` of the server (relay) + // that this proxy will forward client connections to, + // in case the broker itself did not specify the said URL RelayURL string // OutboundAddress specify an IP address to use as SDP host candidate OutboundAddress string @@ -728,7 +731,7 @@ func (sf *SnowflakeProxy) Start() error { } _, err = url.Parse(sf.RelayURL) if err != nil { - return fmt.Errorf("invalid relay url: %s", err) + return fmt.Errorf("invalid default relay url: %s", err) } if !namematcher.IsValidRule(sf.RelayDomainNamePattern) { diff --git a/proxy/main.go b/proxy/main.go index 5671d2b..a66deb4 100644 --- a/proxy/main.go +++ b/proxy/main.go @@ -28,7 +28,7 @@ func main() { rawBrokerURL := flag.String("broker", sf.DefaultBrokerURL, "broker URL") unsafeLogging := flag.Bool("unsafe-logging", false, "prevent logs from being scrubbed") keepLocalAddresses := flag.Bool("keep-local-addresses", false, "keep local LAN address ICE candidates") - relayURL := flag.String("relay", sf.DefaultRelayURL, "websocket relay URL") + defaultRelayURL := flag.String("relay", sf.DefaultRelayURL, "websocket relay URL") probeURL := flag.String("nat-probe-server", sf.DefaultNATProbeURL, "NAT check probe server URL") outboundAddress := flag.String("outbound-address", "", "prefer the given address as outbound address") allowedRelayHostNamePattern := flag.String("allowed-relay-hostname-pattern", "snowflake.torproject.net$", "a pattern to specify allowed hostname pattern for relay URL.") @@ -97,7 +97,7 @@ func main() { STUNURL: *stunURL, BrokerURL: *rawBrokerURL, KeepLocalAddresses: *keepLocalAddresses, - RelayURL: *relayURL, + RelayURL: *defaultRelayURL, NATProbeURL: *probeURL, OutboundAddress: *outboundAddress, EphemeralMinPort: ephemeralPortsRange[0],