acl

package
v1.4.4-testnet Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// pre-defined default allowlist name
	DefaultAllowList = "default"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AllowList

type AllowList struct {
	ID   uint32 // Allowlist ID
	Name string // Allowlist name

	// Any requests which query addresses that are not in the allowlist are rejected.
	ContractAddresses []string

	// The allowed methods list. If the list is empty, all methods will be accpeted.
	AllowMethods []string

	// The disallowed methods list. If the list is empty, no methods will be rejected.
	DisallowMethods []string

	// Restricted `User-Agent` request headers
	UserAgents []string

	// Restricted `Origin` request headers
	Origins []string
}

AllowList access control rule list.

func NewAllowList

func NewAllowList(id uint32, name string) *AllowList

type CfxValidator

type CfxValidator struct {
	// contains filtered or unexported fields
}

func (CfxValidator) Validate

func (v CfxValidator) Validate(ctx Context) error

type Context

type Context struct {
	context.Context

	RpcMethod        string
	ExtractRpcParams func() ([]interface{}, error)
}

validation context

type EthValidator

type EthValidator struct {
	// contains filtered or unexported fields
}

func (EthValidator) Validate

func (v EthValidator) Validate(ctx Context) error

type Validator

type Validator interface {
	Validate(ctx Context) error
}

func NewCfxValidator

func NewCfxValidator(al *AllowList) Validator

func NewEthValidator

func NewEthValidator(al *AllowList) Validator

type ValidatorFactory

type ValidatorFactory func(al *AllowList) Validator

Jump to

Keyboard shortcuts

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