dot

package
v0.0.0-...-2ad47e2 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2021 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// GraphName is the default name for graph
	GraphName = "G"
)
View Source
const (
	// Label marks the label key for the node
	Label = "label"
)

Variables

This section is empty.

Functions

func Draw

func Draw(gi *GraphInfo, nodeCh <-chan xray.NodeID, h Handler) (*gographviz.Graph, error)

Draw returns the Graph object of the given scan result Notice this operation is blocking

Types

type DefaultHandler

type DefaultHandler struct {
	Processor
}

DefaultHandler is the default dot handler

func (*DefaultHandler) Process

func (p *DefaultHandler) Process(g *GraphInfo, id xray.NodeID)

Process is the node handling logic for default handler

type EdgePair

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

EdgePair describes the source and designation of an edge it's also used to identify the edge

type GraphInfo

type GraphInfo struct {
	// scanned results, all nodes that has been scanned
	Nodes map[xray.NodeID]*xray.Node
	// maps stores the KV pairs for each map
	Maps map[xray.NodeID]map[xray.NodeID]xray.NodeID
}

GraphInfo contains the raw node data collected without being processed

func NewGraphInfo

func NewGraphInfo(s *xray.Scanner) *GraphInfo

NewGraphInfo construct the graph info from scanner

type Handler

type Handler interface {
	Process(*GraphInfo, xray.NodeID)
	Render() (*gographviz.Graph, error)
}

Handler is the interface for hanling a specific node it can read the global nodes information, and it's can use its custome logic to manage the objects to be rendered

type NodeInfo

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

NodeInfo stores the necessary information to construct a node in dot format if graph points to nil then the node should be added to the outmost graph

type Processor

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

Processor is used for convert the node information to gographviz.Graph

func NewProcessor

func NewProcessor() *Processor

NewProcessor initiates a Processor instance

func (*Processor) AddEdge

func (p *Processor) AddEdge(src, dst xray.NodeID, srcField string, attr map[string]string)

AddEdge registers an edge

func (*Processor) AddNode

func (p *Processor) AddNode(node xray.NodeID, graph *xray.NodeID, attr map[string]string)

AddNode registers a node

func (*Processor) AddSubgraph

func (p *Processor) AddSubgraph(child xray.NodeID, parent *xray.NodeID)

AddSubgraph registers an subgraph

func (*Processor) RemoveNode

func (p *Processor) RemoveNode(node xray.NodeID)

RemoveNode removes the node

func (*Processor) Render

func (p *Processor) Render() (*gographviz.Graph, error)

Render add the observed graph objects to the current graph

Jump to

Keyboard shortcuts

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