fail2ban

package
v3.3.13 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2026 License: BSD-3-Clause Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Add

type Add struct {
	Name        string `json:"name" validate:"required && regex:\"^[a-zA-Z0-9_.-]+$\""`
	Type        string `json:"type" validate:"required && in:service,website"`
	MaxRetry    int    `json:"maxretry" validate:"required && min:1"`
	FindTime    int    `json:"findtime" validate:"required && min:1"`
	BanTime     int    `json:"bantime" validate:"required && min:1"`
	WebsiteName string `json:"website_name" validate:"required_if:Type,website"`
	WebsiteMode string `json:"website_mode" validate:"required_if:Type,website && in:cc,path"`
	WebsitePath string `json:"website_path"`
}

type App

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

func NewApp

func NewApp(t *gotext.Locale, log *slog.Logger, websiteRepo biz.WebsiteRepo, pureftpdApp *pureftpd.App) *App

func (*App) BanList

func (s *App) BanList(w http.ResponseWriter, r *http.Request)

BanList 获取封禁列表

func (*App) Create

func (s *App) Create(w http.ResponseWriter, r *http.Request)

Create 添加规则

func (*App) Delete

func (s *App) Delete(w http.ResponseWriter, r *http.Request)

Delete 删除规则

func (*App) GetWhiteList

func (s *App) GetWhiteList(w http.ResponseWriter, r *http.Request)

GetWhiteList 获取白名单

func (*App) List

func (s *App) List(w http.ResponseWriter, r *http.Request)

List 所有规则

func (*App) Route

func (s *App) Route(r chi.Router)

func (*App) SetWhiteList

func (s *App) SetWhiteList(w http.ResponseWriter, r *http.Request)

SetWhiteList 设置白名单

func (*App) Status added in v3.2.2

func (s *App) Status(ctx context.Context) string

func (*App) Unban

func (s *App) Unban(w http.ResponseWriter, r *http.Request)

Unban 解封

func (*App) Update added in v3.3.2

func (s *App) Update(w http.ResponseWriter, r *http.Request)

Update 修改规则

type Jail

type Jail struct {
	Name     string `json:"name"`
	Enabled  bool   `json:"enabled"`
	MaxRetry int    `json:"max_retry"`
	FindTime int    `json:"find_time"`
	BanTime  int    `json:"ban_time"`

	// 以下几项在新增时由面板推导,之后随规则文件原样保留
	Filter  string `json:"filter"`
	Port    string `json:"port"`
	LogPath string `json:"log_path"`
}

type JailName added in v3.3.2

type JailName struct {
	Name string `form:"name" json:"name" validate:"required && regex:\"^[a-zA-Z0-9_.-]+$\""`
}

type SetWhiteList

type SetWhiteList struct {
	IP string `json:"ip" validate:"required"`
}

type Unban

type Unban struct {
	Name string `form:"name" json:"name" validate:"required"`
	IP   string `json:"ip" validate:"required && ip"`
}

type Update added in v3.3.2

type Update struct {
	Name     string `form:"name" json:"name" validate:"required && regex:\"^[a-zA-Z0-9_.-]+$\""`
	Enabled  bool   `json:"enabled"`
	MaxRetry int    `json:"max_retry" validate:"required && min:1"`
	FindTime int    `json:"find_time" validate:"required && min:1"`
	BanTime  int    `json:"ban_time" validate:"required && min:1"`
}

Update 只允许改这几项,过滤器、端口与日志路径随规则文件原样保留

Jump to

Keyboard shortcuts

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