middleware

package
v0.1.27 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2025 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(manager *blocklist.Manager, opts ...Option) mist.Middleware

New 创建IP黑名单中间件

Types

type BlocklistConfig

type BlocklistConfig struct {
	// Manager IP黑名单管理器
	Manager *blocklist.Manager
	// OnBlocked 当IP被封禁时的处理函数
	OnBlocked func(*mist.Context)
}

BlocklistConfig 中间件配置

func DefaultConfig

func DefaultConfig(manager *blocklist.Manager) BlocklistConfig

DefaultConfig 返回默认配置

type Option

type Option func(*BlocklistConfig)

Option 配置选项函数

func WithOnBlocked

func WithOnBlocked(handler func(*mist.Context)) Option

WithOnBlocked 设置IP被封禁时的处理函数

Jump to

Keyboard shortcuts

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