transport

package
v0.3.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 26, 2022 License: AGPL-3.0 Imports: 34 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewGETSigner added in v0.3.4

func NewGETSigner(expiresIn int64) (httpsig.Signer, error)

NewGETSigner returns a new httpsig.Signer instance initialized with GTS GET preferences.

func NewPOSTSigner added in v0.3.4

func NewPOSTSigner(expiresIn int64) (httpsig.Signer, error)

NewPOSTSigner returns a new httpsig.Signer instance initialized with GTS POST 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(db db.DB, federatingDB federatingdb.DB, clock pub.Clock, client pub.HttpClient) Controller

NewController returns an implementation of the Controller interface for creating new transports

type Transport

type Transport interface {
	pub.Transport
	// DereferenceMedia fetches the given media attachment IRI, returning the reader and filesize.
	DereferenceMedia(ctx context.Context, iri *url.URL) (io.ReadCloser, int, 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, targetDomains string) ([]byte, error)
}

Transport wraps 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).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL