Completed get/set configuration
For debugging of "outbound flow" Mostly, a few things still missing
This commit is contained in:
parent
1f0976a26c
commit
7e185db141
6 changed files with 109 additions and 80 deletions
10
src/trie.go
10
src/trie.go
|
|
@ -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
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue