From cffc07579df9565a2a6d509b5a43885ad3af29de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=96=E7=95=8C?= Date: Tue, 5 Dec 2023 18:01:19 +0800 Subject: [PATCH] Fix missing omitempty for NTP server fields --- ntp/service.go | 2 +- option/ntp.go | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/ntp/service.go b/ntp/service.go index 47f84dfc..70a41c0e 100644 --- a/ntp/service.go +++ b/ntp/service.go @@ -33,7 +33,7 @@ type Service struct { func NewService(ctx context.Context, router adapter.Router, logger logger.Logger, options option.NTPOptions) (*Service, error) { ctx, cancel := common.ContextWithCancelCause(ctx) - server := options.ServerOptions.Build() + server := M.ParseSocksaddrHostPort(options.Server, options.ServerPort) if server.Port == 0 { server.Port = 123 } diff --git a/option/ntp.go b/option/ntp.go index 809056dd..000a658c 100644 --- a/option/ntp.go +++ b/option/ntp.go @@ -1,9 +1,10 @@ package option type NTPOptions struct { - Enabled bool `json:"enabled"` + Enabled bool `json:"enabled,omitempty"` + Server string `json:"server,omitempty"` + ServerPort uint16 `json:"server_port,omitempty"` Interval Duration `json:"interval,omitempty"` WriteToSystem bool `json:"write_to_system,omitempty"` - ServerOptions DialerOptions }