firewall

package
v0.0.0-rehearsal.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 2, 2026 License: MIT Imports: 7 Imported by: 3 modules, 2 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
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

View Source
var Disabled = &noFirewall{}

Disabled is an empty Firewall implementation enforcing no rules on the connection.

View Source
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

func SetMetricsRecorder(recorder interface {
	IncrementCounter(name string, value float64)
})

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

func NewAllowList(operatorPublicKeys []*operator.PublicKey) *AllowList

NewAllowList creates a new firewall's allowlist based on the given public key list.

func (*AllowList) Contains added in v1.21.0

func (al *AllowList) Contains(operatorPublicKey *operator.PublicKey) bool

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL