storj/storagenode/trust/rule.go
Andrew Harding 715d97e3d8 storagenode/trust: rule and excluders
Change-Id: I84ed542e1ef3cfaa5cc3d3f631cdc295393bf978
2019-12-10 21:08:12 +00:00

27 lines
651 B
Go

// Copyright (C) 2019 Storj Labs, Inc.
// See LICENSE for copying information.
package trust
// Rule indicates whether or not a Satellite URL is trusted
type Rule interface {
// IsTrusted returns true if the given Satellite is trusted and false otherwise
IsTrusted(url SatelliteURL) bool
// String returns a string representation of the rule
String() string
}
// Rules is a collection of rules
type Rules []Rule
// IsTrusted returns true if the given Satellite is trusted and false otherwise
func (rules Rules) IsTrusted(url SatelliteURL) bool {
for _, rule := range rules {
if !rule.IsTrusted(url) {
return false
}
}
return true
}