Documentation ¶
Index ¶
- Constants
- Variables
- type Account
- func (a *Account) GetActorURI() string
- func (a *Account) GetID() int64
- func (a *Account) GetInstance() fedihelper.Instance
- func (a *Account) GetInstanceAccountID() string
- func (a *Account) GetLastFinger() time.Time
- func (a *Account) GetUsername() string
- func (a *Account) SetActorURI(actorURI string)
- func (a *Account) SetInfoAvatarURL(avatarURL string)
- func (a *Account) SetInfoDisplayName(displayName string)
- func (a *Account) SetInfoHeaderURL(headerURL string)
- func (a *Account) SetInfoIsBot(isBot bool)
- func (a *Account) SetInfoIsLocked(isLocked bool)
- func (a *Account) SetInfoIsMoved(isMoved bool)
- func (a *Account) SetInfoLastUpdate(lastUpdate time.Time)
- func (a *Account) SetInfoURL(url string)
- func (a *Account) SetInstance(instanceI fedihelper.Instance)
- func (a *Account) SetInstanceAccountID(instanceAccountID string)
- func (a *Account) SetLastFinger(lastFinger time.Time)
- func (a *Account) SetUsername(username string)
- func (a *Account) String() string
- type AccountConfigMap
- type AccountInfo
- type Block
- type Change
- type Config
- func (c *Config) GetValue() (string, error)
- func (c *Config) GetValueBool() (bool, error)
- func (c *Config) GetValueInt() (int, error)
- func (c *Config) SetValue(value string, encrypt bool) error
- func (c *Config) SetValueBool(value bool, encrypt bool) error
- func (c *Config) SetValueInt(value int, encrypt bool) error
- type ConfigChange
- type ConfigKey
- type ConfigMap
- type Error
- type EventType
- type Instance
- func (i *Instance) GetActorURI() (actorURI string)
- func (i *Instance) GetDomain() (domain string)
- func (i *Instance) GetID() (instanceID int64)
- func (i *Instance) GetOAuthClientID() (clientID string)
- func (i *Instance) GetOAuthClientSecret() (string, error)
- func (i *Instance) GetPrivateKey() (*rsa.PrivateKey, error)
- func (i *Instance) GetServerHostname() (hostname string)
- func (i *Instance) GetSoftware() (software string)
- func (i *Instance) IsPunycode() bool
- func (i *Instance) PublicKeyPEM() (string, error)
- func (i *Instance) SetActorURI(actorURI string)
- func (i *Instance) SetContactAccount(accountI fedihelper.Account)
- func (i *Instance) SetDomain(domain string)
- func (i *Instance) SetInboxURI(inboxURI string)
- func (i *Instance) SetInfoDescription(description string)
- func (i *Instance) SetInfoTitle(title string)
- func (i *Instance) SetLastUpdate(lastUpdate time.Time)
- func (i *Instance) SetOAuthClientID(clientID string)
- func (i *Instance) SetOAuthClientSecret(clientSecret string) error
- func (i *Instance) SetPrivateKey(key *rsa.PrivateKey) error
- func (i *Instance) SetServerHostname(hostname string)
- func (i *Instance) SetSoftware(software string)
- func (i *Instance) SetVersion(version string)
- func (i *Instance) String() string
- func (i *Instance) UnicodeDomain() string
- type InstanceInfo
- type LogEntry
- type LogEntryBlockCreate
- type LogEntryBlockDelete
- type LogEntryBlockUpdate
- type LogEntryBlockUpdateChange
- type LogEntryInstanceDeliveryPaused
- type LogEntryInstanceDeliveryResumed
- type LogEntryInstanceJoin
- type LogEntryInstanceKick
- type LogEntryInstanceLeft
- type LogEntryMetaData
- type LogEntryReason
- type LogEntryType
- type NotificationService
Constants ¶
const ( LogEntryTypeInstanceJoin LogEntryType = "INSTANCE_JOIN" LogEntryTypeInstanceJoinString string = "Instance %s joined." )
const ( LogEntryTypeInstanceKick LogEntryType = "INSTANCE_KICK" LogEntryTypeInstanceKickString string = "Instance %s was kicked%s." )
const ( LogEntryTypeInstanceLeft LogEntryType = "INSTANCE_LEFT" LogEntryTypeInstanceLeftString string = "Instance %s left." )
Variables ¶
var Changes = []Change{ ChangeAdd, ChangeDelete, ChangeUpdate, }
var LogEntryTypeBlockCreateString = []string{
"Domain %s was blocked.",
"Domain %s and it's subdomains were blocked.",
}
var LogEntryTypeBlockDeleteString = []string{
"Domain %s was unblocked.",
"Domain %s and it's subdomains were unblocked.",
}
var LogEntryTypeBlockUpdateString = []string{
"Domain %s block was updated, %s.",
"the field %s was changed from '%s' to '%s'",
}
var LogEntryTypeInstanceDeliveryPausedReasonString = map[LogEntryReason]string{
LogEntryReasonDeliveryError: " due to delivery errors",
}
var LogEntryTypeInstanceDeliveryResumedReasonString = map[LogEntryReason]string{
LogEntryReasonAdminIntervention: " manually",
LogEntryReasonDeliveryReceived: " because a delivery was received from it",
LogEntryReasonUserIntervention: " manually",
}
var LogEntryTypeInstanceKickReasonString = map[LogEntryReason]string{
LogEntryReasonAdminIntervention: " by relay admin",
LogEntryReasonUserIntervention: " by instance admin",
}
Functions ¶
This section is empty.
Types ¶
type Account ¶
type Account struct { ID int64 `validate:"-" bun:"id,pk,autoincrement"` CreatedAt time.Time `validate:"-" bun:",nullzero,notnull,default:current_timestamp"` UpdatedAt time.Time `validate:"-" bun:",nullzero,notnull,default:current_timestamp"` ActorURI string `validate:"url" bun:",nullzero,notnull"` Username string `validate:"-" bun:",unique:unique_fedi_user,nullzero,notnull"` InstanceAccountID string `validate:"-" bun:",nullzero"` InstanceID int64 `validate:"-" bun:",unique:unique_fedi_user,nullzero,notnull"` Instance *Instance `validate:"-" bun:"rel:belongs-to,join:instance_id=id"` LastFinger time.Time `validate:"-" bun:",notnull"` ContactFor *Instance `bun:"rel:has-one,join:id=info_contact_account_id"` Info AccountInfo `validate:"-" bun:"embed:info_"` LogInCount int64 `validate:"-" bun:",notnull"` LogInLast time.Time `validate:"-" bun:",nullzero"` IsAdmin bool `validate:"-" bun:",notnull"` IsMod bool `validate:"-" bun:",notnull"` }
Account represents an account.
func (*Account) GetActorURI ¶
GetActorURI returns the account's actor uri.
func (*Account) GetInstance ¶
func (a *Account) GetInstance() fedihelper.Instance
GetInstance returns the instance of the account.
func (*Account) GetInstanceAccountID ¶ added in v0.7.0
GetInstanceAccountID returns the account's server account id.
func (*Account) GetLastFinger ¶
GetLastFinger returns the time of the last finger.
func (*Account) GetUsername ¶
GetUsername returns the account's username.
func (*Account) SetActorURI ¶
SetActorURI sets the account's actor uri.
func (*Account) SetInfoAvatarURL ¶ added in v0.7.0
SetInfoAvatarURL sets the account's avatar url.
func (*Account) SetInfoDisplayName ¶ added in v0.7.0
SetInfoDisplayName sets the account's display name.
func (*Account) SetInfoHeaderURL ¶ added in v0.7.0
SetInfoHeaderURL sets the account's header url.
func (*Account) SetInfoIsBot ¶ added in v0.7.0
func (*Account) SetInfoIsLocked ¶ added in v0.7.0
func (*Account) SetInfoIsMoved ¶ added in v0.7.0
func (*Account) SetInfoLastUpdate ¶ added in v0.7.0
func (*Account) SetInfoURL ¶ added in v0.7.0
SetInfoURL sets the account's url.
func (*Account) SetInstance ¶
func (a *Account) SetInstance(instanceI fedihelper.Instance)
SetInstance sets the instance of the account.
func (*Account) SetInstanceAccountID ¶ added in v0.7.0
SetInstanceAccountID sets the account's instance account id.
func (*Account) SetLastFinger ¶
SetLastFinger sets the time of the last finger.
func (*Account) SetUsername ¶
SetUsername sets the account's username.
type AccountConfigMap ¶ added in v0.2.0
type AccountInfo ¶ added in v0.7.0
type AccountInfo struct { AvatarURL string `validate:"-" bun:",nullzero"` DisplayName string `validate:"-" bun:",nullzero"` HeaderURL string `validate:"-" bun:",nullzero"` IsBot bool `validate:"-" bun:",notnull"` IsLocked bool `validate:"-" bun:",notnull"` IsMoved bool `validate:"-" bun:",notnull"` URL string `validate:"-" bun:",nullzero"` LastUpdate time.Time `validate:"-" bun:",nullzero"` }
type Block ¶
type Block struct { ID int64 `validate:"-" bun:",pk,autoincrement,nullzero,notnull,unique" json:"-"` CreatedAt time.Time `validate:"-" bun:",nullzero,notnull,default:current_timestamp" json:"-"` UpdatedAt time.Time `validate:"-" bun:",nullzero,notnull,default:current_timestamp" json:"-"` MarkedForDeletionOn time.Time `validate:"-" bun:",nullzero" json:"-"` Domain string `validate:"required,fqdn" bun:",nullzero,notnull,unique" json:"domain"` ObfuscatedDomain string `validate:"-" bun:",nullzero" json:"obfuscated_domain,omitempty"` BlockSubdomains bool `validate:"-" bun:",notnull" json:"block_subdomains"` }
Block represents a block of a domain
func (*Block) IsPunycode ¶ added in v0.2.1
IsPunycode returns true if the domain is a punycode domain.
func (*Block) UnicodeDomain ¶ added in v0.2.1
UnicodeDomain returns a unicode representation of the domain.
type Config ¶
type Config struct { ID int64 `validate:"-" bun:"id,pk,autoincrement"` CreatedAt time.Time `validate:"-" bun:",nullzero,notnull,default:current_timestamp"` UpdatedAt time.Time `validate:"-" bun:",nullzero,notnull,default:current_timestamp"` Key ConfigKey `validate:"-" bun:",nullzero,notnull"` Value string `validate:"-" bun:",nullzero"` IsEncrypted bool `validate:"-" bun:",notnull"` AccountID int64 `validate:"-" bun:",nullzero"` Account *Account `validate:"-" bun:"rel:belongs-to,join:account_id=id"` }
Config represents a federated social account.
func (*Config) GetValueBool ¶ added in v0.2.0
func (*Config) GetValueInt ¶
func (*Config) SetValueBool ¶ added in v0.2.0
type ConfigChange ¶
type ConfigKey ¶
type ConfigKey string
const ( ConfigHomeBody ConfigKey = `home.body` ConfigRobotsAllowIndexing ConfigKey = `robots.allow-indexing` ConfigTelegramEnabled ConfigKey = `telegram.enabled` ConfigTelegramToken ConfigKey = `telegram.token` ConfigUserTelegramEnabled ConfigKey = `user.telegram.enabled` ConfigUserTelegramChatID ConfigKey = `user.telegram.chat_id` )
func (ConfigKey) DefaultValue ¶ added in v0.5.0
func (ConfigKey) DefaultValueBool ¶ added in v0.5.0
func (ConfigKey) DefaultValueInt ¶ added in v0.5.0
type Error ¶
type Error struct {
// contains filtered or unexported fields
}
Error represents a logic specific error.
type Instance ¶
type Instance struct { ID int64 `validate:"-" bun:",pk,autoincrement,nullzero,notnull,unique"` CreatedAt time.Time `validate:"-" bun:",nullzero,notnull,default:current_timestamp"` UpdatedAt time.Time `validate:"-" bun:",nullzero,notnull,default:current_timestamp"` Domain string `validate:"required,fqdn" bun:",nullzero,notnull,unique"` ServerHostname string `validate:"required,fqdn" bun:",nullzero,notnull,unique"` Software string `validate:"-" bun:",nullzero"` PublicKey *rsa.PublicKey `validate:"-"` PrivateKey string `validate:"-" bun:",nullzero"` ActorIRI string `validate:"required,url" bun:",nullzero,notnull,unique"` InboxIRI string `validate:"required,url" bun:",nullzero,notnull,unique"` Info InstanceInfo `validate:"-" bun:"embed:info_"` IsFollowing bool `validate:"-" bun:",notnull"` IsPaused bool `validate:"-" bun:",notnull"` OAuthClientID string `validate:"-" bun:",nullzero"` OAuthClientSecret string `validate:"-" bun:",nullzero"` BlockID int64 `validate:"-" bun:",nullzero"` Block *Block `validate:"-" bun:"rel:belongs-to"` }
Instance represents a instance
func (*Instance) GetActorURI ¶
func (*Instance) GetOAuthClientID ¶
func (*Instance) GetOAuthClientSecret ¶
GetOAuthClientSecret returns unencrypted client secret.
func (*Instance) GetPrivateKey ¶
func (i *Instance) GetPrivateKey() (*rsa.PrivateKey, error)
GetPrivateKey returns unencrypted client secret.
func (*Instance) GetServerHostname ¶
func (*Instance) GetSoftware ¶
func (*Instance) IsPunycode ¶ added in v0.2.1
IsPunycode returns true if the domain is a punycode domain.
func (*Instance) PublicKeyPEM ¶
PublicKeyPEM returns a PEM string from the public key.
func (*Instance) SetActorURI ¶
func (*Instance) SetContactAccount ¶ added in v0.7.0
func (i *Instance) SetContactAccount(accountI fedihelper.Account)
func (*Instance) SetInboxURI ¶
func (*Instance) SetInfoDescription ¶ added in v0.7.0
func (*Instance) SetInfoTitle ¶ added in v0.7.0
func (*Instance) SetLastUpdate ¶ added in v0.7.0
func (*Instance) SetOAuthClientID ¶
func (*Instance) SetOAuthClientSecret ¶
SetOAuthClientSecret sets encrypted client secret.
func (*Instance) SetPrivateKey ¶
func (i *Instance) SetPrivateKey(key *rsa.PrivateKey) error
SetPrivateKey sets encrypted client secret.
func (*Instance) SetServerHostname ¶
func (*Instance) SetSoftware ¶
func (*Instance) SetVersion ¶ added in v0.7.0
func (*Instance) UnicodeDomain ¶ added in v0.2.1
UnicodeDomain returns a unicode representation of the domain.
type InstanceInfo ¶ added in v0.7.0
type InstanceInfo struct { Title string `validate:"-" bun:",nullzero"` Description string `validate:"-" bun:",nullzero"` ContactAccountID int64 `validate:"-" bun:",nullzero"` ContactAccount *Account `validate:"-" bun:"rel:belongs-to,join:info_contact_account_id=id"` Version string `validate:"-" bun:",nullzero"` LastUpdate time.Time `validate:"-" bun:",nullzero"` }
InstanceInfo represents a instance
type LogEntry ¶ added in v0.3.0
type LogEntry struct { ID int64 `validate:"-" bun:"id,pk,autoincrement"` CreatedAt time.Time `validate:"-" bun:",nullzero,notnull,default:current_timestamp"` Type LogEntryType `validate:"-" bun:",nullzero,notnull"` MetaData string `validate:"-" bun:",nullzero,notnull"` }
LogEntry represents a event log entry.
func (*LogEntry) GetMetaData ¶ added in v0.3.0
func (l *LogEntry) GetMetaData(metadata LogEntryMetaData) error
func (*LogEntry) SetMetaData ¶ added in v0.3.0
func (l *LogEntry) SetMetaData(metadata LogEntryMetaData) error
type LogEntryBlockCreate ¶ added in v0.3.0
type LogEntryBlockCreate struct { Account string `json:"account"` Domain string `json:"domain"` BlockSubdomains bool `json:"subdomains"` }
func (*LogEntryBlockCreate) FromJSON ¶ added in v0.3.0
func (t *LogEntryBlockCreate) FromJSON(metadata string) error
func (*LogEntryBlockCreate) String ¶ added in v0.3.0
func (t *LogEntryBlockCreate) String() string
func (*LogEntryBlockCreate) ToJSON ¶ added in v0.3.0
func (t *LogEntryBlockCreate) ToJSON() (metadata string, err error)
type LogEntryBlockDelete ¶ added in v0.3.0
type LogEntryBlockDelete struct { Account string `json:"account"` Domain string `json:"domain"` BlockSubdomains bool `json:"subdomains"` }
func (*LogEntryBlockDelete) FromJSON ¶ added in v0.3.0
func (t *LogEntryBlockDelete) FromJSON(metadata string) error
func (*LogEntryBlockDelete) String ¶ added in v0.3.0
func (t *LogEntryBlockDelete) String() string
func (*LogEntryBlockDelete) ToJSON ¶ added in v0.3.0
func (t *LogEntryBlockDelete) ToJSON() (metadata string, err error)
type LogEntryBlockUpdate ¶ added in v0.3.0
type LogEntryBlockUpdate struct { Account string `json:"account"` Domain string `json:"domain"` Change []LogEntryBlockUpdateChange `json:"changes"` }
func (*LogEntryBlockUpdate) FromJSON ¶ added in v0.3.0
func (t *LogEntryBlockUpdate) FromJSON(metadata string) error
func (*LogEntryBlockUpdate) String ¶ added in v0.3.0
func (t *LogEntryBlockUpdate) String() string
func (*LogEntryBlockUpdate) ToJSON ¶ added in v0.3.0
func (t *LogEntryBlockUpdate) ToJSON() (metadata string, err error)
type LogEntryBlockUpdateChange ¶ added in v0.3.0
type LogEntryInstanceDeliveryPaused ¶ added in v0.6.0
type LogEntryInstanceDeliveryPaused struct { Domain string `json:"domain"` Reason LogEntryReason `json:"reason"` }
func (*LogEntryInstanceDeliveryPaused) FromJSON ¶ added in v0.6.0
func (t *LogEntryInstanceDeliveryPaused) FromJSON(metadata string) error
func (*LogEntryInstanceDeliveryPaused) String ¶ added in v0.6.0
func (t *LogEntryInstanceDeliveryPaused) String() string
func (*LogEntryInstanceDeliveryPaused) ToJSON ¶ added in v0.6.0
func (t *LogEntryInstanceDeliveryPaused) ToJSON() (metadata string, err error)
type LogEntryInstanceDeliveryResumed ¶ added in v0.6.0
type LogEntryInstanceDeliveryResumed struct { Account string `json:"account,omitempty"` Domain string `json:"domain"` Reason LogEntryReason `json:"reason"` }
func (*LogEntryInstanceDeliveryResumed) FromJSON ¶ added in v0.6.0
func (t *LogEntryInstanceDeliveryResumed) FromJSON(metadata string) error
func (*LogEntryInstanceDeliveryResumed) String ¶ added in v0.6.0
func (t *LogEntryInstanceDeliveryResumed) String() string
func (*LogEntryInstanceDeliveryResumed) ToJSON ¶ added in v0.6.0
func (t *LogEntryInstanceDeliveryResumed) ToJSON() (metadata string, err error)
type LogEntryInstanceJoin ¶ added in v0.3.0
type LogEntryInstanceJoin struct {
Domain string `json:"domain"`
}
func (*LogEntryInstanceJoin) FromJSON ¶ added in v0.3.0
func (t *LogEntryInstanceJoin) FromJSON(metadata string) error
func (*LogEntryInstanceJoin) String ¶ added in v0.3.0
func (t *LogEntryInstanceJoin) String() string
func (*LogEntryInstanceJoin) ToJSON ¶ added in v0.3.0
func (t *LogEntryInstanceJoin) ToJSON() (metadata string, err error)
type LogEntryInstanceKick ¶ added in v0.7.3
type LogEntryInstanceKick struct { Account string `json:"account,omitempty"` Domain string `json:"domain"` Reason LogEntryReason `json:"reason"` }
func (*LogEntryInstanceKick) FromJSON ¶ added in v0.7.3
func (t *LogEntryInstanceKick) FromJSON(metadata string) error
func (*LogEntryInstanceKick) String ¶ added in v0.7.3
func (t *LogEntryInstanceKick) String() string
func (*LogEntryInstanceKick) ToJSON ¶ added in v0.7.3
func (t *LogEntryInstanceKick) ToJSON() (metadata string, err error)
type LogEntryInstanceLeft ¶ added in v0.3.0
type LogEntryInstanceLeft struct {
Domain string `json:"domain"`
}
func (*LogEntryInstanceLeft) FromJSON ¶ added in v0.3.0
func (t *LogEntryInstanceLeft) FromJSON(metadata string) error
func (*LogEntryInstanceLeft) String ¶ added in v0.3.0
func (t *LogEntryInstanceLeft) String() string
func (*LogEntryInstanceLeft) ToJSON ¶ added in v0.3.0
func (t *LogEntryInstanceLeft) ToJSON() (metadata string, err error)
type LogEntryMetaData ¶ added in v0.3.0
type LogEntryReason ¶ added in v0.6.0
type LogEntryReason string
const ( LogEntryReasonAdminIntervention LogEntryReason = "ADMIN_INTERVENTION" LogEntryReasonDeliveryError LogEntryReason = "DELIVERY_ERROR" LogEntryReasonDeliveryReceived LogEntryReason = "DELIVERY_RECEIVED" LogEntryReasonUserIntervention LogEntryReason = "USER_INTERVENTION" )
type LogEntryType ¶ added in v0.3.0
type LogEntryType string
const ( LogEntryTypeInstanceDeliveryPaused LogEntryType = "INSTANCE_DELIVERY_PAUSED" LogEntryTypeInstanceDeliveryPausedString = "Delivery to instance %s was paused%s." )
const ( LogEntryTypeInstanceDeliveryResumed LogEntryType = "INSTANCE_DELIVERY_RESUMED" LogEntryTypeInstanceDeliveryResumedString = "Delivery to instance %s was resumed%s." )
const LogEntryTypeBlockCreate LogEntryType = "BLOCK_CREATE"
const LogEntryTypeBlockDelete LogEntryType = "BLOCK_DELETE"
const LogEntryTypeBlockUpdate LogEntryType = "BLOCK_UPDATE"
type NotificationService ¶ added in v0.2.0
type NotificationService string
const (
ServiceTelegram NotificationService = "telegram"
)