Leverage client options instead of exposing http client

This commit is contained in:
Devon Hudson 2023-04-21 10:48:32 -06:00
parent d3e9ed1097
commit 881d831225
No known key found for this signature in database
GPG key ID: CD06B18E77F6A628
2 changed files with 2 additions and 2 deletions

View file

@ -85,6 +85,7 @@ func CreateFederationClient(cfg *config.Dendrite, dnsCache *fclient.DNSCache) fc
fclient.WithTimeout(time.Minute * 5),
fclient.WithSkipVerify(cfg.FederationAPI.DisableTLSValidation),
fclient.WithKeepAlives(!cfg.FederationAPI.DisableHTTPKeepalives),
fclient.WithUserAgent(fmt.Sprintf("Dendrite/%s", internal.VersionString())),
}
if cfg.Global.DNSCache.Enabled {
opts = append(opts, fclient.WithDNSCache(dnsCache))
@ -92,7 +93,6 @@ func CreateFederationClient(cfg *config.Dendrite, dnsCache *fclient.DNSCache) fc
client := fclient.NewFederationClient(
identities, opts...,
)
client.WithUserAgent(fmt.Sprintf("Dendrite/%s", internal.VersionString()))
return client
}

View file

@ -147,8 +147,8 @@ func newFedClient(tripper func(*http.Request) (*http.Response, error)) fclient.F
PrivateKey: pkey,
},
},
fclient.WithTransport(&roundTripper{tripper}),
)
fedClient.SetInternalClient(*fclient.NewClient(fclient.WithTransport(&roundTripper{tripper})))
return fedClient
}