proxy

package
v0.0.0-...-fbce341 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2022 License: AGPL-3.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultAddress                    = ":8080"
	DefaultNetworkId                  = uint64(1)
	DefaultChainId                    = uint64(1)
	DefaultNatsUrl                    = "ns://127.0.0.1:4222"
	DefaultNatsEmbedded               = false
	DefaultNatsEmbeddedConfigPath     = ""
	DefaultBucketClientStatusFormat   = "eth_%d_%d_client_statuses"
	DefaultBucketClientProfilesFormat = "eth_%d_%d_client_profiles"
	DefaultMaxDistanceFromHead        = 3
)
View Source
const (
	ErrNatsAlreadyConnected = errors.ConstError("nats has already been connected")
)

Variables

This section is empty.

Functions

func InitRouter

func InitRouter(opts Options) error

func ListenAndServe

func ListenAndServe(ctx context.Context, options ...Option) error

func NewLatestBlockRouter

func NewLatestBlockRouter(
	conn *nats.EncodedConn,
	chain *tracking.CanonicalChain,
	profileStore natseth.ProfileStore,
	profileCache cache.Cache,
	maxDistanceFromHead int,
) natsutil.Router

Types

type LatestBlockRouter

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

func (*LatestBlockRouter) Request

func (r *LatestBlockRouter) Request(req jsonrpc.Request, resp *jsonrpc.Response, timeout time.Duration, options ...natsutil.RouteOpt) error

func (*LatestBlockRouter) RequestWithContext

func (r *LatestBlockRouter) RequestWithContext(ctx context.Context, req jsonrpc.Request, resp *jsonrpc.Response, _ ...natsutil.RouteOpt) error

type Option

type Option func(opts *Options) error

func Address

func Address(addr string) Option

func BucketClientProfilesFormat

func BucketClientProfilesFormat(bucket string) Option

func BucketClientStatusesFormat

func BucketClientStatusesFormat(bucket string) Option

func ChainId

func ChainId(chainId uint64) Option

func NatsEmbedded

func NatsEmbedded(embed bool) Option

func NatsEmbeddedConfigPath

func NatsEmbeddedConfigPath(path string) Option

func NatsUrl

func NatsUrl(url *url.URL) Option

func NetworkId

func NetworkId(networkId uint64) Option

type Options

type Options struct {
	Address string

	NetworkId uint64

	ChainId uint64

	NatsUrl string

	NatsEmbedded bool

	NatsEmbeddedUseDefaultConfig bool

	NatsEmbeddedConfigPath string

	BucketClientStatusesFormat string

	BucketClientProfilesFormat string

	MaxDistanceFromHead int
}

func GetDefaultOptions

func GetDefaultOptions() Options

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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