config

package
v0.0.61 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2025 License: GPL-3.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	RunMethod_name = map[int32]string{
		0: "RUN_METHOD_UNSPECIFIED",
		1: "RUN_METHOD_DOCKER",
		2: "RUN_METHOD_SYSTEMD",
		3: "RUN_METHOD_BINARY",
	}
	RunMethod_value = map[string]int32{
		"RUN_METHOD_UNSPECIFIED": 0,
		"RUN_METHOD_DOCKER":      1,
		"RUN_METHOD_SYSTEMD":     2,
		"RUN_METHOD_BINARY":      3,
	}
)

Enum value maps for RunMethod.

View Source
var (
	NetworkName_name = map[int32]string{
		0: "NETWORK_NAME_UNSPECIFIED",
		1: "NETWORK_NAME_MAINNET",
		2: "NETWORK_NAME_SEPOLIA",
		3: "NETWORK_NAME_HOLESKY",
		4: "NETWORK_NAME_HOODI",
	}
	NetworkName_value = map[string]int32{
		"NETWORK_NAME_UNSPECIFIED": 0,
		"NETWORK_NAME_MAINNET":     1,
		"NETWORK_NAME_SEPOLIA":     2,
		"NETWORK_NAME_HOLESKY":     3,
		"NETWORK_NAME_HOODI":       4,
	}
)

Enum value maps for NetworkName.

View Source
var File_config_v1_config_proto protoreflect.FileDescriptor

Functions

func ParseAddress

func ParseAddress(address, defaultHost, defaultPort string) (host, port string)

ParseAddress parses an address string into host and port components. If the address is empty, returns the default host and port. If only port is specified (":8080"), returns default host and the specified port.

Types

type Config

type Config struct {

	// LogLevel is the log level to use.
	LogLevel string `protobuf:"bytes,1,opt,name=log_level,json=logLevel,proto3" json:"log_level,omitempty"`
	// Version of the contributoor service running.
	Version string `protobuf:"bytes,2,opt,name=version,proto3" json:"version,omitempty"`
	// Directory where contributoor houses its configuration and related data.
	ContributoorDirectory string `protobuf:"bytes,3,opt,name=contributoor_directory,json=contributoorDirectory,proto3" json:"contributoor_directory,omitempty"`
	// RunMethod is the method used to run the contributoorservice.
	RunMethod RunMethod `protobuf:"varint,4,opt,name=run_method,json=runMethod,proto3,enum=config.v1.RunMethod" json:"run_method,omitempty"`
	// NetworkName is the name of the network the beacon node is running on.
	NetworkName string `protobuf:"bytes,5,opt,name=network_name,json=networkName,proto3" json:"network_name,omitempty"`
	// BeaconNodeAddress is the address of the beacon node.
	BeaconNodeAddress string `protobuf:"bytes,6,opt,name=beacon_node_address,json=beaconNodeAddress,proto3" json:"beacon_node_address,omitempty"`
	// MetricsAddress is the (optional) address to serve metrics on.
	MetricsAddress string `protobuf:"bytes,7,opt,name=metrics_address,json=metricsAddress,proto3" json:"metrics_address,omitempty"`
	// PprofAddress is the (optional) address to serve pprof on.
	PprofAddress string `protobuf:"bytes,8,opt,name=pprof_address,json=pprofAddress,proto3" json:"pprof_address,omitempty"`
	// OutputServer is the configuration for the output server.
	OutputServer *OutputServer `protobuf:"bytes,9,opt,name=output_server,json=outputServer,proto3" json:"output_server,omitempty"`
	// DockerNetwork is the name of the docker network to use.
	DockerNetwork string `protobuf:"bytes,10,opt,name=docker_network,json=dockerNetwork,proto3" json:"docker_network,omitempty"`
	// HealthCheckAddress is the (optional) address to serve healthcheck on.
	HealthCheckAddress string `protobuf:"bytes,11,opt,name=health_check_address,json=healthCheckAddress,proto3" json:"health_check_address,omitempty"`
	// contains filtered or unexported fields
}

Config represents the main configuration for the contributoor service.

func NewConfigFromPath

func NewConfigFromPath(path string) (*Config, error)

NewConfigFromPath loads a config from a YAML file and validates it.

func NewDefaultConfig

func NewDefaultConfig() *Config

NewDefaultConfig returns a new default config.

func (*Config) Descriptor deprecated

func (*Config) Descriptor() ([]byte, []int)

Deprecated: Use Config.ProtoReflect.Descriptor instead.

func (*Config) GetBeaconNodeAddress

func (x *Config) GetBeaconNodeAddress() string

func (*Config) GetContributoorDirectory

func (x *Config) GetContributoorDirectory() string

func (*Config) GetDockerNetwork

func (x *Config) GetDockerNetwork() string

func (*Config) GetHealthCheckAddress added in v0.0.48

func (x *Config) GetHealthCheckAddress() string

func (*Config) GetHealthCheckHostPort added in v0.0.48

func (c *Config) GetHealthCheckHostPort() (host, port string)

GetHealthCheckHostPort returns the health check host and port. If HealthCheckAddress is not set, returns empty strings.

func (*Config) GetLogLevel

func (x *Config) GetLogLevel() string

func (*Config) GetMetricsAddress

func (x *Config) GetMetricsAddress() string

func (*Config) GetMetricsHostPort

func (c *Config) GetMetricsHostPort() (host, port string)

GetMetricsHostPort returns the metrics host and port. If MetricsAddress is not set, returns default values.

func (*Config) GetNetworkName

func (x *Config) GetNetworkName() string

func (*Config) GetOutputServer

func (x *Config) GetOutputServer() *OutputServer

func (*Config) GetPprofAddress

func (x *Config) GetPprofAddress() string

func (*Config) GetPprofHostPort

func (c *Config) GetPprofHostPort() (host, port string)

GetPprofHostPort returns the pprof host and port. If PprofAddress is not set, returns empty strings.

func (*Config) GetRunMethod

func (x *Config) GetRunMethod() RunMethod

func (*Config) GetVersion

func (x *Config) GetVersion() string

func (*Config) ProtoMessage

func (*Config) ProtoMessage()

func (*Config) ProtoReflect

func (x *Config) ProtoReflect() protoreflect.Message

func (*Config) Reset

func (x *Config) Reset()

func (*Config) SetBeaconNodeAddress

func (c *Config) SetBeaconNodeAddress(address string)

SetBeaconNodeAddress sets the beacon node address.

func (*Config) SetContributoorDirectory

func (c *Config) SetContributoorDirectory(dir string)

SetContributoorDirectory sets the contributoor directory.

func (*Config) SetHealthCheckAddress added in v0.0.48

func (c *Config) SetHealthCheckAddress(address string)

SetHealthCheckAddress sets the health check address.

func (*Config) SetLogLevel

func (c *Config) SetLogLevel(level string)

SetLogLevel sets the log level.

func (*Config) SetMetricsAddress

func (c *Config) SetMetricsAddress(address string)

SetMetricsAddress sets the metrics address.

func (*Config) SetNetwork

func (c *Config) SetNetwork(network string) error

SetNetwork sets the network name.

func (*Config) SetOutputServerAddress

func (c *Config) SetOutputServerAddress(address string)

SetOutputServerAddress sets the output server address.

func (*Config) SetOutputServerCredentials

func (c *Config) SetOutputServerCredentials(creds string)

SetOutputServerCredentials sets the output server credentials.

func (*Config) SetOutputServerTLS

func (c *Config) SetOutputServerTLS(useTLS bool)

SetOutputServerTLS sets whether to use TLS for the output server.

func (*Config) String

func (x *Config) String() string

func (*Config) Validate

func (m *Config) Validate() error

Validate checks the field values on Config with the rules defined in the proto definition for this message. If any rules are violated, the first error encountered is returned, or nil if there are no violations.

func (*Config) ValidateAll

func (m *Config) ValidateAll() error

ValidateAll checks the field values on Config with the rules defined in the proto definition for this message. If any rules are violated, the result is a list of violation errors wrapped in ConfigMultiError, or nil if none found.

type ConfigMultiError

type ConfigMultiError []error

ConfigMultiError is an error wrapping multiple validation errors returned by Config.ValidateAll() if the designated constraints aren't met.

func (ConfigMultiError) AllErrors

func (m ConfigMultiError) AllErrors() []error

AllErrors returns a list of validation violation errors.

func (ConfigMultiError) Error

func (m ConfigMultiError) Error() string

Error returns a concatenation of all the error messages it wraps.

type ConfigValidationError

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

ConfigValidationError is the validation error returned by Config.Validate if the designated constraints aren't met.

func (ConfigValidationError) Cause

func (e ConfigValidationError) Cause() error

Cause function returns cause value.

func (ConfigValidationError) Error

func (e ConfigValidationError) Error() string

Error satisfies the builtin error interface

func (ConfigValidationError) ErrorName

func (e ConfigValidationError) ErrorName() string

ErrorName returns error name.

func (ConfigValidationError) Field

func (e ConfigValidationError) Field() string

Field function returns field value.

func (ConfigValidationError) Key

func (e ConfigValidationError) Key() bool

Key function returns key value.

func (ConfigValidationError) Reason

func (e ConfigValidationError) Reason() string

Reason function returns reason value.

type NetworkName

type NetworkName int32

NetworkName defines which Ethereum network the beacon node is running on.

const (
	// Invalid, should not be used.
	NetworkName_NETWORK_NAME_UNSPECIFIED NetworkName = 0
	// Ethereum mainnet.
	NetworkName_NETWORK_NAME_MAINNET NetworkName = 1
	// Sepolia testnet.
	NetworkName_NETWORK_NAME_SEPOLIA NetworkName = 2
	// Holesky testnet.
	NetworkName_NETWORK_NAME_HOLESKY NetworkName = 3
	// Hoodi testnet.
	NetworkName_NETWORK_NAME_HOODI NetworkName = 4
)

func (NetworkName) Descriptor

func (NetworkName) DisplayName

func (n NetworkName) DisplayName() string

DisplayName returns the display name of the network.

func (NetworkName) Enum

func (x NetworkName) Enum() *NetworkName

func (NetworkName) EnumDescriptor deprecated

func (NetworkName) EnumDescriptor() ([]byte, []int)

Deprecated: Use NetworkName.Descriptor instead.

func (NetworkName) Number

func (x NetworkName) Number() protoreflect.EnumNumber

func (NetworkName) String

func (x NetworkName) String() string

func (NetworkName) Type

type OutputServer

type OutputServer struct {

	// Address of the output server, eg: where the Xatu output server is running.
	Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"`
	// Optional credentials for authentication, this is a base64 encoded string in the format of "username:password".
	Credentials string `protobuf:"bytes,2,opt,name=credentials,proto3" json:"credentials,omitempty"`
	// TLS is whether to use TLS for the output server.
	Tls bool `protobuf:"varint,3,opt,name=tls,proto3" json:"tls,omitempty"`
	// contains filtered or unexported fields
}

OutputServer represents configuration for the output server.

func (*OutputServer) Descriptor deprecated

func (*OutputServer) Descriptor() ([]byte, []int)

Deprecated: Use OutputServer.ProtoReflect.Descriptor instead.

func (*OutputServer) GetAddress

func (x *OutputServer) GetAddress() string

func (*OutputServer) GetCredentials

func (x *OutputServer) GetCredentials() string

func (*OutputServer) GetTls

func (x *OutputServer) GetTls() bool

func (*OutputServer) ProtoMessage

func (*OutputServer) ProtoMessage()

func (*OutputServer) ProtoReflect

func (x *OutputServer) ProtoReflect() protoreflect.Message

func (*OutputServer) Reset

func (x *OutputServer) Reset()

func (*OutputServer) String

func (x *OutputServer) String() string

func (*OutputServer) Validate

func (m *OutputServer) Validate() error

Validate checks the field values on OutputServer with the rules defined in the proto definition for this message. If any rules are violated, the first error encountered is returned, or nil if there are no violations.

func (*OutputServer) ValidateAll

func (m *OutputServer) ValidateAll() error

ValidateAll checks the field values on OutputServer with the rules defined in the proto definition for this message. If any rules are violated, the result is a list of violation errors wrapped in OutputServerMultiError, or nil if none found.

type OutputServerMultiError

type OutputServerMultiError []error

OutputServerMultiError is an error wrapping multiple validation errors returned by OutputServer.ValidateAll() if the designated constraints aren't met.

func (OutputServerMultiError) AllErrors

func (m OutputServerMultiError) AllErrors() []error

AllErrors returns a list of validation violation errors.

func (OutputServerMultiError) Error

func (m OutputServerMultiError) Error() string

Error returns a concatenation of all the error messages it wraps.

type OutputServerValidationError

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

OutputServerValidationError is the validation error returned by OutputServer.Validate if the designated constraints aren't met.

func (OutputServerValidationError) Cause

Cause function returns cause value.

func (OutputServerValidationError) Error

Error satisfies the builtin error interface

func (OutputServerValidationError) ErrorName

func (e OutputServerValidationError) ErrorName() string

ErrorName returns error name.

func (OutputServerValidationError) Field

Field function returns field value.

func (OutputServerValidationError) Key

Key function returns key value.

func (OutputServerValidationError) Reason

Reason function returns reason value.

type RunMethod

type RunMethod int32

RunMethod defines how the service is run.

const (
	// Invalid, should not be used.
	RunMethod_RUN_METHOD_UNSPECIFIED RunMethod = 0
	// Run using docker.
	RunMethod_RUN_METHOD_DOCKER RunMethod = 1
	// Run using systemd/launchd service manager.
	RunMethod_RUN_METHOD_SYSTEMD RunMethod = 2
	// Run directly as a binary.
	RunMethod_RUN_METHOD_BINARY RunMethod = 3
)

func (RunMethod) Descriptor

func (RunMethod) Descriptor() protoreflect.EnumDescriptor

func (RunMethod) DisplayName

func (r RunMethod) DisplayName() string

DisplayName returns the display name of the run method.

func (RunMethod) Enum

func (x RunMethod) Enum() *RunMethod

func (RunMethod) EnumDescriptor deprecated

func (RunMethod) EnumDescriptor() ([]byte, []int)

Deprecated: Use RunMethod.Descriptor instead.

func (RunMethod) Number

func (x RunMethod) Number() protoreflect.EnumNumber

func (RunMethod) String

func (x RunMethod) String() string

func (RunMethod) Type

Jump to

Keyboard shortcuts

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