timeout

package
v1.8.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 28, 2020 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Setting

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

func DefaultSetting() Setting

DefaultSetting returns a Setting representing "use the default".

func DisabledSetting

func DisabledSetting() Setting

DisabledSetting returns a Setting representing "disable the timeout".

func DurationSetting

func DurationSetting(duration time.Duration) Setting

DurationSetting returns a timeout setting with the given duration.

func Parse

func Parse(timeout string) Setting

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.
  • any other input means "disable the timeout".

func (Setting) Duration

func (s Setting) Duration() time.Duration

Duration returns the explicit timeout value if one exists.

func (Setting) IsDisabled

func (s Setting) IsDisabled() bool

IsDisabled returns whether the timeout should be disabled entirely.

func (Setting) UseDefault

func (s Setting) UseDefault() bool

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL