Documentation ¶
Overview ¶
GangGo Federation Library Copyright (C) 2017-2018 Lukas Matt <lukas@zauberstuhl.de>
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.
Package federation is a library to communicate between fediverse protocols ¶
SENDING ¶
To send a entity to a fediverse server we simply have to construct one with the protocol we want to use and hit send! :)
msg := federation.NewMessagePost(federation.DiasporaProtocol) msg.SetAuthor(author) msg.SetText(text) msg.SetGuid(guid) msg.SetPublic(public) msg.SetCreatedAt(createdAt) err = msg.Send(endpoint, privKey, pubKey) if err != nil { [...] }
RECEIVING ¶
Diaspora ¶
To receive and parser diaspora requests `federation.DiasporaParse` and `federation.DiasporaParseEncrypted` is used.
Diaspora has to main routes to receive entities: 1) /receive/public 2) /receive/private/:guid
If we receive something via 1) it will be in a xml format and can be parsed without encryption in the first place. If we receive a entity via 2) we have to decrypt the xml first. This is better described here: https://diaspora.github.io/diaspora_federation/federation/encryption.html
ActivityPub ¶
[...]
After we succesfully parsed the request we will end up with a `Message` interface which includes the `MessageBase` and can be type casted to every entity message. Afterwards all information can be retrieved via abstraction methods e.g. entity.Author()
Index ¶
- Constants
- Variables
- func DiasporaEncryptedMagicEnvelope(privKey *rsa.PrivateKey, pubKey *rsa.PublicKey, handle string, ...) (payload []byte, err error)
- func DiasporaFetchOrder(entity []byte) (string, error)
- func DiasporaMagicEnvelope(privKey *rsa.PrivateKey, handle string, plainXml []byte) (payload []byte, err error)
- func DiasporaSortByOrder(order string, entity []byte) (sorted []byte, err error)
- func FetchHtml(method, url string, body io.Reader) (resp *http.Response, err error)
- func FetchJson(method, url string, body io.Reader, result interface{}) error
- func FetchXml(method, url string, body io.Reader, result interface{}) error
- func SetConfig(userConfig Config)
- func SetLogger(writer LogWriter)
- type ActivityPubAccept
- type ActivityPubActor
- type ActivityPubActorEndpoints
- type ActivityPubActorIcon
- type ActivityPubActorPubKey
- type ActivityPubAttachment
- type ActivityPubBase
- type ActivityPubCollection
- type ActivityPubCollectionPage
- type ActivityPubContext
- type ActivityPubCreate
- func (e *ActivityPubCreate) Author() string
- func (e *ActivityPubCreate) Marshal(priv *rsa.PrivateKey, pub *rsa.PublicKey) ([]byte, error)
- func (e *ActivityPubCreate) Recipients() []string
- func (e *ActivityPubCreate) Send(inbox string, priv *rsa.PrivateKey, pub *rsa.PublicKey) error
- func (e *ActivityPubCreate) SetAuthor(author string)
- func (e *ActivityPubCreate) SetRecipients(recipients []string)
- func (e *ActivityPubCreate) Unmarshal(b []byte) error
- type ActivityPubCreateComment
- func (e *ActivityPubCreateComment) CreatedAt() helpers.Time
- func (e *ActivityPubCreateComment) Guid() string
- func (e *ActivityPubCreateComment) Parent() string
- func (e *ActivityPubCreateComment) SetAuthor(author string)
- func (e *ActivityPubCreateComment) SetCreatedAt(createdAt time.Time)
- func (e *ActivityPubCreateComment) SetGuid(guid string)
- func (e *ActivityPubCreateComment) SetParent(guid string)
- func (e *ActivityPubCreateComment) SetSignature(priv *rsa.PrivateKey) error
- func (e *ActivityPubCreateComment) SetText(text string)
- func (e *ActivityPubCreateComment) Signature() string
- func (e *ActivityPubCreateComment) SignatureOrder() string
- func (e *ActivityPubCreateComment) Text() string
- func (e *ActivityPubCreateComment) Type() MessageType
- type ActivityPubCreatePost
- func (e *ActivityPubCreatePost) CreatedAt() helpers.Time
- func (e *ActivityPubCreatePost) FilePaths() (files []string)
- func (e *ActivityPubCreatePost) Guid() string
- func (e *ActivityPubCreatePost) Provider() string
- func (e *ActivityPubCreatePost) Public() bool
- func (e *ActivityPubCreatePost) SetAuthor(author string)
- func (e *ActivityPubCreatePost) SetCreatedAt(createdAt time.Time)
- func (e *ActivityPubCreatePost) SetGuid(guid string)
- func (e *ActivityPubCreatePost) SetProvider(provider string)
- func (e *ActivityPubCreatePost) SetPublic(public bool)
- func (e *ActivityPubCreatePost) SetText(text string)
- func (e *ActivityPubCreatePost) Text() string
- func (e *ActivityPubCreatePost) Type() MessageType
- type ActivityPubFollow
- func (e *ActivityPubFollow) Author() string
- func (e *ActivityPubFollow) Marshal(priv *rsa.PrivateKey, pub *rsa.PublicKey) ([]byte, error)
- func (e *ActivityPubFollow) Recipient() string
- func (e *ActivityPubFollow) Send(inbox string, priv *rsa.PrivateKey, pub *rsa.PublicKey) error
- func (e *ActivityPubFollow) SetAuthor(author string)
- func (e *ActivityPubFollow) SetRecipient(recipient string)
- func (e *ActivityPubFollow) SetSharing(sharing bool)
- func (e *ActivityPubFollow) Sharing() bool
- func (e *ActivityPubFollow) Type() MessageType
- func (e *ActivityPubFollow) Unmarshal(b []byte) error
- type ActivityPubLike
- func (e *ActivityPubLike) Author() string
- func (e *ActivityPubLike) Guid() string
- func (e *ActivityPubLike) Marshal(priv *rsa.PrivateKey, pub *rsa.PublicKey) ([]byte, error)
- func (e *ActivityPubLike) Parent() string
- func (e *ActivityPubLike) Positive() bool
- func (e *ActivityPubLike) Send(inbox string, priv *rsa.PrivateKey, pub *rsa.PublicKey) error
- func (e *ActivityPubLike) SetAuthor(author string)
- func (e *ActivityPubLike) SetGuid(guid string)
- func (e *ActivityPubLike) SetParent(guid string)
- func (e *ActivityPubLike) SetPositive(positive bool)
- func (e *ActivityPubLike) SetSignature(priv *rsa.PrivateKey) error
- func (e *ActivityPubLike) Signature() string
- func (e *ActivityPubLike) SignatureOrder() string
- func (e *ActivityPubLike) Type() MessageType
- func (e *ActivityPubLike) Unmarshal(b []byte) error
- type ActivityPubMessage
- type ActivityPubNote
- type ActivityPubNoteTag
- type ActivityPubNoteTags
- type ActivityPubRetract
- func (e *ActivityPubRetract) Author() string
- func (e *ActivityPubRetract) Marshal(priv *rsa.PrivateKey, pub *rsa.PublicKey) ([]byte, error)
- func (e *ActivityPubRetract) ParentGuid() string
- func (e *ActivityPubRetract) ParentType() EntityType
- func (e *ActivityPubRetract) Send(inbox string, priv *rsa.PrivateKey, pub *rsa.PublicKey) error
- func (e *ActivityPubRetract) SetAuthor(author string)
- func (e *ActivityPubRetract) SetParentGuid(guid string)
- func (e *ActivityPubRetract) SetParentType(entityType EntityType)
- func (e *ActivityPubRetract) Type() MessageType
- func (e *ActivityPubRetract) Unmarshal(b []byte) error
- type ActivityPubUpdate
- func (actor *ActivityPubUpdate) Author() string
- func (actor *ActivityPubUpdate) Bio() string
- func (actor *ActivityPubUpdate) Birthday() string
- func (actor *ActivityPubUpdate) FirstName() string
- func (actor *ActivityPubUpdate) Gender() string
- func (actor *ActivityPubUpdate) ImageUrl() string
- func (actor *ActivityPubUpdate) LastName() string
- func (actor *ActivityPubUpdate) Location() string
- func (actor *ActivityPubUpdate) Marshal(priv *rsa.PrivateKey, pub *rsa.PublicKey) ([]byte, error)
- func (actor *ActivityPubUpdate) Nsfw() bool
- func (actor *ActivityPubUpdate) Public() bool
- func (actor *ActivityPubUpdate) Send(inbox string, priv *rsa.PrivateKey, pub *rsa.PublicKey) error
- func (actor *ActivityPubUpdate) SetAuthor(author string)
- func (actor *ActivityPubUpdate) Type() MessageType
- func (actor *ActivityPubUpdate) Unmarshal(b []byte) error
- type Config
- type DiasporaAes
- type DiasporaAesWrapper
- type DiasporaComment
- func (e *DiasporaComment) Author() string
- func (e *DiasporaComment) CreatedAt() helpers.Time
- func (e *DiasporaComment) Guid() string
- func (e *DiasporaComment) Marshal(priv *rsa.PrivateKey, pub *rsa.PublicKey) (payload []byte, err error)
- func (e *DiasporaComment) Parent() string
- func (e *DiasporaComment) Recipients() []string
- func (e *DiasporaComment) Send(inbox string, priv *rsa.PrivateKey, pub *rsa.PublicKey) error
- func (e *DiasporaComment) SetAuthor(author string)
- func (e *DiasporaComment) SetCreatedAt(createdAt time.Time)
- func (e *DiasporaComment) SetGuid(guid string)
- func (e *DiasporaComment) SetParent(guid string)
- func (e *DiasporaComment) SetRecipients(recipients []string)
- func (e *DiasporaComment) SetSignature(priv *rsa.PrivateKey) error
- func (e *DiasporaComment) SetText(text string)
- func (e *DiasporaComment) Signature() string
- func (e *DiasporaComment) SignatureOrder() string
- func (e *DiasporaComment) Text() string
- func (e *DiasporaComment) Type() MessageType
- func (e *DiasporaComment) Unmarshal(b []byte) error
- type DiasporaContact
- func (e *DiasporaContact) Author() string
- func (e *DiasporaContact) Marshal(priv *rsa.PrivateKey, pub *rsa.PublicKey) ([]byte, error)
- func (e *DiasporaContact) Recipient() string
- func (e *DiasporaContact) Send(inbox string, priv *rsa.PrivateKey, pub *rsa.PublicKey) error
- func (e *DiasporaContact) SetAuthor(author string)
- func (e *DiasporaContact) SetRecipient(recipient string)
- func (e *DiasporaContact) SetSharing(sharing bool)
- func (e *DiasporaContact) Sharing() bool
- func (e *DiasporaContact) Type() MessageType
- func (e *DiasporaContact) Unmarshal(b []byte) error
- type DiasporaEntity
- type DiasporaEvent
- type DiasporaLike
- func (e *DiasporaLike) Author() string
- func (e *DiasporaLike) Guid() string
- func (e *DiasporaLike) Marshal(priv *rsa.PrivateKey, pub *rsa.PublicKey) (payload []byte, err error)
- func (e *DiasporaLike) Parent() string
- func (e *DiasporaLike) Positive() bool
- func (e *DiasporaLike) Send(inbox string, priv *rsa.PrivateKey, pub *rsa.PublicKey) error
- func (e *DiasporaLike) SetAuthor(author string)
- func (e *DiasporaLike) SetGuid(guid string)
- func (e *DiasporaLike) SetParent(guid string)
- func (e *DiasporaLike) SetPositive(positive bool)
- func (e *DiasporaLike) SetSignature(priv *rsa.PrivateKey) error
- func (e *DiasporaLike) Signature() string
- func (e *DiasporaLike) SignatureOrder() string
- func (e *DiasporaLike) Type() MessageType
- func (e *DiasporaLike) Unmarshal(b []byte) error
- type DiasporaLocation
- type DiasporaMessage
- type DiasporaPhoto
- type DiasporaPhotos
- type DiasporaPoll
- type DiasporaPollAnswer
- type DiasporaProfile
- func (e *DiasporaProfile) Author() string
- func (e *DiasporaProfile) Bio() string
- func (e *DiasporaProfile) Birthday() string
- func (e *DiasporaProfile) FirstName() string
- func (e *DiasporaProfile) Gender() string
- func (e *DiasporaProfile) ImageUrl() string
- func (e *DiasporaProfile) LastName() string
- func (e *DiasporaProfile) Location() string
- func (e *DiasporaProfile) Marshal(priv *rsa.PrivateKey, pub *rsa.PublicKey) ([]byte, error)
- func (e *DiasporaProfile) Nsfw() bool
- func (e *DiasporaProfile) Public() bool
- func (e *DiasporaProfile) Send(inbox string, priv *rsa.PrivateKey, pub *rsa.PublicKey) error
- func (e *DiasporaProfile) SetAuthor(author string)
- func (e *DiasporaProfile) Type() MessageType
- func (e *DiasporaProfile) Unmarshal(b []byte) error
- type DiasporaReshare
- func (e *DiasporaReshare) Author() string
- func (e *DiasporaReshare) CreatedAt() helpers.Time
- func (e *DiasporaReshare) Guid() string
- func (e *DiasporaReshare) Marshal(priv *rsa.PrivateKey, pub *rsa.PublicKey) ([]byte, error)
- func (e *DiasporaReshare) Parent() string
- func (e *DiasporaReshare) ParentAuthor() string
- func (e *DiasporaReshare) Send(inbox string, priv *rsa.PrivateKey, pub *rsa.PublicKey) error
- func (e *DiasporaReshare) SetAuthor(author string)
- func (e *DiasporaReshare) SetCreatedAt(createdAt time.Time)
- func (e *DiasporaReshare) SetGuid(guid string)
- func (e *DiasporaReshare) SetParent(guid string)
- func (e *DiasporaReshare) SetParentAuthor(author string)
- func (e *DiasporaReshare) Type() MessageType
- func (e *DiasporaReshare) Unmarshal(b []byte) error
- type DiasporaRetraction
- func (e *DiasporaRetraction) Author() string
- func (e *DiasporaRetraction) Marshal(priv *rsa.PrivateKey, pub *rsa.PublicKey) ([]byte, error)
- func (e *DiasporaRetraction) ParentGuid() string
- func (e *DiasporaRetraction) ParentType() EntityType
- func (e *DiasporaRetraction) Send(inbox string, priv *rsa.PrivateKey, pub *rsa.PublicKey) error
- func (e *DiasporaRetraction) SetAuthor(author string)
- func (e *DiasporaRetraction) SetParentGuid(guid string)
- func (e *DiasporaRetraction) SetParentType(parentType EntityType)
- func (e *DiasporaRetraction) Type() MessageType
- func (e *DiasporaRetraction) Unmarshal(b []byte) error
- type DiasporaStatusMessage
- func (e *DiasporaStatusMessage) Author() string
- func (e *DiasporaStatusMessage) CreatedAt() helpers.Time
- func (e *DiasporaStatusMessage) FilePaths() (result []string)
- func (e *DiasporaStatusMessage) Guid() string
- func (e *DiasporaStatusMessage) Marshal(priv *rsa.PrivateKey, pub *rsa.PublicKey) ([]byte, error)
- func (e *DiasporaStatusMessage) Provider() string
- func (e *DiasporaStatusMessage) Public() bool
- func (e *DiasporaStatusMessage) Recipients() []string
- func (e *DiasporaStatusMessage) Send(inbox string, priv *rsa.PrivateKey, pub *rsa.PublicKey) error
- func (e *DiasporaStatusMessage) SetAuthor(author string)
- func (e *DiasporaStatusMessage) SetCreatedAt(createdAt time.Time)
- func (e *DiasporaStatusMessage) SetGuid(guid string)
- func (e *DiasporaStatusMessage) SetProvider(provider string)
- func (e *DiasporaStatusMessage) SetPublic(public bool)
- func (e *DiasporaStatusMessage) SetRecipients(recipient []string)
- func (e *DiasporaStatusMessage) SetText(text string)
- func (e *DiasporaStatusMessage) Text() string
- func (e *DiasporaStatusMessage) Type() MessageType
- func (e *DiasporaStatusMessage) Unmarshal(b []byte) error
- type DiasporaXmlOrder
- type DiasporaXmlOrderLine
- type EntityType
- type Hcard
- type HttpClient
- type LogWriter
- type Logger
- type Message
- type MessageBase
- type MessageComment
- type MessageContact
- type MessageLike
- type MessagePost
- type MessageProfile
- type MessageRelayable
- type MessageReshare
- type MessageRetract
- type MessageType
- type Protocol
- type WebFinger
- type WebfingerData
- type WebfingerDataLink
Constants ¶
const ( CONTENT_TYPE_ENVELOPE = "application/magic-envelope+xml" CONTENT_TYPE_JSON = "application/json" CONTENT_TYPE_JSONLD = "application/ld+json" CONTENT_TYPE_TEXTHTML = "text/html" CONTENT_TYPE_XRDXML = "application/xrd+xml" USER_AGENT = "GangGo/v0 (Federation library)" )
const ( LOG_C_TUR = "\033[0;36m" LOG_C_RED = "\033[31m" LOG_C_YELLOW = "\033[33m" LOG_C_RESET = "\033[0m" )
const ( HttpApHeader = "x-ap-object" // protocols DiasporaProtocol Protocol = 100 + iota ActivityPubProtocol // entity names Retraction EntityType = "retraction" Profile EntityType = "profile" StatusMessage EntityType = "status_message" Comment EntityType = "comment" Like EntityType = "like" Contact EntityType = "contact" Unknown EntityType = "unknown" // webfinger WebFingerOstatus = "http://ostatus.org/schema/1.0/subscribe" WebFingerHcard = "http://microformats.org/profile/hcard" WebFingerDiaspora = "http://joindiaspora.com/seed_location" WebFingerSelf = "self" // signatures SignatureDelimiter = "." SignatureAuthorDelimiter = ";" SignatureHTTPDelimiter = "\n" )
const ( XMLNS = "https://joindiaspora.com/protocol" XMLNS_ME = "http://salmon-protocol.org/ns/magic-env" APPLICATION_XML = "application/xml" BASE64_URL = "base64url" RSA_SHA256 = "RSA-SHA256" )
Diaspora
const ( ACTIVITY_STREAMS = "https://www.w3.org/ns/activitystreams" ACTIVITY_STREAMS_PUBLIC = ACTIVITY_STREAMS + "#Public" ActivityTypeUndo = "Undo" ActivityTypeFollow = "Follow" ActivityTypeDelete = "Delete" ActivityTypeAccept = "Accept" ActivityTypeCreate = "Create" ActivityTypeUpdate = "Update" ActivityTypeLike = "Like" ActivityTypeNote = "Note" ActivityTypePerson = "Person" ActivityTypeCollection = "Collection" ActivityTypeOrderedCollection = "OrderedCollection" ActivityTypeCollectionPage = "CollectionPage" ActivityTypeOrderedCollectionPage = "OrderedCollectionPage" )
ActivityPub
Variables ¶
var ( ERR_APU_MISSING_OBJT = errors.New("missing object attribute in request") ERR_APU_MISSING_TYPE = errors.New("missing type in request") ERR_APU_MISSING_ATTR = errors.New("missing attribute in body") ERR_INVALID_ENDPOINT = errors.New("endpoint is invalid") ERR_TYPE_CAST = errors.New("cannot type cast") ERR_NOT_IMPLEMENTED = errors.New("not implemented") )
Functions ¶
func DiasporaFetchOrder ¶
func DiasporaMagicEnvelope ¶
func DiasporaSortByOrder ¶
Types ¶
type ActivityPubAccept ¶
type ActivityPubAccept struct { ActivityPubContext Actor string `json:"actor"` Object ActivityPubFollow `json:"object"` }
func (*ActivityPubAccept) Marshal ¶
func (e *ActivityPubAccept) Marshal(priv *rsa.PrivateKey, pub *rsa.PublicKey) ([]byte, error)
func (*ActivityPubAccept) Unmarshal ¶
func (e *ActivityPubAccept) Unmarshal(b []byte) error
type ActivityPubActor ¶
type ActivityPubActor struct { ActivityPubContext Inbox string `json:"inbox"` Outbox string `json:"outbox"` Following string `json:"following"` Followers string `json:"followers"` PreferredUsername *string `json:"preferredUsername,omitempty"` Name *string `json:"name,omitempty"` Summary *string `json:"summary,omitempty"` Url *string `json:"url,omitempty"` PublicKey *ActivityPubActorPubKey `json:"publicKey,omitempty"` Icon *ActivityPubActorIcon `json:"icon,omitempty"` Endpoints *ActivityPubActorEndpoints `json:"endpoints,omitempty"` }
type ActivityPubActorEndpoints ¶
type ActivityPubActorEndpoints struct {
}type ActivityPubActorIcon ¶
type ActivityPubActorIcon struct {
Url string `json:"url"`
}
type ActivityPubActorPubKey ¶
type ActivityPubAttachment ¶
type ActivityPubBase ¶
type ActivityPubCollection ¶
type ActivityPubCollection struct { ActivityPubContext TotalItems int `json:"totalItems"` First *string `json:"first,omitempty"` }
type ActivityPubCollectionPage ¶
type ActivityPubCollectionPage struct { ActivityPubContext TotalItems int `json:"totalItems"` Next *string `json:"next,omitempty"` PartOf string `json:"partOf"` Items interface{} `json:"items,omitempty"` OrderedItems interface{} `json:"orderedItems,omitempty"` }
type ActivityPubContext ¶
type ActivityPubContext struct { Context []interface{} `json:"@context"` ActivityPubBase }
type ActivityPubCreate ¶
type ActivityPubCreate struct { ActivityPubContext `json:",omitempty"` Actor string `json:"actor"` Published helpers.Time `json:"published"` To []string `json:"to"` Cc []string `json:"cc"` Object ActivityPubNote `json:"object"` }
func (*ActivityPubCreate) Author ¶
func (e *ActivityPubCreate) Author() string
func (*ActivityPubCreate) Marshal ¶
func (e *ActivityPubCreate) Marshal(priv *rsa.PrivateKey, pub *rsa.PublicKey) ([]byte, error)
func (*ActivityPubCreate) Recipients ¶
func (e *ActivityPubCreate) Recipients() []string
func (*ActivityPubCreate) Send ¶
func (e *ActivityPubCreate) Send(inbox string, priv *rsa.PrivateKey, pub *rsa.PublicKey) error
func (*ActivityPubCreate) SetAuthor ¶
func (e *ActivityPubCreate) SetAuthor(author string)
func (*ActivityPubCreate) SetRecipients ¶
func (e *ActivityPubCreate) SetRecipients(recipients []string)
func (*ActivityPubCreate) Unmarshal ¶
func (e *ActivityPubCreate) Unmarshal(b []byte) error
type ActivityPubCreateComment ¶
type ActivityPubCreateComment struct {
ActivityPubCreate
}
func (*ActivityPubCreateComment) CreatedAt ¶
func (e *ActivityPubCreateComment) CreatedAt() helpers.Time
func (*ActivityPubCreateComment) Guid ¶
func (e *ActivityPubCreateComment) Guid() string
func (*ActivityPubCreateComment) Parent ¶
func (e *ActivityPubCreateComment) Parent() string
func (*ActivityPubCreateComment) SetAuthor ¶
func (e *ActivityPubCreateComment) SetAuthor(author string)
func (*ActivityPubCreateComment) SetCreatedAt ¶
func (e *ActivityPubCreateComment) SetCreatedAt(createdAt time.Time)
func (*ActivityPubCreateComment) SetGuid ¶
func (e *ActivityPubCreateComment) SetGuid(guid string)
func (*ActivityPubCreateComment) SetParent ¶
func (e *ActivityPubCreateComment) SetParent(guid string)
func (*ActivityPubCreateComment) SetSignature ¶
func (e *ActivityPubCreateComment) SetSignature(priv *rsa.PrivateKey) error
func (*ActivityPubCreateComment) SetText ¶
func (e *ActivityPubCreateComment) SetText(text string)
func (*ActivityPubCreateComment) Signature ¶
func (e *ActivityPubCreateComment) Signature() string
func (*ActivityPubCreateComment) SignatureOrder ¶
func (e *ActivityPubCreateComment) SignatureOrder() string
func (*ActivityPubCreateComment) Text ¶
func (e *ActivityPubCreateComment) Text() string
func (*ActivityPubCreateComment) Type ¶
func (e *ActivityPubCreateComment) Type() MessageType
type ActivityPubCreatePost ¶
type ActivityPubCreatePost struct {
ActivityPubCreate
}
func (*ActivityPubCreatePost) CreatedAt ¶
func (e *ActivityPubCreatePost) CreatedAt() helpers.Time
func (*ActivityPubCreatePost) FilePaths ¶
func (e *ActivityPubCreatePost) FilePaths() (files []string)
func (*ActivityPubCreatePost) Guid ¶
func (e *ActivityPubCreatePost) Guid() string
func (*ActivityPubCreatePost) Provider ¶
func (e *ActivityPubCreatePost) Provider() string
func (*ActivityPubCreatePost) Public ¶
func (e *ActivityPubCreatePost) Public() bool
func (*ActivityPubCreatePost) SetAuthor ¶
func (e *ActivityPubCreatePost) SetAuthor(author string)
func (*ActivityPubCreatePost) SetCreatedAt ¶
func (e *ActivityPubCreatePost) SetCreatedAt(createdAt time.Time)
func (*ActivityPubCreatePost) SetGuid ¶
func (e *ActivityPubCreatePost) SetGuid(guid string)
func (*ActivityPubCreatePost) SetProvider ¶
func (e *ActivityPubCreatePost) SetProvider(provider string)
func (*ActivityPubCreatePost) SetPublic ¶
func (e *ActivityPubCreatePost) SetPublic(public bool)
func (*ActivityPubCreatePost) SetText ¶
func (e *ActivityPubCreatePost) SetText(text string)
func (*ActivityPubCreatePost) Text ¶
func (e *ActivityPubCreatePost) Text() string
func (*ActivityPubCreatePost) Type ¶
func (e *ActivityPubCreatePost) Type() MessageType
type ActivityPubFollow ¶
type ActivityPubFollow struct { ActivityPubContext Actor string `json:"actor"` Object string `json:"object"` Following helpers.ReadOnlyBool }
func (*ActivityPubFollow) Author ¶
func (e *ActivityPubFollow) Author() string
func (*ActivityPubFollow) Marshal ¶
func (e *ActivityPubFollow) Marshal(priv *rsa.PrivateKey, pub *rsa.PublicKey) ([]byte, error)
func (*ActivityPubFollow) Recipient ¶
func (e *ActivityPubFollow) Recipient() string
func (*ActivityPubFollow) Send ¶
func (e *ActivityPubFollow) Send(inbox string, priv *rsa.PrivateKey, pub *rsa.PublicKey) error
func (*ActivityPubFollow) SetAuthor ¶
func (e *ActivityPubFollow) SetAuthor(author string)
func (*ActivityPubFollow) SetRecipient ¶
func (e *ActivityPubFollow) SetRecipient(recipient string)
func (*ActivityPubFollow) SetSharing ¶
func (e *ActivityPubFollow) SetSharing(sharing bool)
func (*ActivityPubFollow) Sharing ¶
func (e *ActivityPubFollow) Sharing() bool
func (*ActivityPubFollow) Type ¶
func (e *ActivityPubFollow) Type() MessageType
func (*ActivityPubFollow) Unmarshal ¶
func (e *ActivityPubFollow) Unmarshal(b []byte) error
type ActivityPubLike ¶
type ActivityPubLike struct { ActivityPubContext Actor string `json:"actor"` Object string `json:"object"` }
func (*ActivityPubLike) Author ¶
func (e *ActivityPubLike) Author() string
func (*ActivityPubLike) Guid ¶
func (e *ActivityPubLike) Guid() string
func (*ActivityPubLike) Marshal ¶
func (e *ActivityPubLike) Marshal(priv *rsa.PrivateKey, pub *rsa.PublicKey) ([]byte, error)
func (*ActivityPubLike) Parent ¶
func (e *ActivityPubLike) Parent() string
func (*ActivityPubLike) Positive ¶
func (e *ActivityPubLike) Positive() bool
func (*ActivityPubLike) Send ¶
func (e *ActivityPubLike) Send(inbox string, priv *rsa.PrivateKey, pub *rsa.PublicKey) error
func (*ActivityPubLike) SetAuthor ¶
func (e *ActivityPubLike) SetAuthor(author string)
func (*ActivityPubLike) SetGuid ¶
func (e *ActivityPubLike) SetGuid(guid string)
func (*ActivityPubLike) SetParent ¶
func (e *ActivityPubLike) SetParent(guid string)
func (*ActivityPubLike) SetPositive ¶
func (e *ActivityPubLike) SetPositive(positive bool)
func (*ActivityPubLike) SetSignature ¶
func (e *ActivityPubLike) SetSignature(priv *rsa.PrivateKey) error
func (*ActivityPubLike) Signature ¶
func (e *ActivityPubLike) Signature() string
func (*ActivityPubLike) SignatureOrder ¶
func (e *ActivityPubLike) SignatureOrder() string
func (*ActivityPubLike) Type ¶
func (e *ActivityPubLike) Type() MessageType
func (*ActivityPubLike) Unmarshal ¶
func (e *ActivityPubLike) Unmarshal(b []byte) error
type ActivityPubMessage ¶
type ActivityPubMessage struct {
// contains filtered or unexported fields
}
func ActivityPubParse ¶
func ActivityPubParse(r *http.Request) (m ActivityPubMessage, err error)
func (ActivityPubMessage) Entity ¶
func (m ActivityPubMessage) Entity() MessageBase
func (ActivityPubMessage) Parse ¶
func (m ActivityPubMessage) Parse(body []byte) (MessageBase, error)
func (ActivityPubMessage) Type ¶
func (m ActivityPubMessage) Type() MessageType
func (ActivityPubMessage) ValidSignature ¶
func (m ActivityPubMessage) ValidSignature(pub *rsa.PublicKey) bool
type ActivityPubNote ¶
type ActivityPubNote struct { ActivityPubBase `json:",omitempty"` Actor string `json:"actor,omitempty"` Summary string `json:"summary"` Content string `json:"content"` InReplyTo string `json:"inReplyTo"` Published helpers.Time `json:"published"` Url string `json:"url"` AttributedTo string `json:"attributedTo"` // NOTE mastodon is not using it ?? // see Public method for current implementation Sensitive bool `json:"sensitive"` To []string `json:"to"` Cc []string `json:"cc"` Attachment []ActivityPubAttachment `json:"attachment,omitempty"` Tags *ActivityPubNoteTags `json:"tag,omitempty"` }
type ActivityPubNoteTag ¶
type ActivityPubNoteTags ¶
type ActivityPubNoteTags []ActivityPubNoteTag
type ActivityPubRetract ¶
type ActivityPubRetract struct { ActivityPubContext Actor string `json:"actor"` Object map[string]interface{} `json:"object"` }
func (*ActivityPubRetract) Author ¶
func (e *ActivityPubRetract) Author() string
func (*ActivityPubRetract) Marshal ¶
func (e *ActivityPubRetract) Marshal(priv *rsa.PrivateKey, pub *rsa.PublicKey) ([]byte, error)
func (*ActivityPubRetract) ParentGuid ¶
func (e *ActivityPubRetract) ParentGuid() string
func (*ActivityPubRetract) ParentType ¶
func (e *ActivityPubRetract) ParentType() EntityType
func (*ActivityPubRetract) Send ¶
func (e *ActivityPubRetract) Send(inbox string, priv *rsa.PrivateKey, pub *rsa.PublicKey) error
func (*ActivityPubRetract) SetAuthor ¶
func (e *ActivityPubRetract) SetAuthor(author string)
func (*ActivityPubRetract) SetParentGuid ¶
func (e *ActivityPubRetract) SetParentGuid(guid string)
func (*ActivityPubRetract) SetParentType ¶
func (e *ActivityPubRetract) SetParentType(entityType EntityType)
func (*ActivityPubRetract) Type ¶
func (e *ActivityPubRetract) Type() MessageType
func (*ActivityPubRetract) Unmarshal ¶
func (e *ActivityPubRetract) Unmarshal(b []byte) error
type ActivityPubUpdate ¶
type ActivityPubUpdate struct { ActivityPubContext Actor string `json:"actor"` Object ActivityPubActor `json:"object"` }
func (*ActivityPubUpdate) Author ¶
func (actor *ActivityPubUpdate) Author() string
func (*ActivityPubUpdate) Bio ¶
func (actor *ActivityPubUpdate) Bio() string
func (*ActivityPubUpdate) Birthday ¶
func (actor *ActivityPubUpdate) Birthday() string
func (*ActivityPubUpdate) FirstName ¶
func (actor *ActivityPubUpdate) FirstName() string
func (*ActivityPubUpdate) Gender ¶
func (actor *ActivityPubUpdate) Gender() string
func (*ActivityPubUpdate) ImageUrl ¶
func (actor *ActivityPubUpdate) ImageUrl() string
func (*ActivityPubUpdate) LastName ¶
func (actor *ActivityPubUpdate) LastName() string
func (*ActivityPubUpdate) Location ¶
func (actor *ActivityPubUpdate) Location() string
func (*ActivityPubUpdate) Marshal ¶
func (actor *ActivityPubUpdate) Marshal(priv *rsa.PrivateKey, pub *rsa.PublicKey) ([]byte, error)
func (*ActivityPubUpdate) Nsfw ¶
func (actor *ActivityPubUpdate) Nsfw() bool
func (*ActivityPubUpdate) Public ¶
func (actor *ActivityPubUpdate) Public() bool
func (*ActivityPubUpdate) Send ¶
func (actor *ActivityPubUpdate) Send(inbox string, priv *rsa.PrivateKey, pub *rsa.PublicKey) error
func (*ActivityPubUpdate) SetAuthor ¶
func (actor *ActivityPubUpdate) SetAuthor(author string)
func (*ActivityPubUpdate) Type ¶
func (actor *ActivityPubUpdate) Type() MessageType
func (*ActivityPubUpdate) Unmarshal ¶
func (actor *ActivityPubUpdate) Unmarshal(b []byte) error
type Config ¶
type Config struct {
Host, ApiVersion string
GuidURLFormat, ApURLFormat string
// contains filtered or unexported fields
}
func (*Config) GuidURLRegExp ¶
type DiasporaAes ¶
type DiasporaAes struct { Key string `json:"key,omitempty"` Iv string `json:"iv,omitempty"` Data string `json:"-"` }
func (DiasporaAes) Decrypt ¶
func (a DiasporaAes) Decrypt() (ciphertext []byte, err error)
func (*DiasporaAes) Encrypt ¶
func (a *DiasporaAes) Encrypt(data []byte) error
func (*DiasporaAes) Generate ¶
func (a *DiasporaAes) Generate() error
type DiasporaAesWrapper ¶
type DiasporaAesWrapper struct { AesKey string `json:"aes_key"` MagicEnvelope string `json:"encrypted_magic_envelope"` }
func (DiasporaAesWrapper) Decrypt ¶
func (w DiasporaAesWrapper) Decrypt(privKey *rsa.PrivateKey) (entityXML []byte, err error)
type DiasporaComment ¶
type DiasporaComment struct { XMLName xml.Name `xml:"comment"` EntityAuthor string `xml:"author"` EntityCreatedAt helpers.Time `xml:"created_at"` EntityGuid string `xml:"guid"` EntityParentGuid string `xml:"parent_guid"` EntityText string `xml:"text"` EntityAuthorSignature string `xml:"author_signature"` // store relayable signature order EntitySignatureOrder string `xml:"-"` // store original entity in case we relay it EntityRaw []byte `xml:"-"` }
func (*DiasporaComment) Author ¶
func (e *DiasporaComment) Author() string
func (*DiasporaComment) CreatedAt ¶
func (e *DiasporaComment) CreatedAt() helpers.Time
func (*DiasporaComment) Guid ¶
func (e *DiasporaComment) Guid() string
func (*DiasporaComment) Marshal ¶
func (e *DiasporaComment) Marshal(priv *rsa.PrivateKey, pub *rsa.PublicKey) (payload []byte, err error)
func (*DiasporaComment) Parent ¶
func (e *DiasporaComment) Parent() string
func (*DiasporaComment) Recipients ¶
func (e *DiasporaComment) Recipients() []string
func (*DiasporaComment) Send ¶
func (e *DiasporaComment) Send(inbox string, priv *rsa.PrivateKey, pub *rsa.PublicKey) error
func (*DiasporaComment) SetAuthor ¶
func (e *DiasporaComment) SetAuthor(author string)
func (*DiasporaComment) SetCreatedAt ¶
func (e *DiasporaComment) SetCreatedAt(createdAt time.Time)
func (*DiasporaComment) SetGuid ¶
func (e *DiasporaComment) SetGuid(guid string)
func (*DiasporaComment) SetParent ¶
func (e *DiasporaComment) SetParent(guid string)
func (*DiasporaComment) SetRecipients ¶
func (e *DiasporaComment) SetRecipients(recipients []string)
func (*DiasporaComment) SetSignature ¶
func (e *DiasporaComment) SetSignature(priv *rsa.PrivateKey) error
func (*DiasporaComment) SetText ¶
func (e *DiasporaComment) SetText(text string)
func (*DiasporaComment) Signature ¶
func (e *DiasporaComment) Signature() string
func (*DiasporaComment) SignatureOrder ¶
func (e *DiasporaComment) SignatureOrder() string
func (*DiasporaComment) Text ¶
func (e *DiasporaComment) Text() string
func (*DiasporaComment) Type ¶
func (e *DiasporaComment) Type() MessageType
func (*DiasporaComment) Unmarshal ¶
func (e *DiasporaComment) Unmarshal(b []byte) error
type DiasporaContact ¶
type DiasporaContact struct { XMLName xml.Name `xml:"contact"` EntityAuthor string `xml:"author"` EntityRecipient string `xml:"recipient"` EntityFollowing bool `xml:"following"` EntitySharing bool `xml:"sharing"` EntityBlocking bool `xml:"blocking"` }
func (*DiasporaContact) Author ¶
func (e *DiasporaContact) Author() string
func (*DiasporaContact) Marshal ¶
func (e *DiasporaContact) Marshal(priv *rsa.PrivateKey, pub *rsa.PublicKey) ([]byte, error)
func (*DiasporaContact) Recipient ¶
func (e *DiasporaContact) Recipient() string
func (*DiasporaContact) Send ¶
func (e *DiasporaContact) Send(inbox string, priv *rsa.PrivateKey, pub *rsa.PublicKey) error
func (*DiasporaContact) SetAuthor ¶
func (e *DiasporaContact) SetAuthor(author string)
func (*DiasporaContact) SetRecipient ¶
func (e *DiasporaContact) SetRecipient(recipient string)
func (*DiasporaContact) SetSharing ¶
func (e *DiasporaContact) SetSharing(sharing bool)
func (*DiasporaContact) Sharing ¶
func (e *DiasporaContact) Sharing() bool
func (*DiasporaContact) Type ¶
func (e *DiasporaContact) Type() MessageType
func (*DiasporaContact) Unmarshal ¶
func (e *DiasporaContact) Unmarshal(b []byte) error
type DiasporaEntity ¶
type DiasporaEntity struct { XMLName xml.Name // Use custom unmarshaler for xml fetch XMLName // and decide which entity to use Type string `xml:"-"` SignatureOrder string `xml:"-"` Data MessageBase `xml:"-"` DataRaw []byte `xml:"-"` }
func (*DiasporaEntity) UnmarshalXML ¶
func (e *DiasporaEntity) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error
type DiasporaEvent ¶
type DiasporaEvent struct { Author string `xml:"author"` Guid string `xml:"guid"` Summary string `xml:"summary"` Start helpers.Time `xml:"start"` End helpers.Time `xml:"end"` AllDay bool `xml:"all_day"` Timezone string `xml:"timezone"` Description string `xml:"description"` Location *DiasporaLocation `xml:"location,omitempty"` }
type DiasporaLike ¶
type DiasporaLike struct { XMLName xml.Name `xml:"like"` EntityPositive bool `xml:"positive"` EntityGuid string `xml:"guid"` EntityParentGuid string `xml:"parent_guid"` EntityParentType string `xml:"parent_type"` EntityAuthor string `xml:"author"` EntityAuthorSignature string `xml:"author_signature"` // store relayable signature order EntitySignatureOrder string `xml:"-"` // store original entity in case we relay it EntityRaw []byte `xml:"-"` }
func (*DiasporaLike) Author ¶
func (e *DiasporaLike) Author() string
func (*DiasporaLike) Guid ¶
func (e *DiasporaLike) Guid() string
func (*DiasporaLike) Marshal ¶
func (e *DiasporaLike) Marshal(priv *rsa.PrivateKey, pub *rsa.PublicKey) (payload []byte, err error)
func (*DiasporaLike) Parent ¶
func (e *DiasporaLike) Parent() string
func (*DiasporaLike) Positive ¶
func (e *DiasporaLike) Positive() bool
func (*DiasporaLike) Send ¶
func (e *DiasporaLike) Send(inbox string, priv *rsa.PrivateKey, pub *rsa.PublicKey) error
func (*DiasporaLike) SetAuthor ¶
func (e *DiasporaLike) SetAuthor(author string)
func (*DiasporaLike) SetGuid ¶
func (e *DiasporaLike) SetGuid(guid string)
func (*DiasporaLike) SetParent ¶
func (e *DiasporaLike) SetParent(guid string)
func (*DiasporaLike) SetPositive ¶
func (e *DiasporaLike) SetPositive(positive bool)
func (*DiasporaLike) SetSignature ¶
func (e *DiasporaLike) SetSignature(priv *rsa.PrivateKey) error
func (*DiasporaLike) Signature ¶
func (e *DiasporaLike) Signature() string
func (*DiasporaLike) SignatureOrder ¶
func (e *DiasporaLike) SignatureOrder() string
func (*DiasporaLike) Type ¶
func (e *DiasporaLike) Type() MessageType
func (*DiasporaLike) Unmarshal ¶
func (e *DiasporaLike) Unmarshal(b []byte) error
type DiasporaLocation ¶
type DiasporaMessage ¶
type DiasporaMessage struct { XMLName xml.Name `xml:"me:env"` Me string `xml:"me,attr"` Data struct { XMLName xml.Name `xml:"me:data"` Type string `xml:"type,attr"` Data string `xml:",chardata"` } Encoding string `xml:"me:encoding"` Alg string `xml:"me:alg"` Sig struct { XMLName xml.Name `xml:"me:sig"` Sig string `xml:",chardata"` KeyId string `xml:"key_id,attr,omitempty"` } // contains filtered or unexported fields }
func DiasporaParse ¶
func DiasporaParse(raw []byte) (message DiasporaMessage, err error)
func DiasporaParseEncrypted ¶
func DiasporaParseEncrypted(raw []byte, privKey *rsa.PrivateKey) (message DiasporaMessage, err error)
func (DiasporaMessage) Entity ¶
func (m DiasporaMessage) Entity() MessageBase
func (*DiasporaMessage) Parse ¶
func (message *DiasporaMessage) Parse() error
func (DiasporaMessage) Type ¶
func (m DiasporaMessage) Type() MessageType
func (DiasporaMessage) ValidSignature ¶
func (message DiasporaMessage) ValidSignature(pub *rsa.PublicKey) bool
type DiasporaPhoto ¶
type DiasporaPhoto struct { Guid string `xml:"guid"` Author string `xml:"author"` Public bool `xml:"public"` CreatedAt helpers.Time `xml:"created_at"` RemotePhotoPath string `xml:"remote_photo_path"` RemotePhotoName string `xml:"remote_photo_name"` Text string `xml:"text"` StatusMessageGuid string `xml:"status_message_guid"` Height int `xml:"height"` Width int `xml:"width"` }
type DiasporaPhotos ¶
type DiasporaPhotos []DiasporaPhoto
type DiasporaPoll ¶
type DiasporaPoll struct { Guid string `xml:"guid"` Question string `xml:"question"` PollAnswers []DiasporaPollAnswer `xml:"poll_answers"` }
type DiasporaPollAnswer ¶
type DiasporaProfile ¶
type DiasporaProfile struct { XMLName xml.Name `xml:"profile"` EntityAuthor string `xml:"author"` EntityFirstName string `xml:"first_name"` EntityLastName string `xml:"last_name"` EntityImageUrl string `xml:"image_url"` EntityImageUrlMedium string `xml:"image_url_medium"` EntityImageUrlSmall string `xml:"image_url_small"` EntityBirthday string `xml:"birthday"` EntityGender string `xml:"gender"` EntityBio string `xml:"bio"` EntityLocation string `xml:"location"` EntitySearchable bool `xml:"searchable"` EntityPublic bool `xml:"public"` EntityNsfw bool `xml:"nsfw"` EntityTagString string `xml:"tag_string"` }
func (*DiasporaProfile) Author ¶
func (e *DiasporaProfile) Author() string
func (*DiasporaProfile) Bio ¶
func (e *DiasporaProfile) Bio() string
func (*DiasporaProfile) Birthday ¶
func (e *DiasporaProfile) Birthday() string
func (*DiasporaProfile) FirstName ¶
func (e *DiasporaProfile) FirstName() string
func (*DiasporaProfile) Gender ¶
func (e *DiasporaProfile) Gender() string
func (*DiasporaProfile) ImageUrl ¶
func (e *DiasporaProfile) ImageUrl() string
func (*DiasporaProfile) LastName ¶
func (e *DiasporaProfile) LastName() string
func (*DiasporaProfile) Location ¶
func (e *DiasporaProfile) Location() string
func (*DiasporaProfile) Marshal ¶
func (e *DiasporaProfile) Marshal(priv *rsa.PrivateKey, pub *rsa.PublicKey) ([]byte, error)
func (*DiasporaProfile) Nsfw ¶
func (e *DiasporaProfile) Nsfw() bool
func (*DiasporaProfile) Public ¶
func (e *DiasporaProfile) Public() bool
func (*DiasporaProfile) Send ¶
func (e *DiasporaProfile) Send(inbox string, priv *rsa.PrivateKey, pub *rsa.PublicKey) error
func (*DiasporaProfile) SetAuthor ¶
func (e *DiasporaProfile) SetAuthor(author string)
func (*DiasporaProfile) Type ¶
func (e *DiasporaProfile) Type() MessageType
func (*DiasporaProfile) Unmarshal ¶
func (e *DiasporaProfile) Unmarshal(b []byte) error
type DiasporaReshare ¶
type DiasporaReshare struct {}
func (*DiasporaReshare) Author ¶
func (e *DiasporaReshare) Author() string
func (*DiasporaReshare) CreatedAt ¶
func (e *DiasporaReshare) CreatedAt() helpers.Time
func (*DiasporaReshare) Guid ¶
func (e *DiasporaReshare) Guid() string
func (*DiasporaReshare) Marshal ¶
func (e *DiasporaReshare) Marshal(priv *rsa.PrivateKey, pub *rsa.PublicKey) ([]byte, error)
func (*DiasporaReshare) Parent ¶
func (e *DiasporaReshare) Parent() string
func (*DiasporaReshare) ParentAuthor ¶
func (e *DiasporaReshare) ParentAuthor() string
func (*DiasporaReshare) Send ¶
func (e *DiasporaReshare) Send(inbox string, priv *rsa.PrivateKey, pub *rsa.PublicKey) error
func (*DiasporaReshare) SetAuthor ¶
func (e *DiasporaReshare) SetAuthor(author string)
func (*DiasporaReshare) SetCreatedAt ¶
func (e *DiasporaReshare) SetCreatedAt(createdAt time.Time)
func (*DiasporaReshare) SetGuid ¶
func (e *DiasporaReshare) SetGuid(guid string)
func (*DiasporaReshare) SetParent ¶
func (e *DiasporaReshare) SetParent(guid string)
func (*DiasporaReshare) SetParentAuthor ¶
func (e *DiasporaReshare) SetParentAuthor(author string)
func (*DiasporaReshare) Type ¶
func (e *DiasporaReshare) Type() MessageType
func (*DiasporaReshare) Unmarshal ¶
func (e *DiasporaReshare) Unmarshal(b []byte) error
type DiasporaRetraction ¶
type DiasporaRetraction struct { XMLName xml.Name `xml:"retraction"` EntityAuthor string `xml:"author"` EntityTargetGuid string `xml:"target_guid"` EntityTargetType string `xml:"target_type"` }
func (*DiasporaRetraction) Author ¶
func (e *DiasporaRetraction) Author() string
func (*DiasporaRetraction) Marshal ¶
func (e *DiasporaRetraction) Marshal(priv *rsa.PrivateKey, pub *rsa.PublicKey) ([]byte, error)
func (*DiasporaRetraction) ParentGuid ¶
func (e *DiasporaRetraction) ParentGuid() string
func (*DiasporaRetraction) ParentType ¶
func (e *DiasporaRetraction) ParentType() EntityType
func (*DiasporaRetraction) Send ¶
func (e *DiasporaRetraction) Send(inbox string, priv *rsa.PrivateKey, pub *rsa.PublicKey) error
func (*DiasporaRetraction) SetAuthor ¶
func (e *DiasporaRetraction) SetAuthor(author string)
func (*DiasporaRetraction) SetParentGuid ¶
func (e *DiasporaRetraction) SetParentGuid(guid string)
func (*DiasporaRetraction) SetParentType ¶
func (e *DiasporaRetraction) SetParentType(parentType EntityType)
func (*DiasporaRetraction) Type ¶
func (e *DiasporaRetraction) Type() MessageType
func (*DiasporaRetraction) Unmarshal ¶
func (e *DiasporaRetraction) Unmarshal(b []byte) error
type DiasporaStatusMessage ¶
type DiasporaStatusMessage struct { XMLName xml.Name `xml:"status_message"` EntityAuthor string `xml:"author"` EntityGuid string `xml:"guid"` EntityCreatedAt helpers.Time `xml:"created_at"` EntityProviderName string `xml:"provider_display_name"` EntityText string `xml:"text,omitempty"` EntityPhotos *DiasporaPhotos `xml:"photo,omitempty"` EntityLocation *DiasporaLocation `xml:"location,omitempty"` EntityPoll *DiasporaPoll `xml:"poll,omitempty"` EntityPublic bool `xml:"public"` EntityEvent *DiasporaEvent `xml:"event,omitempty"` }
func (*DiasporaStatusMessage) Author ¶
func (e *DiasporaStatusMessage) Author() string
func (*DiasporaStatusMessage) CreatedAt ¶
func (e *DiasporaStatusMessage) CreatedAt() helpers.Time
func (*DiasporaStatusMessage) FilePaths ¶
func (e *DiasporaStatusMessage) FilePaths() (result []string)
func (*DiasporaStatusMessage) Guid ¶
func (e *DiasporaStatusMessage) Guid() string
func (*DiasporaStatusMessage) Marshal ¶
func (e *DiasporaStatusMessage) Marshal(priv *rsa.PrivateKey, pub *rsa.PublicKey) ([]byte, error)
func (*DiasporaStatusMessage) Provider ¶
func (e *DiasporaStatusMessage) Provider() string
func (*DiasporaStatusMessage) Public ¶
func (e *DiasporaStatusMessage) Public() bool
func (*DiasporaStatusMessage) Recipients ¶
func (e *DiasporaStatusMessage) Recipients() []string
func (*DiasporaStatusMessage) Send ¶
func (e *DiasporaStatusMessage) Send(inbox string, priv *rsa.PrivateKey, pub *rsa.PublicKey) error
func (*DiasporaStatusMessage) SetAuthor ¶
func (e *DiasporaStatusMessage) SetAuthor(author string)
func (*DiasporaStatusMessage) SetCreatedAt ¶
func (e *DiasporaStatusMessage) SetCreatedAt(createdAt time.Time)
func (*DiasporaStatusMessage) SetGuid ¶
func (e *DiasporaStatusMessage) SetGuid(guid string)
func (*DiasporaStatusMessage) SetProvider ¶
func (e *DiasporaStatusMessage) SetProvider(provider string)
func (*DiasporaStatusMessage) SetPublic ¶
func (e *DiasporaStatusMessage) SetPublic(public bool)
func (*DiasporaStatusMessage) SetRecipients ¶
func (e *DiasporaStatusMessage) SetRecipients(recipient []string)
func (*DiasporaStatusMessage) SetText ¶
func (e *DiasporaStatusMessage) SetText(text string)
func (*DiasporaStatusMessage) Text ¶
func (e *DiasporaStatusMessage) Text() string
func (*DiasporaStatusMessage) Type ¶
func (e *DiasporaStatusMessage) Type() MessageType
func (*DiasporaStatusMessage) Unmarshal ¶
func (e *DiasporaStatusMessage) Unmarshal(b []byte) error
type DiasporaXmlOrder ¶
type DiasporaXmlOrder struct { XMLName xml.Name Order []string `xml:"-"` Lines []DiasporaXmlOrderLine `xml:",any"` }
func (DiasporaXmlOrder) Len ¶
func (order DiasporaXmlOrder) Len() int
func (DiasporaXmlOrder) Less ¶
func (order DiasporaXmlOrder) Less(i, j int) bool
func (DiasporaXmlOrder) Swap ¶
func (order DiasporaXmlOrder) Swap(i, j int)
type DiasporaXmlOrderLine ¶
type DiasporaXmlOrderLine struct { XMLName xml.Name Value string `xml:",chardata"` }
func (*DiasporaXmlOrderLine) UnmarshalXML ¶
func (o *DiasporaXmlOrderLine) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error
type EntityType ¶
type EntityType string
EntityType type specifies the different entities like comments or posts
type Hcard ¶
type Hcard struct { Guid string Nickname string FullName string Searchable bool PublicKey string FirstName string LastName string Url string Photo string PhotoMedium string PhotoSmall string }
Hcard is used by Diaspora to build and share user profiles
type HttpClient ¶
type HttpClient struct {
// contains filtered or unexported fields
}
HttpClient struct can hold a private key and keyId for signing http headers this is required for ActivityPub communication
func (*HttpClient) New ¶
func (c *HttpClient) New(id string, key *rsa.PrivateKey) *HttpClient
New can set private key and keyId for http header signing
type Logger ¶
var ( // Log is the used logger for the federation library. // On default this is stdout but you can change it with SetLogger() Log Logger )
func (Logger) Error ¶
func (l Logger) Error(values ...interface{})
Error prints error messages and fatals
type Message ¶
type Message interface { ValidSignature(*rsa.PublicKey) bool Type() MessageType Entity() MessageBase }
Message is the main interface for handling requests. It will be returned by all [...]Parse(...) functions e.g. DiasporaParse() or ActivityPubParse()
type MessageBase ¶
type MessageBase interface { Author() string SetAuthor(string) Unmarshal([]byte) error Type() MessageType Marshal(*rsa.PrivateKey, *rsa.PublicKey) ([]byte, error) Send(string, *rsa.PrivateKey, *rsa.PublicKey) error }
MessageBase is the minimum what a entity has to support/implement
type MessageComment ¶
type MessageComment interface { MessageRelayable Recipients() []string SetRecipients([]string) CreatedAt() helpers.Time SetCreatedAt(time.Time) Text() string SetText(string) }
MessageComment represents a comment to a Post or Reshare it inherits MessageRelayable
func NewMessageComment ¶
func NewMessageComment(proto Protocol) (MessageComment, error)
NewMessageComment will return a MessageComment interface depending on the specified Protocol
type MessageContact ¶
type MessageContact interface { MessageBase Recipient() string SetRecipient(string) Sharing() bool SetSharing(bool) }
MessageContact represents a state with another person it inherits MessageBase
func NewMessageContact ¶
func NewMessageContact(proto Protocol) (MessageContact, error)
NewMessageContact will return a MessageContact interface depending on the specified Protocol
type MessageLike ¶
type MessageLike interface { MessageRelayable Positive() bool SetPositive(bool) }
MessageLike represents a like on a other entity e.g. a post it inherits MessageRelayable
func NewMessageLike ¶
func NewMessageLike(proto Protocol) (MessageLike, error)
NewMessageLike will return a MessageLike interface depending on the specified Protocol
type MessagePost ¶
type MessagePost interface { MessageBase Recipients() []string SetRecipients([]string) Guid() string SetGuid(string) CreatedAt() helpers.Time SetCreatedAt(time.Time) Provider() string SetProvider(string) Text() string SetText(string) Public() bool SetPublic(bool) FilePaths() []string }
MessagePost represents a status message or post from a user it inherits MessageBase
func NewMessagePost ¶
func NewMessagePost(proto Protocol) (MessagePost, error)
NewMessagePost will return a MessagePost interface depending on the specified Protocol
type MessageProfile ¶
type MessageProfile interface { MessageBase FirstName() string LastName() string ImageUrl() string Birthday() string Gender() string Bio() string Location() string Public() bool Nsfw() bool }
MessageProfile represents a user profile and inherits MessageBase
type MessageRelayable ¶
type MessageRelayable interface { MessageBase Guid() string SetGuid(string) Parent() string SetParent(string) Signature() string SetSignature(*rsa.PrivateKey) error SignatureOrder() string }
MessageRelayable represents a minimum required to relay child entities
type MessageReshare ¶
type MessageReshare interface { MessageBase }
MessageReshare represents a boost or reshare of a post or status message it also inherits MessageBase
func NewMessageReshare ¶
func NewMessageReshare(proto Protocol) (MessageReshare, error)
NewMessageReshare will return a MessageReshare interface depending on the specified Protocol
type MessageRetract ¶
type MessageRetract interface { MessageBase ParentGuid() string SetParentGuid(string) ParentType() EntityType SetParentType(EntityType) }
func NewMessageRetract ¶
func NewMessageRetract(proto Protocol) (MessageRetract, error)
NewMessageRetract will return a MessageRetract interface depending on the specified Protocol
type MessageType ¶
type MessageType struct { Proto Protocol Entity EntityType }
MessageType defines what kind of message we are dealing with
type Protocol ¶
type Protocol int
Protocol type specifies the kind of protocol e.g. Diaspora or ActivityPub
type WebFinger ¶
type WebFinger struct { Host string Handle string Data WebfingerData }
WebFinger will be used to discover users on different servers (see https://tools.ietf.org/html/rfc7033)
type WebfingerData ¶
type WebfingerData struct { // xml XMLName xml.Name `xml:"XRD" json:"-"` Xmlns string `xml:"xmlns,attr" json:"-"` Alias string `xml:"Alias,omitempty" json:"-"` // json Aliases []string `json:"aliases" xml:"-"` Subject string `json:"subject" xml:"Subject,omitempty"` Links []WebfingerDataLink `json:"links" xml:"Link"` }
WebfingerData holds and stores discovered webfinger profiles
type WebfingerDataLink ¶
type WebfingerDataLink struct { // xml XMLName xml.Name `xml:"Link" json:"-"` Rel string `json:"rel" xml:"rel,attr"` Type string `json:"type,omitempty" xml:"type,attr"` Href string `json:"href,omitempty" xml:"href,attr,omitempty"` Template string `json:"template,omitempty" xml:"template,attr,omitempty"` }
WebfingerDataLink holds and stores webfinger links
Source Files ¶
- apu_entity_accept.go
- apu_entity_base.go
- apu_entity_collection.go
- apu_entity_create.go
- apu_entity_create_comment.go
- apu_entity_create_post.go
- apu_entity_follow.go
- apu_entity_like.go
- apu_entity_retract.go
- apu_entity_update.go
- apu_message.go
- apu_salmon.go
- comment.go
- config.go
- const.go
- contact.go
- dia_aes.go
- dia_entity_comment.go
- dia_entity_contact.go
- dia_entity_like.go
- dia_entity_post.go
- dia_entity_profile.go
- dia_entity_reshare.go
- dia_entity_retraction.go
- dia_magic.go
- dia_message.go
- dia_salmon.go
- dia_sort.go
- doc.go
- error.go
- hcard.go
- http_client.go
- like.go
- logger.go
- message.go
- post.go
- profile.go
- relayable.go
- reshare.go
- retract.go
- signature.go
- webfinger.go