Check for an invalid broker URL at a higher level.

Instead of returning nil from NewBrokerChannel and having
WebRTCDialer.Catch check for nil, let NewBrokerChannel return an error
and bail out before calling WebRTCDialer.Catch.

Suggested by cohosh.
https://bugs.torproject.org/33040#comment:3
This commit is contained in:
David Fifield 2019-12-24 19:57:01 -07:00
parent f1ab65b1c0
commit 2fb52c8639
2 changed files with 7 additions and 7 deletions

View file

@ -130,7 +130,10 @@ func main() {
snowflakes := sf.NewPeers(*max)
// Use potentially domain-fronting broker to rendezvous.
broker := sf.NewBrokerChannel(*brokerURL, *frontDomain, sf.CreateBrokerTransport())
broker, err := sf.NewBrokerChannel(*brokerURL, *frontDomain, sf.CreateBrokerTransport())
if err != nil {
log.Fatalf("parsing broker URL: %v", err)
}
snowflakes.Tongue = sf.NewWebRTCDialer(broker, iceServers)
// Use a real logger to periodically output how much traffic is happening.