Documentation ¶
Index ¶
- func FormatHeaders(header http.Header) string
- func FormatJSON(theJSON []byte) string
- func PrettyPrint(themap map[string]interface{})
- func PrettyPrintJSON(theJSON []byte)
- func ReadLines(filename string, from, to int) (lines []string, err error)
- func Serve(actors map[string]Actor)
- func ServeSingleActor(actor Actor)
- func Setup(configurationFile string, debug bool) *ini.File
- func SetupStorage(storage string)
- type Actor
- func (a *Actor) Accept(follow map[string]interface{})
- func (a *Actor) Announce(url string)
- func (a *Actor) CreateNote(content, inReplyTo string)
- func (a *Actor) Follow(user string) (err error)
- func (a *Actor) Followers() map[string]string
- func (a *Actor) Following() map[string]string
- func (a *Actor) GetFollowers(page int) (response []byte, err error)
- func (a *Actor) GetFollowing(page int) (response []byte, err error)
- func (a *Actor) GetOutboxIRI() *url.URL
- func (a *Actor) NewFollower(iri string, inbox string) error
- func (a *Actor) Unfollow(user string)
- type ActorToSave
- type RemoteActor
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FormatHeaders ¶
FormatHeaders to string for printing
func FormatJSON ¶
FormatJSON formats json with tabs and returns the new string
func PrettyPrintJSON ¶
func PrettyPrintJSON(theJSON []byte)
PrettyPrintJSON does what it's name says
func ServeSingleActor ¶
func ServeSingleActor(actor Actor)
ServeSingleActor just simplifies the call from main so that onboarding is as easy as possible
Types ¶
type Actor ¶
type Actor struct { Name string OnFollow func(map[string]interface{}) OnReceiveContent func(map[string]interface{}) // contains filtered or unexported fields }
Actor represents a local actor we can act on behalf of.
func LoadActor ¶
LoadActor searches the filesystem and creates an Actor from the data in <name>.json This does not preserve events so use with caution
func MakeActor ¶
MakeActor creates and returns a new local actor we can act on behalf of. It also creates its files on disk
func (*Actor) CreateNote ¶
CreateNote posts an activityPub note to our followers
func (*Actor) GetFollowers ¶
GetFollowers returns a list of people that follow us
func (*Actor) GetFollowing ¶
GetFollowing returns a list of people that we follow
func (*Actor) GetOutboxIRI ¶
GetOutboxIRI returns the outbox iri in net/url format
func (*Actor) NewFollower ¶
NewFollower records a new follower to the actor file
func (*Actor) Unfollow ¶
Unfollow the user declared by the iri in `user` this recreates the original follow activity , wraps it in an Undo activity, sets it's id to the id of the original Follow activity that was accepted when initially following that user (this is read from the `actor.following` map
type ActorToSave ¶
type ActorToSave struct {
Name, Summary, ActorType, IRI, PublicKey, PrivateKey string
Followers, Following, Rejected, Requested map[string]interface{}
}
ActorToSave is a stripped down actor representation with exported properties in order for json to be able to marshal it. see https://stackoverflow.com/questions/26327391/json-marshalstruct-returns
type RemoteActor ¶
type RemoteActor struct {
// contains filtered or unexported fields
}
RemoteActor is a type that holds an actor that we want to interact with
func NewRemoteActor ¶
func NewRemoteActor(iri string) (RemoteActor, error)
NewRemoteActor returns a remoteActor which holds all the info required for an actor we want to interact with (not essentially sitting in our instance)
func (RemoteActor) GetInbox ¶
func (ra RemoteActor) GetInbox() string
GetInbox returns the inbox url of the actor
func (RemoteActor) GetSharedInbox ¶
func (ra RemoteActor) GetSharedInbox() string
GetSharedInbox returns the inbox url of the actor