diff --git a/go.mod b/go.mod index fde403d..e341506 100644 --- a/go.mod +++ b/go.mod @@ -16,7 +16,7 @@ require ( github.com/prometheus/common v0.34.0 github.com/prometheus/procfs v0.7.3 // indirect github.com/sirupsen/logrus v1.8.1 - github.com/vulcand/oxy v1.4.0 + github.com/vulcand/oxy v1.4.1 golang.org/x/crypto v0.0.0-20220427172511-eb4f295cb31f // indirect golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4 // indirect golang.org/x/sys v0.0.0-20220412071739-889880a91fd5 // indirect @@ -34,7 +34,7 @@ require ( github.com/golang/protobuf v1.5.2 // indirect github.com/gorilla/securecookie v1.1.1 // indirect github.com/gorilla/websocket v1.5.0 // indirect - github.com/mailgun/multibuf v0.0.0-20150714184110-565402cd71fb // indirect + github.com/mailgun/multibuf v0.1.2 // indirect github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect github.com/nxadm/tail v1.4.8 // indirect github.com/prometheus/client_golang v1.12.1 // indirect diff --git a/go.sum b/go.sum index 4500808..07e2f8d 100644 --- a/go.sum +++ b/go.sum @@ -187,8 +187,8 @@ github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORN github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= -github.com/mailgun/multibuf v0.0.0-20150714184110-565402cd71fb h1:m2FGM8K2LC9Zyt/7zbQNn5Uvf/YV7vFWKtoMcC7hHU8= -github.com/mailgun/multibuf v0.0.0-20150714184110-565402cd71fb/go.mod h1:E0vRBBIQUHcRtmL/oR6w/jehh4FJqJFxe86gBnw9gXc= +github.com/mailgun/multibuf v0.1.2 h1:QE9kE27lK6LFZB4aYNVtUPlWVHVCT0zpgUr2uoq/+jk= +github.com/mailgun/multibuf v0.1.2/go.mod h1:E+sUhIy69qgT6EM57kCPdUTlHnjTuxQBO/yf6af9Hes= github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= @@ -256,8 +256,8 @@ github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5 github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY= -github.com/vulcand/oxy v1.4.0 h1:QslVUBCCev9zf+0QNr+SJlfpidz+4NZXu1yNfv2bLsc= -github.com/vulcand/oxy v1.4.0/go.mod h1:ygVjK9yyTc1iScEZ8ZbFpjjHH2DlX8qXS7s+C5G7lJE= +github.com/vulcand/oxy v1.4.1 h1:8FUsbr5xhSJqNlSrpUBcw93WuZIEI9JUyvThB9YqqF8= +github.com/vulcand/oxy v1.4.1/go.mod h1:Yq8OBb0XWU/7nPSglwUH5LS2Pcp4yvad8SVayobZbSo= github.com/vulcand/predicate v1.2.0 h1:uFsW1gcnnR7R+QTID+FVcs0sSYlIGntoGOTb3rQJt50= github.com/vulcand/predicate v1.2.0/go.mod h1:VipoNYXny6c8N381zGUWkjuuNHiRbeAZhE7Qm9c+2GA= github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= diff --git a/vendor/github.com/mailgun/multibuf/.gitignore b/vendor/github.com/mailgun/multibuf/.gitignore index daf913b..a938edc 100644 --- a/vendor/github.com/mailgun/multibuf/.gitignore +++ b/vendor/github.com/mailgun/multibuf/.gitignore @@ -22,3 +22,5 @@ _testmain.go *.exe *.test *.prof + +vendor/ \ No newline at end of file diff --git a/vendor/github.com/mailgun/multibuf/Makefile b/vendor/github.com/mailgun/multibuf/Makefile index 537ff38..f0de6bc 100644 --- a/vendor/github.com/mailgun/multibuf/Makefile +++ b/vendor/github.com/mailgun/multibuf/Makefile @@ -2,7 +2,7 @@ clean: find . -name flymake_* -delete test: clean - go test -v . + go test -race -v . test-grep: clean go test -v . -check.f=$(e) diff --git a/vendor/github.com/mailgun/multibuf/buffer.go b/vendor/github.com/mailgun/multibuf/buffer.go index 67f10da..5491151 100644 --- a/vendor/github.com/mailgun/multibuf/buffer.go +++ b/vendor/github.com/mailgun/multibuf/buffer.go @@ -1,4 +1,4 @@ -// package multibuf implements buffer optimized for streaming large chunks of data, +// Package multibuf implements buffer optimized for streaming large chunks of data, // multiple reads and optional partial buffering to disk. package multibuf @@ -27,13 +27,13 @@ type MultiReader interface { type WriterOnce interface { // Write implements io.Writer Write(p []byte) (int, error) - // Reader transfers all data written to this writer to MultiReader. If there was no data written it retuns an error + // Reader transfers all data written to this writer to MultiReader. If there was no data written it returns an error Reader() (MultiReader, error) // WriterOnce owns the data before Reader has been called, so Close will close all the underlying files if Reader has not been called. Close() error } -// MaxBytes, ignored if set to value >=, if request exceeds the specified limit, the reader will return error, +// MaxBytes ignored if set to value >=, if request exceeds the specified limit, the reader will return error, // by default buffer is not limited, negative values mean no limit func MaxBytes(m int64) optionSetter { return func(o *options) error { @@ -46,7 +46,7 @@ func MaxBytes(m int64) optionSetter { func MemBytes(m int64) optionSetter { return func(o *options) error { if m < 0 { - return fmt.Errorf("MemBytes should be >= 0") + return fmt.Errorf("memBytes should be >= 0") } o.memBytes = m return nil @@ -68,14 +68,14 @@ func NewWriterOnce(setters ...optionSetter) (WriterOnce, error) { memBytes: DefaultMemBytes, maxBytes: DefaultMaxBytes, } - if o.memBytes == 0 { - o.memBytes = DefaultMemBytes - } for _, s := range setters { if err := s(&o); err != nil { return nil, err } } + if o.memBytes == 0 { + o.memBytes = DefaultMemBytes + } return &writerOnce{o: o}, nil } @@ -157,9 +157,10 @@ type MaxSizeReachedError struct { } func (e *MaxSizeReachedError) Error() string { - return fmt.Sprintf("Maximum size %d was reached", e) + return fmt.Sprintf("Maximum size %d was reached", e.MaxSize) } +// Default sizes const ( DefaultMemBytes = 1048576 DefaultMaxBytes = -1 @@ -298,7 +299,6 @@ const ( type writerOnce struct { o options - err error state int mem *bytes.Buffer file *os.File @@ -357,7 +357,7 @@ func (w *writerOnce) write(p []byte) (int, error) { } // we can't write to memory any more, switch to file if err := w.initFile(); err != nil { - return int(writeToMem), err + return writeToMem, err } w.state = writerFile wrote, err := w.file.Write(p[writeToMem:]) @@ -406,7 +406,7 @@ func (w *writerOnce) Reader() (MultiReader, error) { w.mem = nil return newBuf(w.total, w.cleanupFn, br, fr), nil } - return nil, fmt.Errorf("unsupported state: %d\n", w.state) + return nil, fmt.Errorf("unsupported state: %d", w.state) } const tempFilePrefix = "temp-multibuf-" diff --git a/vendor/modules.txt b/vendor/modules.txt index 9208495..6df1aef 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -56,8 +56,8 @@ github.com/gravitational/trace/internal # github.com/jonboulle/clockwork v0.2.3 ## explicit; go 1.13 github.com/jonboulle/clockwork -# github.com/mailgun/multibuf v0.0.0-20150714184110-565402cd71fb -## explicit +# github.com/mailgun/multibuf v0.1.2 +## explicit; go 1.17 github.com/mailgun/multibuf # github.com/matttproud/golang_protobuf_extensions v1.0.1 ## explicit @@ -132,7 +132,7 @@ github.com/prometheus/procfs/internal/util # github.com/sirupsen/logrus v1.8.1 ## explicit; go 1.13 github.com/sirupsen/logrus -# github.com/vulcand/oxy v1.4.0 +# github.com/vulcand/oxy v1.4.1 ## explicit; go 1.17 github.com/vulcand/oxy/buffer github.com/vulcand/oxy/forward