11 Star 46 Fork 0

Gitee 极速下载 / consul

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
此仓库是为了提升国内下载速度的镜像仓库,每日同步一次。 原始仓库: https://github.com/hashicorp/consul
克隆/下载
blacklist.go 652 Bytes
一键复制 编辑 原始数据 按行查看 历史
package agent
import (
"github.com/armon/go-radix"
)
// Blacklist implements an HTTP endpoint blacklist based on a list of endpoint
// prefixes which should be blocked.
type Blacklist struct {
tree *radix.Tree
}
// NewBlacklist returns a blacklist for the given list of prefixes.
func NewBlacklist(prefixes []string) *Blacklist {
tree := radix.New()
for _, prefix := range prefixes {
tree.Insert(prefix, nil)
}
return &Blacklist{tree}
}
// Block will return true if the given path is included among any of the
// blocked prefixes.
func (b *Blacklist) Block(path string) bool {
_, _, blocked := b.tree.LongestPrefix(path)
return blocked
}
1
https://gitee.com/mirrors/consul.git
git@gitee.com:mirrors/consul.git
mirrors
consul
consul
v1.4.5

搜索帮助