Documentation ¶
Overview ¶
Package uid implements unique ID provision for graphs.
Index ¶
- Constants
- func Int64sEqual(a, b Int64s) bool
- func NewDfdGraph() *dfdGraph
- type Client
- type Config
- type DataFlowDiagram
- func (g *DataFlowDiagram) AddFlow(f graph.Node, t graph.Node, name string) *Flow
- func (g DataFlowDiagram) AddNode(n graph.Node)
- func (g *DataFlowDiagram) AddNodeElem(n graph.Node)
- func (dfd *DataFlowDiagram) AddTrustBoundary(name, color string) (*TrustBoundary, error)
- func (g DataFlowDiagram) DOTAttributeSetters() (graph, node, edge encoding.AttributeSetter)
- func (g DataFlowDiagram) DOTAttributers() (graph, node, edge encoding.Attributer)
- func (g *DataFlowDiagram) DOTID() string
- func (g DataFlowDiagram) Edge(uid, vid int64) graph.Edge
- func (g DataFlowDiagram) Edges() graph.Edges
- func (dfd *DataFlowDiagram) ExternalID() string
- func (g *DataFlowDiagram) FindNode(id string) graph.Node
- func (g DataFlowDiagram) From(id int64) graph.Nodes
- func (dfd *DataFlowDiagram) GetTrustBoundary(id string) *TrustBoundary
- func (g DataFlowDiagram) HasEdgeBetween(xid, yid int64) bool
- func (g DataFlowDiagram) HasEdgeFromTo(uid, vid int64) bool
- func (g DataFlowDiagram) NewEdge(from, to graph.Node) graph.Edge
- func (g DataFlowDiagram) NewNode() graph.Node
- func (g DataFlowDiagram) Node(id int64) graph.Node
- func (g DataFlowDiagram) Nodes() graph.Nodes
- func (g *DataFlowDiagram) RemoveDataStore(id string)
- func (g DataFlowDiagram) RemoveEdge(fid, tid int64)
- func (g *DataFlowDiagram) RemoveExternalService(id string)
- func (g *DataFlowDiagram) RemoveFlow(src_id, dest_id string)
- func (g DataFlowDiagram) RemoveNode(id int64)
- func (g *DataFlowDiagram) RemoveProcess(id string)
- func (g *DataFlowDiagram) RemoveTrustBoundary(id string)
- func (g DataFlowDiagram) SetDOTID(id string)
- func (g DataFlowDiagram) SetEdge(e graph.Edge)
- func (g *DataFlowDiagram) Structure() []dot.Graph
- func (g DataFlowDiagram) To(id int64) graph.Nodes
- func (dfd *DataFlowDiagram) ToDOT() error
- func (dfd *DataFlowDiagram) UpdateName(new_name string)
- type DataStore
- type DfdGraph
- type DfdNode
- type ExternalService
- func (n ExternalService) Attributes() []encoding.Attribute
- func (es *ExternalService) DOTID() string
- func (n ExternalService) ExternalID() string
- func (n ExternalService) SetAttribute(attr encoding.Attribute) error
- func (n ExternalService) SetDOTID(id string)
- func (n *ExternalService) UpdateName(new_name string)
- type Flow
- func (f *Flow) Attributes() []encoding.Attribute
- func (e Flow) FromPort() (port, compass string)
- func (e Flow) SetAttribute(attr encoding.Attribute) error
- func (e Flow) SetFromPort(port, compass string) error
- func (e Flow) SetToPort(port, compass string) error
- func (e Flow) ToPort() (port, compass string)
- type Int64s
- type Process
- type Set
- type TrustBoundary
- func (g TrustBoundary) AddNode(n graph.Node)
- func (g *TrustBoundary) AddNodeElem(n graph.Node)
- func (g TrustBoundary) DOTAttributeSetters() (graph, node, edge encoding.AttributeSetter)
- func (g TrustBoundary) DOTAttributers() (graph, node, edge encoding.Attributer)
- func (g *TrustBoundary) DOTID() string
- func (g TrustBoundary) Edge(uid, vid int64) graph.Edge
- func (g TrustBoundary) Edges() graph.Edges
- func (sg *TrustBoundary) ExternalID() string
- func (g *TrustBoundary) FindNode(id string) graph.Node
- func (g TrustBoundary) From(id int64) graph.Nodes
- func (g TrustBoundary) HasEdgeBetween(xid, yid int64) bool
- func (g TrustBoundary) HasEdgeFromTo(uid, vid int64) bool
- func (g TrustBoundary) NewEdge(from, to graph.Node) graph.Edge
- func (g TrustBoundary) NewNode() graph.Node
- func (g TrustBoundary) Node(id int64) graph.Node
- func (g TrustBoundary) Nodes() graph.Nodes
- func (g *TrustBoundary) RemoveDataStore(id string)
- func (g TrustBoundary) RemoveEdge(fid, tid int64)
- func (g *TrustBoundary) RemoveExternalService(id string)
- func (g TrustBoundary) RemoveNode(id int64)
- func (g *TrustBoundary) RemoveProcess(id string)
- func (g TrustBoundary) SetDOTID(id string)
- func (g TrustBoundary) SetEdge(e graph.Edge)
- func (g *TrustBoundary) Subgraph() graph.Graph
- func (g TrustBoundary) To(id int64) graph.Nodes
- func (sg *TrustBoundary) UpdateName(new_name string)
Constants ¶
const Circle = "circle"
const Cylinder = "cylinder"
const Diamond = "diamond"
const Max = int64(^uint64(0) >> 1)
Max is the maximum value of int64.
Variables ¶
This section is empty.
Functions ¶
func Int64sEqual ¶
Int64sEqual reports set equality between the parameters. Sets are equal if and only if they have the same elements.
func NewDfdGraph ¶
func NewDfdGraph() *dfdGraph
Types ¶
type Client ¶
type Client struct { Config Config DFD *DataFlowDiagram }
type DataFlowDiagram ¶
type DataFlowDiagram struct { Name string Processes map[string]*Process ExternalServices map[string]*ExternalService DataStores map[string]*DataStore TrustBoundaries map[string]*TrustBoundary Flows map[string]*Flow // contains filtered or unexported fields }
Graph
func DeserializeDFD ¶
func DeserializeDFD(id string) *DataFlowDiagram
DeserializeDFD is used when loading a DFD from a DOT file, where an ID is already given
func InitializeDFD ¶
func InitializeDFD(name string) *DataFlowDiagram
func (DataFlowDiagram) AddNode ¶
AddNode adds n to the graph. It panics if the added node ID matches an existing node ID.
func (*DataFlowDiagram) AddNodeElem ¶
func (g *DataFlowDiagram) AddNodeElem(n graph.Node)
func (*DataFlowDiagram) AddTrustBoundary ¶
func (dfd *DataFlowDiagram) AddTrustBoundary(name, color string) (*TrustBoundary, error)
func (DataFlowDiagram) DOTAttributeSetters ¶
func (g DataFlowDiagram) DOTAttributeSetters() (graph, node, edge encoding.AttributeSetter)
DOTAttributeSetters implements the dot.AttributeSetters interface.
func (DataFlowDiagram) DOTAttributers ¶
func (g DataFlowDiagram) DOTAttributers() (graph, node, edge encoding.Attributer)
DOTAttributers implements the dot.Attributers interface.
func (*DataFlowDiagram) DOTID ¶
func (g *DataFlowDiagram) DOTID() string
func (DataFlowDiagram) Edge ¶
Edge returns the edge from u to v if such an edge exists and nil otherwise. The node v must be directly reachable from u as defined by the From method.
func (*DataFlowDiagram) ExternalID ¶
func (dfd *DataFlowDiagram) ExternalID() string
func (*DataFlowDiagram) FindNode ¶
func (g *DataFlowDiagram) FindNode(id string) graph.Node
FindNode looks for a node with a given id in either the top level graph or a subgraph. It assumes that all Nodes have unique IDs. This *should* be true, but further testing is required to really make this claim.
func (*DataFlowDiagram) GetTrustBoundary ¶
func (dfd *DataFlowDiagram) GetTrustBoundary(id string) *TrustBoundary
func (DataFlowDiagram) HasEdgeBetween ¶
HasEdgeBetween returns whether an edge exists between nodes x and y without considering direction.
func (DataFlowDiagram) HasEdgeFromTo ¶
HasEdgeFromTo returns whether an edge exists in the graph from u to v.
func (DataFlowDiagram) NewEdge ¶
NewEdge returns a new Edge from the source to the destination node.
func (DataFlowDiagram) Node ¶
Node returns the node with the given ID if it exists in the graph, and nil otherwise.
func (*DataFlowDiagram) RemoveDataStore ¶
func (g *DataFlowDiagram) RemoveDataStore(id string)
func (DataFlowDiagram) RemoveEdge ¶
func (g DataFlowDiagram) RemoveEdge(fid, tid int64)
RemoveEdge removes the edge with the given end point IDs from the graph, leaving the terminal nodes. If the edge does not exist it is a no-op.
func (*DataFlowDiagram) RemoveExternalService ¶
func (g *DataFlowDiagram) RemoveExternalService(id string)
func (*DataFlowDiagram) RemoveFlow ¶
func (g *DataFlowDiagram) RemoveFlow(src_id, dest_id string)
func (DataFlowDiagram) RemoveNode ¶
func (g DataFlowDiagram) RemoveNode(id int64)
RemoveNode removes the node with the given ID from the graph, as well as any edges attached to it. If the node is not in the graph it is a no-op.
func (*DataFlowDiagram) RemoveProcess ¶
func (g *DataFlowDiagram) RemoveProcess(id string)
func (*DataFlowDiagram) RemoveTrustBoundary ¶
func (g *DataFlowDiagram) RemoveTrustBoundary(id string)
func (DataFlowDiagram) SetDOTID ¶
func (g DataFlowDiagram) SetDOTID(id string)
SetDOTID sets the DOT ID of the graph.
func (DataFlowDiagram) SetEdge ¶
SetEdge adds e, an edge from one node to another. If the nodes do not exist, they are added and are set to the nodes of the edge otherwise. It will panic if the IDs of the e.From and e.To are equal.
func (*DataFlowDiagram) Structure ¶
func (g *DataFlowDiagram) Structure() []dot.Graph
func (*DataFlowDiagram) ToDOT ¶
func (dfd *DataFlowDiagram) ToDOT() error
func (*DataFlowDiagram) UpdateName ¶
func (dfd *DataFlowDiagram) UpdateName(new_name string)
type DataStore ¶
type DataStore struct { Name string // contains filtered or unexported fields }
Node cylinder
func DeserializeDataStore ¶
func NewDataStore ¶
func (DataStore) Attributes ¶
Attributes returns the DOT attributes of the node.
func (*DataStore) ExternalID ¶
func (DataStore) SetAttribute ¶
SetAttribute sets a DOT attribute.
func (*DataStore) UpdateName ¶
type ExternalService ¶
type ExternalService struct { Name string // contains filtered or unexported fields }
Node diamond
func DeserializeExternalService ¶
func DeserializeExternalService(id string) *ExternalService
func NewExternalService ¶
func NewExternalService(name string) *ExternalService
func (ExternalService) Attributes ¶
Attributes returns the DOT attributes of the node.
func (*ExternalService) DOTID ¶
func (es *ExternalService) DOTID() string
func (ExternalService) ExternalID ¶
func (n ExternalService) ExternalID() string
func (ExternalService) SetAttribute ¶
SetAttribute sets a DOT attribute.
func (ExternalService) SetDOTID ¶
func (n ExternalService) SetDOTID(id string)
SetDOTID sets a DOT ID.
func (*ExternalService) UpdateName ¶
func (n *ExternalService) UpdateName(new_name string)
type Flow ¶
type Flow struct {
// contains filtered or unexported fields
}
Edge
func (*Flow) Attributes ¶
func (Flow) SetAttribute ¶
SetAttribute sets a DOT attribute.
func (Flow) SetFromPort ¶
type Int64s ¶
type Int64s map[int64]struct{}
type Process ¶
type Process struct { Name string // contains filtered or unexported fields }
Node circle
func DeserializeProcess ¶
DeserializeProcess returns a pointer to a Process with a given id
func NewProcess ¶
NewProcess returns a pointer to a Process with the given name and an autogenerated id
func (Process) Attributes ¶
Attributes returns the DOT attributes of the node.
func (*Process) ExternalID ¶
func (Process) SetAttribute ¶
SetAttribute sets a DOT attribute.
func (*Process) UpdateName ¶
type Set ¶
type Set struct {
// contains filtered or unexported fields
}
Set implements available ID storage.
func NewSet ¶
func NewSet() Set
NewSet returns a new Set. The returned value should not be passed except by pointer.
type TrustBoundary ¶
type TrustBoundary struct { Name string Color string Processes map[string]*Process ExternalServices map[string]*ExternalService DataStores map[string]*DataStore // contains filtered or unexported fields }
Subgraph
func DeserializeTrustBoundary ¶
func DeserializeTrustBoundary(id string) *TrustBoundary
DeserializeTrustBoundary is used when loading a DFD from a DOT file, where an ID is already given
func InitializeTrustBoundary ¶
func InitializeTrustBoundary(name, color string) *TrustBoundary
func (TrustBoundary) AddNode ¶
AddNode adds n to the graph. It panics if the added node ID matches an existing node ID.
func (*TrustBoundary) AddNodeElem ¶
func (g *TrustBoundary) AddNodeElem(n graph.Node)
func (TrustBoundary) DOTAttributeSetters ¶
func (g TrustBoundary) DOTAttributeSetters() (graph, node, edge encoding.AttributeSetter)
DOTAttributeSetters implements the dot.AttributeSetters interface.
func (TrustBoundary) DOTAttributers ¶
func (g TrustBoundary) DOTAttributers() (graph, node, edge encoding.Attributer)
DOTAttributers implements the dot.Attributers interface.
func (*TrustBoundary) DOTID ¶
func (g *TrustBoundary) DOTID() string
func (TrustBoundary) Edge ¶
Edge returns the edge from u to v if such an edge exists and nil otherwise. The node v must be directly reachable from u as defined by the From method.
func (*TrustBoundary) ExternalID ¶
func (sg *TrustBoundary) ExternalID() string
func (*TrustBoundary) FindNode ¶
func (g *TrustBoundary) FindNode(id string) graph.Node
FindNode looks for a node with a given id It assumes that all Nodes have unique IDs. This *should* be true, but further testing is required to really make this claim.
func (TrustBoundary) HasEdgeBetween ¶
HasEdgeBetween returns whether an edge exists between nodes x and y without considering direction.
func (TrustBoundary) HasEdgeFromTo ¶
HasEdgeFromTo returns whether an edge exists in the graph from u to v.
func (TrustBoundary) Node ¶
Node returns the node with the given ID if it exists in the graph, and nil otherwise.
func (*TrustBoundary) RemoveDataStore ¶
func (g *TrustBoundary) RemoveDataStore(id string)
func (TrustBoundary) RemoveEdge ¶
func (g TrustBoundary) RemoveEdge(fid, tid int64)
RemoveEdge removes the edge with the given end point IDs from the graph, leaving the terminal nodes. If the edge does not exist it is a no-op.
func (*TrustBoundary) RemoveExternalService ¶
func (g *TrustBoundary) RemoveExternalService(id string)
func (TrustBoundary) RemoveNode ¶
func (g TrustBoundary) RemoveNode(id int64)
RemoveNode removes the node with the given ID from the graph, as well as any edges attached to it. If the node is not in the graph it is a no-op.
func (*TrustBoundary) RemoveProcess ¶
func (g *TrustBoundary) RemoveProcess(id string)
func (TrustBoundary) SetDOTID ¶
func (g TrustBoundary) SetDOTID(id string)
SetDOTID sets the DOT ID of the graph.
func (TrustBoundary) SetEdge ¶
SetEdge adds e, an edge from one node to another. If the nodes do not exist, they are added and are set to the nodes of the edge otherwise. It will panic if the IDs of the e.From and e.To are equal.
func (*TrustBoundary) Subgraph ¶
func (g *TrustBoundary) Subgraph() graph.Graph
func (*TrustBoundary) UpdateName ¶
func (sg *TrustBoundary) UpdateName(new_name string)