graph

package
v1.11.5 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2025 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ProcessRemote  = "[remote]"
	ProcessUnknown = "[unknown]"
)

Variables

View Source
var ErrNotEnough = errors.New("not enough items")

Functions

func Build

func Build(
	cfg *Config,
	cli ContainerClient,
) error

func NetstatCMD added in v1.11.0

func NetstatCMD(p NetProto) []string

func ParseNetstat

func ParseNetstat(r io.Reader, cb func(*Connection)) (err error)

Types

type Builder

type Builder interface {
	AddNode(*node.Node) error
	AddEdge(*node.Edge)
}

type Compressor added in v1.10.0

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

func NewCompressor added in v1.10.0

func NewCompressor(
	bldr NamedBuilderWriter,
	group string,
	diff int,
	force bool,
) *Compressor

func (*Compressor) AddEdge added in v1.10.0

func (c *Compressor) AddEdge(e *node.Edge)

func (*Compressor) AddNode added in v1.10.0

func (c *Compressor) AddNode(n *node.Node) error

func (*Compressor) Name added in v1.10.0

func (c *Compressor) Name() string

func (*Compressor) Write added in v1.10.0

func (c *Compressor) Write(w io.Writer) (err error)

type Config added in v1.4.0

type Config struct {
	Builder   Builder
	Meta      Enricher
	Follow    set.Unordered[string]
	SkipEnv   []string
	Proto     NetProto
	OnlyLocal bool
	NoLoops   bool
	Deep      bool
}

func (*Config) MatchName added in v1.4.0

func (c *Config) MatchName(v string) (yes bool)

func (*Config) MatchProto added in v1.4.0

func (c *Config) MatchProto(v string) (yes bool)

type ConnGroup added in v1.9.0

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

func (*ConnGroup) AddListener added in v1.9.0

func (cg *ConnGroup) AddListener(c *Connection)

func (*ConnGroup) AddOutbound added in v1.9.0

func (cg *ConnGroup) AddOutbound(c *Connection)

func (*ConnGroup) IterListeners added in v1.9.0

func (cg *ConnGroup) IterListeners(it func(*Connection))

func (*ConnGroup) IterOutbounds added in v1.9.0

func (cg *ConnGroup) IterOutbounds(it func(*Connection))

func (*ConnGroup) Len added in v1.9.0

func (cg *ConnGroup) Len() (rv int)

func (*ConnGroup) Sort added in v1.9.0

func (cg *ConnGroup) Sort()

type Connection

type Connection struct {
	Process string
	DstID   string
	Path    string
	SrcIP   net.IP
	DstIP   net.IP
	Inode   uint64
	SrcPort int
	DstPort int
	Proto   NetProto
	Listen  bool
}

func (*Connection) IsInbound

func (c *Connection) IsInbound() bool

func (*Connection) IsListener

func (c *Connection) IsListener() bool

func (*Connection) IsLocal added in v1.10.0

func (c *Connection) IsLocal() bool

func (*Connection) UniqID added in v1.9.0

func (c *Connection) UniqID() (id uint64, ok bool)

type Container

type Container struct {
	Endpoints map[string]string
	Labels    map[string]string

	ID      string
	Name    string
	Image   string
	Info    *ContainerInfo
	Volumes []*VolumeInfo
	// contains filtered or unexported fields
}

func (*Container) AddConnection added in v1.9.0

func (c *Container) AddConnection(conn *Connection)

func (*Container) AddMany added in v1.9.0

func (c *Container) AddMany(conns []*Connection)

func (*Container) ConnectionsCount added in v1.4.7

func (c *Container) ConnectionsCount() (rv int)

func (*Container) IterListeners added in v1.5.1

func (c *Container) IterListeners(it func(*Connection))

func (*Container) IterOutbounds added in v1.5.1

func (c *Container) IterOutbounds(it func(*Connection))

func (*Container) SortConnections added in v1.9.0

func (c *Container) SortConnections()

func (*Container) ToNode added in v1.9.0

func (c *Container) ToNode() (rv *node.Node)

type ContainerClient

type ContainerClient interface {
	Containers(context.Context, NetProto, bool, []string, func(int, int)) ([]*Container, error)
}

type ContainerInfo added in v1.9.0

type ContainerInfo struct {
	Cmd []string
	Env []string
}

type Enricher added in v1.4.0

type Enricher interface {
	Enrich(*node.Node)
}

type Loader

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

func NewLoader

func NewLoader(cfg *Config) *Loader

func (*Loader) Build

func (l *Loader) Build() error

func (*Loader) FromReader added in v1.7.4

func (l *Loader) FromReader(r io.Reader) error

type MetaLoader added in v1.4.0

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

func NewMetaLoader added in v1.4.0

func NewMetaLoader() *MetaLoader

func (*MetaLoader) Enrich added in v1.4.0

func (ex *MetaLoader) Enrich(n *node.Node)

func (*MetaLoader) FromReader added in v1.4.0

func (ex *MetaLoader) FromReader(r io.Reader) error

type NamedBuilderWriter added in v1.6.0

type NamedBuilderWriter interface {
	Builder
	NamedWriter
}

type NamedWriter added in v1.6.0

type NamedWriter interface {
	Name() string
	Write(io.Writer) error
}

type NetProto

type NetProto int16
const (
	TCP  NetProto = 1 << iota
	UDP  NetProto = 1 << iota
	UNIX NetProto = 1 << iota
	NONE NetProto = 0
	ALL  NetProto = TCP | UDP | UNIX
)

func ParseNetProto

func ParseNetProto(val string) (p NetProto, ok bool)

func (NetProto) Has added in v1.11.0

func (p NetProto) Has(mask NetProto) bool

func (*NetProto) Set added in v1.11.0

func (p *NetProto) Set(mask NetProto)

func (NetProto) String

func (p NetProto) String() string

type OrphansInspector added in v1.11.0

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

func NewOrphansInspector added in v1.11.0

func NewOrphansInspector(b NamedBuilderWriter) *OrphansInspector

func (*OrphansInspector) AddEdge added in v1.11.0

func (o *OrphansInspector) AddEdge(e *node.Edge)

func (*OrphansInspector) AddNode added in v1.11.0

func (o *OrphansInspector) AddNode(n *node.Node) error

func (*OrphansInspector) Name added in v1.11.0

func (o *OrphansInspector) Name() string

func (*OrphansInspector) Write added in v1.11.0

func (o *OrphansInspector) Write(w io.Writer) (err error)

type VolumeInfo added in v1.5.0

type VolumeInfo struct {
	Type string
	Src  string
	Dst  string
}

Jump to

Keyboard shortcuts

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