snowflake/client/lib
David Fifield 55f4814dfb Change the representation of domain fronting in HTTP rendezvous.
Formerly, BrokerChannel represented the broker URL and possible domain
fronting as
	bc.url  *url.URL
        bc.Host string
That is, bc.url is the URL of the server which we contact directly, and
bc.Host is the Host header to use in the request. With no domain
fronting, bc.url points directly at the broker itself, and bc.Host is
blank. With domain fronting, we do the following reshuffling:
	if front != "" {
		bc.Host = bc.url.Host
		bc.url.Host = front
	}
That is, we alter bc.url to reflect that the server to which we send
requests directly is the CDN, not the broker, and store the broker's own
URL in the HTTP Host header.

The above representation was always confusing to me, because in my
mental model, we are always conceptually communicating with the broker;
but we may optionally be using a CDN proxy in the middle. The new
representation is
	bc.url   *url.URL
        bc.front string
bc.url is the URL of the broker itself, and never changes. bc.front is
the optional CDN front domain, and likewise never changes after
initialization. When domain fronting is in use, we do the swap in the
http.Request struct, not in BrokerChannel itself:
	if bc.front != "" {
		request.Host = request.URL.Host
		request.URL.Host = bc.front
	}

Compare to the representation in meek-client:

https://gitweb.torproject.org/pluggable-transports/meek.git/tree/meek-client/meek-client.go?h=v0.35.0#n94
	var options struct {
		URL       string
		Front     string
	}
https://gitweb.torproject.org/pluggable-transports/meek.git/tree/meek-client/meek-client.go?h=v0.35.0#n308
	if ok { // if front is set
		info.Host = info.URL.Host
		info.URL.Host = front
	}
2021-08-05 16:13:24 -06:00
..
interfaces.go Set max number of snowflakes in the Tongue 2020-08-27 16:44:07 -04:00
lib_test.go Change the representation of domain fronting in HTTP rendezvous. 2021-08-05 16:13:24 -06:00
peers.go Fix data race for Peers.collection 2021-06-24 11:16:24 -04:00
rendezvous.go Change the representation of domain fronting in HTTP rendezvous. 2021-08-05 16:13:24 -06:00
snowflake.go Release resources in client Transport.Dial on error. 2021-05-24 15:28:13 -06:00
turbotunnel.go Turbo Tunnel client and server. 2020-04-23 16:02:56 -06:00
util.go Simplify BytesSyncLogger. 2020-04-23 21:38:44 -06:00
webrtc.go Refactor checkForStaleness to take time.Duration 2021-06-24 11:20:44 -04:00