node

package
v0.0.0-...-365054f Latest Latest
Warning

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

Go to latest
Published: May 16, 2024 License: GPL-3.0 Imports: 13 Imported by: 2

Documentation

Index

Constants

View Source
const (
	// NetworkSubDirMainnet represents mainnet subdir
	NetworkSubDirMainnet = "mainnet"

	// NetworkSubDirLocalnet represents localnet subdir
	NetworkSubDirLocalnet = "localnet"

	// NetworkSubDirTestnet represents localnet subdir
	NetworkSubDirTestnet = "testnet"
)
View Source
const (
	// DiscoveryTypeAPI defines type which discovers proposals through Mysterium API.
	DiscoveryTypeAPI = DiscoveryType("api")
	// DiscoveryTypeBroker defines type which discovers proposals through Broker (Mysterium Communication).
	DiscoveryTypeBroker = DiscoveryType("broker")
	// DiscoveryTypeDHT defines type which discovers proposals through DHT (Distributed Hash Table).
	DiscoveryTypeDHT = DiscoveryType("dht")
)
View Source
const (
	// LocationTypeManual defines type which resolves location from manually entered values
	LocationTypeManual = LocationType("manual")
	// LocationTypeBuiltin defines type which resolves location from built in DB
	LocationTypeBuiltin = LocationType("builtin")
	// LocationTypeMMDB defines type which resolves location from given MMDB file
	LocationTypeMMDB = LocationType("mmdb")
	// LocationTypeOracle defines type which resolves location from given URL of LocationOracle
	LocationTypeOracle = LocationType("oracle")
)
View Source
const (
	// QualityTypeElastic defines type which uses ElasticSearch as Quality Oracle provider
	QualityTypeElastic = QualityType("elastic")
	// QualityTypeMORQA defines type which uses Mysterium MORQA as Quality Oracle provider
	QualityTypeMORQA = QualityType("morqa")
	// QualityTypeNone defines type which disables Quality Oracle
	QualityTypeNone = QualityType("none")
)

Variables

This section is empty.

Functions

func GetLogOptions

func GetLogOptions() *logconfig.LogOptions

GetLogOptions retrieves logger options from the app configuration.

func GetOptionsDirectoryDB

func GetOptionsDirectoryDB(networkSubdir string) string

GetOptionsDirectoryDB returns a database directory given a networkSubdir.

func GetOptionsDirectoryKeystore

func GetOptionsDirectoryKeystore(dataDir string) string

GetOptionsDirectoryKeystore given a dataDir returns a path for keystore.

Types

type ActivityStats

type ActivityStats struct {
	Online float64 `json:"online_percent"`
	Active float64 `json:"active_percent"`
}

ActivityStats represent a provider activity stats

type ConsumersCount

type ConsumersCount struct {
	Count int `json:"count"`
}

ConsumersCount represent a information about number of consumers served during a period of time

type DiscoveryType

type DiscoveryType string

DiscoveryType identifies proposal discovery provider.

type EarningsPerService

type EarningsPerService struct {
	EarningsPublic        string `json:"public"`
	EarningsVPN           string `json:"data_transfer"`
	EarningsScraping      string `json:"scraping"`
	EarningsDVPN          string `json:"dvpn"`
	EarningsTotal         string `json:"total"`
	TotalEarningsPublic   string `json:"total_public"`
	TotalEarningsVPN      string `json:"total_data_transfer"`
	TotalEarningsScraping string `json:"total_scraping"`
	TotalEarningsDVPN     string `json:"total_dvpn"`
}

EarningsPerService represents information about earnings per service

type EarningsSeries

type EarningsSeries struct {
	Data []SeriesItem `json:"data"`
}

EarningsSeries represents data series metrics about earnings during a time

type LocationType

type LocationType string

LocationType identifies location type

type MonitoringAgentStatuses

type MonitoringAgentStatuses map[string]map[string]int

MonitoringAgentStatuses a object represent a [service_type][status]amount of statuses for each service type.

type Openvpn

type Openvpn interface {
	Check() error
	BinaryPath() string
}

Openvpn interface is abstraction over real openvpn options to unblock mobile development will disappear as soon as go-openvpn will unify common factory for openvpn creation

type Options

type Options struct {
	Directories OptionsDirectory

	TequilapiAddress       string
	TequilapiPort          int
	FlagTequilapiDebugMode bool
	TequilapiEnabled       bool
	TequilapiSecured       bool
	BindAddress            string
	UI                     OptionsUI
	FeedbackURL            string

	Keystore OptionsKeystore

	logconfig.LogOptions
	OptionsNetwork
	Discovery  OptionsDiscovery
	Quality    OptionsQuality
	Location   OptionsLocation
	Transactor OptionsTransactor
	Affiliator OptionsAffiliator
	Chains     OptionsChains

	Openvpn  Openvpn
	Firewall OptionsFirewall

	Payments OptionsPayments

	Consumer bool
	Mobile   bool

	SwarmDialerDNSHeadstart time.Duration
	PilvytisAddress         string
	ObserverAddress         string
	SSE                     OptionsSSE
}

Options describes options which are required to start Node

func GetOptions

func GetOptions() *Options

GetOptions retrieves node options from the app configuration.

type OptionsAffiliator

type OptionsAffiliator struct {
	AffiliatorEndpointAddress string
}

OptionsAffiliator describes possible parameters for interaction with affiliator

type OptionsChains

type OptionsChains struct {
	Chain1 metadata.ChainDefinition
	Chain2 metadata.ChainDefinition
}

OptionsChains represents the chain options.

type OptionsDHT

type OptionsDHT struct {
	Address        string
	Port           int
	Protocol       string
	BootstrapPeers []string
}

OptionsDHT describes possible parameters of DHT configuration.

func GetDHTOptions

func GetDHTOptions() *OptionsDHT

GetDHTOptions retrieves DHT options from the app configuration.

type OptionsDirectory

type OptionsDirectory struct {
	// Data directory stores persistent data like keystore, cli history, etc.
	Data string
	// Data directory stores database
	Storage string
	// Data directory stores identity keys
	Keystore string
	// Script directory stores all data needed for runtime, e.g. DNS scripts.
	Script string
	// Runtime directory for various temp file - usually current working dir
	Runtime string
	// NodeUI directory for nodeUI releases
	NodeUI string
}

OptionsDirectory describes data structure holding directories as parameters.

func GetOptionsDirectory

func GetOptionsDirectory(network *OptionsNetwork) *OptionsDirectory

GetOptionsDirectory retrieves directory configuration from app configuration.

func (*OptionsDirectory) Check

func (options *OptionsDirectory) Check() error

Check checks that configured dirs exist (which should contain info) and runtime dirs are created (if not exist)

type OptionsDiscovery

type OptionsDiscovery struct {
	Types         []DiscoveryType
	Address       string
	PingInterval  time.Duration
	FetchEnabled  bool
	FetchInterval time.Duration
	DHT           OptionsDHT
}

OptionsDiscovery describes possible parameters of discovery configuration.

func GetDiscoveryOptions

func GetDiscoveryOptions() *OptionsDiscovery

GetDiscoveryOptions retrieves discovery options from the app configuration.

type OptionsFirewall

type OptionsFirewall struct {
	BlockAlways bool
}

OptionsFirewall represent firewall control options

type OptionsKeystore

type OptionsKeystore struct {
	UseLightweight bool
}

OptionsKeystore stores the keystore configuration

type OptionsLocation

type OptionsLocation struct {
	IPDetectorURL string

	Type    LocationType
	Address string
	Country string
	City    string
	IPType  string
}

OptionsLocation describes possible parameters of location detection configuration

type OptionsNetwork

type OptionsNetwork struct {
	Network          config.BlockchainNetwork
	DiscoveryAddress string
	BrokerAddresses  []string
	EtherClientRPCL1 []string
	EtherClientRPCL2 []string
	ChainID          int64
	DNSMap           map[string][]string
}

OptionsNetwork describes possible parameters of network configuration

type OptionsPayments

type OptionsPayments struct {
	MaxAllowedPaymentPercentile    int
	BCTimeout                      time.Duration
	HermesPromiseSettlingThreshold float64
	MaxFeeSettlingThreshold        float64
	SettlementTimeout              time.Duration
	SettlementRecheckInterval      time.Duration
	ConsumerDataLeewayMegabytes    uint64
	HermesStatusRecheckInterval    time.Duration
	BalanceFastPollInterval        time.Duration
	BalanceFastPollTimeout         time.Duration
	BalanceLongPollInterval        time.Duration
	RegistryTransactorPollInterval time.Duration
	RegistryTransactorPollTimeout  time.Duration
	MinAutoSettleAmount            float64
	MaxUnSettledAmount             float64

	ProviderInvoiceFrequency      time.Duration
	ProviderLimitInvoiceFrequency time.Duration

	MaxUnpaidInvoiceValue   *big.Int
	LimitUnpaidInvoiceValue *big.Int
}

OptionsPayments controls the behaviour of payments

type OptionsQuality

type OptionsQuality struct {
	Type    QualityType
	Address string
}

OptionsQuality describes possible parameters of Quality Oracle configuration

type OptionsSSE

type OptionsSSE struct {
	Enabled bool
}

OptionsSSE represent SSE control options

type OptionsTransactor

type OptionsTransactor struct {
	TransactorEndpointAddress       string
	ProviderMaxRegistrationAttempts int
	TransactorFeesValidTime         time.Duration
	TryFreeRegistration             bool
}

OptionsTransactor describes possible parameters for interaction with transactor

type OptionsUI

type OptionsUI struct {
	UIEnabled     bool
	UIBindAddress string
	UIPort        int
}

OptionsUI describes possible parameters of ui configuration

type ProviderActivityStats

type ProviderActivityStats func(id identity.Identity) (ActivityStats, error)

ProviderActivityStats should return provider activity stats

type ProviderConsumersCount

type ProviderConsumersCount func(id identity.Identity, rangeTime string) (ConsumersCount, error)

ProviderConsumersCount should return unique consumers count

type ProviderEarningsSeries

type ProviderEarningsSeries func(id identity.Identity, rangeTime string) (EarningsSeries, error)

ProviderEarningsSeries should return earnings data series metrics

type ProviderQuality

type ProviderQuality func(id identity.Identity) (QualityInfo, error)

ProviderQuality should return provider quality

type ProviderServiceEarnings

type ProviderServiceEarnings func(id identity.Identity) (EarningsPerService, error)

ProviderServiceEarnings should return earnings by service type

type ProviderSessionsCount

type ProviderSessionsCount func(id identity.Identity, rangeTime string) (SessionsCount, error)

ProviderSessionsCount should return provider sessions count

type ProviderSessionsList

type ProviderSessionsList func(id identity.Identity, rangeTime string) ([]SessionItem, error)

ProviderSessionsList should return provider sessions list

type ProviderSessionsSeries

type ProviderSessionsSeries func(id identity.Identity, rangeTime string) (SessionsSeries, error)

ProviderSessionsSeries should return sessions data series metrics

type ProviderStatuses

type ProviderStatuses func(providerID string) (MonitoringAgentStatuses, error)

ProviderStatuses should return provider statuses from monitoring agent

type ProviderTransferredData

type ProviderTransferredData func(id identity.Identity, rangeTime string) (TransferredData, error)

ProviderTransferredData should return total traffic served by the provider during a period of time

type ProviderTransferredDataSeries

type ProviderTransferredDataSeries func(id identity.Identity, rangeTime string) (TransferredDataSeries, error)

ProviderTransferredDataSeries should return transferred bytes data series metrics

type QualityInfo

type QualityInfo struct {
	Quality float64 `json:"quality"`
}

QualityInfo represents a provider quality info.

type QualityType

type QualityType string

QualityType identifies Quality Oracle provider

type SeriesItem

type SeriesItem struct {
	Value     string `json:"value"`
	Timestamp int64  `json:"timestamp"`
}

SeriesItem represents a general data series item

type SessionItem

type SessionItem struct {
	ID              string `json:"id"`
	ConsumerCountry string `json:"consumer_country"`
	ServiceType     string `json:"service_type"`
	Duration        int64  `json:"duration"`
	StartedAt       int64  `json:"started_at"`
	Earning         string `json:"earning"`
	Transferred     int64  `json:"transferred"`
}

SessionItem represents information about session monitoring metrics.

type SessionsCount

type SessionsCount struct {
	Count int `json:"count"`
}

SessionsCount represent a information about number of sessions during a period of time

type SessionsSeries

type SessionsSeries struct {
	Data []SeriesItem `json:"data"`
}

SessionsSeries represents data series metrics about started sessions during a time

type StatsTracker

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

StatsTracker tracks metrics for service

func NewNodeStatsTracker

func NewNodeStatsTracker(
	providerStatuses ProviderStatuses,
	providerSessions ProviderSessionsList,
	providerTransferredData ProviderTransferredData,
	providerSessionsCount ProviderSessionsCount,
	providerConsumersCount ProviderConsumersCount,
	providerEarningsSeries ProviderEarningsSeries,
	providerSessionsSeries ProviderSessionsSeries,
	providerTransferredDataSeries ProviderTransferredDataSeries,
	providerActivityStats ProviderActivityStats,
	providerQuality ProviderQuality,
	providerServiceEarnings ProviderServiceEarnings,
	currentIdentity currentIdentity,
) *StatsTracker

NewNodeStatsTracker constructor

func (*StatsTracker) ConsumersCount

func (m *StatsTracker) ConsumersCount(rangeTime string) (ConsumersCount, error)

ConsumersCount retrieves and resolved numbers of consumers server during period of time

func (*StatsTracker) EarningsPerService

func (m *StatsTracker) EarningsPerService() (EarningsPerService, error)

EarningsPerService retrieves and resolved earnings per service type

func (*StatsTracker) EarningsSeries

func (m *StatsTracker) EarningsSeries(rangeTime string) (EarningsSeries, error)

EarningsSeries retrieves and resolved earnings data series metrics during a time range

func (*StatsTracker) ProviderActivityStats

func (m *StatsTracker) ProviderActivityStats() (ActivityStats, error)

ProviderActivityStats retrieves and resolved provider activity stats

func (*StatsTracker) ProviderQuality

func (m *StatsTracker) ProviderQuality() (QualityInfo, error)

ProviderQuality retrieves and resolved provider quality

func (*StatsTracker) Sessions

func (m *StatsTracker) Sessions(rangeTime string) ([]SessionItem, error)

Sessions retrieves and resolved monitoring status from quality oracle

func (*StatsTracker) SessionsCount

func (m *StatsTracker) SessionsCount(rangeTime string) (SessionsCount, error)

SessionsCount retrieves and resolved numbers of sessions

func (*StatsTracker) SessionsSeries

func (m *StatsTracker) SessionsSeries(rangeTime string) (SessionsSeries, error)

SessionsSeries retrieves and resolved sessions data series metrics during a time range

func (*StatsTracker) Statuses

func (m *StatsTracker) Statuses() (MonitoringAgentStatuses, error)

Statuses retrieves and resolved monitoring status from quality oracle

func (*StatsTracker) TransferredData

func (m *StatsTracker) TransferredData(rangeTime string) (TransferredData, error)

TransferredData retrieves and resolved total traffic served by the provider

func (*StatsTracker) TransferredDataSeries

func (m *StatsTracker) TransferredDataSeries(rangeTime string) (TransferredDataSeries, error)

TransferredDataSeries retrieves and resolved transferred bytes data series metrics during a time range

type TransferredData

type TransferredData struct {
	Bytes int `json:"transferred_data_bytes"`
}

TransferredData represent information about total traffic served by the provider during a period of time

type TransferredDataSeries

type TransferredDataSeries struct {
	Data []SeriesItem `json:"data"`
}

TransferredDataSeries represents data series metrics about transferred bytes during a time

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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