summaryrefslogtreecommitdiff
path: root/internal/federation/federator.go
diff options
context:
space:
mode:
authorLibravatar Tobi Smethurst <31960611+tsmethurst@users.noreply.github.com>2021-06-27 16:52:18 +0200
committerLibravatar GitHub <noreply@github.com>2021-06-27 16:52:18 +0200
commit87cf621e21283728b2bb5517c6a6981087cc7ce5 (patch)
treebd53f99ac3a0f242668bc33a3aeb0b3350957fb7 /internal/federation/federator.go
parentGo fmt (diff)
downloadgotosocial-87cf621e21283728b2bb5517c6a6981087cc7ce5.tar.xz
Remote instance dereferencing (#70)
Remote instances are now dereferenced when they post to an inbox on a GtS instance. Dereferencing will be done first by checking the /api/v1/instance endpoint of an instance. If that doesn't work, /.well-known/nodeinfo will be checked. If that doesn't work, only a minimal representation of the instance will be stored. A new field was added to the Instance database model. To create it: alter table instances add column contact_account_username text;
Diffstat (limited to 'internal/federation/federator.go')
-rw-r--r--internal/federation/federator.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/internal/federation/federator.go b/internal/federation/federator.go
index 2ee01697f..0c6b54e37 100644
--- a/internal/federation/federator.go
+++ b/internal/federation/federator.go
@@ -28,6 +28,7 @@ import (
"github.com/superseriousbusiness/gotosocial/internal/config"
"github.com/superseriousbusiness/gotosocial/internal/db"
"github.com/superseriousbusiness/gotosocial/internal/federation/federatingdb"
+ "github.com/superseriousbusiness/gotosocial/internal/gtsmodel"
"github.com/superseriousbusiness/gotosocial/internal/transport"
"github.com/superseriousbusiness/gotosocial/internal/typeutils"
)
@@ -50,6 +51,9 @@ type Federator interface {
// DereferenceRemoteStatus can be used to get the representation of a remote status, based on its ID (which is a URI).
// The given username will be used to create a transport for making outgoing requests. See the implementation for more detailed comments.
DereferenceRemoteStatus(username string, remoteStatusID *url.URL) (typeutils.Statusable, error)
+ // DereferenceRemoteInstance takes the URL of a remote instance, and a username (optional) to spin up a transport with. It then
+ // does its damnedest to get some kind of information back about the instance, trying /api/v1/instance, then /.well-known/nodeinfo
+ DereferenceRemoteInstance(username string, remoteInstanceURI *url.URL) (*gtsmodel.Instance, error)
// GetTransportForUser returns a new transport initialized with the key credentials belonging to the given username.
// This can be used for making signed http requests.
//