monero

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2024 License: BSD-3-Clause Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const ProberAPIKey = "X-Prober-Api-Key" // HTTP header key

Variables

This section is empty.

Functions

func New

func New() *moneroRepo

func NewProber

func NewProber() *proberRepo

Initializes a new ProberRepository

NOTE: This "prober" is different with "probe" which is used to fetch a new job

func ParseNodeStatuses

func ParseNodeStatuses(statuses types.JSONText) [5]int

ParseNodeStatuses parses JSONText into [5]int Used this to parse last_check_status for templ engine

Types

type Countries

type Countries struct {
	TotalNodes int    `json:"total_nodes" db:"total_nodes"`
	CC         string `json:"cc" db:"country"` // country code
	Name       string `json:"name" db:"country_name"`
}

Countries represents list of countries

type FetchLog

type FetchLog struct {
	ID           int     `db:"id" json:"id,omitempty"`
	NodeID       int     `db:"node_id" json:"node_id"`
	ProberID     int     `db:"prober_id" json:"prober_id"`
	Status       int     `db:"is_available" json:"status"`
	Height       int     `db:"height" json:"height"`
	AdjustedTime int64   `db:"adjusted_time" json:"adjusted_time"`
	DatabaseSize int     `db:"database_size" json:"database_size"`
	Difficulty   int     `db:"difficulty" json:"difficulty"`
	EstimateFee  int     `db:"estimate_fee" json:"estimate_fee"`
	DateChecked  int64   `db:"date_checked" json:"date_checked"`
	FailedReason string  `db:"failed_reason" json:"failed_reason"`
	FetchRuntime float64 `db:"fetch_runtime" json:"fetch_runtime"`
}

type FetchLogs

type FetchLogs struct {
	TotalRows   int         `json:"total_rows"`
	TotalPages  int         `json:"total_pages"` // total pages
	RowsPerPage int         `json:"rows_per_page"`
	Items       []*FetchLog `json:"items"`
}

type NetFee

type NetFee struct {
	Nettype     string `json:"nettype" db:"nettype"`
	EstimateFee uint   `json:"estimate_fee" db:"estimate_fee"`
	NodeCount   int    `json:"node_count" db:"node_count"`
}

type Node

type Node struct {
	ID              uint           `json:"id,omitempty" db:"id"`
	Hostname        string         `json:"hostname" db:"hostname"`
	IP              string         `json:"ip" db:"ip_addr"`
	Port            uint           `json:"port" db:"port"`
	Protocol        string         `json:"protocol" db:"protocol"`
	IsTor           bool           `json:"is_tor" db:"is_tor"`
	IsI2P           bool           `json:"is_i2p" db:"is_i2p"`
	IsAvailable     bool           `json:"is_available" db:"is_available"`
	Nettype         string         `json:"nettype" db:"nettype"`
	Height          uint           `json:"height" db:"height"`
	AdjustedTime    uint           `json:"adjusted_time" db:"adjusted_time"`
	DatabaseSize    uint           `json:"database_size" db:"database_size"`
	Difficulty      uint           `json:"difficulty" db:"difficulty"`
	Version         string         `json:"version" db:"version"`
	Status          string         `json:"status,omitempty"`
	Uptime          float64        `json:"uptime" db:"uptime"`
	EstimateFee     uint           `json:"estimate_fee" db:"estimate_fee"`
	ASN             uint           `json:"asn" db:"asn"`
	ASNName         string         `json:"asn_name" db:"asn_name"`
	CountryCode     string         `json:"cc" db:"country"`
	CountryName     string         `json:"country_name" db:"country_name"`
	City            string         `json:"city" db:"city"`
	Latitude        float64        `json:"latitude" db:"lat"`
	Longitude       float64        `json:"longitude" db:"lon"`
	DateEntered     uint           `json:"date_entered,omitempty" db:"date_entered"`
	LastChecked     int64          `json:"last_checked" db:"last_checked"`
	FailedCount     uint           `json:"failed_count,omitempty" db:"failed_count"`
	LastCheckStatus types.JSONText `json:"last_check_statuses" db:"last_check_status"`
	CORSCapable     bool           `json:"cors" db:"cors_capable"`
	IPv6Only        bool           `json:"ipv6_only" db:"ipv6_only"`
	IPAddresses     string         `json:"ip_addresses" db:"ip_addresses"`
}

Node represents a single remote node

type Nodes

type Nodes struct {
	TotalRows   int     `json:"total_rows"`
	TotalPages  int     `json:"total_pages"` // total pages
	RowsPerPage int     `json:"rows_per_page"`
	Items       []*Node `json:"items"`
}

Nodes represents a list of nodes

type ProbeReport

type ProbeReport struct {
	TookTime float64 `json:"took_time"`
	Message  string  `json:"message"`
	Node     Node    `json:"node"`
}

type Prober

type Prober struct {
	ID           int64     `json:"id" db:"id"`
	Name         string    `json:"name" db:"name"`
	APIKey       uuid.UUID `json:"api_key" db:"api_key"`
	LastSubmitTS int64     `json:"last_submit_ts" db:"last_submit_ts"`
}

type QueryLogs

type QueryLogs struct {
	paging.Paging
	NodeID       int    `url:"node_id,omitempty"`       // 0 for all, >0 for specific node
	Status       int    `url:"status"`                  // -1 for all, 0 for failed, 1 for success
	FailedReason string `url:"failed_reason,omitempty"` // empty for all, non empty string will be used as search
}

type QueryNodes

type QueryNodes struct {
	paging.Paging
	Host     string `url:"host,omitempty"`
	Nettype  string `url:"nettype,omitempty"`  // Can be empty string, "any", mainnet, stagenet, testnet.
	Protocol string `url:"protocol,omitempty"` // Can be "any", tor, http, https. Default: "any"
	CC       string `url:"cc,omitempty"`       // 2 letter country code
	Status   int    `url:"status"`
	CORS     string `url:"cors,omitempty"`
}

QueryNodes represents database query parameters

type QueryProbers

type QueryProbers struct {
	Search        string
	SortBy        string
	SortDirection string
}

Jump to

Keyboard shortcuts

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