net

package
v1.16.3 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2025 License: GPL-3.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BloomItemNums  = 1_000_000             // 布隆过滤器存储的元素个数
	BloomErrorRate = 0.001                 // 布隆过滤器的容错率
	Env_BlackIps   = "bloom_black_ips"     // 存储布隆过滤器数据的环境变量值
	BlackIpDir     = constant.Dir_DataRoot // 存储黑名单 ip 的文件路径
)
View Source
const (
	IpAddrDiskFileName = "ip_addr.json" // ip 属地信息持久化的文件名
)

Variables

This section is empty.

Functions

func AddBlackIp

func AddBlackIp(ip string) error

AddBlackIp 添加黑名单 ip

func GetIpAddrInfo

func GetIpAddrInfo(ip string) (string, bool)

GetIpAddrInfo 获取 ip 属地信息

func IsBlackIp

func IsBlackIp(ip string) bool

IsBlackIp 判断一个 ip 是否在黑名单中

func IsPrivateIp added in v1.11.2

func IsPrivateIp(ip string) bool

IsPrivateIp 判断一个 ip

Types

This section is empty.

Jump to

Keyboard shortcuts

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