mirror of
https://github.com/bettercap/bettercap
synced 2025-08-20 13:33:21 -07:00
misc: moved graph module to experimental branch for now
This commit is contained in:
parent
4dac3b9373
commit
f2b6d9b708
16 changed files with 0 additions and 1751 deletions
|
@ -1,42 +0,0 @@
|
|||
package graph
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/bettercap/bettercap/session"
|
||||
"time"
|
||||
)
|
||||
|
||||
type EdgeType string
|
||||
|
||||
const (
|
||||
Is EdgeType = "is"
|
||||
ProbesFor EdgeType = "probes_for"
|
||||
ProbedBy EdgeType = "probed_by"
|
||||
ConnectsTo EdgeType = "connects_to"
|
||||
Manages EdgeType = "manages"
|
||||
)
|
||||
|
||||
type EdgeEvent struct {
|
||||
Left *Node
|
||||
Edge *Edge
|
||||
Right *Node
|
||||
}
|
||||
|
||||
type Edge struct {
|
||||
Type EdgeType `json:"type"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
Position *session.GPS `json:"position,omitempty"`
|
||||
}
|
||||
|
||||
func (e Edge) Dot(left, right *Node, width float64) string {
|
||||
edgeLen := 1.0
|
||||
if e.Type == Is {
|
||||
edgeLen = 0.3
|
||||
}
|
||||
return fmt.Sprintf("\"%s\" -> \"%s\" [label=\"%s\", len=%.2f, penwidth=%.2f];",
|
||||
left.String(),
|
||||
right.String(),
|
||||
e.Type,
|
||||
edgeLen,
|
||||
width)
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue