ipfilter

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: May 10, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package ipfilter

@author: xwc1125

Package ipfilter

@author: xwc1125

Package ipfilter

@author: xwc1125 过滤器集合类 管理一组过滤器,提供统一的外部调用接口

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CCConnFilter

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

CCConnFilter cc过滤

func NewCCConnFilter

func NewCCConnFilter() *CCConnFilter

NewCCConnFilter 创建对象实例 maxConnCount 同ip最大连接数

func (*CCConnFilter) GetAbnConn

func (filter *CCConnFilter) GetAbnConn(ip string) int

func (*CCConnFilter) OnConnected

func (filter *CCConnFilter) OnConnected(ip string) (bool, string)

type ConnFilter

type ConnFilter interface {
	// OnConnected 客户端连接建立
	// 返回false则关闭连接,同时返回需要关闭连接的原因
	OnConnected(ip string) (bool, string)
	GetAbnConn(ip string) int // 获取异常连接数
}

ConnFilter 连接过滤器接口定义

type ConnFilterColl

type ConnFilterColl map[string]ConnFilter

func ConnFilterCtx

func ConnFilterCtx() ConnFilterColl

func (ConnFilterColl) GetAbnConn

func (filters ConnFilterColl) GetAbnConn(ip string) int

func (ConnFilterColl) OnConnected

func (filters ConnFilterColl) OnConnected(ip string) (bool, string)

Jump to

Keyboard shortcuts

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