mirror of
https://github.com/DNSCrypt/dnscrypt-proxy.git
synced 2025-04-05 06:07:36 +03:00
Update deps
This commit is contained in:
parent
d627a4bc58
commit
d2db6b55a8
187 changed files with 15865 additions and 3125 deletions
4
vendor/github.com/k-sone/critbitgo/CHANGES.md
generated
vendored
4
vendor/github.com/k-sone/critbitgo/CHANGES.md
generated
vendored
|
@ -1,3 +1,7 @@
|
|||
## 1.3.0 (2019/09/30)
|
||||
|
||||
- Add Net.Walk [#9](https://github.com/k-sone/critbitgo/pull/9)
|
||||
|
||||
## 1.2.0 (2018/04/25)
|
||||
|
||||
- Add ContainedIP() as fast way to check an IP [#7](https://github.com/k-sone/critbitgo/pull/7)
|
||||
|
|
14
vendor/github.com/k-sone/critbitgo/net.go
generated
vendored
14
vendor/github.com/k-sone/critbitgo/net.go
generated
vendored
|
@ -189,6 +189,20 @@ func lookup(p *node, key []byte, backtracking bool) *node {
|
|||
}
|
||||
}
|
||||
|
||||
// Walk iterates routes from a given route.
|
||||
// handle is called with arguments route and value (if handle returns `false`, the iteration is aborted)
|
||||
func (n *Net) Walk(r *net.IPNet, handle func(*net.IPNet, interface{}) bool) {
|
||||
var key []byte
|
||||
if r != nil {
|
||||
if ip, _, err := netValidateIPNet(r); err == nil {
|
||||
key = netIPNetToKey(ip, r.Mask)
|
||||
}
|
||||
}
|
||||
n.trie.Walk(key, func(key []byte, value interface{}) bool {
|
||||
return handle(netKeyToIPNet(key), value)
|
||||
})
|
||||
}
|
||||
|
||||
// Deletes all routes.
|
||||
func (n *Net) Clear() {
|
||||
n.trie.Clear()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue