Documentation
¶
Overview ¶
Package ntp provides NTP server management via chrony.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
Servers []string `json:"servers"`
}
Config represents an NTP server configuration to deploy.
type CreateResult ¶
CreateResult represents the outcome of an NTP config create operation.
type Darwin ¶
type Darwin struct{}
Darwin implements the Provider interface for Darwin (macOS). All methods return ErrUnsupported as chrony NTP management is not available on macOS.
func NewDarwinProvider ¶
func NewDarwinProvider() *Darwin
NewDarwinProvider factory to create a new Darwin instance.
func (*Darwin) Delete ¶
func (d *Darwin) Delete( _ context.Context, ) (*DeleteResult, error)
Delete returns ErrUnsupported on Darwin.
type Debian ¶
type Debian struct {
provider.FactsAware
// contains filtered or unexported fields
}
Debian implements the Provider interface for Debian-family systems using chrony for NTP management.
func NewDebianProvider ¶
NewDebianProvider factory to create a new Debian instance.
func (*Debian) Create ¶
Create deploys a managed NTP server configuration via a chrony drop-in file. Idempotent: returns Changed: false if already managed.
func (*Debian) Delete ¶
func (d *Debian) Delete( _ context.Context, ) (*DeleteResult, error)
Delete removes the managed NTP server configuration. Fails if the config file does not exist.
type DeleteResult ¶
DeleteResult represents the outcome of an NTP config delete operation.
type Linux ¶
type Linux struct{}
Linux implements the Provider interface for generic Linux. All methods return ErrUnsupported as this is a generic Linux stub.
func NewLinuxProvider ¶
func NewLinuxProvider() *Linux
NewLinuxProvider factory to create a new Linux instance.
func (*Linux) Delete ¶
func (l *Linux) Delete( _ context.Context, ) (*DeleteResult, error)
Delete returns ErrUnsupported on generic Linux.
type Provider ¶
type Provider interface {
// Get returns current NTP sync status and configured servers.
Get(ctx context.Context) (*Status, error)
// Create deploys a managed NTP server configuration. Idempotent: returns Changed: false if already managed.
Create(ctx context.Context, config Config) (*CreateResult, error)
// Update replaces the managed NTP server configuration. Fails if not managed.
Update(ctx context.Context, config Config) (*UpdateResult, error)
// Delete removes the managed NTP server configuration.
Delete(ctx context.Context) (*DeleteResult, error)
}
Provider implements the methods to manage NTP configuration.
type Status ¶
type Status struct {
Synchronized bool `json:"synchronized"`
Stratum int `json:"stratum,omitempty"`
Offset string `json:"offset,omitempty"`
CurrentSource string `json:"current_source,omitempty"`
Servers []string `json:"servers,omitempty"`
}
Status represents the current NTP sync state and configured servers.
type UpdateResult ¶
UpdateResult represents the outcome of an NTP config update operation.