client

package
v0.0.0-...-07d7cf3 Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultHttpReqTimeout = 30 * time.Second
View Source
const DefaultSlackTimeout = 5 * time.Second

Variables

This section is empty.

Functions

This section is empty.

Types

type HTTPClient

type HTTPClient interface {
	Do(req *http.Request) (*http.Response, error)
}
var (
	Client HTTPClient
)

type HTTPClientMock

type HTTPClientMock struct {
	DoFunc func(*http.Request) (*http.Response, error)
}

func (HTTPClientMock) Do

type Site

type Site struct {
	URL      string `yaml:"url"`
	Interval string `yaml:"interval"`
	Code     uint16 `yaml:"code"`
}

func (Site) CheckUrlStatus

func (site Site) CheckUrlStatus() (int, error)

type SiteConfig

type SiteConfig struct {
	Sites []Site `yaml:"sites"`
}

type SlackConfig

type SlackConfig struct {
	WebhookURL string        `yaml:"webhook_url"`
	Username   string        `yaml:"username"`
	Channel    string        `yaml:"channel"`
	TimeOut    time.Duration `yaml:"timeout"`
}

func (SlackConfig) SendSlackNotification

func (sc SlackConfig) SendSlackNotification(sr SlackRequest) error

type SlackMessage

type SlackMessage struct {
	Username  string `json:"username,omitempty"`
	IconEmoji string `json:"icon_emoji,omitempty"`
	Channel   string `json:"channel,omitempty"`
	Text      string `json:"text,omitempty"`
}

type SlackRequest

type SlackRequest struct {
	Text      string
	IconEmoji string
}

Jump to

Keyboard shortcuts

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