source

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2025 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package source provides transaction source implementations for the bridge.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNodeRecordsRequired is returned when nodeRecords is empty for p2p mode
	ErrNodeRecordsRequired = errors.New("nodeRecords is required for p2p mode")
	// ErrRPCEndpointsRequired is returned when rpcEndpoints is empty for rpc mode
	ErrRPCEndpointsRequired = errors.New("rpcEndpoints is required for rpc mode")
	// ErrInvalidPollingInterval is returned when pollingInterval is too short
	ErrInvalidPollingInterval = errors.New("pollingInterval must be at least 1 second for HTTP endpoints")
	// ErrUnsupportedProtocol is returned when an RPC endpoint uses an unsupported protocol
	ErrUnsupportedProtocol = errors.New("rpc endpoint must use a supported protocol (ws://, wss://, http://, https://)")
	// ErrUnknownMode is returned when an unknown mode is specified
	ErrUnknownMode = errors.New("unknown mode")
)

Functions

This section is empty.

Types

type Config

type Config struct {
	RetryInterval      time.Duration           `yaml:"retryInterval" default:"60s"`
	NodeRecords        []string                `yaml:"nodeRecords"`
	RPCEndpoints       []string                `yaml:"rpcEndpoints"`
	PollingInterval    time.Duration           `yaml:"pollingInterval" default:"10s"`
	TransactionFilters TransactionFilterConfig `yaml:"transactionFilters"`
}

Config holds the source configuration.

func (*Config) Validate

func (c *Config) Validate(mode any) error

Validate validates the source configuration.

type Metrics

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

Metrics provides Prometheus metrics for source operations.

func NewMetrics

func NewMetrics(namespace string) *Metrics

NewMetrics creates a new Metrics instance.

func NewMetricsWithRegisterer added in v0.2.0

func NewMetricsWithRegisterer(namespace string, registerer prometheus.Registerer) *Metrics

NewMetricsWithRegisterer creates a new Metrics instance with a custom registerer. Pass nil to skip metrics registration (useful for tests).

func (*Metrics) IncNewTxHashesCount added in v0.1.0

func (m *Metrics) IncNewTxHashesCount(txType byte)

IncNewTxHashesCount increments the new transaction hashes counter.

func (*Metrics) IncReceivedTxCount added in v0.1.0

func (m *Metrics) IncReceivedTxCount(txType byte)

IncReceivedTxCount increments the received transaction counter.

func (*Metrics) SetPeers

func (m *Metrics) SetPeers(count int, status string)

SetPeers sets the peer count metric.

type TransactionFilterConfig

type TransactionFilterConfig struct {
	To   []string `yaml:"to"`
	From []string `yaml:"from"`
}

TransactionFilterConfig defines transaction filtering rules.

Directories

Path Synopsis
Package cache provides caching mechanisms for transaction deduplication and tracking.
Package cache provides caching mechanisms for transaction deduplication and tracking.
Package p2p provides P2P-based transaction source functionality.
Package p2p provides P2P-based transaction source functionality.
Package rpc provides RPC-based transaction source functionality.
Package rpc provides RPC-based transaction source functionality.

Jump to

Keyboard shortcuts

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