iplist

package
v6.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package iplist 根据 IP 对请求进行过滤

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type IPList

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

func New

func New(white, black []string) *IPList

New 声明 IPList 对象

white 和 black 分别表示白名单和黑名单的值,格式可参考 IPList.WithWhite。 如果同时存在于黑名单和白名单,则白名单优先于黑名单。

func (*IPList) Enable

func (l *IPList) Enable(v bool)

func (*IPList) Middleware

func (l *IPList) Middleware(next web.HandlerFunc) web.HandlerFunc

func (*IPList) WithBlack

func (l *IPList) WithBlack(ip ...string) *IPList

WithBlack 添加黑名单

ip IP 地址,格式可参考 IPList.WithWhite

func (*IPList) WithWhite

func (l *IPList) WithWhite(ip ...string) *IPList

WithWhite 添加白名单

ip IP 地址,可以是具体的 IP 地址,比如 44.44.44.44, 也可以是通配符,比如 44.44/*。

Jump to

Keyboard shortcuts

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