Documentation ¶
Index ¶
- func NewMachineryServer(globalConfig *RelayConfig) (*machinery.Server, error)
- func ReadPublicKeyRSAFromString(pemString string) (*rsa.PublicKey, error)
- type Activity
- type ActivityObject
- type Actor
- type Config
- type Endpoints
- type Image
- type Nodeinfo
- type NodeinfoLink
- type NodeinfoLinks
- type NodeinfoMetadata
- type NodeinfoResources
- type NodeinfoServices
- type NodeinfoSoftware
- type NodeinfoUsage
- type NodeinfoUsageUsers
- type PublicKey
- type RelayConfig
- func (relayConfig *RelayConfig) ActorKey() *rsa.PrivateKey
- func (relayConfig *RelayConfig) DumpWelcomeMessage(moduleName string, version string) string
- func (relayConfig *RelayConfig) JobConcurrency() int
- func (relayConfig *RelayConfig) RedisClient() *redis.Client
- func (relayConfig *RelayConfig) ServerBind() string
- func (relayConfig *RelayConfig) ServerHostname() *url.URL
- func (relayConfig *RelayConfig) ServerServiceName() string
- type RelayState
- func (config *RelayState) AddSubscription(domain Subscription)
- func (config *RelayState) DelSubscription(domain string)
- func (config *RelayState) ListenNotify(c chan<- bool)
- func (config *RelayState) Load()
- func (config *RelayState) SelectSubscription(domain string) *Subscription
- func (config *RelayState) SetBlockedDomain(domain string, value bool)
- func (config *RelayState) SetConfig(key Config, value bool)
- func (config *RelayState) SetLimitedDomain(domain string, value bool)
- type Signature
- type Subscription
- type WebfingerLink
- type WebfingerResource
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewMachineryServer ¶
func NewMachineryServer(globalConfig *RelayConfig) (*machinery.Server, error)
NewMachineryServer create Redis backed Machinery Server from RelayConfig.
Types ¶
type Activity ¶
type Activity struct { Context interface{} `json:"@context,omitempty"` ID string `json:"id,omitempty"` Actor string `json:"actor,omitempty"` Type string `json:"type,omitempty"` Object interface{} `json:"object,omitempty"` To []string `json:"to,omitempty"` Cc []string `json:"cc,omitempty"` }
Activity : ActivityPub Activity.
func (*Activity) GenerateAnnounce ¶
GenerateAnnounce : Generate Announce of activity.
func (*Activity) GenerateResponse ¶
GenerateResponse : Generate activity response.
func (*Activity) InnerActivity ¶ added in v1.2.0
InnerActivity : Unwrap inner activity.
type ActivityObject ¶
type ActivityObject struct { ID string `json:"id,omitempty"` Type string `json:"type,omitempty"` Name string `json:"name,omitempty"` Content string `json:"content,omitempty"` To []string `json:"to,omitempty"` Cc []string `json:"cc,omitempty"` }
ActivityObject : ActivityPub Activity.
type Actor ¶
type Actor struct { Context interface{} `json:"@context,omitempty"` ID string `json:"id,omitempty"` Type string `json:"type,omitempty"` Name string `json:"name,omitempty"` PreferredUsername string `json:"preferredUsername,omitempty"` Summary string `json:"summary,omitempty"` Inbox string `json:"inbox,omitempty"` Endpoints *Endpoints `json:"endpoints,omitempty"` PublicKey PublicKey `json:"publicKey,omitempty"` Icon *Image `json:"icon,omitempty"` Image *Image `json:"image,omitempty"` }
Actor : ActivityPub Actor.
func NewActivityPubActorFromSelfKey ¶
func NewActivityPubActorFromSelfKey(globalConfig *RelayConfig) Actor
func (*Actor) GenerateSelfKey ¶
GenerateSelfKey : Generate relay Actor from PublicKey.
type Nodeinfo ¶
type Nodeinfo struct { Version string `json:"version"` Software NodeinfoSoftware `json:"software"` Protocols []string `json:"protocols"` Services NodeinfoServices `json:"services"` OpenRegistrations bool `json:"openRegistrations"` Usage NodeinfoUsage `json:"usage"` Metadata NodeinfoMetadata `json:"metadata"` }
Nodeinfo : Nodeinfo Resource.
type NodeinfoLink ¶
NodeinfoLink : Nodeinfo Link Resource.
type NodeinfoLinks ¶
type NodeinfoLinks struct {
Links []NodeinfoLink `json:"links"`
}
NodeinfoLinks : Nodeinfo Link Resource.
type NodeinfoMetadata ¶
type NodeinfoMetadata struct { }
NodeinfoMetadata : NodeinfoMetadata Resource.
type NodeinfoResources ¶
type NodeinfoResources struct { NodeinfoLinks NodeinfoLinks Nodeinfo Nodeinfo }
NodeinfoResources : Nodeinfo Resources.
func (*NodeinfoResources) GenerateFromActor ¶
func (resource *NodeinfoResources) GenerateFromActor(hostname *url.URL, _ *Actor, serverVersion string)
GenerateFromActor : Generate Webfinger resource from Actor.
type NodeinfoServices ¶
type NodeinfoServices struct { Inbound []string `json:"inbound"` Outbound []string `json:"outbound"` }
NodeinfoServices : NodeinfoSoftware Resource.
type NodeinfoSoftware ¶
type NodeinfoSoftware struct { Name string `json:"name"` Version string `json:"version"` Repository string `json:"repository,omitempty"` }
NodeinfoSoftware : NodeinfoSoftware Resource.
type NodeinfoUsage ¶
type NodeinfoUsage struct {
Users NodeinfoUsageUsers `json:"users"`
}
NodeinfoUsage : NodeinfoUsage Resource.
type NodeinfoUsageUsers ¶
type NodeinfoUsageUsers struct { Total int `json:"total"` ActiveMonth int `json:"activeMonth"` ActiveHalfyear int `json:"activeHalfyear"` }
NodeinfoUsageUsers : NodeinfoUsageUsers Resource.
type PublicKey ¶
type PublicKey struct { ID string `json:"id,omitempty"` Owner string `json:"owner,omitempty"` PublicKeyPem string `json:"publicKeyPem,omitempty"` }
PublicKey : Activity Certificate.
type RelayConfig ¶
type RelayConfig struct {
// contains filtered or unexported fields
}
RelayConfig contains valid configuration.
func NewRelayConfig ¶
func NewRelayConfig() (*RelayConfig, error)
NewRelayConfig create valid RelayConfig from viper configuration.
func (*RelayConfig) ActorKey ¶
func (relayConfig *RelayConfig) ActorKey() *rsa.PrivateKey
ActorKey is API Worker's HTTPSignature private key.
func (*RelayConfig) DumpWelcomeMessage ¶
func (relayConfig *RelayConfig) DumpWelcomeMessage(moduleName string, version string) string
DumpWelcomeMessage provide build and config information string.
func (*RelayConfig) JobConcurrency ¶
func (relayConfig *RelayConfig) JobConcurrency() int
JobConcurrency is API Worker's jobConcurrency definition.
func (*RelayConfig) RedisClient ¶
func (relayConfig *RelayConfig) RedisClient() *redis.Client
RedisClient is return redis client from RelayConfig.
func (*RelayConfig) ServerBind ¶
func (relayConfig *RelayConfig) ServerBind() string
ServerBind is API Server's bind interface definition.
func (*RelayConfig) ServerHostname ¶
func (relayConfig *RelayConfig) ServerHostname() *url.URL
ServerHostname is API Server's hostname definition.
func (*RelayConfig) ServerServiceName ¶
func (relayConfig *RelayConfig) ServerServiceName() string
ServerServiceName is API Server's servername definition.
type RelayState ¶
type RelayState struct { RedisClient *redis.Client RelayConfig relayConfig `json:"relayConfig,omitempty"` LimitedDomains []string `json:"limitedDomains,omitempty"` BlockedDomains []string `json:"blockedDomains,omitempty"` Subscriptions []Subscription `json:"subscriptions,omitempty"` // contains filtered or unexported fields }
RelayState : Store subscriptions and relay configurations
func NewState ¶
func NewState(redisClient *redis.Client, notifiable bool) RelayState
NewState : Create new RelayState instance with redis client
func (*RelayState) AddSubscription ¶
func (config *RelayState) AddSubscription(domain Subscription)
AddSubscription : Add new instance for subscription list
func (*RelayState) DelSubscription ¶
func (config *RelayState) DelSubscription(domain string)
DelSubscription : Delete instance from subscription list
func (*RelayState) ListenNotify ¶
func (config *RelayState) ListenNotify(c chan<- bool)
func (*RelayState) SelectSubscription ¶
func (config *RelayState) SelectSubscription(domain string) *Subscription
SelectSubscription : Select instance from string
func (*RelayState) SetBlockedDomain ¶
func (config *RelayState) SetBlockedDomain(domain string, value bool)
SetBlockedDomain : Set/Unset instance for blocked domain
func (*RelayState) SetConfig ¶
func (config *RelayState) SetConfig(key Config, value bool)
SetConfig : Set relay configuration
func (*RelayState) SetLimitedDomain ¶
func (config *RelayState) SetLimitedDomain(domain string, value bool)
SetLimitedDomain : Set/Unset instance for limited domain
type Signature ¶
type Signature struct { Type string `json:"type,omitempty"` Creator string `json:"creator,omitempty"` Created string `json:"created,omitempty"` SignatureValue string `json:"signatureValue,omitempty"` }
Signature : ActivityPub Header Signature.
type Subscription ¶
type Subscription struct { Domain string `json:"domain,omitempty"` InboxURL string `json:"inbox_url,omitempty"` ActivityID string `json:"activity_id,omitempty"` ActorID string `json:"actor_id,omitempty"` }
Subscription : Instance subscription information
type WebfingerLink ¶
type WebfingerLink struct { Rel string `json:"rel,omitempty"` Type string `json:"type,omitempty"` Href string `json:"href,omitempty"` }
WebfingerLink : Webfinger Link Resource.
type WebfingerResource ¶
type WebfingerResource struct { Subject string `json:"subject,omitempty"` Links []WebfingerLink `json:"links,omitempty"` }
WebfingerResource : Webfinger Resource.
func (*WebfingerResource) GenerateFromActor ¶
func (resource *WebfingerResource) GenerateFromActor(hostname *url.URL, actor *Actor)
GenerateFromActor : Generate Webfinger resource from Actor.