Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Fed = NewFederatedClient()
Fed is a global federated matrix client. Safe for concurrent use.
Functions ¶
func NewFederatedClient ¶
NewFederatedClient returns a http.Client that uses the federated transport.
Types ¶
type FederatedTripper ¶
type FederatedTripper struct {
// contains filtered or unexported fields
}
FederatedTripper implements http.RoundTripper interface with support for exponential backoff retries. This is used to talk to federated servers
func NewFederatedTripper ¶
func NewFederatedTripper(maxRetries uint64) *FederatedTripper
type RoutingInfo ¶
type RoutingInfo struct { // The value we should assign to the Host header (host:port from the matrix // URI, or .well-known). HostHeader string // The server name we should set in the SNI (typically host, without port, from // the matrix URI or .well-known) TLSServerName string // The hostname (or IP literal) we should route the TCP connection to (the // target of the SRV record, or the hostname from the URL/.well-known) TargetHost string // The port we should route the TCP connection to (the target of the SRV // record, or the port from the URL/.well-known, or 8448) TargetPort uint16 }
RoutingInfo Contains the parameters needed to direct a federation connection to a particular server. Where a SRV record points to several servers, this object contains a single server chosen from the list.
func RouteMatrixURI ¶
func RouteMatrixURI(resolve SRVResolveFunc, u *url.URL, lookupWellKnown bool) (*RoutingInfo, error)
RouteMatrixURI returns RoutingInfo that contains information about which server the request should be sent to.
resolve is used to resolve hostname for non IP hosts.
type SRVResolveFunc ¶
SRVResolveFunc is a function used to resolve srv records offederated matrix servers
func SrvResolver ¶
func SrvResolver() SRVResolveFunc
SrvResolver returns a function that lookup for srv records of a host configured for matrix federation.
This caches the records, and the returned function is safe for concurrent use.
type WellKnownResponse ¶
type WellKnownResponse struct {
Server string `json:"m.server"`
}
WellKnownResponse is a response returned from a federated matrix server for queries on /.well-known/matrix/server path.
func GetWellKnown ¶
func GetWellKnown(address string) (*WellKnownResponse, error)
GetWellKnown sends a GET request to address looking for .well=known host address.
No caching is performed.