Completed get/set configuration

For debugging of "outbound flow"
Mostly, a few things still missing
This commit is contained in:
Mathias Hall-Andersen
2017-06-29 14:39:21 +02:00
parent 1f0976a26c
commit 7e185db141
6 changed files with 109 additions and 80 deletions

View File

@@ -195,7 +195,10 @@ func (node *Trie) Count() uint {
return l + r
}
func (node *Trie) AllowedIPs(p *Peer, results []net.IPNet) {
func (node *Trie) AllowedIPs(p *Peer, results []net.IPNet) []net.IPNet {
if node == nil {
return results
}
if node.peer == p {
var mask net.IPNet
mask.Mask = net.CIDRMask(int(node.cidr), len(node.bits)*8)
@@ -213,6 +216,7 @@ func (node *Trie) AllowedIPs(p *Peer, results []net.IPNet) {
}
results = append(results, mask)
}
node.child[0].AllowedIPs(p, results)
node.child[1].AllowedIPs(p, results)
results = node.child[0].AllowedIPs(p, results)
results = node.child[1].AllowedIPs(p, results)
return results
}