client

package
v0.0.0-...-769be50 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2024 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// The file that contains the authorization for the client, signed by
	// the GCA.
	AuthorizationFile = "authorization.dat"

	// The file that contains the keypair for the client, authorized by the GCA.
	ClientKeyFile = "clientKeys.dat"

	// The file that contains the public key of the GCA.
	GCAPubKeyFile = "gcaPubKey.dat"

	// GCAServerMapFile contains the list of servers that the GCA has online. It
	// will also contain banned servers.
	GCAServerMapFile = "gcaServers.dat"

	// HistoryFile contains all of the historic power readings for this solar
	// installation.
	HistoryFile = "history.dat"

	// ShortIDFile contains the ShortID of the device, which is useful for
	// compressing communications with the GCA servers.
	ShortIDFile = "shortID.dat"
)
View Source
const (

	// EnergyFile is the file used by the monitoring equipment to write the total
	// amount of energy that was measured in each timeslot.
	EnergyFile = "/opt/halki/energy_data.csv"

	// CTMultiplier is the multiplier that we use on the current
	// transformer to correctly normalize the readings from the current
	// transformer.
	EnergyMultiplier = 2000

	// UDPSleepSyncTime sets the amount of time that the system sleeps
	// between each UDP packet that gets sent. We sleep between packets
	// because the cell network can only handle at points less than 1 kbps
	// of traffic, and sending a ton of packets all at once during a sync
	// operation is all but guaranteed to get them dropped.
	UDPSleepSyncTime = time.Second
)

Variables

This section is empty.

Functions

func SerializeGCAServerMap

func SerializeGCAServerMap(gcaMap map[glow.PublicKey]GCAServer) ([]byte, error)

This is a function for creating the server map and saving it to disk.

func UntrustedDeserializeGCAServerMap

func UntrustedDeserializeGCAServerMap(data []byte) (map[glow.PublicKey]GCAServer, error)

UntrustedDeserializeGCAServerMap will deserialize an untrusted array into a GCA server map.

Types

type Client

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

The stateful object for the client.

func NewClient

func NewClient(baseDir string) (*Client, error)

NewClient will return a new client that is running smoothly.

func (*Client) Close

func (c *Client) Close() error

Currently only closes the history file and shuts down the sync thread.

type EnergyRecord

type EnergyRecord struct {
	Timeslot uint32
	Energy   uint64
}

Represents one row of data from the energy file.

type GCAServer

type GCAServer struct {
	Banned   bool
	Location string
	HttpPort uint16
	TcpPort  uint16
	UdpPort  uint16
}

The object used to store GCA servers on disk. Once a GCAServer is banned, it can never become un-banned.

Jump to

Keyboard shortcuts

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