rpc

package
v1.26.0 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EvaluateCleartextRPC added in v1.24.0

func EvaluateCleartextRPC(rpcURL string, opts CleartextPolicyOptions) (warnMsg string, blockErr error)

EvaluateCleartextRPC blocks non-localhost HTTP RPC URLs unless explicitly opted in. Returns a warning when cleartext use is allowed via --allow-insecure-rpc.

func IsLoopbackHost added in v1.24.0

func IsLoopbackHost(host string) bool

IsLoopbackHost reports whether host is a local loopback address (localhost, 127.0.0.1, ::1).

func IsValidURL

func IsValidURL(rpcURL string) error

IsValidURL checks that rpcURL has an http or https scheme and a non-empty host.

func QueryEthChainID

func QueryEthChainID(rpcURL string) (uint64, error)

QueryEthChainID dials rpcURL and returns the chain ID from eth_chainId.

func RedactURL added in v1.24.0

func RedactURL(rawURL string) string

RedactURL returns a version of the URL with credentials masked to avoid leaking secrets that may have been resolved from environment variables.

func ValidateMatchesSelector

func ValidateMatchesSelector(rpcURL string, expectedSelector uint64) error

ValidateMatchesSelector verifies the RPC's eth_chainId matches expectedSelector.

Types

type CleartextPolicyOptions added in v1.24.0

type CleartextPolicyOptions struct {
	AllowInsecure bool
}

CleartextPolicyOptions controls cleartext RPC policy evaluation.

Jump to

Keyboard shortcuts

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