backends

package
v0.1.10 Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2023 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	LastReceived string

	SyncActions = struct {
		Push   string
		Pull   string
		Sync   string
		Manual string
	}{
		Push:   "push",
		Pull:   "pull",
		Sync:   "sync",
		Manual: "manual",
	}
	Hosts = struct {
		Ntfy  string
		Nostr string
	}{
		Ntfy:  "ntfy",
		Nostr: "nostr",
	}
)

Functions

func ClipReceived

func ClipReceived(clip string, client string)

func Close

func Close()

func PostClip

func PostClip(clip string)

Types

type BackendClient

type BackendClient interface {
	HandleMessages()
	Post(string) error
	Close()
	Get() string
	GetConfig() *BackendConfig
}

func New

func New(config BackendConfig) BackendClient

type BackendConfig

type BackendConfig struct {
	Type          string `yaml:"type"`
	Host          string `yaml:"host"`
	User          string `yaml:"user,omitempty"`
	Pass          string `yaml:"pass,omitempty"`
	Topic         string `yaml:"topic,omitempty"`
	EncryptionKey string `yaml:"encryptionkey,omitempty"`
	Action        string `yaml:"action"`
	Compression   bool   `yaml:"compression,omitempty"`
}

type NostrClient

type NostrClient struct {
	Config       BackendConfig
	Client       string
	Ctx          context.Context
	Cancel       context.CancelFunc
	Relay        *nostr.Relay
	Subscription *nostr.Subscription
	SharedSecret []byte
}

func (*NostrClient) Close

func (c *NostrClient) Close()

func (*NostrClient) Get

func (c *NostrClient) Get() string

func (*NostrClient) GetConfig

func (c *NostrClient) GetConfig() *BackendConfig

func (*NostrClient) HandleMessages

func (c *NostrClient) HandleMessages()

func (*NostrClient) Post

func (c *NostrClient) Post(clip string) error

type NtfyClient

type NtfyClient struct {
	Config      BackendConfig
	ClientName  string
	Client      *ntfyClient.Client
	Cipher      *dongle.Cipher
	BaseOptions []ntfyClient.PublishOption
}

func (*NtfyClient) Close

func (c *NtfyClient) Close()

func (*NtfyClient) Get

func (c *NtfyClient) Get() string

func (*NtfyClient) GetConfig

func (c *NtfyClient) GetConfig() *BackendConfig

func (*NtfyClient) HandleMessages

func (c *NtfyClient) HandleMessages()

func (*NtfyClient) Post

func (c *NtfyClient) Post(clip string) error

Jump to

Keyboard shortcuts

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