Documentation ¶
Index ¶
- Constants
- Variables
- func SplitAccount(act string) (username string, domain string, err error)
- type Activity
- type ActivityType
- type Actor
- type ActorType
- type Attachment
- type Endpoints
- type Error
- type HostMeta
- type Link
- type Media
- type NodeInfo
- type NodeInfoServices
- type NodeInfoSoftware
- type NodeInfoUsage
- type NodeInfoUsageUsers
- type PublicKey
- type Software
- type Tag
- type WebFinger
- type WebFingerURI
- type WellKnownNodeInfo
Constants ¶
const ( // ContextActivityStreams contains the context document for activity streams. ContextActivityStreams = "https://www.w3.org/ns/activitystreams" // ContextMastodon contains the context document for mastodon. ContextMastodon = "http://joinmastodon.org/ns" // ContextSecurity contains the context document for security. ContextSecurity = "https://w3id.org/security/v1" )
const ( // NodeInfo20Schema the schema url for nodeinfo 2.0. NodeInfo20Schema = "http://nodeinfo.diaspora.software/ns/schema/2.0" // NodeInfo21Schema the schema url for nodeinfo 2.1. NodeInfo21Schema = "http://nodeinfo.diaspora.software/ns/schema/2.1" )
const HostMetaWebFingerTemplateRel = "lrdd"
HostMetaWebFingerTemplateRel matches a webfinger link relationship.
Variables ¶
var ( // ErrInvalidAccountFormat is returned when a federated account is in an invalid format. ErrInvalidAccountFormat = NewError("invalid account format") // ErrMissingNodeInfoURI is returned a well known node info document is missing a node info url. ErrMissingNodeInfoURI = NewError("missing node info url") )
Functions ¶
Types ¶
type Activity ¶
type Activity map[string]interface{}
func (Activity) ObjectType ¶
func (a Activity) ObjectType() (ActivityType, error)
func (Activity) Type ¶
func (a Activity) Type() (ActivityType, error)
type ActivityType ¶
type ActivityType string
const ( // TypeAccept is the Accept activity Type. TypeAccept ActivityType = "Accept" // TypeAdd is the Add activity Type. TypeAdd ActivityType = "Add" // TypeAnnounce is the Announce activity Type. TypeAnnounce ActivityType = "Announce" // TypeCreate is the Create activity Type. TypeCreate ActivityType = "Create" // TypeDelete is the Delete activity Type. TypeDelete ActivityType = "Delete" // TypeFollow is the Follow activity Type. TypeFollow ActivityType = "Follow" // TypeMove is the Move activity Type. TypeMove ActivityType = "Move" // TypeOrderedCollection is the OrderedCollection activity Type. TypeOrderedCollection ActivityType = "OrderedCollection" // TypeOrderedCollectionPage is the OrderedCollectionPage activity Type. TypeOrderedCollectionPage ActivityType = "OrderedCollectionPage" // TypeRemove is the Remove activity Type. TypeRemove ActivityType = "Remove" // TypeUndo is the Undo activity Type. TypeUndo ActivityType = "Undo" // TypeUpdate is the Update activity Type. TypeUpdate ActivityType = "Update" )
func (ActivityType) String ¶
func (a ActivityType) String() string
type Actor ¶
type Actor struct { Context interface{} `json:"@context"` Attachment []Attachment `json:"attachment,omitempty"` Device string `json:"device,omitempty"` Discoverable bool `json:"discoverable"` Endpoints *Endpoints `json:"endpoints,omitempty"` Featured string `json:"featured,omitempty"` FeaturedTags string `json:"featuredTags,omitempty"` Followers string `json:"followers,omitempty"` Following string `json:"following,omitempty"` Icon *Media `json:"icon,omitempty"` Image *Media `json:"image,omitempty"` Inbox string `json:"inbox"` ID string `json:"id"` ManuallyApprovesFollowers bool `json:"manuallyApprovesFollowers"` Name string `json:"name,omitempty"` Outbox string `json:"outbox"` PreferredUsername string `json:"preferredUsername,omitempty"` PublicKey *PublicKey `json:"publicKey,omitempty"` Published *time.Time `json:"published,omitempty"` Summary string `json:"summary,omitempty"` Tags []Tag `json:"tag,omitempty"` Type ActorType `json:"type,omitempty"` URL string `json:"url,omitempty"` }
Actor is an actor response.
func FetchActor ¶
FetchActor retrieves an actor resource from a instance.
type Attachment ¶
type Error ¶
type Error struct {
// contains filtered or unexported fields
}
Error represents a fedihelper specific error.
type HostMeta ¶
func FetchHostMeta ¶
func (*HostMeta) WebFingerURI ¶
func (h *HostMeta) WebFingerURI() WebFingerURI
type Link ¶
type Link struct { Href string `json:"href,omitempty"` Rel string `json:"rel,omitempty" xml:"rel,attr"` Template string `json:"template,omitempty" xml:"template,attr"` Type string `json:"type,omitempty"` }
Link represents a link.
type NodeInfo ¶
type NodeInfo struct { Metadata interface{} `json:"metadata"` OpenRegistrations bool `json:"openRegistrations"` Protocols []string `json:"protocols"` Services NodeInfoServices `json:"services"` Software NodeInfoSoftware `json:"software"` Usage NodeInfoUsage `json:"usage"` Version string `json:"version"` }
NodeInfo is a federated node info 2.0 object.
func FetchNodeInfo ¶
FetchNodeInfo retrieves well-known nodei nfo from a federated instance.
type NodeInfoServices ¶
type NodeInfoServices struct { Inbound []string `json:"inbound"` Outbound []string `json:"outbound"` }
NodeInfoServices contains the supported services of the node.
type NodeInfoSoftware ¶
NodeInfoSoftware contains the software and version of the node.
type NodeInfoUsage ¶
type NodeInfoUsage struct { LocalPosts int64 `json:"localPosts"` Users NodeInfoUsageUsers `json:"users"` }
NodeInfoUsage contains usage statistics.
type NodeInfoUsageUsers ¶
type NodeInfoUsageUsers struct {
Total int64 `json:"total"`
}
NodeInfoUsageUsers contains usage statistics about users.
type PublicKey ¶
type PublicKey struct { ID string `json:"id"` Owner string `json:"owner"` PublicKeyPEM string `json:"publicKeyPem"` }
PublicKey represents an actor's public key.
type WebFinger ¶
type WebFinger struct { Aliases []string `json:"aliases,omitempty"` Links []Link `json:"links,omitempty"` Subject string `json:"subject,omitempty"` }
WebFinger is a web finger response.
type WebFingerURI ¶
type WebFingerURI string
func (WebFingerURI) FTemplate ¶
func (w WebFingerURI) FTemplate() string
func (WebFingerURI) String ¶
func (w WebFingerURI) String() string
type WellKnownNodeInfo ¶
type WellKnownNodeInfo struct {
Links []Link `json:"links"`
}
WellKnownNodeInfo is a federated well known node info object.
func FetchWellKnownNodeInfo ¶
func FetchWellKnownNodeInfo(ctx context.Context, t *http.Client, domain string, config ...bool) (*WellKnownNodeInfo, error)
FetchWellKnownNodeInfo retrieves wellknown nodeinfo from a federated instance.
func (*WellKnownNodeInfo) NodeInfoURI ¶
func (w *WellKnownNodeInfo) NodeInfoURI() (*url.URL, error)