mirror of
https://github.com/sot-tech/mochi.git
synced 2026-06-11 15:33:31 -07:00
middleware/clientapproval : add error when using blacklist and whitelist at the same time
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user