client

package
v0.33.1 Latest Latest
Warning

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

Go to latest
Published: Jul 12, 2022 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ScaleFactor = 1000000000
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ActivityPayload

type ActivityPayload struct {
	Online       int32
	Offline      int32
	BurstOnline  int32
	BurstOffline int32
	Unresolved   int32
}

ActivityPayload is the payload for activity replies (RPY_Activity) https://github.com/mlichvar/chrony/blob/7daf34675a5a2487895c74d1578241ca91a4eb70/candm.h#L685

type ChronyFloat

type ChronyFloat int32

ChronyFloat is 32-bit floating-point format consisting of 7-bit signed exponent and 25-bit signed coefficient without hidden bit. The result is calculated as: 2^(exp - 25) * coef.

func (ChronyFloat) Float64

func (cf ChronyFloat) Float64() float64

Float64 does magic to decode float from int32. https://github.com/mlichvar/chrony/blob/2ac22477563581ae3bc39c4ff28464059c0a73be/util.c#L900

func (ChronyFloat) Int64

func (cf ChronyFloat) Int64() int64

Int64 returns the 64bits float value

type ChronyTimespec

type ChronyTimespec struct {
	TvSecHigh uint32
	TvSecLow  uint32
	TvNSec    uint32
}

ChronyTimespec is the custom chrony timespec type (Timespec) https://github.com/mlichvar/chrony/blob/7daf34675a5a2487895c74d1578241ca91a4eb70/candm.h#L115

func (ChronyTimespec) Time

func (ct ChronyTimespec) Time() time.Time

type Client

type Client struct {
	*logger.Logger
	// contains filtered or unexported fields
}

func New

func New(l *logger.Logger, c Config) (*Client, error)

func (*Client) Activity

func (c *Client) Activity() (*ActivityPayload, error)

func (*Client) Close

func (c *Client) Close()

func (*Client) Ping

func (c *Client) Ping() error

func (*Client) Tracking

func (c *Client) Tracking() (*TrackingPayload, error)

type Config

type Config struct {
	Address string
	Timeout time.Duration
}

type IPAddr

type IPAddr struct {
	IPAddrHigh uint64
	IPAddrLow  uint64
	Family     uint16
	Pad        uint16
}

IPAddr represents IPAddr structure. https://github.com/mlichvar/chrony/blob/7daf34675a5a2487895c74d1578241ca91a4eb70/addressing.h#L41

func (IPAddr) IP

func (ia IPAddr) IP() net.IP

func (IPAddr) String

func (ia IPAddr) String() string

type TrackingPayload

type TrackingPayload struct {
	RefID              uint32
	Ip                 IPAddr
	Stratum            uint16
	LeapStatus         uint16
	RefTime            ChronyTimespec
	CurrentCorrection  ChronyFloat
	LastOffset         ChronyFloat
	RmsOffset          ChronyFloat
	FreqPpm            ChronyFloat
	ResidFreqPpm       ChronyFloat
	SkewPpm            ChronyFloat
	RootDelay          ChronyFloat
	RootDispersion     ChronyFloat
	LastUpdateInterval ChronyFloat
}

TrackingPayload is the payload for tracking replies (RPY_Tracking) https://github.com/mlichvar/chrony/blob/7daf34675a5a2487895c74d1578241ca91a4eb70/candm.h#L581

func (*TrackingPayload) String

func (tp *TrackingPayload) String() string

Jump to

Keyboard shortcuts

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