Documentation ¶
Index ¶
- func DisableLog()
- func NewTaker(store DataStore, cfg config.NetworkSnapshotOptions) *taker
- func Snapshotinterval() int
- func UseLogger(logger slog.Logger)
- type CountryInfo
- type DataStore
- type Heartbeat
- type IPInfo
- type Manager
- type NetworkPeer
- type Node
- type NodeCount
- type SnapShot
- type UserAgentInfo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DisableLog ¶
func DisableLog()
DisableLog disables all library log output. Logging output is disabled by default until UseLogger is called.
func NewTaker ¶
func NewTaker(store DataStore, cfg config.NetworkSnapshotOptions) *taker
func Snapshotinterval ¶
func Snapshotinterval() int
Types ¶
type CountryInfo ¶
type DataStore ¶
type DataStore interface { LastSnapshotTime(ctx context.Context) (timestamp int64) DeleteSnapshot(ctx context.Context, timestamp int64) SaveSnapshot(ctx context.Context, snapShot SnapShot) error SaveHeartbeat(ctx context.Context, peer Heartbeat) error AttemptPeer(ctx context.Context, address string, now int64) error RecordNodeConnectionFailure(ctx context.Context, address string, maxAllowedFailure int) error SaveNode(ctx context.Context, peer NetworkPeer) error UpdateNode(ctx context.Context, peer NetworkPeer) error GetAvailableNodes(ctx context.Context) ([]net.IP, error) LastSnapshot(ctx context.Context) (*SnapShot, error) GetIPLocation(ctx context.Context, ip string) (string, int, error) NodeExists(ctx context.Context, address string) (bool, error) }
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
func (*Manager) AddAddresses ¶
type NetworkPeer ¶
type NetworkPeer struct { Timestamp int64 `json:"timestamp"` Address string `json:"address"` UserAgent string `json:"user_agent"` StartingHeight int64 `json:"starting_height"` CurrentHeight int64 `json:"current_height"` ConnectionTime int64 `json:"connection_time"` ProtocolVersion uint32 `json:"protocol_version"` LastSeen int64 `json:"last_seen"` LastSuccess int64 `json:"last_success"` IsDead bool `json:"is_dead"` Latency int `json:"latency"` Reachable bool `json:"reachable"` IPVersion int `json:"ip_version"` Services string `json:"services"` LastAttempt int64 `json:"last_attempt"` IPInfo }
type SnapShot ¶
type SnapShot struct { Timestamp int64 `json:"timestamp"` Height int64 `json:"height"` NodeCount int `json:"node_count"` ReachableNodeCount int `json:"reachable_node_count"` OldestNode string `json:"oldest_node"` OldestNodeTimestamp int64 `json:"oldest_node_timestamp"` Latency int `json:"latency"` }
type UserAgentInfo ¶
Click to show internal directories.
Click to hide internal directories.