all: specify explicit JSON format for time.Duration (#17307)

The default representation of time.Duration has different
JSON representation between v1 and v2.

Apply an explicit format flag that uses the v1 representation
so that this behavior does not change if serialized with v2.

Updates tailscale/corp#791

Signed-off-by: Joe Tsai <joetsai@digital-static.net>
pull/17395/merge
Joe Tsai 2 months ago committed by GitHub
parent 8e98ecb5f7
commit a2dc517d7d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -24,7 +24,7 @@ const (
// conduct the test. // conduct the test.
type config struct { type config struct {
Version int `json:"version"` Version int `json:"version"`
TestDuration time.Duration `json:"time"` TestDuration time.Duration `json:"time,format:nano"`
Direction Direction `json:"direction"` Direction Direction `json:"direction"`
} }

@ -2903,7 +2903,7 @@ type SSHAction struct {
// SessionDuration, if non-zero, is how long the session can stay open // SessionDuration, if non-zero, is how long the session can stay open
// before being forcefully terminated. // before being forcefully terminated.
SessionDuration time.Duration `json:"sessionDuration,omitempty"` SessionDuration time.Duration `json:"sessionDuration,omitempty,format:nano"`
// AllowAgentForwarding, if true, allows accepted connections to forward // AllowAgentForwarding, if true, allows accepted connections to forward
// the ssh agent if requested. // the ssh agent if requested.

Loading…
Cancel
Save