Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrNoAvailableServer = errors.New("no available NTP server found")
View Source
var ErrNotReachable = errors.New("failed to reach NTP server")
Functions ¶
func SetSystemNTPServers ¶
SetSystemNTPServers 设置系统 NTP 服务器
func UpdateSystemTime ¶
func UpdateSystemTimeZone ¶
Types ¶
type NTPServiceType ¶
type NTPServiceType string
NTPServiceType 表示系统使用的 NTP 服务类型
const ( NTPServiceTimesyncd NTPServiceType = "timesyncd" // systemd-timesyncd (Debian/Ubuntu) NTPServiceChrony NTPServiceType = "chrony" // chrony (RHEL/CentOS/Rocky) NTPServiceUnknown NTPServiceType = "unknown" // 未知或不支持 )
type SystemNTPConfig ¶
type SystemNTPConfig struct {
ServiceType NTPServiceType `json:"service_type"` // 服务类型
Servers []string `json:"servers"` // NTP 服务器列表
}
SystemNTPConfig 系统 NTP 配置信息
func GetSystemNTPConfig ¶
func GetSystemNTPConfig() (*SystemNTPConfig, error)
GetSystemNTPConfig 获取系统 NTP 配置
Click to show internal directories.
Click to hide internal directories.