Documentation
¶
Index ¶
Constants ¶
const ( // NegativeIsRecognizedCachePeriod is the time period the cache maintains // the negative result of the last `IsRecognized` checks. // We use the cache to minimize calls to the on-chain client. NegativeIsRecognizedCachePeriod = 1 * time.Hour )
Variables ¶
var Disabled = &noFirewall{}
Disabled is an empty Firewall implementation enforcing no rules on the connection.
var ErrNotRecognized = fmt.Errorf(
"remote peer has not been recognized by any application",
)
ErrNotRecognized is returned by Validate when the remote peer is not recognized by any application. It lets callers tell a genuine non-recognition apart from an application/RPC error during validation.
Functions ¶
func AnyApplicationPolicy ¶ added in v1.21.0
func AnyApplicationPolicy( applications []Application, allowList *AllowList, ) net.Firewall
func SetMetricsRecorder ¶
SetMetricsRecorder sets the metrics recorder used by firewall validation. It should be called once during startup, after metrics are initialized.
Types ¶
type AllowList ¶ added in v1.21.0
type AllowList struct {
// contains filtered or unexported fields
}
AllowList represents a list of operator public keys that are not checked against the firewall rules and are always valid peers.
func EmptyAllowList ¶ added in v1.21.0
func EmptyAllowList() *AllowList
EmptyAllowList returns the empty firewall allowlist. In production, this ensures all peers are subject to on-chain staking verification with no AllowList bypass.
func NewAllowList ¶ added in v1.21.0
NewAllowList creates a new firewall's allowlist based on the given public key list.
type Application ¶ added in v1.21.0
type Application interface {
// IsRecognized returns true if the application recognizes the operator
// as one participating in the application.
IsRecognized(operatorPublicKey *operator.PublicKey) (bool, error)
}
Application defines functionalities for operator verification in the firewall.