MCPcopy Create free account
hub / github.com/daodst/chat / CreateClient

Method CreateClient

setup/base/base.go:331–347  ·  view source on GitHub ↗

CreateClient creates a new client (normally used for media fetch requests). Should only be called once per component.

()

Source from the content-addressed store, hash-verified

329// CreateClient creates a new client (normally used for media fetch requests).
330// Should only be called once per component.
331func (b *BaseDendrite) CreateClient() *gomatrixserverlib.Client {
332 if b.Cfg.Global.DisableFederation {
333 return gomatrixserverlib.NewClient(
334 gomatrixserverlib.WithTransport(noOpHTTPTransport),
335 )
336 }
337 opts := []gomatrixserverlib.ClientOption{
338 gomatrixserverlib.WithSkipVerify(b.Cfg.FederationAPI.DisableTLSValidation),
339 gomatrixserverlib.WithWellKnownSRVLookups(false),
340 }
341 if b.Cfg.Global.DNSCache.Enabled {
342 opts = append(opts, gomatrixserverlib.WithDNSCache(b.DNSCache))
343 }
344 client := gomatrixserverlib.NewClient(opts...)
345 client.SetUserAgent(fmt.Sprintf("Dendrite/%s", internal.VersionString()))
346 return client
347}
348
349// CreateFederationClient creates a new federation client. Should only be called
350// once per component.

Callers 1

mainFunction · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected