Update vendor/

Signed-off-by: Ben Kochie <superq@gmail.com>
This commit is contained in:
Ben Kochie 2020-05-14 19:47:23 +02:00
commit cdb9e7d2b8
No known key found for this signature in database
GPG key ID: C646B23C9E3245F1
527 changed files with 113006 additions and 150362 deletions

View file

@ -29,6 +29,7 @@ import (
"time"
"github.com/mwitkow/go-conntrack"
"golang.org/x/net/http2"
"gopkg.in/yaml.v2"
)
@ -153,6 +154,11 @@ func NewRoundTripperFromConfig(cfg HTTPClientConfig, name string, disableKeepAli
conntrack.DialWithName(name),
),
}
// TODO: use ForceAttemptHTTP2 when we move to Go 1.13+.
err := http2.ConfigureTransport(rt.(*http.Transport))
if err != nil {
return nil, err
}
// If a bearer token is provided, create a round tripper that will set the
// Authorization header correctly on each request.

View file

@ -186,6 +186,10 @@ var durationRE = regexp.MustCompile("^([0-9]+)(y|w|d|h|m|s|ms)$")
// ParseDuration parses a string into a time.Duration, assuming that a year
// always has 365d, a week always has 7d, and a day always has 24h.
func ParseDuration(durationStr string) (Duration, error) {
// Allow 0 without a unit.
if durationStr == "0" {
return 0, nil
}
matches := durationRE.FindStringSubmatch(durationStr)
if len(matches) != 3 {
return 0, fmt.Errorf("not a valid duration string: %q", durationStr)

View file

@ -94,13 +94,15 @@ type Config struct {
// with a timestamp. The output always goes to stderr.
func New(config *Config) log.Logger {
var l log.Logger
if config.Format.s == "logfmt" {
l = log.NewLogfmtLogger(log.NewSyncWriter(os.Stderr))
} else {
if config.Format != nil && config.Format.s == "json" {
l = log.NewJSONLogger(log.NewSyncWriter(os.Stderr))
} else {
l = log.NewLogfmtLogger(log.NewSyncWriter(os.Stderr))
}
l = level.NewFilter(l, config.Level.o)
if config.Level != nil {
l = level.NewFilter(l, config.Level.o)
}
l = log.With(l, "ts", timestampFormat, "caller", log.DefaultCaller)
return l
}