tgb

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Aug 1, 2022 License: MIT Imports: 16 Imported by: 6

Documentation

Overview

Package tgb is a Telegram bot framework. It's contains high level API to easily create Telegram bots.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CallbackQueryHandler added in v0.0.3

type CallbackQueryHandler func(context.Context, *CallbackQueryUpdate) error

CallbackQueryHandler it's typed handler for CallbackQuery.

func (CallbackQueryHandler) Handle added in v0.0.3

func (handler CallbackQueryHandler) Handle(ctx context.Context, update *Update) error

type CallbackQueryUpdate added in v0.0.3

type CallbackQueryUpdate struct {
	*tg.CallbackQuery

	Update *Update
	Client *tg.Client
}

func (*CallbackQueryUpdate) Answer added in v0.0.3

func (cbq *CallbackQueryUpdate) Answer() *tg.AnswerCallbackQueryCall

Answer without response (just hide loading icon)

func (*CallbackQueryUpdate) AnswerText added in v0.0.3

func (cbq *CallbackQueryUpdate) AnswerText(text string, alert bool) *tg.AnswerCallbackQueryCall

AnswerText with text response and optional alert

func (*CallbackQueryUpdate) AnswerURL added in v0.0.3

func (cbq *CallbackQueryUpdate) AnswerURL(url string) *tg.AnswerCallbackQueryCall

AnswerURL with URL response and optional. URL has limitations, see CallbackQuery.Url for more details.

type ChatJoinRequestHandler added in v0.0.3

type ChatJoinRequestHandler func(context.Context, *ChatJoinRequestUpdate) error

ChatJoinRequestHandler it's typed handler for ChatJoinRequest.

func (ChatJoinRequestHandler) Handle added in v0.0.3

func (handler ChatJoinRequestHandler) Handle(ctx context.Context, update *Update) error

type ChatJoinRequestUpdate added in v0.0.3

type ChatJoinRequestUpdate struct {
	*tg.ChatJoinRequest
	Update *Update
	Client *tg.Client
}

func (*ChatJoinRequestUpdate) Approve added in v0.0.3

func (joinRequest *ChatJoinRequestUpdate) Approve() *tg.ApproveChatJoinRequestCall

Approve join request

func (*ChatJoinRequestUpdate) Decline added in v0.0.3

func (joinRequest *ChatJoinRequestUpdate) Decline() *tg.DeclineChatJoinRequestCall

Decline join request

type ChatMemberUpdatedHandler added in v0.0.3

type ChatMemberUpdatedHandler func(context.Context, *ChatMemberUpdatedUpdate) error

UpdateHandler it's typed handler for ChatMemberUpdate subtype.

func (ChatMemberUpdatedHandler) Handle added in v0.0.3

func (handler ChatMemberUpdatedHandler) Handle(ctx context.Context, update *Update) error

type ChatMemberUpdatedUpdate added in v0.0.3

type ChatMemberUpdatedUpdate struct {
	*tg.ChatMemberUpdated
	Update *Update
	Client *tg.Client
}

type ChosenInlineResultHandler added in v0.0.3

type ChosenInlineResultHandler func(context.Context, *ChosenInlineResultUpdate) error

ChosenInlineResultHandler it's typed handler for ChosenInlineResult. Impliment Handler interface.

func (ChosenInlineResultHandler) Handle added in v0.0.3

func (handler ChosenInlineResultHandler) Handle(ctx context.Context, update *Update) error

type ChosenInlineResultUpdate added in v0.0.3

type ChosenInlineResultUpdate struct {
	*tg.ChosenInlineResult
	Update *Update
	Client *tg.Client
}

type CommandFilterOption

type CommandFilterOption func(*commandFilter)

func WithCommandAlias

func WithCommandAlias(aliases ...string) CommandFilterOption

WithCommandAlias adds alias to command.

func WithCommandIgnoreCaption

func WithCommandIgnoreCaption(ignoreCaption bool) CommandFilterOption

WithCommandIgnoreCaption sets ignore caption as text source. By default is true.

func WithCommandIgnoreCase

func WithCommandIgnoreCase(ignoreCase bool) CommandFilterOption

WithCommandIgnoreCase sets ignore case in commands. By default is true.

func WithCommandIgnoreMention

func WithCommandIgnoreMention(ignoreMention bool) CommandFilterOption

WithCommandIgnoreMention sets ignore mention in command with mention (/command@username). By default is false.

func WithCommandPrefix

func WithCommandPrefix(prefixes ...string) CommandFilterOption

WithCommandPrefix sets allowed command prefixies. By default is '/'.

type ErrorHandler added in v0.0.4

type ErrorHandler func(ctx context.Context, update *Update, err error) error

ErrorHandler define interface for error handling in Bot. See Bot.Error for more information.

type Filter

type Filter interface {
	Allow(ctx context.Context, update *Update) (bool, error)
}

Filter is a interface for generic update filter.

func All

func All(filters ...Filter) Filter

All pass update to handler, if all of filters allow it.

func Any

func Any(filters ...Filter) Filter

Any pass update to handler, if any of filters allow it.

func ChatType added in v0.0.2

func ChatType(types ...tg.ChatType) Filter

ChatType filter checks if chat type is in specified list.

Check is performed in:

  • Message, EditedMessage, ChannelPost, EditedChannelPost
  • CallbackQuery.Message.Chat.Type (if not nil)
  • InlineQuery.ChatType
  • MyChatMember.Chat.Type
  • ChatMember.Chat.Type
  • ChatJoinRequest.Chat.Type

func Command

func Command(command string, opts ...CommandFilterOption) Filter

Command adds filter for command with specified options.

func MessageEntity added in v0.1.1

func MessageEntity(types ...tg.MessageEntityType) Filter

MessageEntity checks Message, EditedMessage, ChannelPost, EditedChannelPost .Entities, .CaptionEntities, .Poll.ExplanationEntities or .Game.TextEntities for matching type with specified. If multiple types are specified, it checks if message entity type is one of them.

func MessageType added in v0.0.6

func MessageType(types ...tg.MessageType) Filter

MessageType checks Message, EditedMessage, ChannelPost, EditedChannelPost for matching type with specified. If multiple types are specified, it checks if message type is one of them.

func Regexp

func Regexp(re *regexp.Regexp) Filter

RegexpFilter handles updates by regexp.

Checks following fields:

  • Update.Message.Text
  • Update.Message.Caption
  • Update.CallbackQuery.Data
  • Update.InlineQuery.Query
  • Update.ChosenInlineResult.Query
  • Update.Poll.Question

func TextContains added in v0.0.6

func TextContains(v string, opts ...TextFuncFilterOption) Filter

TextContains creates a TextFuncFilter that checks if text of update contains specified.

func TextEqual added in v0.0.6

func TextEqual(v string, opts ...TextFuncFilterOption) Filter

TextEqual creates a TextFuncFilter that checks if text of update equals to specified.

func TextFunc added in v0.0.6

func TextFunc(fn func(text string, ignoreCase bool) bool, opts ...TextFuncFilterOption) Filter

TextFunc creates a generic TextFuncFilter with specified function.

func TextHasPrefix added in v0.0.6

func TextHasPrefix(v string, opts ...TextFuncFilterOption) Filter

TextHasPrefix creates a TextFuncFilter that checks if text of update has prefix.

func TextHasSuffix added in v0.0.6

func TextHasSuffix(v string, opts ...TextFuncFilterOption) Filter

TextHasSuffix creates a TextFuncFilter that checks if text of update has suffix.

func TextIn added in v0.0.6

func TextIn(vs []string, opts ...TextFuncFilterOption) Filter

TextIn creates a TextFuncFilter that checks if text of update is in specified slice.

type FilterFunc

type FilterFunc func(ctx context.Context, update *Update) (bool, error)

The FilterFunc type is an adapter to allow the use of ordinary functions as filter. If f is a function with the appropriate signature, FilterFunc(f) is a Filter that calls f.

func (FilterFunc) Allow

func (filter FilterFunc) Allow(ctx context.Context, update *Update) (bool, error)

Allow implements Filter interface.

type Handler

type Handler interface {
	Handle(ctx context.Context, update *Update) error
}

Handler define generic Update handler.

type HandlerFunc

type HandlerFunc func(ctx context.Context, update *Update) error

HandlerFunc define functional handler.

func (HandlerFunc) Handle

func (handler HandlerFunc) Handle(ctx context.Context, update *Update) error

Handle implements Handler interface.

type InlineQueryHandler added in v0.0.3

type InlineQueryHandler func(context.Context, *InlineQueryUpdate) error

InlineQueryHandler it's typed handler for InlineQuery. Impliment Handler interface.

func (InlineQueryHandler) Handle added in v0.0.3

func (handler InlineQueryHandler) Handle(ctx context.Context, update *Update) error

type InlineQueryUpdate added in v0.0.3

type InlineQueryUpdate struct {
	*tg.InlineQuery
	Update *Update
	Client *tg.Client
}

func (*InlineQueryUpdate) Answer added in v0.0.3

func (iq *InlineQueryUpdate) Answer(results []tg.InlineQueryResult) *tg.AnswerInlineQueryCall

type Logger

type Logger interface {
	Printf(format string, args ...any)
}

Logger defines generic interface for loggers

type MessageHandler added in v0.0.3

type MessageHandler func(context.Context, *MessageUpdate) error

MessageHandler it's typed handler for Message. Impliment Handler interface.

func (MessageHandler) Handle added in v0.0.3

func (handler MessageHandler) Handle(ctx context.Context, update *Update) error

type MessageUpdate added in v0.0.3

type MessageUpdate struct {
	*tg.Message
	Client *tg.Client
	Update *Update
}

MessageUpdate it's extend wrapper around tg.Message.

func (*MessageUpdate) Answer added in v0.0.3

func (msg *MessageUpdate) Answer(text string) *tg.SendMessageCall

Answer calls sendMessage with pre-defined chatID to incoming message chat.

func (*MessageUpdate) AnswerAnimation added in v0.0.3

func (msg *MessageUpdate) AnswerAnimation(animation tg.FileArg) *tg.SendAnimationCall

AnswerAnimation calls sendAnimation with pre-defined chatID to incoming message chat.

func (*MessageUpdate) AnswerAudio added in v0.0.3

func (msg *MessageUpdate) AnswerAudio(audio tg.FileArg) *tg.SendAudioCall

AnswerAudio calls sendAudio with pre-defined chatID to incoming message chat.

func (*MessageUpdate) AnswerChatAction added in v0.0.3

func (msg *MessageUpdate) AnswerChatAction(action tg.ChatAction) *tg.SendChatActionCall

AnswerChatAction calls sendChatAction with pre-defined chatID to incoming message chat.

func (*MessageUpdate) AnswerContact added in v0.0.3

func (msg *MessageUpdate) AnswerContact(phoneNumber string, firstName string) *tg.SendContactCall

AnswerContact calls sendContact with pre-defined chatID to incoming message chat.

func (*MessageUpdate) AnswerDice added in v0.0.3

func (msg *MessageUpdate) AnswerDice(emoji string) *tg.SendDiceCall

AnswerDice calls sendDice with pre-defined chatID to incoming message chat.

func (*MessageUpdate) AnswerDocument added in v0.0.3

func (msg *MessageUpdate) AnswerDocument(document tg.FileArg) *tg.SendDocumentCall

AnswerDocument calls sendDocument with pre-defined chatID to incoming message chat.

func (*MessageUpdate) AnswerLocation added in v0.0.3

func (msg *MessageUpdate) AnswerLocation(latitude float64, longitude float64) *tg.SendLocationCall

AnswerLocation calls sendLocation with pre-defined chatID to incoming message chat.

func (*MessageUpdate) AnswerMediaGroup added in v0.0.5

func (msg *MessageUpdate) AnswerMediaGroup(action []tg.InputMedia) *tg.SendMediaGroupCall

AnswerMediaGroup calls sendMediaGroup with pre-defined chatID to incoming message chat.

func (*MessageUpdate) AnswerPhoto added in v0.0.3

func (msg *MessageUpdate) AnswerPhoto(photo tg.FileArg) *tg.SendPhotoCall

AnswerPhoto calls sendPhoto with pre-defined chatID to incoming message chat.

func (*MessageUpdate) AnswerPoll added in v0.0.3

func (msg *MessageUpdate) AnswerPoll(question string, options []string) *tg.SendPollCall

AnswerPoll calls sendPoll with pre-defined chatID to incoming message chat.

func (*MessageUpdate) AnswerSticker added in v0.0.3

func (msg *MessageUpdate) AnswerSticker(sticker tg.FileArg) *tg.SendStickerCall

AnswerSticker calls sendSticker with pre-defined chatID to incoming message chat.

func (*MessageUpdate) AnswerVenue added in v0.0.3

func (msg *MessageUpdate) AnswerVenue(latitude float64, longitude float64, title string, address string) *tg.SendVenueCall

AnswerVenue calls sendVenue with pre-defined chatID to incoming message chat.

func (*MessageUpdate) AnswerVideo added in v0.0.3

func (msg *MessageUpdate) AnswerVideo(video tg.FileArg) *tg.SendVideoCall

AnswerVideo calls sendVideo with pre-defined chatID to incoming message chat.

func (*MessageUpdate) AnswerVideoNote added in v0.0.3

func (msg *MessageUpdate) AnswerVideoNote(videoNote tg.FileArg) *tg.SendVideoNoteCall

AnswerVideoNote calls sendVideoNote with pre-defined chatID to incoming message chat.

func (*MessageUpdate) AnswerVoice added in v0.0.3

func (msg *MessageUpdate) AnswerVoice(voice tg.FileArg) *tg.SendVoiceCall

AnswerVoice calls sendVoice with pre-defined chatID to incoming message chat.

func (*MessageUpdate) Copy added in v0.0.3

func (msg *MessageUpdate) Copy(to tg.PeerID) *tg.CopyMessageCall

Copy incoming message to another chat.

func (*MessageUpdate) EditCaption added in v0.0.3

func (msg *MessageUpdate) EditCaption(caption string) *tg.EditMessageCaptionCall

EditCaption of incoming message.

func (*MessageUpdate) EditReplyMarkup added in v0.0.3

func (msg *MessageUpdate) EditReplyMarkup(markup tg.InlineKeyboardMarkup) *tg.EditMessageReplyMarkupCall

EditReplyMarkup of incoming message.

func (*MessageUpdate) EditText added in v0.0.3

func (msg *MessageUpdate) EditText(text string) *tg.EditMessageTextCall

EditText of incoming message.

func (*MessageUpdate) Forward added in v0.0.3

func (msg *MessageUpdate) Forward(to tg.PeerID) *tg.ForwardMessageCall

Forward incoming message to another chat.

type Middleware

type Middleware func(Handler) Handler

type PollAnswerHandler added in v0.0.3

type PollAnswerHandler func(context.Context, *PollAnswerUpdate) error

PollAnswerHandler it's typed handler for PollAnswer.

func (PollAnswerHandler) Handle added in v0.0.3

func (handler PollAnswerHandler) Handle(ctx context.Context, update *Update) error

type PollAnswerUpdate added in v0.0.3

type PollAnswerUpdate struct {
	*tg.PollAnswer
	Update *Update
	Client *tg.Client
}

type PollHandler added in v0.0.3

type PollHandler func(context.Context, *PollUpdate) error

PollHandler it's typed handler for Poll.

func (PollHandler) Handle added in v0.0.3

func (handler PollHandler) Handle(ctx context.Context, update *Update) error

type PollUpdate added in v0.0.3

type PollUpdate struct {
	*tg.Poll
	Update *Update
	Client *tg.Client
}

type Poller added in v0.0.2

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

Poller is a long polling update deliverer.

func NewPoller added in v0.0.2

func NewPoller(handler Handler, client *tg.Client, opts ...PollerOption) *Poller

func (*Poller) Run added in v0.0.2

func (poller *Poller) Run(ctx context.Context) error

type PollerOption added in v0.0.2

type PollerOption func(*Poller)

func WithPollerAllowedUpdates added in v0.0.3

func WithPollerAllowedUpdates(allowedUpdates ...tg.UpdateType) PollerOption

WithPollerAllowedUpdates sets the allowed updates.

func WithPollerHandlerTimeout added in v0.0.2

func WithPollerHandlerTimeout(timeout time.Duration) PollerOption

WithHandlerTimeout sets the timeout for Handler exectution.

func WithPollerLimit added in v0.0.3

func WithPollerLimit(limit int) PollerOption

WithPollerLimit sets the limit for batch size.

func WithPollerLogger added in v0.0.5

func WithPollerLogger(logger Logger) PollerOption

WithPollerLogger sets the logger for the poller.

func WithPollerRetryAfter added in v0.0.2

func WithPollerRetryAfter(retryAfter time.Duration) PollerOption

WithPollerRetryAfter sets the retry after for polling.

func WithPollerTimeout added in v0.0.2

func WithPollerTimeout(timeout time.Duration) PollerOption

WithPollerTimeout sets the timeout for polling.

type PreCheckoutQueryHandler added in v0.0.3

type PreCheckoutQueryHandler func(context.Context, *PreCheckoutQueryUpdate) error

PreCheckoutQueryHandler it's typed handler for PreCheckoutQuery.

func (PreCheckoutQueryHandler) Handle added in v0.0.3

func (handler PreCheckoutQueryHandler) Handle(ctx context.Context, update *Update) error

type PreCheckoutQueryUpdate added in v0.0.3

type PreCheckoutQueryUpdate struct {
	*tg.PreCheckoutQuery
	Update *Update
	Client *tg.Client
}

func (*PreCheckoutQueryUpdate) Answer added in v0.0.3

func (pcq *PreCheckoutQueryUpdate) Answer(ok bool) *tg.AnswerPreCheckoutQueryCall

type Router added in v0.0.6

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

Router is a router for incoming Updates. tg.Update should be wrapped into tgb.Update with binded Client and Update.

func NewRouter added in v0.0.6

func NewRouter() *Router

NewRouter creates new Bot.

func (*Router) CallbackQuery added in v0.0.6

func (bot *Router) CallbackQuery(handler CallbackQueryHandler, filters ...Filter) *Router

CallbackQuery register handlers for Update with not empty CallbackQuery field.

func (*Router) ChannelPost added in v0.0.6

func (bot *Router) ChannelPost(handler MessageHandler, filters ...Filter) *Router

ChannelPost register handlers for Update with not empty ChannelPost field.

func (*Router) ChatJoinRequest added in v0.0.6

func (bot *Router) ChatJoinRequest(handler ChatJoinRequestHandler, filters ...Filter) *Router

ChatJoinRequest register handlers for Update with not empty ChatJoinRequest field.

func (*Router) ChatMember added in v0.0.6

func (bot *Router) ChatMember(handler ChatMemberUpdatedHandler, filters ...Filter) *Router

ChatMember register handlers for Update with not empty ChatMember field.

func (*Router) ChosenInlineResult added in v0.0.6

func (bot *Router) ChosenInlineResult(handler ChosenInlineResultHandler, filters ...Filter) *Router

ChosenInlineResult register handlers for Update with not empty ChosenInlineResult field.

func (*Router) EditedChannelPost added in v0.0.6

func (bot *Router) EditedChannelPost(handler MessageHandler, filters ...Filter) *Router

EditedChannelPost register handlers for Update with not empty EditedChannelPost field.

func (*Router) EditedMessage added in v0.0.6

func (bot *Router) EditedMessage(handler MessageHandler, filters ...Filter) *Router

EditedMessage register handlers for Update with not empty EditedMessage field.

func (*Router) Error added in v0.0.6

func (bot *Router) Error(handler ErrorHandler) *Router

Error registers a handler for errors. If any error occurs in the chain, it will be passed to that handler. By default, errors are returned back by handler method. You can customize this behavior by passing a custom error handler.

func (*Router) Handle added in v0.0.6

func (bot *Router) Handle(ctx context.Context, update *Update) error

Handle handles an Update.

func (*Router) InlineQuery added in v0.0.6

func (bot *Router) InlineQuery(handler InlineQueryHandler, filters ...Filter) *Router

InlineQuery register handlers for Update with not empty InlineQuery field.

func (*Router) Message added in v0.0.6

func (bot *Router) Message(handler MessageHandler, filters ...Filter) *Router

Message register handlers for Update with not empty Message field.

func (*Router) MyChatMember added in v0.0.6

func (bot *Router) MyChatMember(handler ChatMemberUpdatedHandler, filters ...Filter) *Router

MyChatMember register handlers for Update with not empty MyChatMember field.

func (*Router) Poll added in v0.0.6

func (bot *Router) Poll(handler PollHandler, filters ...Filter) *Router

Poll register handlers for Update with not empty Poll field.

func (*Router) PollAnswer added in v0.0.6

func (bot *Router) PollAnswer(handler PollAnswerHandler, filters ...Filter) *Router

PollAnswer register handlers for Update with not empty PollAnswer field.

func (*Router) PreCheckoutQuery added in v0.0.6

func (bot *Router) PreCheckoutQuery(handler PreCheckoutQueryHandler, filters ...Filter) *Router

PreCheckoutQuery register handlers for Update with not empty PreCheckoutQuery field.

func (*Router) ShippingQuery added in v0.0.6

func (bot *Router) ShippingQuery(handler ShippingQueryHandler, filters ...Filter) *Router

ShippingQuery register handlers for Update with not empty ShippingQuery field.

func (*Router) Update added in v0.0.6

func (bot *Router) Update(handler HandlerFunc, filters ...Filter) *Router

Update registers a generic Update handler. It will be called as typed handlers only in filters match the update. First check Update handler, then typed.

func (*Router) Use added in v0.0.6

func (bot *Router) Use(mws ...Middleware) *Router

Use add middleware to chain handlers. Should be called before any other register handler.

type ShippingQueryHandler added in v0.0.3

type ShippingQueryHandler func(context.Context, *ShippingQueryUpdate) error

ShippingQueryHandler it's typed handler for ShippingQuery.

func (ShippingQueryHandler) Handle added in v0.0.3

func (handler ShippingQueryHandler) Handle(ctx context.Context, update *Update) error

type ShippingQueryUpdate added in v0.0.3

type ShippingQueryUpdate struct {
	*tg.ShippingQuery
	Update *Update
	Client *tg.Client
}

func (*ShippingQueryUpdate) Answer added in v0.0.3

func (sq *ShippingQueryUpdate) Answer(ok bool) *tg.AnswerShippingQueryCall

type TextFuncFilterOption added in v0.0.6

type TextFuncFilterOption func(*textFuncFilter)

TextFuncFilterOption is a filter option for TextFuncFilter.

func WithTextFuncIgnoreCase added in v0.0.6

func WithTextFuncIgnoreCase(v bool) TextFuncFilterOption

type Update added in v0.0.3

type Update struct {
	*tg.Update
	Client *tg.Client
	// contains filtered or unexported fields
}

Update wraps around a tg.Update. Also contains Client which is used to send responses.

func (*Update) Respond added in v0.0.3

func (update *Update) Respond(ctx context.Context, v UpdateRespond) error

Respond to Webhook, if possible or make usual call via Client.

type UpdateRespond added in v0.0.3

type UpdateRespond interface {
	json.Marshaler
	DoVoid(ctx context.Context) error
	Bind(client *tg.Client)
}

UpdateRespond defines interface for responding to an update via Webhook.

type Webhook

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

func NewWebhook

func NewWebhook(handler Handler, client *tg.Client, url string, options ...WebhookOption) *Webhook

func (*Webhook) Run added in v0.0.5

func (webhook *Webhook) Run(ctx context.Context, listen string) error

Run starts the webhook server.

func (*Webhook) ServeHTTP

func (webhook *Webhook) ServeHTTP(w http.ResponseWriter, r *http.Request)

func (*Webhook) Setup

func (webhook *Webhook) Setup(ctx context.Context) (err error)

type WebhookOption

type WebhookOption func(*Webhook)

WebhookOption used to configure the Webhook

func WithDropPendingUpdates added in v0.0.3

func WithDropPendingUpdates(dropPendingUpdates bool) WebhookOption

WithDropPendingUpdates drop pending updates (if pending > 0 only)

func WithWebhookAllowedUpdates added in v0.0.3

func WithWebhookAllowedUpdates(updates ...tg.UpdateType) WebhookOption

WithWebhookAllowedUpdates sets the list of allowed updates. By default all update types except chat_member (default). If not specified, the previous setting will be used. Please note that this parameter doesn't affect updates created before the call to the setWebhook, so unwanted updates may be received for a short period of time.

func WithWebhookIP added in v0.0.3

func WithWebhookIP(ip string) WebhookOption

WithWebhookIP the fixed IP address which will be used to send webhook requests instead of the IP address resolved through DNS

func WithWebhookLogger added in v0.0.5

func WithWebhookLogger(logger Logger) WebhookOption

WithWebhookLogger sets the logger which will be used to log the webhook related errors.

func WithWebhookMaxConnections added in v0.0.3

func WithWebhookMaxConnections(maxConnections int) WebhookOption

WithWebhookMaxConnections sets the maximum number of concurrent connections. By default is 40

func WithWebhookSecuritySubnets

func WithWebhookSecuritySubnets(subnets ...netip.Prefix) WebhookOption

WithWebhookSecuritySubnets sets list of subnets which are allowed to send webhook requests.

func WithWebhookSecurityToken

func WithWebhookSecurityToken(token string) WebhookOption

WithWebhookSecurityToken sets the security token which is used to validate the webhook requests. By default the token is generated from the client token via sha256. 1-256 characters. Only characters A-Z, a-z, 0-9, _ and - are allowed. The header is useful to ensure that the request comes from a webhook set by you.

Directories

Path Synopsis
session
sessionredis Module
sessionsql Module

Jump to

Keyboard shortcuts

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