pushkit

package module
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2025 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EmailSender

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

func NewEmailSender

func NewEmailSender(logger *glog.Logger, config ...EmailSenderCoreConfig) *EmailSender

func (*EmailSender) Push

func (s *EmailSender) Push(ctx context.Context, message Message) (err error)

func (*EmailSender) Start

func (s *EmailSender) Start(stopCtx context.Context) (err error)

type EmailSenderCore

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

func NewEmailSenderCore

func NewEmailSenderCore(config EmailSenderCoreConfig) *EmailSenderCore

func (*EmailSenderCore) GetCurrentWeight

func (s *EmailSenderCore) GetCurrentWeight() int

func (*EmailSenderCore) GetName

func (s *EmailSenderCore) GetName() string

func (*EmailSenderCore) GetWeight

func (s *EmailSenderCore) GetWeight() int

func (*EmailSenderCore) Send

func (s *EmailSenderCore) Send(m ...*gomail.Message) error

func (*EmailSenderCore) SetCurrentWeight

func (s *EmailSenderCore) SetCurrentWeight(w int)

type EmailSenderCoreConfig

type EmailSenderCoreConfig struct {
	Name     string
	Weight   int
	Host     string
	Port     int
	Username string
	Password string
}

type Message

type Message struct {
	To      []string
	Subject string
	Content string
}

type Option

type Option func(*PushService)

func WithEmailSender

func WithEmailSender(logger *glog.Logger, config ...EmailSenderCoreConfig) Option

func WithTgBotSender

func WithTgBotSender(logger *glog.Logger, config TgBotConfig) (Option, error)

type PushRequest

type PushRequest struct {
	Type    PushType
	Message Message
}

type PushService

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

func NewPushService

func NewPushService(opts ...Option) *PushService

func (*PushService) Push

func (ps *PushService) Push(ctx context.Context, req PushRequest) (err error)

func (*PushService) Start

func (ps *PushService) Start() (err error)

func (*PushService) Stop

func (ps *PushService) Stop()

type PushType

type PushType string
const (
	PushTypeEmail PushType = "Email"
)
const (
	PushTypeTgBot PushType = "TgBot"
)

type Sender

type Sender interface {
	Push(ctx context.Context, message Message) error
	Start(context.Context) error
}

type TgBotConfig

type TgBotConfig struct {
	// tg bot token
	BotToken string
	// 自定义的 bot 自动回复
	DefaultHandler bot.HandlerFunc
	// https://github.com/go-telegram/bot/issues/140
	// https://goframe.org/docs/web/http-client-proxy
	// 代理地址,支持 http 和 socks5 两种形式,分别为 http://USER:PASSWORD@IP:PORT 或 socks5://USER:PASSWORD@IP:PORT 形式
	ProxyURL string
}

type TgBotSender

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

func NewTgBotSender

func NewTgBotSender(logger *glog.Logger, config TgBotConfig) (*TgBotSender, error)

func (*TgBotSender) Push

func (s *TgBotSender) Push(ctx context.Context, message Message) (err error)

func (*TgBotSender) Start

func (s *TgBotSender) Start(stopCtx context.Context) (err error)

Jump to

Keyboard shortcuts

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