MCPcopy
hub / github.com/bettercap/bettercap / CreateNode

Method CreateNode

modules/graph/graph.go:343–362  ·  view source on GitHub ↗
(t NodeType, id string, entity interface{}, annotations string)

Source from the content-addressed store, hash-verified

341}
342
343func (g *Graph) CreateNode(t NodeType, id string, entity interface{}, annotations string) (*Node, error) {
344 g.Lock()
345 defer g.Unlock()
346
347 node := &Node{
348 Type: t,
349 ID: id,
350 Entity: entity,
351 Annotations: annotations,
352 }
353
354 nodeFileName := path.Join(g.path, fmt.Sprintf("%s.json", node.String()))
355 if err := CreateNode(nodeFileName, node); err != nil {
356 return nil, err
357 }
358
359 session.I.Events.Add("graph.node.new", node)
360
361 return node, nil
362}
363
364func (g *Graph) UpdateNode(node *Node) error {
365 g.Lock()

Callers 6

ConfigureMethod · 0.80
createIPGraphMethod · 0.80
createDot11ApGraphMethod · 0.80
createDot11SSIDGraphMethod · 0.80
createDot11StaGraphMethod · 0.80
createBLEServerGraphMethod · 0.80

Calls 5

StringMethod · 0.95
CreateNodeFunction · 0.85
LockMethod · 0.80
UnlockMethod · 0.80
AddMethod · 0.45

Tested by

no test coverage detected