Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewGETSigner ¶ added in v0.3.4
NewGETSigner returns a new httpsig.Signer instance initialized with GTS GET preferences.
Types ¶
type Controller ¶
type Controller interface { // NewTransport returns an http signature transport with the given public key ID (URL location of pubkey), and the given private key. NewTransport(pubKeyID string, privkey *rsa.PrivateKey) (Transport, error) // NewTransportForUsername searches for account with username, and returns result of .NewTransport(). NewTransportForUsername(ctx context.Context, username string) (Transport, error) }
Controller generates transports for use in making federation requests to other servers.
func NewController ¶
func NewController(state *state.State, federatingDB federatingdb.DB, clock pub.Clock, client httpclient.SigningClient) Controller
NewController returns an implementation of the Controller interface for creating new transports
type Transport ¶
type Transport interface { // Deliver sends an ActivityStreams object. Deliver(ctx context.Context, b []byte, to *url.URL) error // BatchDeliver sends an ActivityStreams object to multiple recipients. BatchDeliver(ctx context.Context, b []byte, recipients []*url.URL) error // Dereference fetches the ActivityStreams object located at this IRI with a GET request. Dereference(ctx context.Context, iri *url.URL) ([]byte, error) // DereferenceMedia fetches the given media attachment IRI, returning the reader and filesize. DereferenceMedia(ctx context.Context, iri *url.URL) (io.ReadCloser, int64, error) // DereferenceInstance dereferences remote instance information, first by checking /api/v1/instance, and then by checking /.well-known/nodeinfo. DereferenceInstance(ctx context.Context, iri *url.URL) (*gtsmodel.Instance, error) // Finger performs a webfinger request with the given username and domain, and returns the bytes from the response body. Finger(ctx context.Context, targetUsername string, targetDomain string) ([]byte, error) }
Transport implements the pub.Transport interface with some additional functionality for fetching remote media.
Since the transport has the concept of 'shortcuts' for fetching data locally rather than remotely, it is not *always* the case that calling a Transport function does an http call, but it usually will for remote hosts or resources for which a shortcut isn't provided by the transport controller (also in this package).
For any of the transport functions, if a Fastfail context is passed in as the first parameter, the function will return after the first transport failure, instead of retrying + backing off.