Documentation ¶
Index ¶
- Variables
- func CreateKeyFile(file string) (err error)
- func DoCollectionPagination(c util.Context, iri *url.URL, defaultSize, maxSize int, any AnyCPageFn, ...) (p vocab.ActivityStreamsCollectionPage, err error)
- func DoOrderedCollectionPagination(c util.Context, iri *url.URL, defaultSize, maxSize int, any AnyOCPageFn, ...) (p vocab.ActivityStreamsOrderedCollectionPage, err error)
- func UpdateCollectionToPrependCalls(c util.Context, updated vocab.ActivityStreamsCollection, ...) error
- type Any
- type AnyCPageFn
- type AnyOCPageFn
- type CreateUserParameters
- type Crypto
- type Data
- func (d *Data) Create(c util.Context, v vocab.Type) (err error)
- func (d *Data) Delete(c util.Context, iri *url.URL) (err error)
- func (d *Data) Exists(c util.Context, id *url.URL) (exists bool, err error)
- func (d *Data) Get(c util.Context, id *url.URL) (v vocab.Type, err error)
- func (d *Data) Owns(id *url.URL) bool
- func (d *Data) Update(c util.Context, v vocab.Type) (err error)
- type DeliveryAttempts
- func (d *DeliveryAttempts) FirstPageRetryableFailures(c util.Context, n int) (rf []RetryableFailure, err error)
- func (d *DeliveryAttempts) InsertAttempt(c util.Context, from paths.UUID, toActor *url.URL, payload []byte) (id string, err error)
- func (d *DeliveryAttempts) MarkAbandonedAttempt(c util.Context, id string) (err error)
- func (d *DeliveryAttempts) MarkRetryFailureAttempt(c util.Context, id string) (err error)
- func (d *DeliveryAttempts) MarkSuccessfulAttempt(c util.Context, id string) (err error)
- func (d *DeliveryAttempts) NextPageRetryableFailures(c util.Context, prevID string, fetch time.Time, n int) (rf []RetryableFailure, err error)
- type Followers
- func (f *Followers) Contains(c util.Context, followers, id *url.URL) (has bool, err error)
- func (f *Followers) ContainsForActor(c util.Context, actor, id *url.URL) (has bool, err error)
- func (f *Followers) DeleteItem(c util.Context, followers, item *url.URL) error
- func (f *Followers) GetAllForActor(c util.Context, actor *url.URL) (col vocab.ActivityStreamsCollection, err error)
- func (f *Followers) GetLastPage(c util.Context, followers *url.URL, n int) (page vocab.ActivityStreamsCollectionPage, err error)
- func (f *Followers) GetPage(c util.Context, followers *url.URL, min, n int) (page vocab.ActivityStreamsCollectionPage, err error)
- func (f *Followers) OpenFollowRequests(c util.Context, actorIRI *url.URL) (r []vocab.ActivityStreamsFollow, err error)
- func (f *Followers) PrependItem(c util.Context, followers, item *url.URL) error
- type Following
- func (f *Following) Contains(c util.Context, following, id *url.URL) (has bool, err error)
- func (f *Following) ContainsForActor(c util.Context, actor, id *url.URL) (has bool, err error)
- func (f *Following) DeleteItem(c util.Context, following, item *url.URL) error
- func (f *Following) GetAllForActor(c util.Context, actor *url.URL) (col vocab.ActivityStreamsCollection, err error)
- func (f *Following) GetLastPage(c util.Context, following *url.URL, n int) (page vocab.ActivityStreamsCollectionPage, err error)
- func (f *Following) GetPage(c util.Context, following *url.URL, min, n int) (page vocab.ActivityStreamsCollectionPage, err error)
- func (f *Following) PrependItem(c util.Context, following, item *url.URL) error
- type HashPasswordParameters
- type Inboxes
- func (i *Inboxes) Contains(c util.Context, inbox, id *url.URL) (has bool, err error)
- func (i *Inboxes) ContainsForActor(c util.Context, actor, id *url.URL) (has bool, err error)
- func (i *Inboxes) DeleteItem(c util.Context, inbox, item *url.URL) error
- func (i *Inboxes) GetLastPage(c util.Context, inbox *url.URL, n int) (page vocab.ActivityStreamsOrderedCollectionPage, err error)
- func (i *Inboxes) GetPage(c util.Context, inbox *url.URL, min, n int) (page vocab.ActivityStreamsOrderedCollectionPage, err error)
- func (i *Inboxes) GetPublicLastPage(c util.Context, inbox *url.URL, n int) (page vocab.ActivityStreamsOrderedCollectionPage, err error)
- func (i *Inboxes) GetPublicPage(c util.Context, inbox *url.URL, min, n int) (page vocab.ActivityStreamsOrderedCollectionPage, err error)
- func (i *Inboxes) PrependItem(c util.Context, inbox, item *url.URL) error
- type LastCPageFn
- type LastOCPageFn
- type Liked
- func (f *Liked) Contains(c util.Context, liked, id *url.URL) (has bool, err error)
- func (f *Liked) ContainsForActor(c util.Context, actor, id *url.URL) (has bool, err error)
- func (f *Liked) DeleteItem(c util.Context, liked, item *url.URL) error
- func (f *Liked) GetAllForActor(c util.Context, actor *url.URL) (col vocab.ActivityStreamsCollection, err error)
- func (f *Liked) GetLastPage(c util.Context, liked *url.URL, n int) (page vocab.ActivityStreamsCollectionPage, err error)
- func (f *Liked) GetPage(c util.Context, liked *url.URL, min, n int) (page vocab.ActivityStreamsCollectionPage, err error)
- func (f *Liked) PrependItem(c util.Context, liked, item *url.URL) error
- type NodeInfo
- type NodeInfoStats
- type OAuth2
- func (o *OAuth2) Create(ctx context.Context, info oauth2.TokenInfo) error
- func (o *OAuth2) DeleteExpiredFirstPartyCredentials(ctx context.Context) error
- func (o *OAuth2) GetByAccess(ctx context.Context, access string) (ti oauth2.TokenInfo, err error)
- func (o *OAuth2) GetByCode(ctx context.Context, code string) (ti oauth2.TokenInfo, err error)
- func (o *OAuth2) GetByID(ctx context.Context, id string) (ci oauth2.ClientInfo, err error)
- func (o *OAuth2) GetByRefresh(ctx context.Context, refresh string) (ti oauth2.TokenInfo, err error)
- func (o *OAuth2) ProxyCreateCredential(ctx context.Context, ti oauth2.TokenInfo) (id string, err error)
- func (o *OAuth2) ProxyGetCredential(ctx context.Context, id string) (ti oauth2.TokenInfo, err error)
- func (o *OAuth2) ProxyRemoveCredential(ctx context.Context, id string) error
- func (o *OAuth2) ProxyUpdateCredential(ctx context.Context, id string, ti oauth2.TokenInfo) error
- func (o *OAuth2) RemoveByAccess(ctx context.Context, access string) error
- func (o *OAuth2) RemoveByCode(ctx context.Context, code string) error
- func (o *OAuth2) RemoveByRefresh(ctx context.Context, refresh string) error
- type Outboxes
- func (i *Outboxes) DeleteItem(c util.Context, outbox, item *url.URL) error
- func (i *Outboxes) GetLastPage(c util.Context, outbox *url.URL, n int) (page vocab.ActivityStreamsOrderedCollectionPage, err error)
- func (i *Outboxes) GetPage(c util.Context, outbox *url.URL, min, n int) (page vocab.ActivityStreamsOrderedCollectionPage, err error)
- func (i *Outboxes) GetPublicLastPage(c util.Context, outbox *url.URL, n int) (page vocab.ActivityStreamsOrderedCollectionPage, err error)
- func (i *Outboxes) GetPublicPage(c util.Context, outbox *url.URL, min, n int) (page vocab.ActivityStreamsOrderedCollectionPage, err error)
- func (i *Outboxes) OutboxForInbox(c util.Context, inboxIRI *url.URL) (outboxIRI *url.URL, err error)
- func (i *Outboxes) PrependItem(c util.Context, outbox, item *url.URL) error
- type Policies
- type Preferences
- type PrependFn
- type PrivateKeys
- type Privileges
- type RetryableFailure
- type ServerPreferences
- type User
- type Users
- func (u *Users) ActorIDForInbox(c util.Context, inboxIRI *url.URL) (actorIRI *url.URL, err error)
- func (u *Users) ActorIDForOutbox(c util.Context, outboxIRI *url.URL) (actorIRI *url.URL, err error)
- func (u *Users) CreateAdminUser(c util.Context, params CreateUserParameters, password string) (userID string, err error)
- func (u *Users) CreateInstanceActorSingleton(c util.Context, scheme, host string, rsaKeySize int) (userID string, err error)
- func (u *Users) CreateUser(c util.Context, params CreateUserParameters, password string) (userID string, err error)
- func (u *Users) GetServerPreferences(c util.Context) (p ServerPreferences, err error)
- func (u *Users) Preferences(c util.Context, uuid paths.UUID, appPref interface{}) (p *Preferences, err error)
- func (u *Users) Privileges(c util.Context, uuid string, appPriv interface{}) (p *Privileges, err error)
- func (u *Users) SetServerPreferences(c util.Context, p ServerPreferences) (err error)
- func (u *Users) UpdatePreferences(c util.Context, uuid string, p *Preferences) (err error)
- func (u *Users) UpdatePrivileges(c util.Context, uuid string, p *Privileges) (err error)
- func (u *Users) UserByID(c util.Context, id paths.UUID) (s *User, err error)
- func (u *Users) UserByUsername(c util.Context, name string) (s *User, err error)
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func CreateKeyFile ¶
CreateKeyFile writes a symmetric key of random bytes to a file.
func DoCollectionPagination ¶
func DoCollectionPagination(c util.Context, iri *url.URL, defaultSize, maxSize int, any AnyCPageFn, last LastCPageFn) (p vocab.ActivityStreamsCollectionPage, err error)
DoCollectionPagination examines the query parameters of an IRI, and uses it to either fetch the bare ordered collection without values, the very last ordered collection page, or an arbitrary ordered collection page using the provided fetching functions.
func DoOrderedCollectionPagination ¶
func DoOrderedCollectionPagination(c util.Context, iri *url.URL, defaultSize, maxSize int, any AnyOCPageFn, last LastOCPageFn) (p vocab.ActivityStreamsOrderedCollectionPage, err error)
DoPagination examines the query parameters of an IRI, and uses it to either fetch the bare ordered collection without values, the very last ordered collection page, or an arbitrary ordered collection page using the provided fetching functions.
func UpdateCollectionToPrependCalls ¶
func UpdateCollectionToPrependCalls(c util.Context, updated vocab.ActivityStreamsCollection, defaultSize, maxSize int, firstPageFn AnyCPageFn, prependFn PrependFn) error
UpdateCollectionToPrependCalls takes new beginning elements of a collection in order to generate calls to PrependFn in order.
This function only prepends to the very beginning of the collection, and expects the page to be the first one, though it is written as if for the general case.
TODO: Could generalize this to apply a diff to a portion of the collection
Types ¶
type AnyCPageFn ¶
type AnyCPageFn func(c util.Context, iri *url.URL, min, n int) (vocab.ActivityStreamsCollectionPage, error)
AnyCPageFn fetches any arbitrary CollectionPage
type AnyOCPageFn ¶
type AnyOCPageFn func(c util.Context, iri *url.URL, min, n int) (vocab.ActivityStreamsOrderedCollectionPage, error)
AnyOCPageFn fetches any arbitrary OrderedCollectionPage
type CreateUserParameters ¶
type CreateUserParameters struct { // Scheme is the server's scheme for serving the ActivityPub actor // representing this user. Scheme string // Host is this server's hostname for the ActivityPub actor representing // this user. Host string // Username is the user-facing username to give the initial ActivityPub // actor representing the user. Username string // Email is the email address of the user. Email string // HashParams are the parameters used to hash this user's password. HashParams HashPasswordParameters // RSAKeySize is the size of the RSA private key to create for this // user, in bits. RSAKeySize int }
CreateUserParameters contains all parameters needed to create a user & Actor.
type Data ¶
type Data struct { DB *sql.DB Hostname string FedData *models.FedData LocalData *models.LocalData Users *models.Users Following *Following Followers *Followers Liked *Liked DefaultCollectionSize int MaxCollectionPageSize int }
func (*Data) Exists ¶
Exists determines if this ActivityStreams ID already exists locally or federated.
type DeliveryAttempts ¶
type DeliveryAttempts struct { DB *sql.DB DeliveryAttempts *models.DeliveryAttempts }
func (*DeliveryAttempts) FirstPageRetryableFailures ¶
func (d *DeliveryAttempts) FirstPageRetryableFailures(c util.Context, n int) (rf []RetryableFailure, err error)
func (*DeliveryAttempts) InsertAttempt ¶
func (*DeliveryAttempts) MarkAbandonedAttempt ¶
func (d *DeliveryAttempts) MarkAbandonedAttempt(c util.Context, id string) (err error)
func (*DeliveryAttempts) MarkRetryFailureAttempt ¶
func (d *DeliveryAttempts) MarkRetryFailureAttempt(c util.Context, id string) (err error)
func (*DeliveryAttempts) MarkSuccessfulAttempt ¶
func (d *DeliveryAttempts) MarkSuccessfulAttempt(c util.Context, id string) (err error)
func (*DeliveryAttempts) NextPageRetryableFailures ¶
func (d *DeliveryAttempts) NextPageRetryableFailures(c util.Context, prevID string, fetch time.Time, n int) (rf []RetryableFailure, err error)
type Followers ¶
func (*Followers) ContainsForActor ¶
func (*Followers) DeleteItem ¶
func (*Followers) GetAllForActor ¶
func (*Followers) GetLastPage ¶
func (*Followers) OpenFollowRequests ¶
type Following ¶
func (*Following) ContainsForActor ¶
func (*Following) DeleteItem ¶
func (*Following) GetAllForActor ¶
func (*Following) GetLastPage ¶
type HashPasswordParameters ¶
type HashPasswordParameters struct { // Size of the salt in number of bytes. SaltSize int // Strength of the bcrypt hashing. BCryptStrength int }
HashPasswordParameters contains values used in generating secrets.
type Inboxes ¶
func (*Inboxes) ContainsForActor ¶
func (*Inboxes) DeleteItem ¶
func (*Inboxes) GetLastPage ¶
func (*Inboxes) GetPublicLastPage ¶
func (*Inboxes) GetPublicPage ¶
type LastCPageFn ¶
type LastCPageFn func(c util.Context, iri *url.URL, n int) (vocab.ActivityStreamsCollectionPage, error)
LastCPageFn fetches the last page of an Collection.
type LastOCPageFn ¶
type LastOCPageFn func(c util.Context, iri *url.URL, n int) (vocab.ActivityStreamsOrderedCollectionPage, error)
LastOCPageFn fetches the last page of an OrderedCollection.
type Liked ¶
func (*Liked) ContainsForActor ¶
func (*Liked) GetAllForActor ¶
func (*Liked) GetLastPage ¶
type NodeInfo ¶
type NodeInfo struct { DB *sql.DB Users *models.Users LocalData *models.LocalData Rand *rand.Rand CacheInvalidated time.Duration // contains filtered or unexported fields }
func (*NodeInfo) GetAnonymizedStats ¶
func (n *NodeInfo) GetAnonymizedStats(c util.Context) (t NodeInfoStats, err error)
type NodeInfoStats ¶
type OAuth2 ¶
type OAuth2 struct { DB *sql.DB Client *models.ClientInfos Token *models.TokenInfos Creds *models.Credentials }
OAuth2 implements services for the oauth2 server package.
func (*OAuth2) DeleteExpiredFirstPartyCredentials ¶
func (*OAuth2) GetByAccess ¶
func (*OAuth2) GetByRefresh ¶
func (*OAuth2) ProxyCreateCredential ¶
func (*OAuth2) ProxyGetCredential ¶
func (*OAuth2) ProxyRemoveCredential ¶
func (*OAuth2) ProxyUpdateCredential ¶
func (*OAuth2) RemoveByAccess ¶
type Outboxes ¶
func (*Outboxes) DeleteItem ¶
func (*Outboxes) GetLastPage ¶
func (*Outboxes) GetPublicLastPage ¶
func (*Outboxes) GetPublicPage ¶
func (*Outboxes) OutboxForInbox ¶
type Policies ¶
type Preferences ¶
type Preferences struct { OnFollow pub.OnFollowBehavior AppPreferences interface{} }
type PrivateKeys ¶
func (*PrivateKeys) GetUserHTTPSignatureKey ¶
func (p *PrivateKeys) GetUserHTTPSignatureKey(c util.Context, userID paths.UUID) (k *rsa.PrivateKey, iri *url.URL, err error)
func (*PrivateKeys) GetUserHTTPSignatureKeyForInstanceActor ¶
func (p *PrivateKeys) GetUserHTTPSignatureKeyForInstanceActor(c util.Context) (k *rsa.PrivateKey, iri *url.URL, err error)
type Privileges ¶
type RetryableFailure ¶
type ServerPreferences ¶
type ServerPreferences struct { OnFollow pub.OnFollowBehavior OpenRegistrations bool ServerBaseURL string ServerName string OrgName string OrgContact string OrgAccount string Payload json.RawMessage }
type Users ¶
type Users struct { App app.Application DB *sql.DB Users *models.Users PrivateKeys *models.PrivateKeys Inboxes *models.Inboxes Outboxes *models.Outboxes Followers *models.Followers Following *models.Following Liked *models.Liked // contains filtered or unexported fields }
func (*Users) ActorIDForInbox ¶
func (*Users) ActorIDForOutbox ¶
func (*Users) CreateAdminUser ¶
func (*Users) CreateInstanceActorSingleton ¶
func (*Users) CreateUser ¶
func (*Users) GetServerPreferences ¶
func (u *Users) GetServerPreferences(c util.Context) (p ServerPreferences, err error)
func (*Users) Preferences ¶
func (u *Users) Preferences(c util.Context, uuid paths.UUID, appPref interface{}) (p *Preferences, err error)
Preferences returns the preferences associated with the user.
Fetches the application-specific preferences if appPref is non-nil and JSON compatible struct.
func (*Users) Privileges ¶
func (u *Users) Privileges(c util.Context, uuid string, appPriv interface{}) (p *Privileges, err error)
Privileges returns the privileges associated with the user.
Fetches the application-specific privileges if appPriv is non-nil and JSON compatible struct.
func (*Users) SetServerPreferences ¶
func (u *Users) SetServerPreferences(c util.Context, p ServerPreferences) (err error)