contour: github.com/projectcontour/contour/internal/timeout Index | Files

package timeout

import "github.com/projectcontour/contour/internal/timeout"

Index

Package Files

timeout.go

type Setting Uses

type Setting struct {
    // contains filtered or unexported fields
}

Setting describes a timeout setting that can be exactly one of: disable the timeout entirely, use the default, or use a specific value. The zero value is a Setting representing "use the default".

func DefaultSetting Uses

func DefaultSetting() Setting

DefaultSetting returns a Setting representing "use the default".

func DisabledSetting Uses

func DisabledSetting() Setting

DisabledSetting returns a Setting representing "disable the timeout".

func DurationSetting Uses

func DurationSetting(duration time.Duration) Setting

DurationSetting returns a timeout setting with the given duration.

func Parse Uses

func Parse(timeout string) (Setting, error)

Parse parses string representations of timeout settings that we pass in various places in a standard way:

- an empty string means "use the default".
- any valid representation of "0" means "use the default".
- a valid Go duration string is used as the specific timeout value.
- "infinity" or "infinite" means "disable the timeout".
- any other value results in an error.

func ParseMaxAge Uses

func ParseMaxAge(timeout string) (Setting, error)

ParseMaxAge parses string representations of "max age" values used mostly in cache related settings. An example of this is the MaxAge field of the CORS policy:

- an empty string means "use the default".
- 0 means "disable cache".
- a valid Go duration string is used as the specific timeout value.
- any other input means "use the default".

func (Setting) Duration Uses

func (s Setting) Duration() time.Duration

Duration returns the explicit timeout value if one exists.

func (Setting) IsDisabled Uses

func (s Setting) IsDisabled() bool

IsDisabled returns whether the timeout should be disabled entirely.

func (Setting) UseDefault Uses

func (s Setting) UseDefault() bool

UseDefault returns whether the default proxy timeout value should be used.

Package timeout imports 2 packages (graph) and is imported by 12 packages. Updated 2021-01-02. Refresh now. Tools for package owners.