Documentation ¶
Index ¶
- Constants
- func NewMORQATransport(morqaClient *MysteriumMORQA, lp locationProvider) *morqaTransport
- func NewNoopTransport() *noopTransport
- type ConnectCount
- type ConnectionEvent
- type Event
- type MonitoringStatus
- type MonitoringStatusResponse
- type MysteriumMORQA
- func (m *MysteriumMORQA) MonitoringStatus(providerIds []string) MonitoringStatusResponse
- func (m *MysteriumMORQA) ProposalsQuality() []ProposalQuality
- func (m *MysteriumMORQA) ProviderActivityStats(id identity.Identity) (node.ActivityStats, error)
- func (m *MysteriumMORQA) ProviderConsumersCount(id identity.Identity, rangeTime string) (node.ConsumersCount, error)
- func (m *MysteriumMORQA) ProviderEarningsSeries(id identity.Identity, rangeTime string) (node.EarningsSeries, error)
- func (m *MysteriumMORQA) ProviderQuality(id identity.Identity) (node.QualityInfo, error)
- func (m *MysteriumMORQA) ProviderServiceEarnings(id identity.Identity) (node.EarningsPerService, error)
- func (m *MysteriumMORQA) ProviderSessions(providerID string) []ProviderSession
- func (m *MysteriumMORQA) ProviderSessionsCount(id identity.Identity, rangeTime string) (node.SessionsCount, error)
- func (m *MysteriumMORQA) ProviderSessionsList(id identity.Identity, rangeTime string) ([]node.SessionItem, error)
- func (m *MysteriumMORQA) ProviderSessionsSeries(id identity.Identity, rangeTime string) (node.SessionsSeries, error)
- func (m *MysteriumMORQA) ProviderStatuses(providerID string) (node.MonitoringAgentStatuses, error)
- func (m *MysteriumMORQA) ProviderTransferredData(id identity.Identity, rangeTime string) (node.TransferredData, error)
- func (m *MysteriumMORQA) ProviderTransferredDataSeries(id identity.Identity, rangeTime string) (node.TransferredDataSeries, error)
- func (m *MysteriumMORQA) SendMetric(id string, event *metrics.Event) error
- func (m *MysteriumMORQA) Start()
- func (m *MysteriumMORQA) Stop()
- type PingEvent
- type ProposalID
- type ProposalQuality
- type ProviderSession
- type Sender
- type Transport
Constants ¶
const ( // StagePraseRequest describes connection request parse event. StagePraseRequest = "parse_request" // StageValidateRequest describes connection request validate event. StageValidateRequest = "validate_request" // StageNoProposal describes connection request event when proposal does not exists. StageNoProposal = "no_proposal" // StageGetProposal describes proposal get event for connection create. StageGetProposal = "get_proposal" // StageConnectionOK describes successful connection event. StageConnectionOK = "connection_ok" // StageConnectionCanceled describes canceled connection event. StageConnectionCanceled = "connection_canceled" // StageConnectionAlreadyExists describes already exists connection event. StageConnectionAlreadyExists = "connection_already_exists" // StageConnectionUnknownError describes unknown connection event. StageConnectionUnknownError = "connection_unknown_error" // StageRegistrationGetStatus describes getting registration status event. StageRegistrationGetStatus = "registration_get_status" // StageRegistrationUnregistered describes registration unregistered status event. StageRegistrationUnregistered = "registration_unregistered" // StageRegistrationInProgress describes registration in progress status event. StageRegistrationInProgress = "registration_in_progress" // StageRegistrationRegistered describes registration registered status event. StageRegistrationRegistered = "registration_registered" // StageRegistrationUnknown describes registration unknown status event. StageRegistrationUnknown = "registration_unknown" )
const ( // AppTopicConnectionEvents represents event bus topic for the connection events. AppTopicConnectionEvents = "connection_events" // AppTopicConsumerPingP2P represents event bus topic for consumer p2p pings to provider. AppTopicConsumerPingP2P = "consumer_ping_p2p" // AppTopicProviderPingP2P represents event bus topic for provider p2p pings to consumer. AppTopicProviderPingP2P = "provider_ping_p2p" )
Variables ¶
This section is empty.
Functions ¶
func NewMORQATransport ¶
func NewMORQATransport(morqaClient *MysteriumMORQA, lp locationProvider) *morqaTransport
NewMORQATransport creates transport allowing to send events to Mysterium Quality Oracle - MORQA.
func NewNoopTransport ¶
func NewNoopTransport() *noopTransport
NewNoopTransport creates transport which ignores requests to send metrics
Types ¶
type ConnectCount ¶
type ConnectCount struct { Success int `json:"success" example:"100" format:"int64"` Fail int `json:"fail" example:"50" format:"int64"` Timeout int `json:"timeout" example:"10" format:"int64"` }
ConnectCount represents the connection count statistics.
type ConnectionEvent ¶
type ConnectionEvent struct { ServiceType string `json:"service_type"` ProviderID string `json:"provider_id"` ConsumerID string `json:"consumer_id"` HermesID string `json:"hermes_id"` Error string `json:"error"` Stage string `json:"stage"` }
ConnectionEvent represents the connection stages events.
type Event ¶
type Event struct { Application appInfo `json:"application"` EventName string `json:"eventName"` CreatedAt int64 `json:"createdAt"` Context interface{} `json:"context"` }
Event contains data about event, which is sent using transport
type MonitoringStatus ¶
type MonitoringStatus struct {
MonitoringStatus string `json:"monitoring_status"`
}
MonitoringStatus identity's monitoring status
type MonitoringStatusResponse ¶
type MonitoringStatusResponse = map[string]MonitoringStatus
MonitoringStatusResponse monitoring status API response
type MysteriumMORQA ¶
type MysteriumMORQA struct {
// contains filtered or unexported fields
}
MysteriumMORQA HTTP client for Mysterium Quality Oracle - MORQA.
func NewMorqaClient ¶
func NewMorqaClient(httpClient *requests.HTTPClient, baseURL string, signer identity.SignerFactory) *MysteriumMORQA
NewMorqaClient creates Mysterium Morqa client with a real communication.
func (*MysteriumMORQA) MonitoringStatus ¶
func (m *MysteriumMORQA) MonitoringStatus(providerIds []string) MonitoringStatusResponse
MonitoringStatus retrieve monitoring statuses.
func (*MysteriumMORQA) ProposalsQuality ¶
func (m *MysteriumMORQA) ProposalsQuality() []ProposalQuality
ProposalsQuality returns a list of proposals with a quality parameters.
func (*MysteriumMORQA) ProviderActivityStats ¶
func (m *MysteriumMORQA) ProviderActivityStats(id identity.Identity) (node.ActivityStats, error)
ProviderActivityStats fetch provider activity stats from quality oracle.
func (*MysteriumMORQA) ProviderConsumersCount ¶
func (m *MysteriumMORQA) ProviderConsumersCount(id identity.Identity, rangeTime string) (node.ConsumersCount, error)
ProviderConsumersCount fetch consumers number served by provider from quality oracle.
func (*MysteriumMORQA) ProviderEarningsSeries ¶
func (m *MysteriumMORQA) ProviderEarningsSeries(id identity.Identity, rangeTime string) (node.EarningsSeries, error)
ProviderEarningsSeries fetch earnings data series metrics from quality oracle.
func (*MysteriumMORQA) ProviderQuality ¶
func (m *MysteriumMORQA) ProviderQuality(id identity.Identity) (node.QualityInfo, error)
ProviderQuality fetch provider quality from quality oracle.
func (*MysteriumMORQA) ProviderServiceEarnings ¶
func (m *MysteriumMORQA) ProviderServiceEarnings(id identity.Identity) (node.EarningsPerService, error)
ProviderServiceEarnings fetch earnings per service type.
func (*MysteriumMORQA) ProviderSessions ¶
func (m *MysteriumMORQA) ProviderSessions(providerID string) []ProviderSession
ProviderSessions fetch provider sessions from prometheus
func (*MysteriumMORQA) ProviderSessionsCount ¶
func (m *MysteriumMORQA) ProviderSessionsCount(id identity.Identity, rangeTime string) (node.SessionsCount, error)
ProviderSessionsCount fetch provider sessions number from quality oracle.
func (*MysteriumMORQA) ProviderSessionsList ¶
func (m *MysteriumMORQA) ProviderSessionsList(id identity.Identity, rangeTime string) ([]node.SessionItem, error)
ProviderSessionsList fetch provider sessions list from quality oracle.
func (*MysteriumMORQA) ProviderSessionsSeries ¶
func (m *MysteriumMORQA) ProviderSessionsSeries(id identity.Identity, rangeTime string) (node.SessionsSeries, error)
ProviderSessionsSeries fetch earnings data series metrics from quality oracle.
func (*MysteriumMORQA) ProviderStatuses ¶
func (m *MysteriumMORQA) ProviderStatuses(providerID string) (node.MonitoringAgentStatuses, error)
ProviderStatuses fetch provider connectivity statuses from quality oracle.
func (*MysteriumMORQA) ProviderTransferredData ¶
func (m *MysteriumMORQA) ProviderTransferredData(id identity.Identity, rangeTime string) (node.TransferredData, error)
ProviderTransferredData fetch total traffic served by the provider during a period of time from quality oracle.
func (*MysteriumMORQA) ProviderTransferredDataSeries ¶
func (m *MysteriumMORQA) ProviderTransferredDataSeries(id identity.Identity, rangeTime string) (node.TransferredDataSeries, error)
ProviderTransferredDataSeries fetch transferred bytes data series metrics from quality oracle.
func (*MysteriumMORQA) SendMetric ¶
func (m *MysteriumMORQA) SendMetric(id string, event *metrics.Event) error
SendMetric submits new metric.
func (*MysteriumMORQA) Start ¶
func (m *MysteriumMORQA) Start()
Start starts sending batch metrics to the Morqa server.
func (*MysteriumMORQA) Stop ¶
func (m *MysteriumMORQA) Stop()
Stop sends the final metrics to the MORQA and stops the sending process.
type PingEvent ¶
type PingEvent struct { SessionID string `json:"session_id"` Duration time.Duration `json:"duration"` }
PingEvent represents p2p ping keepalive events.
type ProposalID ¶
type ProposalID struct { ProviderID string `json:"providerId" example:"0x286f0e9eb943eca95646bf4933698856579b096e"` ServiceType string `json:"serviceType" example:"openvpn"` }
ProposalID represents the struct used to uniquely identify proposals.
type ProposalQuality ¶
type ProposalQuality struct { ProposalID ProposalID `json:"proposalId"` Quality float64 `json:"quality"` MonitoringFailed bool `json:"monitoringFailed"` }
ProposalQuality represents a proposal with quality info.
type ProviderSession ¶
type ProviderSession struct { ProposalID ProposalID `json:"proposalId"` ConnectCount ConnectCount `json:"connectCount"` MonitoringFailed bool `json:"monitoringFailed"` }
ProviderSession represents a provider session
type Sender ¶
type Sender struct { Transport Transport AppVersion string // contains filtered or unexported fields }
Sender builds events and sends them using given transport
func (*Sender) SendNATMappingFailEvent ¶
SendNATMappingFailEvent sends event about failed NAT mapping
func (*Sender) SendNATMappingSuccessEvent ¶
SendNATMappingSuccessEvent sends event about successful NAT mapping
type Transport ¶
Transport allows sending events
func NewElasticSearchTransport ¶
func NewElasticSearchTransport(httpClient *requests.HTTPClient, url string, timeout time.Duration) Transport
NewElasticSearchTransport creates transport allowing to send events to ElasticSearch through HTTP