summaryrefslogtreecommitdiff
path: root/internal/transport/dereference.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/transport/dereference.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/transport/dereference.go')
-rw-r--r--internal/transport/dereference.go12
1 files changed, 12 insertions, 0 deletions
diff --git a/internal/transport/dereference.go b/internal/transport/dereference.go
new file mode 100644
index 000000000..d7a28fe17
--- /dev/null
+++ b/internal/transport/dereference.go
@@ -0,0 +1,12 @@
+package transport
+
+import (
+ "context"
+ "net/url"
+)
+
+func (t *transport) Dereference(c context.Context, iri *url.URL) ([]byte, error) {
+ l := t.log.WithField("func", "Dereference")
+ l.Debugf("performing GET to %s", iri.String())
+ return t.sigTransport.Dereference(c, iri)
+}