middleware/clientapproval : add error when using blacklist and whitelist at the same time
This commit is contained in:
parent
d5bddeac96
commit
12c9f95eb1
1 changed files with 4 additions and 0 deletions
|
@ -56,6 +56,10 @@ func NewHook(cfg Config) (middleware.Hook, error) {
|
|||
unapproved: make(map[bittorrent.ClientID]struct{}),
|
||||
}
|
||||
|
||||
if len(cfg.Whitelist) > 0 && len(cfg.Blacklist) > 0 {
|
||||
return nil, fmt.Errorf("using both whitelist and blacklist is invalid")
|
||||
}
|
||||
|
||||
for _, cidString := range cfg.Whitelist {
|
||||
cidBytes := []byte(cidString)
|
||||
if len(cidBytes) != 6 {
|
||||
|
|
Loading…
Reference in a new issue