wscaller

package
v0.0.0-...-6140180 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2023 License: BSD-2-Clause Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewWebsocketCaller

func NewWebsocketCaller(ctx context.Context, uri string, timeout time.Duration, notifier Notifier) (*websocketCaller, error)

Types

type DummyNotifier

type DummyNotifier struct{}

func (DummyNotifier) OnBtDownloadComplete

func (DummyNotifier) OnBtDownloadComplete(events []Event)

func (DummyNotifier) OnDownloadComplete

func (DummyNotifier) OnDownloadComplete(events []Event)

func (DummyNotifier) OnDownloadError

func (DummyNotifier) OnDownloadError(events []Event)

func (DummyNotifier) OnDownloadPause

func (DummyNotifier) OnDownloadPause(events []Event)

func (DummyNotifier) OnDownloadStart

func (DummyNotifier) OnDownloadStart(events []Event)

func (DummyNotifier) OnDownloadStop

func (DummyNotifier) OnDownloadStop(events []Event)

type Event

type Event struct {
	Gid string `json:"gid"` // GID of the download
}

type Notifier

type Notifier interface {
	// OnDownloadStart will be sent when a download is started.
	OnDownloadStart([]Event)
	// OnDownloadPause will be sent when a download is paused.
	OnDownloadPause([]Event)
	// OnDownloadStop will be sent when a download is stopped by the user.
	OnDownloadStop([]Event)
	// OnDownloadComplete will be sent when a download is complete. For BitTorrent downloads, this notification is sent when the download is complete and seeding is over.
	OnDownloadComplete([]Event)
	// OnDownloadError will be sent when a download is stopped due to an error.
	OnDownloadError([]Event)
	// OnBtDownloadComplete will be sent when a torrent download is complete but seeding is still going on.
	OnBtDownloadComplete([]Event)
}

Notifier handles rpc notification from aria2 server

type ResponseProcFn

type ResponseProcFn func(resp rpc.ClientResponse) error

type ResponseProcessor

type ResponseProcessor struct {
	// contains filtered or unexported fields
}

func NewResponseProcessor

func NewResponseProcessor() *ResponseProcessor

func (*ResponseProcessor) Add

func (r *ResponseProcessor) Add(id uint64, fn ResponseProcFn)

func (*ResponseProcessor) Process

func (r *ResponseProcessor) Process(resp rpc.ClientResponse) error

Process called by recv routine

Jump to

Keyboard shortcuts

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