graph

package
v0.0.0-...-4f8ec59 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 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

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

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

func NewCompressor

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

func (*Compressor) AddEdge

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

func (*Compressor) AddNode

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

func (*Compressor) Name

func (c *Compressor) Name() string

func (*Compressor) Write

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

type Config

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

func (*Config) MatchName

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

func (*Config) MatchProto

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

type ConnGroup

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

func (*ConnGroup) AddListener

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

func (*ConnGroup) AddOutbound

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

func (*ConnGroup) IterListeners

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

func (*ConnGroup) IterOutbounds

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

func (*ConnGroup) Len

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

func (*ConnGroup) Sort

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

func (c *Connection) IsLocal() bool

func (*Connection) UniqID

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

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

func (*Container) AddMany

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

func (*Container) ConnectionsCount

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

func (*Container) IterListeners

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

func (*Container) IterOutbounds

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

func (*Container) SortConnections

func (c *Container) SortConnections()

func (*Container) ToNode

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

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

type Enricher

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

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

type MetaLoader

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

func NewMetaLoader

func NewMetaLoader() *MetaLoader

func (*MetaLoader) Enrich

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

func (*MetaLoader) FromReader

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

type NamedBuilderWriter

type NamedBuilderWriter interface {
	Builder
	NamedWriter
}

type NamedWriter

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

func (p NetProto) Has(mask NetProto) bool

func (*NetProto) Set

func (p *NetProto) Set(mask NetProto)

func (NetProto) String

func (p NetProto) String() string

type OrphansInspector

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

func NewOrphansInspector

func NewOrphansInspector(b NamedBuilderWriter) *OrphansInspector

func (*OrphansInspector) AddEdge

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

func (*OrphansInspector) AddNode

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

func (*OrphansInspector) Name

func (o *OrphansInspector) Name() string

func (*OrphansInspector) Write

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

type VolumeInfo

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