member

package
v0.0.0-...-1f3a9a3 Latest Latest
Warning

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

Go to latest
Published: Jan 2, 2025 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	TTLAnalyze      sync.Map
	TTLCache        sync.Map
	MacCache        sync.Map
	UaCache         sync.Map
	DeviceCache     sync.Map
	DeviceNameCache sync.Map
	DeviceTypeCache sync.Map
	Mutex           sync.Map
	Events          = make(chan PropertyChangeEvent, 100)
)

Functions

func ChangeEventIP

func ChangeEventIP(events <-chan PropertyChangeEvent)

ChangeEventIP IP 属性变化事件

func CleanUp

func CleanUp()

func DelFeatureSet

func DelFeatureSet(ip string)

func DelMemory

func DelMemory(ip string)

DelMemory 删除缓存

func EnsureIndexOnce

func EnsureIndexOnce()

EnsureIndexOnce 设置索引

func FlushToMongo

func FlushToMongo()

FlushToMongo 刷新到mongodb

func GetAnalyze

func GetAnalyze(ip string) bool

func GetFeatureSet

func GetFeatureSet(ip string) *types.FeatureSet

GetFeatureSet 获取或创建IP对应的FeatureSet

func GetHashForRedis

func GetHashForRedis(ip string) map[string]string

GetHashForRedis 从redis获取hash

func GetSuspectedCache

func GetSuspectedCache() *bigcache.BigCache

func Increment

func Increment(f types.Feature)

Increment 增量统计特征访问频率

func PutAnalyze

func PutAnalyze(ip string)

func Setup

func Setup()

func StartFlushScheduler

func StartFlushScheduler(interval time.Duration)

StartFlushScheduler 刷新时间窗口,记录到mongodb

func Store

func Store(i interface{})

Store IP加载/更新

func TriggerSuspected

func TriggerSuspected(ip string, ft types.FeatureType, count int)

Types

type Hash

type Hash struct {
	IP    string
	Field types.Property
	Value any
}

type InfoJson

type InfoJson struct {
	IP         string  `json:"ip" redis:"ip"`
	Username   string  `json:"username,omitempty" redis:"username,omitempty"`
	Mac        string  `json:"mac,omitempty" redis:"mac,omitempty"`
	TTL        string  `json:"ttl,omitempty" redis:"ttl,omitempty"`
	UA         string  `json:"user_agent,omitempty" redis:"user_agent,omitempty"`
	Device     string  `json:"device,omitempty" redis:"device,omitempty"`
	DeviceName string  `json:"device_name" redis:"device_name,omitempty"`
	DeviceType string  `json:"device_type" redis:"device_type,omitempty"`
	All        string  `json:"all,omitempty" redis:"all,omitempty"`
	Mobile     string  `json:"mobile,omitempty" redis:"mobile,omitempty"`
	Pc         string  `json:"pc,omitempty" redis:"pc,omitempty"`
	LastSeen   float64 `json:"last_seen" redis:"last_seen"`
}

type PropertyChangeEvent

type PropertyChangeEvent struct {
	IP       string
	OldValue any
	NewValue any
	Property types.Property
}

PropertyChangeEvent 属性变化事件结构

type Tables

type Tables struct {
	Results    []InfoJson `json:"results"`
	TotalCount int64      `json:"totalCount"`
}

func TraversalIP

func TraversalIP(startTime, endTime int64, page, pageSize int64) (result Tables, err error)

TraversalIP 遍历IP表

Jump to

Keyboard shortcuts

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