graph

package
v1.6.3 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2023 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidFormat = errors.New("invalid format")
	ErrInvalidRange  = errors.New("invalid range")
	ErrPortCollision = errors.New("ports collision")
)
View Source
var ErrNotEnough = errors.New("not enough items")

Functions

func Build

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

Types

type Builder

type Builder interface {
	AddNode(*node.Node) error
	AddEdge(src, dst string, port node.Port)
}

type ClusterBuilder added in v1.6.0

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

func NewClusterBuilder added in v1.6.0

func NewClusterBuilder(b NamedBuilderWriter) *ClusterBuilder

func (*ClusterBuilder) AddEdge added in v1.6.0

func (cb *ClusterBuilder) AddEdge(src, dst string, port node.Port)

func (*ClusterBuilder) AddNode added in v1.6.0

func (cb *ClusterBuilder) AddNode(n *node.Node) error

func (*ClusterBuilder) FromReader added in v1.6.0

func (cb *ClusterBuilder) FromReader(r io.Reader) (err error)

func (*ClusterBuilder) Match added in v1.6.0

func (cb *ClusterBuilder) Match(n *node.Node) (cluster string, ok bool)

func (*ClusterBuilder) Name added in v1.6.0

func (cb *ClusterBuilder) Name() string

func (*ClusterBuilder) Write added in v1.6.0

func (cb *ClusterBuilder) Write(w io.Writer)

type Config added in v1.4.0

type Config struct {
	Builder   Builder
	Meta      Enricher
	Follow    string
	SkipEnv   []string
	Proto     NetProto
	OnlyLocal bool
	FullInfo  bool
	NoLoops   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 Connection

type Connection struct {
	LocalIP    net.IP
	RemoteIP   net.IP
	LocalPort  uint16
	RemotePort uint16
	Proto      NetProto
}

func ParseNetstat

func ParseNetstat(r io.Reader) (rv []*Connection, err error)

func (*Connection) IsInbound

func (cn *Connection) IsInbound() bool

func (*Connection) IsListener

func (cn *Connection) IsListener() bool

type Container

type Container struct {
	Endpoints map[string]string
	ID        string
	Name      string
	Image     string
	Process   *ProcessInfo
	Volumes   []*VolumeInfo
	// contains filtered or unexported fields
}

func (*Container) ConnectionsCount added in v1.4.7

func (ct *Container) ConnectionsCount() int

func (*Container) IterListeners added in v1.5.1

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

func (*Container) IterOutbounds added in v1.5.1

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

func (*Container) SetConnections

func (ct *Container) SetConnections(conns []*Connection)

type ContainerClient

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

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) LoadStream

func (l *Loader) LoadStream(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)
}

type NetProto

type NetProto byte
const (
	ALL NetProto = 0
	TCP NetProto = 1
	UDP NetProto = 2
)

func ParseNetProto

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

func (NetProto) Flag

func (p NetProto) Flag() string

func (NetProto) String

func (p NetProto) String() string

type ProcessInfo added in v1.5.0

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

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