forcegraph, main: l2tp support
This commit is contained in:
parent
2a78af4208
commit
2f28c51da1
|
@ -214,7 +214,7 @@ define(["d3"], function (d3) {
|
|||
|
||||
function drawLabel(d) {
|
||||
var neighbours = d.neighbours.filter(function (d) {
|
||||
return d.link.o.type !== "VPN"
|
||||
return d.link.o.type !== "fastd" && d.link.o.type !== "L2TP"
|
||||
})
|
||||
|
||||
var sum = neighbours.reduce(function (a, b) {
|
||||
|
@ -332,8 +332,8 @@ define(["d3"], function (d3) {
|
|||
ctx.moveTo(d.source.x + dx * nodeRadius, d.source.y + dy * nodeRadius)
|
||||
ctx.lineTo(d.target.x - dx * nodeRadius, d.target.y - dy * nodeRadius)
|
||||
ctx.strokeStyle = d.o.type === "Kabel" ? cableColor : d.color
|
||||
ctx.globalAlpha = d.o.type === "VPN" ? 0.1 : 0.8
|
||||
ctx.lineWidth = d.o.type === "VPN" ? 1.5 : 2.5
|
||||
ctx.globalAlpha = d.o.type === "fastd" || d.o.type === "L2TP" ? 0.1 : 0.8
|
||||
ctx.lineWidth = d.o.type === "fastd" || d.o.type === "L2TP" ? 1.5 : 2.5
|
||||
ctx.stroke()
|
||||
})
|
||||
|
||||
|
@ -523,7 +523,7 @@ define(["d3"], function (d3) {
|
|||
}
|
||||
|
||||
var links = intLinks.filter(function (d) {
|
||||
return d.o.type !== "VPN"
|
||||
return d.o.type !== "fastd" && d.o.type !== "L2TP"
|
||||
}).filter(function (d) {
|
||||
return distanceLink(e, d.source, d.target) < LINE_RADIUS
|
||||
})
|
||||
|
@ -584,13 +584,13 @@ define(["d3"], function (d3) {
|
|||
.charge(-250)
|
||||
.gravity(0.1)
|
||||
.linkDistance(function (d) {
|
||||
if (d.o.type === "VPN")
|
||||
if (d.o.type === "fastd" || d.o.type === "L2TP")
|
||||
return 0
|
||||
else
|
||||
return LINK_DISTANCE
|
||||
})
|
||||
.linkStrength(function (d) {
|
||||
if (d.o.type === "VPN")
|
||||
if (d.o.type === "fastd" || d.o.type === "L2TP")
|
||||
return 0
|
||||
else
|
||||
return Math.max(0.5, 1 / d.o.tq)
|
||||
|
@ -644,7 +644,7 @@ define(["d3"], function (d3) {
|
|||
e.source = newNodesDict[d.source.id]
|
||||
e.target = newNodesDict[d.target.id]
|
||||
|
||||
if (d.type === "VPN")
|
||||
if (d.type === "fastd" || d.type === "L2TP")
|
||||
e.color = "rgba(255, 255, 255, " + (0.6 / d.tq) + ")"
|
||||
else
|
||||
e.color = linkScale(d.tq).hex()
|
||||
|
|
12
lib/main.js
12
lib/main.js
|
@ -113,9 +113,13 @@ function (moment, Router, L, GUI, numeral) {
|
|||
})
|
||||
|
||||
links.forEach( function (d) {
|
||||
if (d.type === "tunnel")
|
||||
d.type = "VPN"
|
||||
else if (d.type === "wireless")
|
||||
console.log(d)
|
||||
if (d.type === "tunnel" || d.type === "fastd")
|
||||
d.type = "fastd"
|
||||
else if (d.type === "l2tp") {
|
||||
d.type = "L2TP"
|
||||
d.target.node.flags.uplink = true
|
||||
} else if (d.type === "wireless")
|
||||
d.type = "Wifi"
|
||||
else if (d.type === "other")
|
||||
d.type = "Kabel"
|
||||
|
@ -128,7 +132,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 !== "VPN")
|
||||
if (d.type !== "fastd" && d.type !== "L2TP")
|
||||
d.source.node.meshlinks = d.source.node.meshlinks ? d.source.node.meshlinks + 1 : 1
|
||||
})
|
||||
|
||||
|
|
Loading…
Reference in a new issue