Documentation
¶
Index ¶
- func ListAllDevices() ([]pcap.Interface, error)
- func NewApp() *cobra.Command
- type Connection
- type ConnectionData
- type ConnectionInfo
- type ConnectionsResult
- type DNSResolver
- type Direction
- type LocalSocket
- type Lookup
- type NetworkData
- type OpenSockets
- type Options
- type PcapClient
- type PlotViewer
- type ProcessInfo
- type ProcessesResult
- type Protocol
- type RemoteAddrsResult
- type RemoteSocket
- type Segment
- type Sinker
- type Snapshot
- type Sniffer
- type SocketFetcher
- type Stat
- type StatsManager
- type TableViewer
- type UIComponent
- type Unit
- type Utilization
- type ViewMode
- type Viewer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ListAllDevices ¶
Types ¶
type Connection ¶
type Connection struct {
Local LocalSocket
Remote RemoteSocket
}
type ConnectionData ¶
type ConnectionData struct {
DownloadBytes int
UploadBytes int
UploadPackets int
DownloadPackets int
ProcessName string
InterfaceName string
}
func (*ConnectionData) DivideBy ¶
func (d *ConnectionData) DivideBy(n int)
type ConnectionInfo ¶
type ConnectionsResult ¶
type ConnectionsResult struct {
Conn Connection
Data *ConnectionData
}
type DNSResolver ¶
type DNSResolver struct {
// contains filtered or unexported fields
}
func NewDnsResolver ¶
func NewDnsResolver() *DNSResolver
func (*DNSResolver) Close ¶
func (c *DNSResolver) Close()
func (*DNSResolver) Lookup ¶
func (c *DNSResolver) Lookup(ip string) string
Lookup resolve remote ip to the domains.
type LocalSocket ¶
type NetworkData ¶
type NetworkData struct {
UploadBytes int
DownloadBytes int
UploadPackets int
DownloadPackets int
ConnCount int
}
func (*NetworkData) DivideBy ¶
func (d *NetworkData) DivideBy(n int)
type OpenSockets ¶
type OpenSockets map[LocalSocket]ProcessInfo
type Options ¶
type Options struct {
// BPFFilter is the string pcap filter with the BPF syntax
// eg. "tcp and port 80"
BPFFilter string
// Interval is the interval for refresh rate in seconds
Interval int
// ViewMode represents the sniffer view mode, optional: bytes, packets, processes
ViewMode ViewMode
// DevicesPrefix represents prefixed devices to monitor
DevicesPrefix []string
// Unit of stats in processes mode, optional: B, Kb, KB, Mb, MB, Gb, GB
Unit Unit
// DisableDNSResolve decides whether if disable the DNS resolution
DisableDNSResolve bool
// AllDevices specifies whether to listen all devices or not
AllDevices bool
}
Options is the options set for the sniffer instance.
func DefaultOptions ¶
func DefaultOptions() Options
type PcapClient ¶
type PcapClient struct {
Sinker *Sinker
// contains filtered or unexported fields
}
func NewPcapClient ¶
func NewPcapClient(lookup Lookup, opt Options) (*PcapClient, error)
func (*PcapClient) Close ¶
func (c *PcapClient) Close()
type PlotViewer ¶
type PlotViewer struct {
// contains filtered or unexported fields
}
func (*PlotViewer) Render ¶
func (pv *PlotViewer) Render(stats interface{})
func (*PlotViewer) Resize ¶
func (pv *PlotViewer) Resize(width, height int)
func (*PlotViewer) Setup ¶
func (pv *PlotViewer) Setup()
func (*PlotViewer) Shift ¶
func (pv *PlotViewer) Shift()
type ProcessInfo ¶
func (ProcessInfo) String ¶
func (p ProcessInfo) String() string
type ProcessesResult ¶
type ProcessesResult struct {
ProcessName string
Data *NetworkData
}
type RemoteAddrsResult ¶
type RemoteAddrsResult struct {
Addr string
Data *NetworkData
}
type RemoteSocket ¶
type Segment ¶
type Segment struct {
Interface string
DataLen int
Connection Connection
Direction Direction
}
type Sinker ¶
type Sinker struct {
// contains filtered or unexported fields
}
func (*Sinker) GetUtilization ¶
func (c *Sinker) GetUtilization() Utilization
type Snapshot ¶
type Snapshot struct {
Processes map[string]*NetworkData
RemoteAddrs map[string]*NetworkData
Connections map[Connection]*ConnectionData
TotalUploadBytes int
TotalDownloadBytes int
TotalUploadPackets int
TotalDownloadPackets int
TotalConnections int
}
func (*Snapshot) TopNConnections ¶
func (s *Snapshot) TopNConnections(n int, mode ViewMode) []ConnectionsResult
func (*Snapshot) TopNProcesses ¶
func (s *Snapshot) TopNProcesses(n int, mode ViewMode) []ProcessesResult
func (*Snapshot) TopNRemoteAddrs ¶
func (s *Snapshot) TopNRemoteAddrs(n int, mode ViewMode) []RemoteAddrsResult
type Sniffer ¶
type Sniffer struct {
Opts Options
DnsResolver *DNSResolver
PcapClient *PcapClient
StatsManager *StatsManager
Ui *UIComponent
SocketFetcher SocketFetcher
}
func NewSniffer ¶
func (*Sniffer) SwitchViewMode ¶
func (s *Sniffer) SwitchViewMode()
type SocketFetcher ¶
type SocketFetcher interface {
GetOpenSockets() (OpenSockets, error)
}
func GetSocketFetcher ¶
func GetSocketFetcher() SocketFetcher
type Stat ¶
type Stat struct {
OpenSockets OpenSockets
Utilization Utilization
}
type StatsManager ¶
type StatsManager struct {
// contains filtered or unexported fields
}
func NewStatsManager ¶
func NewStatsManager(opt Options) *StatsManager
func (*StatsManager) GetStats ¶
func (s *StatsManager) GetStats() interface{}
func (*StatsManager) Put ¶
func (s *StatsManager) Put(stat Stat)
type TableViewer ¶
type TableViewer struct {
// contains filtered or unexported fields
}
func (*TableViewer) Render ¶
func (tv *TableViewer) Render(stats interface{})
func (*TableViewer) Resize ¶
func (tv *TableViewer) Resize(width, height int)
func (*TableViewer) Setup ¶
func (tv *TableViewer) Setup()
func (*TableViewer) Shift ¶
func (tv *TableViewer) Shift()
type UIComponent ¶
type UIComponent struct {
// contains filtered or unexported fields
}
func NewUIComponent ¶
func NewUIComponent(opt Options) *UIComponent
func (*UIComponent) Close ¶
func (ui *UIComponent) Close()
type Utilization ¶
type Utilization map[Connection]*ConnectionInfo
Click to show internal directories.
Click to hide internal directories.

