usage

package
v0.0.0-...-9823ec8 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2021 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HashBits         = 20
	SaltChars        = 40
	DefaultExtension = ""
)

Variables

This section is empty.

Functions

This section is empty.

Types

type HTTPClient

type HTTPClient interface {
	Send(context.Context, string, interface{}, interface{}) error
}

type Minter

type Minter interface {
	Mint(string) (string, error)
}

type ReportReply

type ReportReply struct {
	Status  int    `json:"status"`
	Message string `json:"message,omitempty"`
}

type ReportRequest

type ReportRequest struct {
	Token string    `json:"token"`
	Pow   string    `json:"pow"`
	Data  UsageData `json:"data"`
}

type Reporter

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

func New

func New(url, clusterID, serverID, Version string) (*Reporter, error)

func (*Reporter) Report

func (r *Reporter) Report(ctx context.Context)

func (*Reporter) SingleReport

func (r *Reporter) SingleReport(ctx context.Context) error

type SessionReply

type SessionReply struct {
	Token string `json:"token"`
}

type SessionRequest

type SessionRequest struct {
	ClusterID string `json:"cluster_id"`
	ServerID  string `json:"server_id"`
}

type UsageClient

type UsageClient interface {
	NewSession(context.Context, *SessionRequest) (*SessionReply, error)
	SendReport(context.Context, *ReportRequest) (*ReportReply, error)
}

type UsageData

type UsageData struct {
	Version   string `json:"version"`
	Arch      string `json:"arch"`
	OS        string `json:"os"`
	ClusterID string `json:"cluster_id"`
	ServerID  string `json:"server_id"`
	Uptime    int64  `json:"uptime"`
	Time      int64  `json:"time"`
}

func (*UsageData) Expired

func (u *UsageData) Expired() bool

func (*UsageData) Hash

func (u *UsageData) Hash() (string, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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