Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrNoConfig = errors.New("no notify config")
Functions ¶
Types ¶
type Config ¶
type Config struct {
Timeout time.Duration `json:"ntfy.timeout" yaml:"ntfy.timeout"`
Proxy string `json:"ntfy.proxy" yaml:"ntfy.proxy"`
Retry int `json:"ntfy.retry" yaml:"ntfy.retry"`
DingtalkConfig `yaml:",squash"`
TelegramConfig `yaml:",squash"`
WeixinWorkConfig `yaml:",squash"`
WebhookConfig `yaml:",squash"`
}
type DingtalkConfig ¶
type DingtalkConfig struct {
Token *string `json:"ntfy.dingtalk.token" yaml:"ntfy.dingtalk.token"`
Secret string `json:"ntfy.dingtalk.secret" yaml:"ntfy.dingtalk.secret"`
}
func (DingtalkConfig) Name ¶
func (DingtalkConfig) Name() string
func (DingtalkConfig) Sign ¶
func (c DingtalkConfig) Sign() (string, string)
type Option ¶ added in v2.0.20
type Option = optionutil.I[Options]
func WithHeader ¶ added in v2.0.20
type TelegramConfig ¶
type TelegramConfig struct {
Token *string `json:"ntfy.telegram.token" yaml:"ntfy.telegram.token"`
ChatId string `json:"ntfy.telegram.chat_id" yaml:"ntfy.telegram.chat_id"`
}
func (TelegramConfig) Name ¶
func (TelegramConfig) Name() string
type WebhookConfig ¶
type WebhookConfig struct {
URL *string `json:"ntfy.webhook.url" yaml:"ntfy.webhook.url"`
// optional: GET or POST, default is GET
Method string `json:"ntfy.webhook.method" yaml:"ntfy.webhook.method"`
// only available when method is POST
// optional: JSON or FORM, default is FORM
// - FORM is request by `application/x-www-form-urlencoded`
// - JSON is request by `application/json`
Type string `json:"ntfy.webhook.type" yaml:"ntfy.webhook.type"`
// the key of text in request body or query string
// default is text
Key string `json:"ntfy.webhook.key" yaml:"ntfy.webhook.key"`
// extra values
Extra map[string]string `json:"ntfy.webhook.extra" yaml:"ntfy.webhook.extra"`
// headers
Headers map[string]string `json:"ntfy.webhook.headers" yaml:"ntfy.webhook.headers"`
}
WebhookConfig is the config for webhook.
ServerChan [docs](https://sct.ftqq.com/sendkey) ¶
ntfy:
webhook:
url: https://sctapi.ftqq.com/{key}.send
method: POST
type: JSON
key: desp
extras:
title: ntfy
ntfy.sh [docs](https://docs.ntfy.sh/publish/#publish-as-json) ¶
ntfy:
webhook:
url: https://ntfy.com/
method: POST
type: JSON
key: message
extra:
title: ntfy
topic: default
headers:
Authorization: Basic base64(username:password)
func (WebhookConfig) Name ¶
func (c WebhookConfig) Name() string
type WeixinWorkConfig ¶ added in v2.0.1
type WeixinWorkConfig struct {
Key *string `json:"ntfy.weixin_work.key" yaml:"ntfy.weixin_work.key"`
}
func (WeixinWorkConfig) Name ¶ added in v2.0.1
func (WeixinWorkConfig) Name() string
Click to show internal directories.
Click to hide internal directories.