320
321
// CreateLocalFrontendHTTPClient gets or creates a cached frontend client.
322
>
func (d *RPCFactory) CreateLocalFrontendHTTPClient() (*common.FrontendHTTPClient, error) {
rpc.go
323
>
return d.localFrontendClient()
324
>
}
325
326
// createLocalFrontendHTTPClient creates an HTTP client for communicating with the frontend.
327
// It uses either the provided frontendURL or membership to resolve the frontend address.
328
>
func (d *RPCFactory) createLocalFrontendHTTPClient() (*common.FrontendHTTPClient, error) {
rpc.go
329
>
// dialer and transport field values copied from http.DefaultTransport.
330
>
dialer := &net.Dialer{
331
>
Timeout: 30 * time.Second,
332
>
KeepAlive: 30 * time.Second,
333
>
}
334
>
transport := &http.Transport{
335
>
Proxy: http.ProxyFromEnvironment,
336
>
DialContext: dialer.DialContext,
337
>
ForceAttemptHTTP2: true,
338
>
MaxIdleConns: 100,
339
>
IdleConnTimeout: 90 * time.Second,
340
>
TLSHandshakeTimeout: 10 * time.Second,
341
>
ExpectContinueTimeout: 1 * time.Second,
342
>
}
343
>
client := http.Client{}
344
>
345
>
// Default to http unless TLS is configured.
346
>
scheme := "http"
347
>
if d.frontendTLSConfig != nil {
348
transport.TLSClientConfig = d.frontendTLSConfig
349
scheme = "https"
350
}
351
352
>
var address string
rpc.go
353
>
if r := serviceResolverFromGRPCURL(d.frontendHTTPURL); r != nil {
354
client.Transport = &roundTripper{
355
resolver: r,