Skip to content

Commit

Permalink
Fix missing omitempty for NTP server fields
Browse files Browse the repository at this point in the history
  • Loading branch information
nekohasekai committed Dec 5, 2023
1 parent 0ef2686 commit cffc075
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion ntp/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
5 changes: 3 additions & 2 deletions option/ntp.go
Original file line number Diff line number Diff line change
@@ -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
}

0 comments on commit cffc075

Please sign in to comment.