pkg

package
v0.0.0-...-cace17c Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2022 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ItoDotPort

func ItoDotPort(port uint32) string

func StoDotPort

func StoDotPort(port string) string

Types

type Config

type Config struct {
	All  bool     `json:"all" default:"false"`
	Cmd  []string `json:"cmd"`
	Port []uint32 `json:"port"`
	Pid  []int32  `json:"pid"`
}

func NewConfig

func NewConfig() *Config

func (*Config) WriteTo

func (c *Config) WriteTo(path string)

type DotRender

type DotRender struct {
	Render
	// contains filtered or unexported fields
}

func (*DotRender) Write

func (r *DotRender) Write(topo *PSTopo, output string) error

type PSTopo

type PSTopo struct {
	graph.Graph
	Snapshot    *Snapshot
	PidSet      map[int32]*Process
	PidConnSet  map[string]*TopoEdge
	IPConnSet   map[string]*TopoEdge
	PidChildSet map[string]*TopoEdge
}

func NewTopo

func NewTopo(snapshot *Snapshot) *PSTopo

func (*PSTopo) Analyse

func (tp *PSTopo) Analyse(cfg *Config) *PSTopo

type PortSet

type PortSet struct {
	sync.Once
	// contains filtered or unexported fields
}

func NewPortSet

func NewPortSet() *PortSet

func (*PortSet) Add

func (set *PortSet) Add(port uint32) bool

func (*PortSet) Iter

func (set *PortSet) Iter() <-chan uint32

func (*PortSet) MarshalJSON

func (set *PortSet) MarshalJSON() ([]byte, error)

func (*PortSet) UnmarshalJSON

func (set *PortSet) UnmarshalJSON(data []byte) error

type Process

type Process struct {
	Pid      int32   `json:"pid"`
	Name     string  `json:"name"`
	Exec     string  `json:"exec"`
	Cmdline  string  `json:"cmdline"`
	Parent   int32   `json:"parent"`
	Children []int32 `json:"children"`
}

type Render

type Render interface {
	Write(topo *PSTopo, output string) error
}

func NewDotRender

func NewDotRender() (Render, error)

type Snapshot

type Snapshot struct {
	PidProcess            map[int32]*Process              `yaml:"process"`
	PidListenPort         map[int32]*PortSet              `yaml:"pid_listen_port"`
	PidPort               map[int32]*PortSet              `yaml:"pid_port"`
	ListenPortConnections map[uint32][]net.ConnectionStat `yaml:"listen_port_connection"`
	ListenPortPid         map[uint32]int32                `yaml:"listen_port_pid"`
	PortConnection        map[uint32]net.ConnectionStat   `yaml:"port_connection"`
	PortPid               map[uint32]int32                `yaml:"port_pid"`
}

func NewSnapshot

func NewSnapshot() *Snapshot

func TakeSnapshot

func TakeSnapshot(kind string) (*Snapshot, error)

func (*Snapshot) Copy

func (s *Snapshot) Copy(snapshot *Snapshot, pid int32)

func (*Snapshot) CopyLite

func (s *Snapshot) CopyLite(snapshot *Snapshot, pid int32)

func (*Snapshot) Dump

func (s *Snapshot) Dump() []byte

func (*Snapshot) DumpFile

func (s *Snapshot) DumpFile(filepath string)

func (*Snapshot) GetConnection

func (s *Snapshot) GetConnection(port uint32) net.ConnectionStat

func (*Snapshot) Print

func (s *Snapshot) Print() []byte

func (*Snapshot) Processes

func (s *Snapshot) Processes() []*Process

type TopoEdge

type TopoEdge struct {
	From       int32
	To         int32
	Connection net.ConnectionStat
}

func (*TopoEdge) String

func (t *TopoEdge) String() string

Jump to

Keyboard shortcuts

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