const maxSeconds … const minSeconds … // validateDuration determines whether the Duration is valid according to the // definition in google/protobuf/duration.proto. A valid Duration // may still be too large to fit into a time.Duration (the range of Duration // is about 10,000 years, and the range of time.Duration is about 290). func validateDuration(d *duration) error { … } // DurationFromProto converts a Duration to a time.Duration. DurationFromProto // returns an error if the Duration is invalid or is too large to be // represented in a time.Duration. func durationFromProto(p *duration) (time.Duration, error) { … } // DurationProto converts a time.Duration to a Duration. func durationProto(d time.Duration) *duration { … }