Documentation
¶
Index ¶
- Constants
- Variables
- type Aggregation
- type AhoCorasick
- type Application
- type ApplicationInfo
- type Chart
- type Charts
- type Component
- type Condition
- type Context
- type Controls
- type CustomFields
- type DeviceBrand
- type DeviceList
- type DeviceRecord
- type DeviceRecordByFront
- type DnsInfo
- type Domain
- type Ethernet
- type Events
- type Feature
- type FeatureData
- type FeatureSet
- type FeatureType
- type HttpInfo
- type Internet
- type LayerMap
- type Metadata
- type Policy
- type Products
- type Property
- type ProtocolFlags
- type ProxyRecord
- type ReasonDetail
- type RtpInfo
- type Sessions
- type SuspectedRecord
- type TCPFlags
- type TlsInfo
- type TrafficRecord
- type Transmission
- type UDPFlags
- type User
- type UserAgentRecord
- type UserEvent
- type UserEventCondition
Constants ¶
View Source
const ( MongoDatabaseUserAgent = "useragent" MongoDatabaseStream = "streams" MongoDatabaseFeatures = "features" MongoDatabaseUserEvents = "user_events" MongoDatabaseDevices = "devices" MongoDatabaseConfigs = "config" MongoDatabaseProxy = "proxy" MongoDatabaseSuspected = "suspected" MongoCollectionPolicy = "policy" MongoCollectionConfig = "config" MongoCollectionFeatureApplication = "feature_application" MongoCollectionFeatureApplicationHistory = "feature_application_history" MongoCollectionFeatureBrands = "feature_brands" MongoCollectionFeatureBrandsHistory = "feature_brands_history" MongoCollectionFeatureBrandsKeyword = "feature_brands_keyword" MongoCollectionFeatureBrandsKeywordHistory = "feature_brands_keyword_history" MongoCollectionFeatureBrandsRoot = "feature_brands_root" MongoCollectionFeatureBrandsRootHistory = "feature_brands_root_history" )
View Source
const ( Features = "features" OnlineUsersFeature = "online_users" )
View Source
const ( STOP string = "stop" START string = "start" STATUS string = "status" RESTART string = "restart" )
View Source
const ( ZSetApplication = "z_set:application" ZSetIP = "z_set:ip" ZSetObserverTTL = "z_set:observer:ttl" ZSetObserverMac = "z_set:observer:mac" ZSetObserverUa = "z_set:observer:ua" ZSetObserverDevice = "z_set:observer:device" ZSetOnlineUsers = "z_set:online:users" ZSetRealtimeShored = "z_set:realtime:shored" HashAnalyzeIP = "hash:analyze:ip:%s" SetIPDevices = "set:ip:devices:%s" KeyDiscoverIP = "key:discover:ip:%s" KeyDevicesAllIP = "key:devices:all:ip:%s" KeyDevicesMobileIP = "key:devices:mobile:ip:%s" KeyDevicesPcIP = "key:devices:pc:ip:%s" LockIPBrand = "lock:%s:%s" ListProducts = "list:products" ListControl = "list:control" HashProducts = "hash:products:%s" HashControl = "hash:control:%s" ListProductsControl = "list:products:control:%s" )
View Source
const ( ListRadOnline = "list:rad_online" ListRadOnlineUpdate = "list:rad_online:update" HashRadOnline = "hash:rad_online:%d" ListAntiProxy = "list:antiproxy:%s" )
Variables ¶
View Source
var (
ApplicationCount int // 应用总数
)
Functions ¶
This section is empty.
Types ¶
type Aggregation ¶
type Aggregation interface {
GetTotalCount() int64
}
type AhoCorasick ¶
type Application ¶
type Application interface {
AddUp()
}
type ApplicationInfo ¶
type Chart ¶
type Chart struct { Date time.Time `bson:"date" json:"date"` Industry FeatureType `bson:"industry" json:"industry"` Unemployed int `bson:"unemployed" json:"unemployed"` }
type Charts ¶
func GenerateChartData ¶
func GenerateChartData() []Charts
type Controls ¶
type Controls struct { ControlName string `json:"control_name" bson:"control_name" redis:"control_name"` DisableProxy int `json:"disable_proxy" bson:"disable_proxy" redis:"disable_proxy"` ProxyTimes int `json:"proxy_times" bson:"proxy_times" redis:"proxy_times"` ProxyDisableTime int `json:"proxy_disable_time" bson:"proxy_disable_time" redis:"proxy_disable_time"` }
type CustomFields ¶
type CustomFields struct { FieldName string `bson:"field_name,omitempty" json:"field_name"` FieldValue string `bson:"field_value,omitempty" json:"field_value"` }
CustomFields 存储用户自定义字段
type DeviceBrand ¶
type DeviceList ¶
type DeviceList struct {
Brands []DeviceBrand `json:"brands" mapstructure:"brands"`
}
type DeviceRecord ¶
type DeviceRecord struct { IP string `json:"ip" bson:"ip"` OriginChanel Property `json:"-" bson:"origin_chanel"` OriginValue string `json:"-" bson:"origin_value"` Type string `json:"type" bson:"type"` Os string `json:"os" bson:"os,omitempty"` Version string `json:"version" bson:"version,omitempty"` Device string `json:"device" bson:"device,omitempty"` Brand string `json:"brand" bson:"brand,omitempty"` Model string `json:"model" bson:"model,omitempty"` Icon string `json:"icon" bson:"icon,omitempty"` Description string `json:"description" bson:"description,omitempty"` Remark string `json:"remark" bson:"remark,omitempty"` LastSeen time.Time `json:"-" bson:"last_seen,omitempty"` }
type DeviceRecordByFront ¶
type DeviceRecordByFront struct { IP string `json:"ip" bson:"ip"` OriginChanel Property `json:"origin_chanel" bson:"origin_chanel"` OriginValue string `json:"origin_value" bson:"origin_value"` Os string `json:"os" bson:"os,omitempty"` Version string `json:"version" bson:"version,omitempty"` Device string `json:"device" bson:"device,omitempty"` Brand string `json:"brand" bson:"brand,omitempty"` Model string `json:"model" bson:"model,omitempty"` Icon string `json:"icon" bson:"icon,omitempty"` Description string `json:"description" bson:"description,omitempty"` Remark string `json:"remark" bson:"remark,omitempty"` LastSeen time.Time `json:"last_seen" bson:"last_seen,omitempty"` }
type DnsInfo ¶
type DnsInfo struct { QueryName string `bson:"query_name,omitempty" json:"query_name"` ResponseIp string `bson:"response_ip,omitempty" json:"response_ip"` }
DnsInfo 存储 DNS 相关信息
type Feature ¶
type Feature struct { IP string Field FeatureType Value string }
type FeatureData ¶
type FeatureSet ¶
type FeatureSet struct { IP string `bson:"ip" json:"ip"` LastSeen time.Time `bson:"last_seen"` Features map[FeatureType][]FeatureData `bson:"features"` Total []Chart `bson:"total"` }
type FeatureType ¶
type FeatureType string
const ( SNI FeatureType = "sni" HTTP FeatureType = "http" TLSVersion FeatureType = "tls_version" CipherSuite FeatureType = "cipher_suite" Session FeatureType = "session" DNS FeatureType = "dns" DHCP FeatureType = "dhcp" DHCPv6 FeatureType = "dhcp_v6" NTP FeatureType = "ntp" QUIC FeatureType = "quic" TFTP FeatureType = "tftp" SNMP FeatureType = "snmp" MDNS FeatureType = "mdns" VXLAN FeatureType = "vxlan" SIP FeatureType = "sip" SFlow FeatureType = "s_flow" Geneve FeatureType = "geneve" BFD FeatureType = "bfd" GTPv1U FeatureType = "gtp_v1u" RMCP FeatureType = "rmcp" Radius FeatureType = "radius" )
type HttpInfo ¶
type HttpInfo struct { Host string `bson:"host,omitempty" json:"host"` UserAgent string `bson:"user_agent,omitempty" json:"user_agent"` Urls []string `bson:"urls,omitempty" json:"urls"` ContentType string `bson:"content_type,omitempty" json:"content_type"` Upgrade string `bson:"upgrade,omitempty" json:"upgrade"` }
HttpInfo 存储 HTTP 相关信息
type Metadata ¶
type Metadata struct { HttpInfo HttpInfo `bson:"http_info,omitempty" json:"http_info"` DnsInfo DnsInfo `bson:"dns_info,omitempty" json:"dns_info"` RtpInfo RtpInfo `bson:"rtp_info,omitempty" json:"rtp_info"` TlsInfo TlsInfo `bson:"tls_info,omitempty" json:"tls_info"` ApplicationInfo ApplicationInfo `bson:"application_info,omitempty" json:"application_info"` }
Metadata 存储所有协议相关的附加信息
type ProtocolFlags ¶
type ProtocolFlags struct { TCP TCPFlags `bson:"tcp" json:"tcp"` UDP UDPFlags `bson:"udp" json:"udp"` }
ProtocolFlags 结构体,用于保存不同协议的标志
type ProxyRecord ¶
type ProxyRecord struct { ID primitive.ObjectID `json:"_id,omitempty" bson:"_id,omitempty"` IP string `json:"ip" bson:"ip"` Username string `json:"username" bson:"username"` Devices []DeviceRecord `json:"devices" bson:"devices"` AllCount int `json:"all_count" bson:"all_count"` MobileCount int `json:"mobile_count" bson:"mobile_count"` PcCount int `json:"pc_count" bson:"pc_count"` LastSeen time.Time `json:"last_seen" bson:"last_seen"` }
type ReasonDetail ¶
type ReasonDetail struct { Name any `json:"name" bson:"name"` Value any `json:"value" bson:"value"` Threshold any `json:"threshold" bson:"threshold"` Description string `json:"description,omitempty" bson:"description,omitempty"` ExtraInfo string `json:"extra_info,omitempty" bson:"extra_info,omitempty"` }
type RtpInfo ¶
type RtpInfo struct { Codec string `bson:"codec,omitempty" json:"codec"` Bitrate string `bson:"bitrate,omitempty" json:"bitrate"` }
RtpInfo 存储 RTP 相关信息
type Sessions ¶
type Sessions struct { ID primitive.ObjectID `bson:"_id,omitempty" json:"_id"` Ident string `bson:"ident" json:"ident"` SessionId string `bson:"session_id" json:"session_id"` SrcIp string `bson:"src_ip" json:"src_ip"` DstIp string `bson:"dst_ip" json:"dst_ip"` SrcPort string `bson:"src_port" json:"src_port"` DstPort string `bson:"dst_port" json:"dst_port"` Protocol string `bson:"protocol" json:"protocol"` PacketCount int `bson:"packet_count" json:"packet_count"` ByteCount int `bson:"byte_count" json:"byte_count"` MissBytes int `bson:"miss_bytes" json:"miss_bytes"` OutOfOrderPackets int `bson:"out_of_order_packets" json:"out_of_order_packets"` OutOfOrderBytes int `bson:"out_of_order_bytes" json:"out_of_order_bytes"` OverlapBytes int `bson:"overlap_bytes" json:"overlap_bytes"` OverlapPackets int `bson:"overlap_packets" json:"overlap_packets"` StartTime time.Time `bson:"start_time" json:"start_time"` EndTime time.Time `bson:"end_time" json:"end_time"` ProtocolFlags ProtocolFlags `bson:"protocol_flags" json:"protocol_flags"` // 协议标志 ApplicationProtocol protocols.ProtocolType `bson:"application_protocol" json:"application_protocol"` Metadata Metadata `bson:"metadata" json:"metadata"` CustomFields CustomFields `bson:"custom_fields" json:"custom_fields"` }
Sessions 用于存储每个网络会话的信息,包括源 IP、目标 IP、协议、传输层协议等。
type SuspectedRecord ¶
type SuspectedRecord struct { ID primitive.ObjectID `json:"_id,omitempty" bson:"_id,omitempty"` IP string `json:"ip" bson:"ip"` Username string `json:"username" bson:"username"` ReasonCategory string `json:"reason_category" bson:"reason_category"` ReasonDetail ReasonDetail `json:"reason_detail" bson:"reason_detail"` Tags []string `json:"tags" bson:"tags"` Context Context `json:"context" bson:"context"` Remark string `json:"remark" bson:"remark"` LastSeen time.Time `json:"last_seen" bson:"last_seen"` }
type TCPFlags ¶
type TCPFlags struct { SYN bool `bson:"syn" json:"syn"` ACK bool `bson:"ack" json:"ack"` FIN bool `bson:"fin" json:"fin"` RST bool `bson:"rst" json:"rst"` }
TCPFlags 结构体,用于保存 TCP 协议的标志
type TlsInfo ¶
type TlsInfo struct { Version string `bson:"version,omitempty" json:"version"` CipherSuite string `bson:"cipher_suite,omitempty" json:"cipher_suite"` Sni string `bson:"sni,omitempty" json:"sni"` }
TlsInfo 存储 TLS 相关信息
type TrafficRecord ¶
type TrafficRecord struct { IP string `bson:"ip" json:"ip"` WindowStart time.Time `bson:"window_start" json:"window_start"` WindowEnd time.Time `bson:"window_end" json:"window_end"` FeatureType string `bson:"feature_type" json:"feature_type"` FeatureData map[string]int `bson:"feature_data" json:"feature_data"` CreateAt time.Time `bson:"create_at" json:"create_at"` }
type Transmission ¶
type Transmission struct { UpStream int64 `json:"up_stream"` DownStream int64 `json:"down_stream"` }
Transmission 传输层
type UDPFlags ¶
type UDPFlags struct {
IsDNS bool `bson:"is_dns" json:"is_dns"`
}
UDPFlags 结构体,用于保存 UDP 协议的标志
type User ¶
type User struct { RadOnlineID int `redis:"rad_online_id" json:"rad_online_id"` UserName string `redis:"user_name" json:"user_name"` IP string `redis:"ip" json:"ip"` UserMac string `redis:"user_mac" json:"user_mac"` LineType int `redis:"line_type" json:"line_type"` AddTime int `redis:"add_time" json:"add_time"` ProductsID int `redis:"products_id" json:"products_id"` BillingID int `redis:"billing_id" json:"billing_id"` ContractID int `redis:"contract_id" json:"contract_id"` }
type UserAgentRecord ¶
type UserAgentRecord struct { IP string `json:"ip" bson:"ip"` Host string `json:"host" bson:"host"` UserAgent string `json:"user_agent" bson:"user_agent"` Ua string `json:"ua" bson:"ua"` UaVersion string `json:"ua_version" bson:"ua_version"` Os string `json:"os" bson:"os"` OsVersion string `json:"os_version" bson:"os_version"` Device string `json:"device" bson:"device"` Brand string `json:"brand" bson:"brand"` Model string `json:"model" bson:"model"` LastSeen time.Time `json:"last_seen" bson:"last_seen"` }
type UserEvent ¶
type UserEvent struct { ID primitive.ObjectID `json:"_id,omitempty" bson:"_id,omitempty"` Action int `json:"action" bson:"action,omitempty"` SessionId string `json:"session_id" bson:"session_id,omitempty"` NasIp string `json:"nas_ip" bson:"nas_ip,omitempty"` NasIp1 string `json:"nas_ip1" bson:"nas_ip1,omitempty"` UserName string `json:"user_name" bson:"user_name,omitempty"` Ip string `json:"ip" bson:"ip,omitempty"` Ip6 string `json:"ip6" bson:"ip6,omitempty"` Ip61 string `json:"ip6_1" bson:"ip6_1,omitempty"` Ip62 string `json:"ip6_2" bson:"ip6_2,omitempty"` Ip63 string `json:"ip6_3" bson:"ip6_3,omitempty"` UserMac string `json:"user_mac" bson:"user_mac,omitempty"` NasPort int `json:"nas_port" bson:"nas_port,omitempty"` NasPortId string `json:"nas_port_id" bson:"nas_port_id,omitempty"` CalledStationId string `json:"called_station_id" bson:"called_station_id,omitempty"` NasIdentifier string `json:"nas_identifier" bson:"nas_identifier,omitempty"` NasPortType int `json:"nas_port_type" bson:"nas_port_type,omitempty"` VlanId string `json:"vlan_id" bson:"vlan_id,omitempty"` VlanId1 string `json:"vlan_id1" bson:"vlan_id1,omitempty"` VlanId2 string `json:"vlan_id2" bson:"vlan_id2,omitempty"` DeviceId string `json:"device_id" bson:"device_id,omitempty"` BandwidthUp int `json:"bandwidth_up" bson:"bandwidth_up,omitempty"` BandwidthDown int `json:"bandwidth_down" bson:"bandwidth_down,omitempty"` ProductsId int `json:"products_id" bson:"products_id,omitempty"` BillingId int `json:"billing_id" bson:"billing_id,omitempty"` ControlId int `json:"control_id" bson:"control_id,omitempty"` GroupId int `json:"group_id" bson:"group_id,omitempty"` RadOnlineId int `json:"rad_online_id" bson:"rad_online_id,omitempty"` DisableProxy int `json:"disable_proxy" bson:"disable_proxy,omitempty"` Domain string `json:"domain" bson:"domain,omitempty"` OsName string `json:"os_name" bson:"os_name,omitempty"` ClassName string `json:"class_name" bson:"class_name,omitempty"` MobilePhone string `json:"mobile_phone" bson:"mobile_phone,omitempty"` MobilePassword string `json:"mobile_password" bson:"mobile_password,omitempty"` IsArrears int `json:"is_arrears" bson:"is_arrears,omitempty"` BytesIn int `json:"bytes_in" bson:"bytes_in,omitempty"` BytesOut int `json:"bytes_out" bson:"bytes_out,omitempty"` AddTime int `json:"add_time" bson:"add_time,omitempty"` MyIp string `json:"my_ip" bson:"my_ip,omitempty"` DropCause int `json:"drop_cause" bson:"drop_cause,omitempty"` UserDebug int `json:"user_debug" bson:"user_debug,omitempty"` LineType int `json:"line_type" bson:"line_type,omitempty"` AcType string `json:"ac_type" bson:"ac_type,omitempty"` Daa int `json:"daa" bson:"daa,omitempty"` PoolId int `json:"pool_id" bson:"pool_id,omitempty"` Drop int `json:"drop" bson:"drop,omitempty"` CurBytesIn int `json:"cur_bytes_in" bson:"cur_bytes_in,omitempty"` CurBytesOut int `json:"cur_bytes_out" bson:"cur_bytes_out,omitempty"` CurBytesIn6 int `json:"cur_bytes_in6" bson:"cur_bytes_in6,omitempty"` CurBytesOut6 int `json:"cur_bytes_out6" bson:"cur_bytes_out6,omitempty"` CheckoutDate int `json:"checkout_date" bson:"checkout_date,omitempty"` RemainDay int `json:"remain_day" bson:"remain_day,omitempty"` RemainBytes int `json:"remain_bytes" bson:"remain_bytes,omitempty"` SumTimes int `json:"sum_times" bson:"sum_times,omitempty"` SumBytes int `json:"sum_bytes" bson:"sum_bytes,omitempty"` SumSeconds int `json:"sum_seconds" bson:"sum_seconds,omitempty"` AllBytes int `json:"all_bytes" bson:"all_bytes,omitempty"` AllSeconds int `json:"all_seconds" bson:"all_seconds,omitempty"` UserBalance float64 `json:"user_balance" bson:"user_balance,omitempty"` UserCharge float64 `json:"user_charge" bson:"user_charge,omitempty"` CurCharge float64 `json:"cur_charge" bson:"cur_charge,omitempty"` DropReason int `json:"drop_reason" bson:"drop_reason,omitempty"` DropTime int `json:"drop_time" bson:"drop_time,omitempty"` DestControl int `json:"dest_control" bson:"dest_control,omitempty"` Proc string `json:"proc" bson:"proc,omitempty"` }
Click to show internal directories.
Click to hide internal directories.