mirror of
https://github.com/cwinfo/yggdrasil-go.git
synced 2024-11-22 14:10:28 +00:00
Highlight own node on dot graph
This commit is contained in:
parent
87a4af7841
commit
36f9cc5041
@ -54,10 +54,10 @@ func (a *admin) handleRequest(conn net.Conn) {
|
|||||||
|
|
||||||
// Add my own entry
|
// Add my own entry
|
||||||
peerID := address_addrForNodeID(getNodeID(&peers[0].box))
|
peerID := address_addrForNodeID(getNodeID(&peers[0].box))
|
||||||
addr := net.IP(peerID[:]).String()
|
myAddr := net.IP(peerID[:]).String()
|
||||||
var index [mDepth]switchPort
|
var index [mDepth]switchPort
|
||||||
copy(index[:mDepth], table.self.coords[:])
|
copy(index[:mDepth], table.self.coords[:])
|
||||||
m[index] = addr
|
m[index] = myAddr
|
||||||
|
|
||||||
// Connect switch table entries to peer entries
|
// Connect switch table entries to peer entries
|
||||||
for _, tableentry := range table.elems {
|
for _, tableentry := range table.elems {
|
||||||
@ -157,7 +157,11 @@ func (a *admin) handleRequest(conn net.Conn) {
|
|||||||
conn.Write([]byte(fmt.Sprintf("digraph {\n")))
|
conn.Write([]byte(fmt.Sprintf("digraph {\n")))
|
||||||
// First set the labels
|
// First set the labels
|
||||||
for _, info := range infos {
|
for _, info := range infos {
|
||||||
conn.Write([]byte(fmt.Sprintf("\"%v\" [ label = \"%v\" ];\n", info.key, info.name)))
|
if info.name == myAddr {
|
||||||
|
conn.Write([]byte(fmt.Sprintf("\"%v\" [ style = \"filled\", label = \"%v\" ];\n", info.key, info.name)))
|
||||||
|
} else {
|
||||||
|
conn.Write([]byte(fmt.Sprintf("\"%v\" [ label = \"%v\" ];\n", info.key, info.name)))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// Then print the tree structure
|
// Then print the tree structure
|
||||||
for _, info := range infos {
|
for _, info := range infos {
|
||||||
|
Loading…
Reference in New Issue
Block a user