webhook

package
v0.0.0-...-2b4f063 Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2024 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Telegram ConfigTelegram `json:"telegram" validate:"omitempty"`
	Vkteams  ConfigVkteams  `json:"vkteams" validate:"omitempty"`
}

func (Config) Init

func (cfg Config) Init(ctx context.Context)

Инициализация вебхуков. Если появляются ошибки в процессе -> просто игнорируем и пишем в лог

type ConfigTelegram

type ConfigTelegram struct {
	Enabled bool   `json:"enabled" default:"false"`
	Token   string `json:"token" validate:"required_if=Enabled true"`
	ChatId  string `json:"chat_id" validate:"required_if=Enabled true"`
	Text    string `json:"text" validate:"required_if=Enabled true"`
}

type ConfigVkteams

type ConfigVkteams struct {
	Enabled bool   `json:"enabled" default:"false"`
	Token   string `json:"token" validate:"required_if=Enabled true"`
	ChatId  string `json:"chat_id" validate:"required_if=Enabled true"`
	Text    string `json:"text" validate:"required_if=Enabled true"`
	Api     string `json:"api" validate:"required_if=Enabled true"`
}

type Telegram

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

func (*Telegram) Send

func (t *Telegram) Send(data *TemplateData)

Отправка сообщения в Telegram

type TemplateData

type TemplateData struct {
	Bid        int
	Username   string
	Hostname   string
	Domain     string
	ExternalIP string
	InternalIP string
	Privileged bool
}

type Vkteams

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

func (*Vkteams) Send

func (v *Vkteams) Send(data *TemplateData)

Отправка сообщения в Vkteams

type WebhookConnectors

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

Объект для хранения и обработки перенаправления сообщений в разные коннекторы

func (WebhookConnectors) Send

func (w WebhookConnectors) Send(data *TemplateData)

Отправка сообщения во все коннекторы

Jump to

Keyboard shortcuts

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