core

package
v0.0.0-...-84d87dc Latest Latest
Warning

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

Go to latest
Published: May 30, 2021 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Body

func Body(doc *html.Node) (*html.Node, error)

func RenderNode

func RenderNode(n *html.Node) string

Types

type ChannelInfo

type ChannelInfo struct {
	// Local identification of the client
	ID string `json:"id"`

	// Cna be wither telegram, email, sms, or smoke_signal
	ChannelType string `json:"type"`

	// External identification of the feedback channel
	ChannelID string `json:"channel"`
}

func NewChannelInfo

func NewChannelInfo(channelType string, channelId string) *ChannelInfo

type HttpService

type HttpService struct {
	Client http.Client
}

func NewHttpService

func NewHttpService() *HttpService

func (HttpService) GetBody

func (httpService HttpService) GetBody(URL string) (string, error)

type WatchRequest

type WatchRequest struct {
	// The channel information to return the feedback
	FeedbackChannelInfo *ChannelInfo `json:"id"`

	// URL to be checked if changed
	URL *url.URL `json:"url"`

	// interval in seconds, defaults to 3600s = 1h
	Interval int64
}

Represents the request of a watcher of a certain website

func NewWatchRequest

func NewWatchRequest(channelInfo *ChannelInfo, rawURL string) (*WatchRequest, error)

type Watched

type Watched struct {
	// Local identification of the client
	URL        *url.URL  `json:"url"`
	Hash       string    `json:"hash"`
	LastUpdate time.Time `json:"last_update"`
	Interval   int64     `json:"interval"`
}

type WatcherRepository

type WatcherRepository struct {
}

func NewWatcherRepository

func NewWatcherRepository() *WatcherRepository

type WatcherService

type WatcherService struct {
	WatchedUrls []*Watched
	// contains filtered or unexported fields
}

func NewWatcherService

func NewWatcherService() *WatcherService

func (*WatcherService) Insert

func (watcherService *WatcherService) Insert(watch *Watched)

func (*WatcherService) Register

func (watcherService *WatcherService) Register(request *WatchRequest) error

func (*WatcherService) Request

func (watcherService *WatcherService) Request(wg *sync.WaitGroup, watched *Watched)

func (*WatcherService) Start

func (watcherService *WatcherService) Start()

Jump to

Keyboard shortcuts

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