firewall

package
v0.0.0-...-369a1d7 Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// PositiveIsRecognizedCachePeriod is the time period the cache maintains
	// the positive result of the last `IsRecognized` checks.
	// We use the cache to minimize calls to the on-chain client.
	PositiveIsRecognizedCachePeriod = 12 * time.Hour

	// 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 EmptyAllowList = NewAllowList([]*operator.PublicKey{})

EmptyAllowList represents an empty firewall allowlist.

Functions

func AnyApplicationPolicy

func AnyApplicationPolicy(
	applications []Application,
	allowList *AllowList,
) net.Firewall

Types

type AllowList

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 NewAllowList

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

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

func (*AllowList) Contains

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

type Application

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