github.com/ipni/storetheindex@v0.8.30/assigner/config/policy.go (about) 1 package config 2 3 // Policy configures which peers are allowed and which are blocked. Announce 4 // messages are accepted from allowed peers and the publisher assigned to an 5 // indexer. Announce messagees from blocked peers are ignored. 6 type Policy struct { 7 // Allow is either false or true, and determines whether a peer is allowed 8 // (true) or is blocked (false), by default. 9 Allow bool 10 // Except is a list of peer IDs that are exceptions to the Allow policy. 11 // If Allow is true, then all peers are allowed except those listed in 12 // Except. If Allow is false, then no peers are allowed except those listed 13 // in Except. in other words, Allow=true means that Except is a deny-list 14 // and Allow=false means that Except is an allow-list. 15 Except []string 16 } 17 18 // NewPolicy returns Policy with values set to their defaults. 19 func NewPolicy() Policy { 20 return Policy{ 21 Allow: true, 22 } 23 }