Properly handle link types (#47)

* Properly handle link types

* fixup! Properly handle link types
This commit is contained in:
Marvin W 2016-07-04 11:29:16 +02:00 committed by PetaByteBoy // Milan Pässler
commit 760cca6806
2 changed files with 25 additions and 14 deletions

View file

@ -126,17 +126,28 @@ function (moment, Router, L, GUI, numeral) {
})
links.forEach( function (d) {
if (d.type === "tunnel" || d.type === "fastd")
if (d.type === "tunnel") {
d.type = "VPN"
d.isVPN = true
} else if (d.type === "fastd") {
d.type = "fastd"
else if (d.type === "l2tp") {
d.isVPN = true
} else if (d.type === "l2tp") {
d.type = "L2TP"
d.target.node.flags.uplink = true
} else if (d.type === "wireless")
d.isVPN = true
} else if (d.type === "gre") {
d.type = "GRE"
d.isVPN = true
} else if (d.type === "wireless") {
d.type = "Wifi"
else if (d.type === "other")
d.isVPN = false
} else if (d.type === "other") {
d.type = "Kabel"
else
d.isVPN = false
} else {
d.type = "N/A"
d.isVPN = false
}
var unknown = (d.source.node === undefined)
if (unknown) {
d.target.node.neighbours.push({ id: d.source.id, link: d, incoming: true })
@ -144,7 +155,7 @@ function (moment, Router, L, GUI, numeral) {
}
d.source.node.neighbours.push({ node: d.target.node, link: d, incoming: false })
d.target.node.neighbours.push({ node: d.source.node, link: d, incoming: true })
if (d.type !== "fastd" && d.type !== "L2TP")
if (!d.isVPN)
d.source.node.meshlinks = d.source.node.meshlinks ? d.source.node.meshlinks + 1 : 1
})