1// Copyright (C) 2019 Storj Labs, Inc. 2// See LICENSE for copying information. 3 4package trust 5 6// Rule indicates whether or not a Satellite URL is trusted. 7type Rule interface { 8 // IsTrusted returns true if the given Satellite is trusted and false otherwise 9 IsTrusted(url SatelliteURL) bool 10 11 // String returns a string representation of the rule 12 String() string 13} 14 15// Rules is a collection of rules. 16type Rules []Rule 17 18// IsTrusted returns true if the given Satellite is trusted and false otherwise. 19func (rules Rules) IsTrusted(url SatelliteURL) bool { 20 for _, rule := range rules { 21 if !rule.IsTrusted(url) { 22 return false 23 } 24 } 25 return true 26} 27