state

package
v0.2.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 5, 2019 License: AGPL-3.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config int

Config : Enum for RelayConfig

const (
	// BlockService : Blocking for service-type actor
	BlockService Config = iota
	// ManuallyAccept : Manually accept follow-request
	ManuallyAccept
	// CreateAsAnnounce : Announce activity instead of relay create activity
	CreateAsAnnounce
)

type RelayState

type RelayState struct {
	RedisClient *redis.Client

	RelayConfig    relayConfig    `json:"relayConfig"`
	LimitedDomains []string       `json:"limitedDomains"`
	BlockedDomains []string       `json:"blockedDomains"`
	Subscriptions  []Subscription `json:"subscriptions"`
}

RelayState : Store subscriptions and relay configrations

func NewState

func NewState(redisClient *redis.Client) 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) Load

func (config *RelayState) Load()

Load : Refrash content from redis

func (*RelayState) SelectSubscription added in v0.2.1

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 configration

func (*RelayState) SetLimitedDomain

func (config *RelayState) SetLimitedDomain(domain string, value bool)

SetLimitedDomain : Set/Unset instance for limited domain

type Subscription

type Subscription struct {
	Domain     string `json:"domain"`
	InboxURL   string `json:"inbox_url"`
	ActivityID string `json:"activity_id"`
	ActorID    string `json:"actor_id"`
}

Subscription : Instance subscription information

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL