ntopng

package module
v0.0.0-...-b8f4ac7 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2024 License: MIT Imports: 13 Imported by: 0

README

ntopng

  • 基于ntopng v5.7 RESTful API封装的Golang SDK

Documentation

Index

Constants

View Source
const (
	CodeOK                                            = 0
	CodeNotFound                                      = -1
	CodeInvalidInterface                              = -2
	CodeNotGranted                                    = -3
	CodeInvalidHost                                   = -4
	CodeInvalidArguments                              = -5
	CodeInternalError                                 = -6
	CodeBadFormat                                     = -7
	CodeBadContent                                    = -8
	CodeNameResolutionFailed                          = -9
	CodeSnmpDeviceAlreadyAdded                        = -10
	CodeSnmpDeviceUnreachable                         = -11
	CodeNoSnmpDeviceDiscovered                        = -12
	CodeAddPoolFailed                                 = -13
	CodeEditPoolFailed                                = -14
	CodePoolNotFound                                  = -16
	CodeBindPoolMemberFailed                          = -17
	CodePasswordMismatch                              = -19
	CodeAddUserFailed                                 = -20
	CodeDeleteUserFailed                              = -21
	CodeSnmpUnknownDevice                             = -22
	CodeUserAlreadyExisting                           = -23
	CodeEditUserFailed                                = -24
	CodeSnmpDeviceInterfaceStatusChangeFailed         = -26
	CodeConfigurationFileMismatch                     = -27
	CodePartialImport                                 = -28
	CodeInfrastructureInstanceNotFound                = -32
	CodeInfrastructureInstanceEmptyID                 = -33
	CodeInfrastructureInstanceEmptyAlias              = -34
	CodeInfrastructureInstanceEmptyURL                = -35
	CodeInfrastructureInstanceEmptyToken              = -36
	CodeInfrastructureInstanceEmptyRTTThreshold       = -37
	CodeInfrastructureInstanceSameAlias               = -39
	CodeInfrastructureInstanceSameURL                 = -40
	CodeInfrastructureInstanceSameToken               = -41
	CodeInfrastructureInstanceAlreadyExisting         = -42
	CodeInfrastructureInstanceCheckFailed             = -43
	CodeInfrastructureInstanceCheckNotFound           = -44
	CodeInfrastructureInstanceCheckInvalidResponse    = -45
	CodeInfrastructureInstanceCheckAuthFailed         = -46
	CodeInfrastructureInstanceEmptyBandwidthThreshold = -47
)
View Source
const (
	HostDistroTypeL4Proto         = "l4_proto"   // 4层协议
	HostDistroTypeL4Traffic       = "l4_traffic" // 4层流量
	HostDistroTypeL4ConnectedHost = "l4_connected_host"
	HostDistroTypeL7Proto         = "l7_proto"
	HostDistroTypeL7Breed         = "l7_breed"
	HostDistroTypePktSendSize     = "pkt_send_size"
	HostDistroTypePktRcvdSize     = "pkt_rcvd_size"
	HostDistroTypePktTcpFlags     = "pkt_tcp_flags"
	HostDistroTypePktArp          = "pkt_arp"
	HostDistroTypePortTraffic     = "port_traffic"
	HostDistroTypeDnsBreakdown    = "dns_breakdown"
	HostDistroTypeHttpBreakdown   = "http_breakdown"
)

Variables

This section is empty.

Functions

func UnmarshalRaw

func UnmarshalRaw(b []byte, v interface{}) error

func UnmarshalRsp

func UnmarshalRsp(b []byte, v interface{}) error

Types

type AS

type AS struct {
	Key                  string `json:"key"`
	ColumnHosts          string `json:"column_hosts"`
	ColumnThpt           string `json:"column_thpt"`
	ColumnAsname         string `json:"column_asname"`
	ColumnAsn            string `json:"column_asn"`
	ColumnHostScoreRatio string `json:"column_host_score_ratio"`
	ColumnAlertedFlows   string `json:"column_alerted_flows"`
	ColumnChart          string `json:"column_chart"`
	ColumnScore          string `json:"column_score"`
	ColumnSince          string `json:"column_since"`
	ColumnTraffic        string `json:"column_traffic"`
	ColumnBreakdown      string `json:"column_breakdown"`
}

func (AS) ASN

func (a AS) ASN() int

func (AS) ASName

func (a AS) ASName() string

func (AS) AlertedFlows

func (a AS) AlertedFlows() int

func (AS) Breakdown

func (a AS) Breakdown() []float64

func (AS) HostScoreRatio

func (a AS) HostScoreRatio() float64

func (AS) NumHosts

func (a AS) NumHosts() int

func (AS) Score

func (a AS) Score() int

func (AS) Since

func (a AS) Since() string

func (AS) Thpt

func (a AS) Thpt() string

func (AS) Traffic

func (a AS) Traffic() string

type ASReq

type ASReq struct {
	BasePageReq
}

type ASResp

type ASResp struct {
	BasePageResp
	Data []*AS `json:"data"`
}

type ActiveFlow

type ActiveFlow struct {
	Key       string  `json:"key"`
	HashId    string  `json:"hash_id"`
	FirstSeen int64   `json:"first_seen"`
	LastSeen  int64   `json:"last_seen"`
	Bytes     float64 `json:"bytes"`
	Duration  int64   `json:"duration"`
	Vlan      int     `json:"vlan"`

	Client struct {
		Ip                string `json:"ip,omitempty"`
		IsBlacklisted     bool   `json:"is_blacklisted,omitempty"`
		IsBroadcastDomain bool   `json:"is_broadcast_domain,omitempty"`
		Port              int    `json:"port,omitempty"`
		IsDhcp            bool   `json:"is_dhcp,omitempty"`
		Name              string `json:"name,omitempty"`
	} `json:"client,omitempty"`

	Server struct {
		Ip            string `json:"ip"`
		IsBlacklisted bool   `json:"is_blacklisted"`
		IsDhcp        bool   `json:"is_dhcp"`
		Port          int    `json:"port"`
		Name          string `json:"name"`
		IsBroadcast   bool   `json:"is_broadcast"`
	}

	Breakdown struct {
		Srv2Cli float64 `json:"srv2cli"`
		Cli2Srv float64 `json:"cli2srv"`
	} `json:"breakdown"`

	Thpt struct {
		Pps float64 `json:"pps"`
		Bps float64 `json:"bps"`
	} `json:"thpt"`

	Protocol struct {
		L4 string `json:"l4"`
		L7 string `json:"l7"`
	} `json:"protocol"`
}

type ActiveFlowResp

type ActiveFlowResp struct {
	BasePageResp
	Data []*ActiveFlow `json:"data"`
}

type AlertType

type AlertType string

AlertType 警告类型

所有流警告的Key也可作为警告类型,详见 https://www.ntop.org/guides/ntopng/scripts/alert_definitions.html#alert-key
const (
	AlertTypeAll      AlertType = ""         // 全部
	AlertTypeNormal   AlertType = "normal"   // 正常
	AlertTypeAlerted  AlertType = "alerted"  // 所有警告
	AlertTypePeriodic AlertType = "periodic" // All Periodic
)

type AlertTypeSeverity

type AlertTypeSeverity string

AlertTypeSeverity 严重性

const (
	AlertTypeSeverityAll           AlertTypeSeverity = ""                // 全部
	AlertTypeSeverityNoticeOrLower AlertTypeSeverity = "notice_or_lower" // 通知或更低
	AlertTypeSeverityWarning       AlertTypeSeverity = "warning"         // 警告
	AlertTypeSeverityError         AlertTypeSeverity = "error"           // 错误或更高
)

type Application

type Application struct {
	ApplicationId int    `json:"application_id"`
	Application   string `json:"application"`
	CategoryId    int    `json:"category_id"`
	Category      string `json:"category"`
	NumHosts      int    `json:"num_hosts"`
	CustomRules   string `json:"custom_rules"`
	IsCustom      bool   `json:"is_custom"`
}

type ApplicationCategory

type ApplicationCategory struct {
	ColumnCategoryId    int    `json:"column_category_id"`
	ColumnCategoryName  string `json:"column_category_name"`
	ColumnCategoryHosts string `json:"column_category_hosts"`
	ColumnNumHosts      string `json:"column_num_hosts"`
	ColumnNumProtos     string `json:"column_num_protos"`
}

func (ApplicationCategory) Id

func (c ApplicationCategory) Id() int

func (ApplicationCategory) Name

func (c ApplicationCategory) Name() string

func (ApplicationCategory) NumHosts

func (c ApplicationCategory) NumHosts() int

func (ApplicationCategory) NumProtocols

func (c ApplicationCategory) NumProtocols() int

type BasePageReq

type BasePageReq struct {
	CurrentPage int    `json:"currentPage"`          // 当前页
	PerPage     int    `json:"perPage"`              // 每页条数
	SortColumn  string `json:"sortColumn,omitempty"` // 排序字段
	SortOrder   string `json:"sortOrder,omitempty"`  // 排序顺序 asc desc
}

type BasePageResp

type BasePageResp struct {
	TotalRows   int64      `json:"totalRows"`
	CurrentPage int        `json:"currentPage"`
	PerPage     int        `json:"perPage"`
	Sort        [][]string `json:"sort,omitempty"` // 排序字段 [["字段名","asc|desc"],...]
}

type Behaviour

type Behaviour struct {
	AsServer struct {
		Value      int64 `json:"value"`
		UpperBound int64 `json:"upper_bound"`
		LowerBound int64 `json:"lower_bound"`
		Anomaly    bool  `json:"anomaly"`
	} `json:"as_server"`
	AsClient struct {
		Value      int64 `json:"value"`
		UpperBound int64 `json:"upper_bound"`
		LowerBound int64 `json:"lower_bound"`
		Anomaly    bool  `json:"anomaly"`
	} `json:"as_client"`
	TotNumAnomalies int64 `json:"tot_num_anomalies"`
}

type Category

type Category struct {
	ColumnStatus              string `json:"column_status"`
	ColumnName                string `json:"column_name"`
	ColumnCategoryName        string `json:"column_category_name"`
	ColumnCategory            string `json:"column_category"`
	ColumnUpdateIntervalLabel string `json:"column_update_interval_label"`
	ColumnLabel               string `json:"column_label"`
	ColumnNumHits             string `json:"column_num_hits"`
	ColumnEnabled             bool   `json:"column_enabled"`
	ColumnNumHosts            string `json:"column_num_hosts"`
	ColumnUrl                 string `json:"column_url"`
	ColumnUpdateInterval      int    `json:"column_update_interval"`
	ColumnLastUpdate          string `json:"column_last_update"`
}

func (Category) CategoryName

func (c Category) CategoryName() string

CategoryName 应用程序类别名称

func (Category) Enabled

func (c Category) Enabled() bool

func (Category) LastUpdate

func (c Category) LastUpdate() string

func (Category) Name

func (c Category) Name() string

func (Category) NumHits

func (c Category) NumHits() int

func (Category) NumHosts

func (c Category) NumHosts() int

func (Category) Status

func (c Category) Status() string

func (Category) UpdateInterval

func (c Category) UpdateInterval() int

func (Category) UpdateIntervalLabel

func (c Category) UpdateIntervalLabel() string

type CategoryReq

type CategoryReq struct {
	BasePageReq
	EnabledStatus EnabledStatus `json:"enabled_status"`     // 启用状态
	Category      string        `json:"category,omitempty"` // 应用程序类别
}

type CategoryResp

type CategoryResp struct {
	BasePageResp
	Data []*Category `json:"data"`
}

type CliSrvType

type CliSrvType string
const (
	CliSrvTypeClient CliSrvType = "client"
	CliSrvTypeServer CliSrvType = "server"
)

type Country

type Country struct {
	ColumnChart     string `json:"column_chart"`
	ColumnTraffic   string `json:"column_traffic"`
	ColumnId        string `json:"column_id"`
	ColumnBreakdown string `json:"column_breakdown"`
	Key             string `json:"key"`
	ColumnSince     string `json:"column_since"`
	ColumnHosts     string `json:"column_hosts"`
	ColumnScore     string `json:"column_score"`
	ColumnThpt      string `json:"column_thpt"`
}

func (Country) Breakdown

func (c Country) Breakdown() []float64

func (Country) Name

func (c Country) Name() string

func (Country) NumHosts

func (c Country) NumHosts() int

func (Country) Score

func (c Country) Score() int

func (Country) Since

func (c Country) Since() string

func (Country) Thpt

func (c Country) Thpt() string

func (Country) Traffic

func (c Country) Traffic() string

type CountryReq

type CountryReq struct {
	BasePageReq
}

type CountryResp

type CountryResp struct {
	BasePageResp
	Data []*Country `json:"data"`
}

type DeviceApplication

type DeviceApplication struct {
	ColumnNdpiApplicationId int    `json:"column_ndpi_application_id"`
	ColumnNdpiApplication   string `json:"column_ndpi_application"`
	ColumnNdpiCategory      string `json:"column_ndpi_category"`
	ColumnServerPolicy      string `json:"column_server_policy"`
	ColumnClientPolicy      string `json:"column_client_policy"`
}

func (DeviceApplication) ClientPolicy

func (dp DeviceApplication) ClientPolicy() PolicyFilter

func (DeviceApplication) NdpiAppId

func (dp DeviceApplication) NdpiAppId() int

func (DeviceApplication) NdpiAppName

func (dp DeviceApplication) NdpiAppName() string

func (DeviceApplication) NdpiCategory

func (dp DeviceApplication) NdpiCategory() string

func (DeviceApplication) ServerPolicy

func (dp DeviceApplication) ServerPolicy() PolicyFilter

type DeviceApplicationReq

type DeviceApplicationReq struct {
	BasePageReq
	DeviceType   *DeviceType   `json:"device_type"`             // 设备类型
	PolicyFilter *PolicyFilter `json:"policy_filter,omitempty"` // 过滤策略
	Category     string        `json:"category,omitempty"`      // 类别
	L7Proto      int           `json:"l7_proto,omitempty"`      // 协议
}

type DeviceApplicationResp

type DeviceApplicationResp struct {
	BasePageResp
	Data []*DeviceApplication `json:"data"`
}

type DeviceType

type DeviceType int

DeviceType 设备类型

const (
	DeviceTypeUnknown        DeviceType = iota // 未知
	DeviceTypePrinter                          // 打印机
	DeviceTypeRecording                        // 录像
	DeviceTypePC                               // 计算机
	DeviceTypeLaptop                           // 笔记本电脑
	DeviceTypePad                              // 平板
	DeviceTypeMobile                           // 手机
	DeviceTypeTV                               // TV
	DeviceTypeRouterOrSwitch                   // 路由器/交换机
	DeviceTypeWireless                         // 无线网络
	DeviceTypeNAS                              // NAS
	DeviceTypeMultimedia                       // 多媒体
	DeviceTypeIoT                              // IoT
)

type EnabledStatus

type EnabledStatus string

EnabledStatus 启用状态

const (
	EnabledStatusAll      EnabledStatus = "all"
	EnabledStatusEnabled  EnabledStatus = "enabled"
	EnabledStatusDisabled EnabledStatus = "disabled"
)

type FindReq

type FindReq struct {
	IfId  int64  `json:"ifid"`
	Query string `json:"query"`
}

type FindResp

type FindResp struct {
	Interface string    `json:"interface"` // 接口名称
	Results   []*Object `json:"results"`   // 搜索结果
}

type Flow

type Flow struct {
	KeyAndHash      string  `json:"key_and_hash"`
	Key             string  `json:"key"`
	HashId          string  `json:"hash_id"`
	ColumnKey       string  `json:"column_key"`
	ColumnNdpi      string  `json:"column_ndpi"`
	ColumnProtoL4   string  `json:"column_proto_l4"`
	ColumnClient    string  `json:"column_client"`
	ColumnServer    string  `json:"column_server"`
	ColumnBreakdown string  `json:"column_breakdown"`
	ColumnDuration  string  `json:"column_duration"`
	ColumnThpt      float64 `json:"column_thpt"`  // 当前流量,单位:bps
	ColumnBytes     int64   `json:"column_bytes"` // 总字节数,单位:byte
	ColumnInfo      string  `json:"column_info"`
	ColumnFirstSeen string  `json:"column_first_seen"`
	ColumnLastSeen  string  `json:"column_last_seen"`
}

func (Flow) Application

func (f Flow) Application() string

func (Flow) Breakdown

func (f Flow) Breakdown() []float64

Breakdown client和server流量占比

func (Flow) Client

func (f Flow) Client() string

func (Flow) Duration

func (f Flow) Duration() string

func (Flow) FirstSeenTime

func (f Flow) FirstSeenTime() time.Time

func (Flow) Id

func (f Flow) Id() string

func (Flow) Info

func (f Flow) Info() string

func (Flow) LastSeenTime

func (f Flow) LastSeenTime() time.Time

func (Flow) Protocol

func (f Flow) Protocol() string

func (Flow) Server

func (f Flow) Server() string

func (Flow) Thpt

func (f Flow) Thpt() float64

func (Flow) Traffic

func (f Flow) Traffic() int64

type FlowHostType

type FlowHostType string

FlowHostType 主机类型

const (
	FlowHostTypeAll           FlowHostType = ""
	FlowHostTypeLocalOnly     FlowHostType = "local_only"
	FlowHostTypeRemoteOnly    FlowHostType = "remote_only"
	FlowHostTypeLocalToRemote FlowHostType = "local_origin_remote_target"
	FlowHostTypeRemoteToLocal FlowHostType = "remote_origin_local_target"
)

type FlowReq

type FlowReq struct {
	BasePageReq
	IfId              int64             `json:"ifid"`
	FlowHostsType     FlowHostType      `json:"flowhosts_type,omitempty"`
	AlertType         AlertType         `json:"alert_type,omitempty"`
	AlertTypeSeverity AlertTypeSeverity `json:"alert_type_severity,omitempty"`
	TrafficType       TrafficType       `json:"traffic_type,omitempty"`
	Host              string            `json:"host,omitempty"`         // 主机IP
	Application       string            `json:"application,omitempty"`  // 应用程序
	Category          string            `json:"category,omitempty"`     // 应用程序类别
	DSCP              *int              `json:"dscp,omitempty"`         // DSCP有效值0-63
	HostPoolId        *int              `json:"host_pool_id,omitempty"` // 主机池ID
	Network           *int              `json:"network,omitempty"`      // 网络ID
	Version           IPVersion         `json:"version,omitempty"`      // IP版本
	L4Proto           L4Proto           `json:"l4_proto,omitempty"`     // 协议
}

type FlowResp

type FlowResp struct {
	BasePageResp
	Data []*Flow `json:"data"`
}

type FlowStatsReq

type FlowStatsReq struct {
	IfId   int64  `json:"ifid"`
	Key    string `json:"key"`
	HashId string `json:"hash_id"`
}

type FlowStatsResp

type FlowStatsResp struct {
	SeenLast             string  `json:"seen.last"`
	SeenFirst            string  `json:"seen.first"`
	SeenDuration         string  `json:"seen.duration"`
	Bytes                int64   `json:"bytes"`
	GoodputBytes         int64   `json:"goodput_bytes"`
	Cli2SrvPackets       int64   `json:"cli2srv.packets"`
	Srv2CliPackets       int64   `json:"srv2cli.packets"`
	Cli2SrvBytes         int64   `json:"cli2srv.bytes"`
	Srv2CliBytes         int64   `json:"srv2cli.bytes"`
	Throughput           string  `json:"throughput"`
	TopThroughputDisplay string  `json:"top_throughput_display"`
	ThroughputRaw        float64 `json:"throughput_raw"`
	C2SOOO               int64   `json:"c2sOOO"`
	C2Slost              int64   `json:"c2slost"`
	C2SkeepAlive         int64   `json:"c2skeep_alive"`
	C2Sretr              int64   `json:"c2sretr"`
	S2COOO               int64   `json:"s2cOOO"`
	S2Clost              int64   `json:"s2clost"`
	S2CkeepAlive         int64   `json:"s2ckeep_alive"`
	S2Cretr              int64   `json:"s2cretr"`
}

type Host

type Host struct {
	ColumnBreakdown   string `json:"column_breakdown"`
	ColumnUrl         string `json:"column_url"`
	ColumnIp          string `json:"column_ip"`
	ColumnScore       string `json:"column_score"`
	ColumnNumFlows    string `json:"column_num_flows"`
	ColumnTrafficSent string `json:"column_traffic_sent"`
	Key               string `json:"key"`
	ColumnName        string `json:"column_name"`
	ColumnAlerts      string `json:"column_alerts"`
	ColumnTraffic     string `json:"column_traffic"`
	ColumnLast        string `json:"column_last"`
	ColumnThpt        string `json:"column_thpt"`
	ColumnInfo        string `json:"column_info"`
	ColumnSince       string `json:"column_since"`
}

func (Host) Alerts

func (h Host) Alerts() int

func (Host) Breakdown

func (h Host) Breakdown() []float64

Breakdown sent和rcvd流量占比

func (Host) IP

func (h Host) IP() string

func (Host) Name

func (h Host) Name() string

func (Host) NumFlows

func (h Host) NumFlows() int

func (Host) Score

func (h Host) Score() int

func (Host) Since

func (h Host) Since() string

func (Host) Thpt

func (h Host) Thpt() string

Thpt 吞吐量,带单位的字符串

func (Host) Traffic

func (h Host) Traffic() string

Traffic 总字节数,带单位的字符串

func (Host) TrafficSent

func (h Host) TrafficSent() string

TrafficSent 发送的总字节数,带单位的字符串

type HostDistroReq

type HostDistroReq struct {
	Host     string
	Type     HostDistroType
	CliSrv   CliSrvType `json:"cli_srv,omitempty"`   // 仅HostDistroTypePortTraffic需要指定值
	HttpMode HttpMode   `json:"http_mode,omitempty"` // 仅HostDistroTypeHttpBreakdown需要指定值
}

type HostDistroType

type HostDistroType string

type HostFingerprint

type HostFingerprint struct {
	Ja3         string `json:"ja3"`
	IsMalicious bool   `json:"is_malicious"`
	AppName     string `json:"app_name"`
	NumUses     int64  `json:"num_uses"`
}

type HostL4Data

type HostL4Data struct {
	Protocol        string  `json:"protocol"`
	BytesSent       int64   `json:"bytes_sent"`
	BytesRcvd       int64   `json:"bytes_rcvd"`
	TotalBytes      int64   `json:"total_bytes"`
	TotalPercentage float64 `json:"total_percentage"`
}

type HostL7Data

type HostL7Data struct {
	Application struct {
		Id    int64  `json:"id"`
		Label string `json:"label"`
	} `json:"application"`
	Duration   int64   `json:"duration"`
	BytesSent  int64   `json:"bytes_sent"`
	BytesRcvd  int64   `json:"bytes_rcvd"`
	TotBytes   int64   `json:"tot_bytes"`
	Percentage float64 `json:"percentage"`
}

type HostMode

type HostMode string

HostMode 过滤主机

const (
	HostModeAll                  HostMode = ""                    // 全部
	HostModeBlacklisted          HostMode = "blacklisted"         // 列入黑名单的主机
	HostModeBroadcastDomain      HostMode = "broadcast_domain"    // 广播域主机
	HostModeBroadcastOrMulticast HostMode = "broadcast_multicast" // 组播/广播主机
	HostModeDHCP                 HostMode = "dhcp"                // DHCP主机
	HostModeLocal                HostMode = "local"               // 本地主机
	HostModeLocalNoTx            HostMode = "local_no_tx"         // 本地无发送流量主机
	HostModeLocalNoTcpTx         HostMode = "local_no_tcp_tx"     // 本地无TCP/UDP发送流量主机
	HostModeRemote               HostMode = "remote"              // 远程主机
	HostModeRemoteNoRx           HostMode = "remote_no_rx"        // 远程无接收流量主机
	HostModeRemoteNoTcpRx        HostMode = "remote_no_tcp_rx"    // 远程无TCP/UDP接收流量主机
)

type HostPool

type HostPool struct {
	ColumnHosts           string `json:"column_hosts"`
	ColumnId              string `json:"column_id"`
	ColumnSince           string `json:"column_since"`
	ColumnThpt            string `json:"column_thpt"`
	Key                   string `json:"key"`
	ColumnChart           string `json:"column_chart"`
	ColumnBreakdown       string `json:"column_breakdown"`
	ColumnNumDroppedFlows string `json:"column_num_dropped_flows"`
	ColumnTraffic         string `json:"column_traffic"`
}

func (HostPool) Breakdown

func (h HostPool) Breakdown() []float64

func (HostPool) Id

func (h HostPool) Id() string

func (HostPool) NumDroppedFlows

func (h HostPool) NumDroppedFlows() int

func (HostPool) NumHosts

func (h HostPool) NumHosts() int

func (HostPool) Since

func (h HostPool) Since() string

func (HostPool) Thpt

func (h HostPool) Thpt() string

func (HostPool) Traffic

func (h HostPool) Traffic() string

type HostPoolReq

type HostPoolReq struct {
	BasePageReq
}

type HostReq

type HostReq struct {
	BasePageReq
	Version     IPVersion   `json:"version,omitempty"`      // IP版本
	TrafficType TrafficType `json:"traffic_type,omitempty"` // 流量方向
	HostMode    HostMode    `json:"mode,omitempty"`         // 过滤主机
}

type HostResp

type HostResp struct {
	BasePageResp
	Data []*Host `json:"data"`
}

type HostStats

type HostStats struct {
	Systemhost                   bool        `json:"systemhost"`
	ThroughputTrendBps           int64       `json:"throughput_trend_bps"`
	Asn                          int64       `json:"asn"`
	UdpBytesSent                 int64       `json:"udp.bytes.sent"`
	Os                           int64       `json:"os"`
	UdpBytesRcvd                 int64       `json:"udp.bytes.rcvd"`
	ContactsAsClient             int64       `json:"contacts.as_client"`
	Name                         string      `json:"name"`
	HostUnreachableFlowsAsServer int64       `json:"host_unreachable_flows.as_server"`
	AlertedFlowsAsServer         int64       `json:"alerted_flows.as_server"`
	IcmpBytesRcvdAnomalyIndex    int64       `json:"icmp.bytes.rcvd.anomaly_index"`
	ThroughputBps                float64     `json:"throughput_bps"`
	HasshFingerprint             interface{} `json:"hassh_fingerprint"`
	Ifid                         int         `json:"ifid"`
	Ja3Fingerprint               interface{} `json:"ja3_fingerprint"`
	FlowsAsServer                int64       `json:"flows.as_server"`
	ActiveFlowsAsServer          int64       `json:"active_flows.as_server"`
	OtherIpPacketsRcvd           int64       `json:"other_ip.packets.rcvd"`
	Localhost                    bool        `json:"localhost"`
	Duration                     int64       `json:"duration"`
	City                         string      `json:"city"`
	Ipkey                        int64       `json:"ipkey"`
	SeenLast                     int64       `json:"seen.last"`
	BytesSent                    int64       `json:"bytes.sent"`
	SeenFirst                    int64       `json:"seen.first"`
	TcpPacketStatsSent           struct {
		Lost            int64 `json:"lost"`
		KeepAlive       int64 `json:"keep_alive"`
		OutOfOrder      int64 `json:"out_of_order"`
		Retransmissions int64 `json:"retransmissions"`
	} `json:"tcpPacketStats.sent"`
	OtherIpBytesRcvd int64 `json:"other_ip.bytes.rcvd"`
	Privatehost      bool  `json:"privatehost"`
	NdpiCategories   map[string]struct {
		Duration  int64 `json:"duration"`
		Category  int64 `json:"category"`
		Bytes     int64 `json:"bytes"`
		BytesRcvd int64 `json:"bytes.rcvd"`
		BytesSent int64 `json:"bytes.sent"`
	} `json:"ndpi_categories"`
	Names                        interface{} `json:"names"`
	HostUnreachableFlowsAsClient int64       `json:"host_unreachable_flows.as_client"`
	ThroughputPps                float64     `json:"throughput_pps"`
	ScoreAsClient                int64       `json:"score.as_client"`
	TcpPacketStatsRcvd           struct {
		Lost            int64 `json:"lost"`
		KeepAlive       int64 `json:"keep_alive"`
		OutOfOrder      int64 `json:"out_of_order"`
		Retransmissions int64 `json:"retransmissions"`
	} `json:"tcpPacketStats.rcvd"`
	UnreachableFlowsAsServer int `json:"unreachable_flows.as_server"`
	ScorePct                 struct {
		ScoreBreakdownServer map[string]interface{} `json:"score_breakdown_server"`
		ScoreBreakdownClient map[string]interface{} `json:"score_breakdown_client"`
	} `json:"score_pct"`
	IcmpBytesSent             int64  `json:"icmp.bytes.sent"`
	OsDetail                  string `json:"os_detail"`
	NumUnidirectionalTcpFlows struct {
		NumEgress  int64 `json:"num_egress"`
		NumIngress int64 `json:"num_ingress"`
	} `json:"num_unidirectional_tcp_flows"`
	TcpBytesSentAnomalyIndex                      int64   `json:"tcp.bytes.sent.anomaly_index"`
	TcpPacketsSent                                int64   `json:"tcp.packets.sent"`
	IcmpBytesRcvd                                 int64   `json:"icmp.bytes.rcvd"`
	TcpBytesRcvdAnomalyIndex                      int64   `json:"tcp.bytes.rcvd.anomaly_index"`
	NumIncomingPeersThatSentTcpUdpFlowsNoResponse int64   `json:"num_incoming_peers_that_sent_tcp_udp_flows_no_response"`
	Latitude                                      float64 `json:"latitude"`
	ActiveAlertedFlows                            int64   `json:"active_alerted_flows"`
	Dscp                                          map[string]struct {
		PacketsRcvd int64 `json:"packets.rcvd"`
		PacketsSent int64 `json:"packets.sent"`
		BytesRcvd   int64 `json:"bytes.rcvd"`
		BytesSent   int64 `json:"bytes.sent"`
	} `json:"dscp"`
	BytesNdpiUnknown                           int64   `json:"bytes.ndpi.unknown"`
	ContactsAsServer                           int64   `json:"contacts.as_server"`
	NumContactedPeersWithTcpUdpFlowsNoResponse int64   `json:"num_contacted_peers_with_tcp_udp_flows_no_response"`
	ThroughputTrendPps                         int64   `json:"throughput_trend_pps"`
	BytesRatio                                 float64 `json:"bytes_ratio"`
	Score                                      int64   `json:"score"`
	ScoreAsServer                              int64   `json:"score.as_server"`
	Mac                                        string  `json:"mac"`
	Ndpi                                       map[string]struct {
		Breed       string `json:"breed"`
		PacketsSent int64  `json:"packets.sent"`
		PacketsRcvd int64  `json:"packets.rcvd"`
		BytesRcvd   int64  `json:"bytes.rcvd"`
		Duration    int64  `json:"duration"`
		NumFlows    int64  `json:"num_flows"`
		BytesSent   int64  `json:"bytes.sent"`
	} `json:"ndpi"`
	ActiveFlowsAsClient       int64     `json:"active_flows.as_client"`
	ActiveFlowsBehaviour      Behaviour `json:"active_flows_behaviour"`
	HostServicesBitmap        int64     `json:"host_services_bitmap"`
	Longitude                 float64   `json:"longitude"`
	Devtype                   int64     `json:"devtype"`
	TcpPacketsSeqProblems     bool      `json:"tcp.packets.seq_problems"`
	UnreachableFlowsAsClient  int64     `json:"unreachable_flows.as_client"`
	Iphex                     string    `json:"iphex"`
	PktsRatio                 float64   `json:"pkts_ratio"`
	UdpBytesSentNonUnicast    int64     `json:"udpBytesSent.non_unicast"`
	BytesRcvd                 int64     `json:"bytes.rcvd"`
	AlertedFlowsAsClient      int64     `json:"alerted_flows.as_client"`
	OtherIpBytesSent          int64     `json:"other_ip.bytes.sent"`
	Tskey                     string    `json:"tskey"`
	PacketsRcvd               int64     `json:"packets.rcvd"`
	IcmpPacketsRcvd           int64     `json:"icmp.packets.rcvd"`
	UdpPacketsSent            int64     `json:"udp.packets.sent"`
	IcmpPacketsSent           int64     `json:"icmp.packets.sent"`
	UdpPacketsRcvd            int64     `json:"udp.packets.rcvd"`
	BytesSentAnomalyIndex     int64     `json:"bytes.sent.anomaly_index"`
	TcpBytesRcvd              int64     `json:"tcp.bytes.rcvd"`
	BytesRcvdAnomalyIndex     int64     `json:"bytes.rcvd.anomaly_index"`
	IpVersion                 IPVersion `json:"ip_version"`
	IcmpBytesSentAnomalyIndex int64     `json:"icmp.bytes.sent.anomaly_index"`
	TcpPacketsRcvd            int64     `json:"tcp.packets.rcvd"`
	NumFlowAlerts             int64     `json:"num_flow_alerts"`
	NumBlacklistedFlows       struct {
		TotAsServer int64 `json:"tot_as_server"`
		TotAsClient int64 `json:"tot_as_client"`
		AsClient    int64 `json:"as_client"`
		AsServer    int64 `json:"as_server"`
	} `json:"num_blacklisted_flows"`
	UdpBytesSentUnicast          int64            `json:"udpBytesSent.unicast"`
	TotalFlowsAsServer           int64            `json:"total_flows.as_server"`
	TotalFlowsAsClient           int64            `json:"total_flows.as_client"`
	ObservationPointId           int64            `json:"observation_point_id"`
	FlowsAsClient                int64            `json:"flows.as_client"`
	OtherIpPacketsSent           int64            `json:"other_ip.packets.sent"`
	PktStatsRecv                 PktStats         `json:"pktStats.recv"`
	IsRxOnly                     bool             `json:"is_rx_only"`
	TcpBytesSent                 int64            `json:"tcp.bytes.sent"`
	Continent                    string           `json:"continent"`
	OtherIpBytesRcvdAnomalyIndex int64            `json:"other_ip.bytes.rcvd.anomaly_index"`
	IsMulticast                  bool             `json:"is_multicast"`
	Ip                           string           `json:"ip"`
	PktStatsSent                 PktStats         `json:"pktStats.sent"`
	DhcpHost                     bool             `json:"dhcpHost"`
	CrawlerBotScannerHost        bool             `json:"crawlerBotScannerHost"`
	BroadcastDomainHost          bool             `json:"broadcast_domain_host"`
	IsBlacklisted                bool             `json:"is_blacklisted"`
	UdpBytesSentAnomalyIndex     int64            `json:"udp.bytes.sent.anomaly_index"`
	TotalActivityTime            int64            `json:"total_activity_time"`
	ActiveHttpHosts              int64            `json:"active_http_hosts"`
	Vlan                         int64            `json:"vlan"`
	PacketsSent                  int64            `json:"packets.sent"`
	PacketsRcvdAnomalyIndex      int64            `json:"packets.rcvd.anomaly_index"`
	TotalAlerts                  int64            `json:"total_alerts"`
	HostPoolId                   int64            `json:"host_pool_id"`
	PacketsSentAnomalyIndex      int64            `json:"packets.sent.anomaly_index"`
	Country                      string           `json:"country"`
	OtherIpBytesSentAnomalyIndex int64            `json:"other_ip.bytes.sent.anomaly_index"`
	NumAlerts                    int64            `json:"num_alerts"`
	UdpBytesRcvdAnomalyIndex     int64            `json:"udp.bytes.rcvd.anomaly_index"`
	SerializeByMac               bool             `json:"serialize_by_mac"`
	IsBroadcast                  bool             `json:"is_broadcast"`
	ScoreBehaviour               Behaviour        `json:"score_behaviour"`
	Asname                       string           `json:"asname"`
	ServerContacts               map[string]int64 `json:"server_contacts,omitempty"`
	UsedPorts                    struct {
		LocalServerPorts     map[string]string `json:"local_server_ports"`
		RemoteContactedPorts map[string]string `json:"remote_contacted_ports"`
	} `json:"used_ports,omitempty"`
	Cardinality struct {
		NumHostContactsAsServer      int64 `json:"num_host_contacts_as_server"`
		NumContactedHostsAsClient    int64 `json:"num_contacted_hosts_as_client"`
		NumContactedServicesAsClient int64 `json:"num_contacted_services_as_client"`
	} `json:"cardinality,omitempty"`
	HTTP struct {
		Receiver     HttpBreakdown `json:"receiver"`
		Sender       HttpBreakdown `json:"sender"`
		VirtualHosts interface{}   `json:"virtual_hosts"`
	} `json:"http,omitempty"`
}

type HostTopPeer

type HostTopPeer struct {
	Host       string `json:"host"`
	Name       string `json:"name"`
	Url        string `json:"url"`
	Traffic    int64  `json:"traffic"`
	L7Proto    string `json:"l7proto"`
	L7ProtoUrl string `json:"l7proto_url"`
}

type HttpBreakdown

type HttpBreakdown struct {
	Query struct {
		Total    int64 `json:"total"`
		NumGet   int64 `json:"num_get"`
		NumOther int64 `json:"num_other"`
		NumHead  int64 `json:"num_head"`
		NumPut   int64 `json:"num_put"`
		NumPost  int64 `json:"num_post"`
	} `json:"query"`
	Rate struct {
		Query struct {
			Get   int64 `json:"get"`
			Put   int64 `json:"put"`
			Post  int64 `json:"post"`
			Head  int64 `json:"head"`
			Other int64 `json:"other"`
		} `json:"query"`
		Response struct {
			Num1XX int64 `json:"1xx"`
			Num2XX int64 `json:"2xx"`
			Num3XX int64 `json:"3xx"`
			Num4XX int64 `json:"4xx"`
			Num5XX int64 `json:"5xx"`
		} `json:"response"`
	} `json:"rate"`
	Response struct {
		Total  int64 `json:"total"`
		Num3XX int64 `json:"num_3xx"`
		Num4XX int64 `json:"num_4xx"`
		Num2XX int64 `json:"num_2xx"`
		Num5XX int64 `json:"num_5xx"`
		Num1XX int64 `json:"num_1xx"`
	} `json:"response"`
}

type HttpMode

type HttpMode string
const (
	HttpModeQueries   HttpMode = "queries"
	HttpModeResponses HttpMode = "responses"
)

type IPVersion

type IPVersion int

IPVersion IP版本

const (
	IPVersionAll IPVersion = 0 // 全部
	IPVersion4   IPVersion = 4 // IPv4
	IPVersion6   IPVersion = 6 // IPv6
)

type IfDistroReq

type IfDistroReq struct {
	IfId int64 `json:"ifid"`
	Type IfDistroType
}

type IfDistroType

type IfDistroType string

IfDistroType 接口统计类型

const (
	IfDistroTypePktSize             IfDistroType = "size"           // 数据包 - 大小分布
	IfDistroTypePktIpVer            IfDistroType = "ipver"          // 数据包 - IP版本分布
	IfDistroTypePktTcpFlags         IfDistroType = "tcp_flags"      // 数据包 - TCP标志分布
	IfDistroTypeDSCP                IfDistroType = "dscp"           // DSCP - 优先级分布
	IfDistroTypeL7SinceStartup      IfDistroType = "l7"             // 应用程序概述 - 协议分布
	IfDistroTypeL7BreedSinceStartup IfDistroType = "l7_breed"       // 应用程序概述 - 协议类型分布
	IfDistroTypeL7BreedCount        IfDistroType = "l7_breed_count" // 应用程序实时流计数 - 协议类型分布
	IfDistroTypeTcpStats            IfDistroType = "tcp_stats"      // 应用程序实时流计数 - TCP连接状态分布
	IfDistroTypeL7Category          IfDistroType = "l7_category"    // 应用程序类别概述
	IfDistroTypeTopHosts            IfDistroType = "top_hosts"      // Top主机
)

type Interface

type Interface struct {
	ActiveDiscoveryActive bool  `json:"active_discovery_active,omitempty"`
	AlertedFlows          int64 `json:"alerted_flows,omitempty"`
	AlertedFlowsError     int64 `json:"alerted_flows_error,omitempty"`
	AlertedFlowsNotice    int64 `json:"alerted_flows_notice,omitempty"`
	AlertedFlowsWarning   int64 `json:"alerted_flows_warning,omitempty"`
	Bytes                 int64 `json:"bytes,omitempty"`
	BytesDownload         int64 `json:"bytes_download,omitempty"`
	BytesUpload           int64 `json:"bytes_upload,omitempty"`
	DownloadUploadChart   struct {
		Download []int64 `json:"download"`
		Upload   []int64 `json:"upload"`
	} `json:"download_upload_chart,omitempty"`
	DroppedAlerts                    int64       `json:"dropped_alerts,omitempty"`
	Drops                            int64       `json:"drops,omitempty"`
	EngagedAlerts                    int64       `json:"engaged_alerts,omitempty"`
	EngagedAlertsError               int64       `json:"engaged_alerts_error,omitempty"`
	EngagedAlertsNotice              int64       `json:"engaged_alerts_notice,omitempty"`
	EngagedAlertsWarning             int64       `json:"engaged_alerts_warning,omitempty"`
	Epoch                            int64       `json:"epoch,omitempty"`
	FlowDroppedAlerts                int64       `json:"flow_dropped_alerts,omitempty"`
	FlowsPctg                        int64       `json:"flows_pctg,omitempty"`
	HostDroppedAlerts                int64       `json:"host_dropped_alerts,omitempty"`
	HostsPctg                        int64       `json:"hosts_pctg,omitempty"`
	Ifid                             int64       `json:"ifid"`
	Ifname                           string      `json:"ifname"`
	IsView                           bool        `json:"is_view,omitempty"`
	Local2Remote                     int64       `json:"local2remote,omitempty"`
	Localtime                        string      `json:"localtime,omitempty"`
	MacsPctg                         int64       `json:"macs_pctg,omitempty"`
	NumDevices                       int64       `json:"num_devices,omitempty"`
	NumFlows                         int64       `json:"num_flows,omitempty"`
	NumHosts                         int64       `json:"num_hosts,omitempty"`
	NumLiveCaptures                  int64       `json:"num_live_captures,omitempty"`
	NumLocalHosts                    int64       `json:"num_local_hosts,omitempty"`
	NumLocalHostsAnomalies           int64       `json:"num_local_hosts_anomalies,omitempty"`
	NumLocalRcvdOnlyHosts            int64       `json:"num_local_rcvd_only_hosts,omitempty"`
	NumRcvdOnlyHosts                 int64       `json:"num_rcvd_only_hosts,omitempty"`
	NumRemoteHostsAnomalies          int64       `json:"num_remote_hosts_anomalies,omitempty"`
	OtherDroppedAlerts               int64       `json:"other_dropped_alerts,omitempty"`
	Packets                          int64       `json:"packets,omitempty"`
	PacketsDownload                  int64       `json:"packets_download,omitempty"`
	PacketsUpload                    int64       `json:"packets_upload,omitempty"`
	PeriodicStatsUpdateFrequencySecs int64       `json:"periodic_stats_update_frequency_secs,omitempty"`
	Profiles                         interface{} `json:"profiles,omitempty"`
	Remote2Local                     int64       `json:"remote2local,omitempty"`
	RemoteBps                        float64     `json:"remote_bps,omitempty"`
	RemotePps                        float64     `json:"remote_pps,omitempty"`
	Speed                            int64       `json:"speed,omitempty"` // Mbps
	SystemHostStats                  struct {
		AlertsQueries int64 `json:"alerts_queries,omitempty"`
		AlertsStats   struct {
			AlertQueues struct {
				InternalAlertsQueue struct {
					PctNotEnqueued int64 `json:"pct_not_enqueued,omitempty"`
				} `json:"internal_alerts_queue,omitempty"`
			} `json:"alert_queues,omitempty"`
		} `json:"alerts_stats,omitempty"`
		CpuLoad   float64 `json:"cpu_load,omitempty"`
		CpuStates struct {
			Guest     float64 `json:"guest,omitempty"`
			GuestNice float64 `json:"guest_nice,omitempty"`
			Idle      float64 `json:"idle,omitempty"`
			Iowait    float64 `json:"iowait,omitempty"`
			Irq       float64 `json:"irq,omitempty"`
			Nice      float64 `json:"nice,omitempty"`
			Softirq   float64 `json:"softirq,omitempty"`
			Steal     float64 `json:"steal,omitempty"`
			System    float64 `json:"system,omitempty"`
			User      float64 `json:"user,omitempty"`
		} `json:"cpu_states,omitempty"`
		DroppedAlerts     int64 `json:"dropped_alerts,omitempty"`
		MemBuffers        int64 `json:"mem_buffers,omitempty"`
		MemCached         int64 `json:"mem_cached,omitempty"`
		MemFree           int64 `json:"mem_free,omitempty"`
		MemNtopngResident int64 `json:"mem_ntopng_resident,omitempty"`
		MemNtopngVirtual  int64 `json:"mem_ntopng_virtual,omitempty"`
		MemShmem          int64 `json:"mem_shmem,omitempty"`
		MemSreclaimable   int64 `json:"mem_sreclaimable,omitempty"`
		MemTotal          int64 `json:"mem_total,omitempty"`
		MemUsed           int64 `json:"mem_used,omitempty"`
		WrittenAlerts     int64 `json:"written_alerts,omitempty"`
	} `json:"system_host_stats,omitempty"`
	TcpPacketStats struct {
		Lost            int64 `json:"lost,omitempty"`            // 丢失包数量
		OutOfOrder      int64 `json:"out_of_order,omitempty"`    // 乱序包数量
		Retransmissions int64 `json:"retransmissions,omitempty"` // 重传包数量
	} `json:"tcpPacketStats,omitempty"` // TCP数据包分析
	Throughput struct {
		Download struct {
			Bps float64 `json:"bps,omitempty"`
			Pps float64 `json:"pps,omitempty"`
		} `json:"download,omitempty"`
		Upload struct {
			Bps float64 `json:"bps,omitempty"`
			Pps float64 `json:"pps,omitempty"`
		} `json:"upload,omitempty"`
	} `json:"throughput,omitempty"`
	ThroughputBps             float64 `json:"throughput_bps,omitempty"`
	ThroughputPps             float64 `json:"throughput_pps,omitempty"`
	TrafficExtractionNumTasks int64   `json:"traffic_extraction_num_tasks,omitempty"`
	TrafficRecording          string  `json:"traffic_recording,omitempty"`
	Uptime                    string  `json:"uptime,omitempty"`
}

type InterfaceSummary

type InterfaceSummary struct {
	ActiveDiscoveryActive bool   `json:"active_discovery_active,omitempty"`
	AlertedFlows          int64  `json:"alerted_flows,omitempty"`
	AlertedFlowsError     int64  `json:"alerted_flows_error,omitempty"`
	AlertedFlowsWarning   int64  `json:"alerted_flows_warning,omitempty"`
	Drops                 int64  `json:"drops,omitempty"`
	EngagedAlerts         int64  `json:"engaged_alerts,omitempty"`
	EngagedAlertsError    int64  `json:"engaged_alerts_error,omitempty"`
	EngagedAlertsWarning  int64  `json:"engaged_alerts_warning,omitempty"`
	FlowsPctg             int64  `json:"flows_pctg,omitempty"`
	HostsPctg             int64  `json:"hosts_pctg,omitempty"`
	Ifid                  int64  `json:"ifid"`
	Ifname                string `json:"ifname"`
	Localtime             string `json:"localtime,omitempty"`
	MacsPctg              int64  `json:"macs_pctg,omitempty"`
	NumDevices            int64  `json:"num_devices,omitempty"`
	NumFlows              int64  `json:"num_flows,omitempty"`
	NumHosts              int64  `json:"num_hosts,omitempty"`
	NumLiveCaptures       int64  `json:"num_live_captures,omitempty"`
	NumLocalHosts         int64  `json:"num_local_hosts,omitempty"`
	NumLocalRcvdOnlyHosts int64  `json:"num_local_rcvd_only_hosts,omitempty"`
	NumRcvdOnlyHosts      int64  `json:"num_rcvd_only_hosts,omitempty"`
	Throughput            struct {
		Download float64 `json:"download,omitempty"`
		Upload   float64 `json:"upload,omitempty"`
	} `json:"throughput,omitempty"`
	ThroughputBps             float64 `json:"throughput_bps,omitempty"`
	TrafficExtractionNumTasks int64   `json:"traffic_extraction_num_tasks,omitempty"`
	TrafficRecording          string  `json:"traffic_recording,omitempty"`
	Uptime                    string  `json:"uptime,omitempty"`
}

type L4Proto

type L4Proto int

L4Proto 4层协议

const (
	L4ProtoAll    L4Proto = 0  // 全部
	L4ProtoICMP   L4Proto = 1  // ICMP
	L4ProtoTCP    L4Proto = 6  // TCP
	L4ProtoUDP    L4Proto = 17 // UDP
	L4ProtoICMPv6 L4Proto = 58 // ICMPv6
)

type LabelValue

type LabelValue struct {
	Label string  `json:"label"`
	Value float64 `json:"value"`
	Color string  `json:"color,omitempty"`
}

type Mac

type Mac struct {
	ColumnArpTotal     string `json:"column_arp_total"`
	ColumnDeviceType   string `json:"column_device_type"`
	Key                string `json:"key"`
	ColumnSince        string `json:"column_since"`
	ColumnBreakdown    string `json:"column_breakdown"`
	ColumnMac          string `json:"column_mac"`
	ColumnName         string `json:"column_name"`
	ColumnTraffic      string `json:"column_traffic"`
	ColumnHosts        string `json:"column_hosts"`
	ColumnThpt         string `json:"column_thpt"`
	ColumnManufacturer string `json:"column_manufacturer"`
}

func (Mac) ArpTotal

func (m Mac) ArpTotal() int

func (Mac) Breakdown

func (m Mac) Breakdown() []float64

func (Mac) DeviceType

func (m Mac) DeviceType() string

func (Mac) Hosts

func (m Mac) Hosts() int

func (Mac) MAC

func (m Mac) MAC() string

func (Mac) Manufacturer

func (m Mac) Manufacturer() string

type MacMode

type MacMode string

MacMode 过滤MAC

const (
	MacModeAll            MacMode = ""                 // 全部
	MacModeSourceMacsOnly MacMode = "source_macs_only" // 仅源MAC
)

type MacReq

type MacReq struct {
	BasePageReq
	MacMode      *MacMode    // 过滤MAC
	Manufacturer string      // 供应商
	DeviceType   *DeviceType // 设备类型
}

type MacResp

type MacResp struct {
	BasePageResp
	Data []*Mac `json:"data"`
}

type Network

type Network struct {
	Key                  string `json:"key"`
	ColumnId             string `json:"column_id"`
	ColumnHostScoreRatio string `json:"column_host_score_ratio"`
	ColumnAlertedFlows   string `json:"column_alerted_flows"`
	ColumnBreakdown      string `json:"column_breakdown"`
	ColumnHosts          string `json:"column_hosts"`
	ColumnChart          string `json:"column_chart"`
	ColumnScore          string `json:"column_score"`
	ColumnThpt           string `json:"column_thpt"`
	ColumnTraffic        string `json:"column_traffic"`
}

func (Network) AlertedFlows

func (n Network) AlertedFlows() int

func (Network) Breakdown

func (n Network) Breakdown() []float64

func (Network) Hosts

func (n Network) Hosts() int

func (Network) Name

func (n Network) Name() string

func (Network) Score

func (n Network) Score() int

func (Network) Thpt

func (n Network) Thpt() string

func (Network) Traffic

func (n Network) Traffic() string

type NetworkResp

type NetworkResp struct {
	BasePageResp
	Data []*Network `json:"data"`
}

type NetworksReq

type NetworksReq struct {
	BasePageReq
}

type Ntopng

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

func New

func New(opts ...Option) *Ntopng

func (*Ntopng) Find

func (this *Ntopng) Find(req *FindReq) (*FindResp, error)

func (*Ntopng) Get

func (this *Ntopng) Get(path string, headers, params map[string]interface{}) ([]byte, error)

func (*Ntopng) GetASList

func (this *Ntopng) GetASList(req *ASReq) (*ASResp, error)

func (*Ntopng) GetActiveFlows

func (this *Ntopng) GetActiveFlows(req *FlowReq) (*ActiveFlowResp, error)

func (*Ntopng) GetApplicationCategoryList

func (this *Ntopng) GetApplicationCategoryList() ([]*ApplicationCategory, error)

func (*Ntopng) GetApplicationList

func (this *Ntopng) GetApplicationList() ([]*Application, error)

func (*Ntopng) GetCategoryList

func (this *Ntopng) GetCategoryList(req *CategoryReq) (*CategoryResp, error)

func (*Ntopng) GetCountryList

func (this *Ntopng) GetCountryList(req *CountryReq) (*CountryResp, error)

func (*Ntopng) GetDeviceApplicationList

func (this *Ntopng) GetDeviceApplicationList(req *DeviceApplicationReq) (*DeviceApplicationResp, error)

func (*Ntopng) GetFlowList

func (this *Ntopng) GetFlowList(req *FlowReq) (*FlowResp, error)

GetFlowList 活动流列表

func (*Ntopng) GetFlowStats

func (this *Ntopng) GetFlowStats(req *FlowStatsReq) (*FlowStatsResp, error)

func (*Ntopng) GetHostDistro

func (this *Ntopng) GetHostDistro(req *HostDistroReq) ([]*LabelValue, error)

func (*Ntopng) GetHostFingerprint

func (this *Ntopng) GetHostFingerprint(host string) ([]*HostFingerprint, error)

func (*Ntopng) GetHostL4Data

func (this *Ntopng) GetHostL4Data(host string) ([]*HostL4Data, error)

func (*Ntopng) GetHostL7Data

func (this *Ntopng) GetHostL7Data(host string) ([]*HostL7Data, error)

func (*Ntopng) GetHostList

func (this *Ntopng) GetHostList(req *HostReq) (*HostResp, error)

func (*Ntopng) GetHostPoolList

func (this *Ntopng) GetHostPoolList(req *HostPoolReq) ([]*HostPool, error)

GetHostPoolList 获取主机池列表

func (*Ntopng) GetHostStats

func (this *Ntopng) GetHostStats(host string) (*HostStats, error)

func (*Ntopng) GetHostTopPeersProtocols

func (this *Ntopng) GetHostTopPeersProtocols(host string) ([]*HostTopPeer, error)

func (*Ntopng) GetInterface

func (this *Ntopng) GetInterface(ifId int64) (*Interface, error)

func (*Ntopng) GetInterfaceAddress

func (this *Ntopng) GetInterfaceAddress(ifId int64) ([]string, error)

func (*Ntopng) GetInterfaceDistro

func (this *Ntopng) GetInterfaceDistro(req *IfDistroReq) ([]*LabelValue, error)

GetInterfaceDistro 接口数据分布情况

func (*Ntopng) GetInterfaceList

func (this *Ntopng) GetInterfaceList() ([]*Interface, error)

func (*Ntopng) GetInterfaceSummary

func (this *Ntopng) GetInterfaceSummary(ifId int64) (*InterfaceSummary, error)

func (*Ntopng) GetMacList

func (this *Ntopng) GetMacList(req *MacReq) (*MacResp, error)

GetMacList 获取MAC地址列表

func (*Ntopng) GetNetworkList

func (this *Ntopng) GetNetworkList(req *NetworksReq) (*NetworkResp, error)

GetNetworkList 获取网络列表

func (*Ntopng) GetOsList

func (this *Ntopng) GetOsList(req *OsReq) (*OsResp, error)

func (*Ntopng) GetTsData

func (this *Ntopng) GetTsData(req *TsDataReq) (*TsDataResp, error)

func (*Ntopng) GetTsTypeConst

func (this *Ntopng) GetTsTypeConst(req *TsTypeConstReq) ([]*TsTypeConst, error)

func (*Ntopng) Post

func (this *Ntopng) Post(path string, headers, body map[string]interface{}) ([]byte, error)

type OS

type OS struct {
	ColumnId        string `json:"column_id"`
	Key             string `json:"key"`
	ColumnHosts     string `json:"column_hosts"`
	ColumnBreakdown string `json:"column_breakdown"`
	ColumnAlerts    string `json:"column_alerts"`
	ColumnThpt      string `json:"column_thpt"`
	ColumnTraffic   string `json:"column_traffic"`
	ColumnChart     string `json:"column_chart"`
	ColumnSince     string `json:"column_since"`
}

func (OS) Alerts

func (o OS) Alerts() int

func (OS) Breakdown

func (o OS) Breakdown() []float64

func (OS) Name

func (o OS) Name() string

func (OS) NumHosts

func (o OS) NumHosts() int

func (OS) Since

func (o OS) Since() string

func (OS) Thpt

func (o OS) Thpt() string

func (OS) Traffic

func (o OS) Traffic() string

type Object

type Object struct {
	Type    string `json:"type"`              // 对象类型 network、mac、asn、ip等
	Name    string `json:"name"`              // 显示名称
	Network int    `json:"network,omitempty"` // 网络ID
	Mac     string `json:"mac,omitempty"`     // MAC地址
	ASN     int    `json:"asn,omitempty"`     // ASN
	IP      string `json:"ip,omitempty"`      // 主机IP
}

type Option

type Option func(n *Ntopng)

func WithBaseUrl

func WithBaseUrl(url string) Option

func WithBasicAuth

func WithBasicAuth(user, pass string) Option

func WithClient

func WithClient(client *http.Client) Option

func WithTimeout

func WithTimeout(timeout time.Duration) Option

func WithToken

func WithToken(token string) Option

func WithTransport

func WithTransport(transport http.RoundTripper) Option

type OsReq

type OsReq struct {
	BasePageReq
}

type OsResp

type OsResp struct {
	BasePageResp
	Data []*OS `json:"data"`
}

type PktStats

type PktStats struct {
	TcpFlags struct {
		Rst    int64 `json:"rst"`
		Synack int64 `json:"synack"`
		Finack int64 `json:"finack"`
		Syn    int64 `json:"syn"`
	} `json:"tcp_flags"`
	Size map[string]int64 `json:"size"`
}

type PolicyFilter

type PolicyFilter int

PolicyFilter 过滤策略

const (
	PolicyFilterWarning PolicyFilter = iota // 触发告警
	PolicyFilterAllow                       // 可接受
)

type Series

type Series struct {
	Id         string    `json:"id"`
	Data       []float64 `json:"data"`
	Statistics struct {
		Total     float64 `json:"total"`
		P95       float64 `json:"95th_percentile"`
		Average   float64 `json:"average"`
		MaxVal    float64 `json:"max_val"`
		MaxValIdx int     `json:"max_val_idx"`
		MinVal    float64 `json:"min_val"`
		MinValIdx int     `json:"min_val_idx"`
	} `json:"statistics"`
}

type TrafficType

type TrafficType string

TrafficType 流方向

const (
	TrafficTypeAll TrafficType = "" // 全部
	// 流 方向
	TrafficTypeUnicast                    TrafficType = "unicast"                     // 单播(非组播/非广播)
	TrafficTypeBroadcastOrMulticast       TrafficType = "broadcast_multicast"         // 组播/广播
	TrafficTypeOneWayUnicast              TrafficType = "one_way_unicast"             // 单向单播(非组播/非广播)
	TrafficTypeOneWayBroadcastOrMulticast TrafficType = "one_way_broadcast_multicast" // 单向组播/广播
	// 主机 流量方向
	TrafficTypeOneWay        TrafficType = "one_way"       // 单向
	TrafficTypeBidirectional TrafficType = "bidirectional" // 双向
)

type TsDataReq

type TsDataReq struct {
	Schema    string                 `json:"schema"` // 查询类型
	Query     map[string]interface{} `json:"query"`  // 查询条件
	TsKey     interface{}            `json:"tskey"`  // 查询对象唯一标识,比如接口ID、主机IP
	BeginTime time.Time              `json:"begin_time,omitempty"`
	EndTime   time.Time              `json:"end_time,omitempty"`
	Limit     int                    `json:"limit,omitempty"`
	Zoom      string                 `json:"zoom,omitempty"`
	TsCompare string                 `json:"ts_compare,omitempty"`
	Version   IPVersion              `json:"version,omitempty"`
}

type TsDataResp

type TsDataResp struct {
	Metadata struct {
		Query      map[string]interface{} `json:"query"`
		Schema     string                 `json:"schema"`
		NumPoint   int64                  `json:"num_point"`
		EpochBegin int64                  `json:"epoch_begin"`
		EpochEnd   int64                  `json:"epoch_end"`
		EpochStep  int64                  `json:"epoch_step"`
	} `json:"metadata"`
	Series           []*Series              `json:"series"`
	AdditionalSeries map[string]interface{} `json:"additional_series"`
}

type TsTypeConst

type TsTypeConst struct {
	Id             string                 `json:"id"`
	Group          string                 `json:"group,omitempty"` // 分组
	Scale          string                 `json:"scale"`
	Query          string                 `json:"query,omitempty"`
	Schema         string                 `json:"schema"`
	Label          string                 `json:"label"`        // 名称
	MeasureUnit    string                 `json:"measure_unit"` // 单位
	Priority       int                    `json:"priority"`     // 顺序
	DefaultVisible bool                   `json:"default_visible,omitempty"`
	AlwaysVisible  bool                   `json:"alwais_visibile,omitempty"` // 注:接口原始返回字段拼写错误
	Timeseries     map[string]interface{} `json:"timeseries"`
}

type TsTypeConstReq

type TsTypeConstReq struct {
	IfId  int64  `json:"ifid"`
	Query string `json:"query"` // 查询类型:iface, host, mac, subnet, asn, country, os, vlan, host_pool, pod, container, ht, system, profile, redis, influxdb, am, snmp_interface, snmp_device, obs_point, sflowdev_port, flowdev, flowdev_port
	Host  string `json:"host,omitempty"`
	Pool  int64  `json:"pool,omitempty"`
	VLAN  int64  `json:"vlan,omitempty"`
	ASN   int64  `json:"asn,omitempty"`
	Mac   string `json:"mac,omitempty"`
}

Jump to

Keyboard shortcuts

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