diff --git a/NOTICE.txt b/NOTICE.txt index 951b7e7785c..3cee98a02e5 100644 --- a/NOTICE.txt +++ b/NOTICE.txt @@ -12969,11 +12969,11 @@ SOFTWARE -------------------------------------------------------------------------------- Dependency : github.com/elastic/elastic-agent-libs -Version: v0.7.5 +Version: v0.9.4 Licence type (autodetected): Apache-2.0 -------------------------------------------------------------------------------- -Contents of probable licence file $GOMODCACHE/github.com/elastic/elastic-agent-libs@v0.7.5/LICENSE: +Contents of probable licence file $GOMODCACHE/github.com/elastic/elastic-agent-libs@v0.9.4/LICENSE: Apache License Version 2.0, January 2004 @@ -22336,11 +22336,11 @@ Contents of probable licence file $GOMODCACHE/github.com/prometheus/common@v0.30 -------------------------------------------------------------------------------- Dependency : github.com/prometheus/procfs -Version: v0.9.0 +Version: v0.13.0 Licence type (autodetected): Apache-2.0 -------------------------------------------------------------------------------- -Contents of probable licence file $GOMODCACHE/github.com/prometheus/procfs@v0.9.0/LICENSE: +Contents of probable licence file $GOMODCACHE/github.com/prometheus/procfs@v0.13.0/LICENSE: Apache License Version 2.0, January 2004 @@ -25507,11 +25507,11 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -------------------------------------------------------------------------------- Dependency : golang.org/x/sync -Version: v0.5.0 +Version: v0.6.0 Licence type (autodetected): BSD-3-Clause -------------------------------------------------------------------------------- -Contents of probable licence file $GOMODCACHE/golang.org/x/sync@v0.5.0/LICENSE: +Contents of probable licence file $GOMODCACHE/golang.org/x/sync@v0.6.0/LICENSE: Copyright (c) 2009 The Go Authors. All rights reserved. @@ -25544,11 +25544,11 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -------------------------------------------------------------------------------- Dependency : golang.org/x/sys -Version: v0.18.0 +Version: v0.19.0 Licence type (autodetected): BSD-3-Clause -------------------------------------------------------------------------------- -Contents of probable licence file $GOMODCACHE/golang.org/x/sys@v0.18.0/LICENSE: +Contents of probable licence file $GOMODCACHE/golang.org/x/sys@v0.19.0/LICENSE: Copyright (c) 2009 The Go Authors. All rights reserved. @@ -26952,11 +26952,11 @@ Contents of probable licence file $GOMODCACHE/gotest.tools/gotestsum@v1.7.0/LICE -------------------------------------------------------------------------------- Dependency : howett.net/plist -Version: v1.0.0 +Version: v1.0.1 Licence type (autodetected): BSD-2-Clause -------------------------------------------------------------------------------- -Contents of probable licence file $GOMODCACHE/howett.net/plist@v1.0.0/LICENSE: +Contents of probable licence file $GOMODCACHE/howett.net/plist@v1.0.1/LICENSE: Copyright (c) 2013, Dustin L. Howett. All rights reserved. diff --git a/go.mod b/go.mod index ad13afabd8d..2f4dd380749 100644 --- a/go.mod +++ b/go.mod @@ -130,7 +130,7 @@ require ( github.com/pmezard/go-difflib v1.0.0 // indirect github.com/prometheus/client_model v0.2.0 github.com/prometheus/common v0.30.0 - github.com/prometheus/procfs v0.9.0 + github.com/prometheus/procfs v0.13.0 github.com/prometheus/prometheus v1.8.2-0.20210701133801-b0944590a1c9 github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 github.com/samuel/go-parser v0.0.0-20130731160455-ca8abbf65d0e // indirect @@ -156,8 +156,8 @@ require ( golang.org/x/mod v0.14.0 golang.org/x/net v0.23.0 golang.org/x/oauth2 v0.10.0 - golang.org/x/sync v0.5.0 - golang.org/x/sys v0.18.0 + golang.org/x/sync v0.6.0 + golang.org/x/sys v0.19.0 golang.org/x/text v0.14.0 golang.org/x/time v0.3.0 golang.org/x/tools v0.16.0 @@ -173,7 +173,7 @@ require ( gopkg.in/yaml.v2 v2.4.0 gotest.tools v2.2.0+incompatible gotest.tools/gotestsum v1.7.0 - howett.net/plist v1.0.0 + howett.net/plist v1.0.1 k8s.io/api v0.23.4 k8s.io/apimachinery v0.23.4 k8s.io/client-go v0.23.4 @@ -204,7 +204,7 @@ require ( github.com/elastic/bayeux v1.0.5 github.com/elastic/ebpfevents v0.6.0 github.com/elastic/elastic-agent-autodiscover v0.6.14 - github.com/elastic/elastic-agent-libs v0.7.5 + github.com/elastic/elastic-agent-libs v0.9.4 github.com/elastic/elastic-agent-shipper-client v0.5.1-0.20230228231646-f04347b666f3 github.com/elastic/elastic-agent-system-metrics v0.9.2 github.com/elastic/go-elasticsearch/v8 v8.13.1 diff --git a/go.sum b/go.sum index 5c45bdee748..fefe7776b03 100644 --- a/go.sum +++ b/go.sum @@ -555,8 +555,8 @@ github.com/elastic/elastic-agent-autodiscover v0.6.14 h1:0zJYNyv9GKTOiNqCHqEVboP github.com/elastic/elastic-agent-autodiscover v0.6.14/go.mod h1:39/fHHlnyTK6oUNZfAhxJwBTVahO9tNasEIjzsxGMu8= github.com/elastic/elastic-agent-client/v7 v7.8.1 h1:J9wZc/0mUvSEok0X5iR5+n60Jgb+AWooKddb3XgPWqM= github.com/elastic/elastic-agent-client/v7 v7.8.1/go.mod h1:axl1nkdqc84YRFkeJGD9jExKNPUrOrzf3DFo2m653nY= -github.com/elastic/elastic-agent-libs v0.7.5 h1:4UMqB3BREvhwecYTs/L23oQp1hs/XUkcunPlmTZn5yg= -github.com/elastic/elastic-agent-libs v0.7.5/go.mod h1:pGMj5myawdqu+xE+WKvM5FQzKQ/MonikkWOzoFTJxaU= +github.com/elastic/elastic-agent-libs v0.9.4 h1:I6c1NAj3grJ1YZgo+U04w0csMAWGIn6eZTb23Z5MbAI= +github.com/elastic/elastic-agent-libs v0.9.4/go.mod h1:SkMnpLm+tXybBrIWK6f3rcOhrDIztLbYCV46m8gwc8g= github.com/elastic/elastic-agent-shipper-client v0.5.1-0.20230228231646-f04347b666f3 h1:sb+25XJn/JcC9/VL8HX4r4QXSUq4uTNzGS2kxOE7u1U= github.com/elastic/elastic-agent-shipper-client v0.5.1-0.20230228231646-f04347b666f3/go.mod h1:rWarFM7qYxJKsi9WcV6ONcFjH/NA3niDNpTxO+8/GVI= github.com/elastic/elastic-agent-system-metrics v0.9.2 h1:/tvTKOt55EerU0WwGFoDhBlyWLgxyv7d8xCbny0bciw= @@ -1511,8 +1511,8 @@ github.com/prometheus/procfs v0.0.8/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+Gx github.com/prometheus/procfs v0.0.11/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= github.com/prometheus/procfs v0.6.0/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA= -github.com/prometheus/procfs v0.9.0 h1:wzCHvIvM5SxWqYvwgVL7yJY8Lz3PKn49KQtpgMYJfhI= -github.com/prometheus/procfs v0.9.0/go.mod h1:+pB4zwohETzFnmlpe6yd2lSc+0/46IYZRB/chUwxUZY= +github.com/prometheus/procfs v0.13.0 h1:GqzLlQyfsPbaEHaQkO7tbDlriv/4o5Hudv6OXHGKX7o= +github.com/prometheus/procfs v0.13.0/go.mod h1:cd4PFCR54QLnGKPaKGA6l+cfuNXtht43ZKY6tow0Y1g= github.com/prometheus/prometheus v0.0.0-20200609090129-a6600f564e3c/go.mod h1:S5n0C6tSgdnwWshBUceRx5G1OsjLv/EeZ9t3wIfEtsY= github.com/prometheus/prometheus v1.8.2-0.20210701133801-b0944590a1c9 h1:If7jYp33vwa8ZQ7GGwrAs0SBjiW0aWeAB/oV1aG7bZ4= github.com/prometheus/prometheus v1.8.2-0.20210701133801-b0944590a1c9/go.mod h1:A97P+iwS3Ffpxpejz4+ASZl6i9EqSJDzxObq8DjV2SU= @@ -1994,8 +1994,8 @@ golang.org/x/sync v0.0.0-20220513210516-0976fa681c29/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220819030929-7fc1605a5dde/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.5.0 h1:60k92dhOjHxJkrqnwsfl8KuaHbn/5dl0lUPUklKo3qE= -golang.org/x/sync v0.5.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sync v0.6.0 h1:5BMeUDZ7vkXGfEr1x9B4bRcTH4lpkTkpdh0T/J+qjbQ= +golang.org/x/sync v0.6.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20170830134202-bb24a47a89ea/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180810173357-98c5dad5d1a0/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -2112,8 +2112,8 @@ golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.18.0 h1:DBdB3niSjOA/O0blCZBqDefyWNYveAYMNF1Wum0DYQ4= -golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.19.0 h1:q5f1RH2jigJ1MoAWp2KTp3gm5zAGFUTarQZ5U386+4o= +golang.org/x/sys v0.19.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210220032956-6a3ed077a48d/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= @@ -2472,8 +2472,8 @@ honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= honnef.co/go/tools v0.1.3/go.mod h1:NgwopIslSNH47DimFoV78dnkksY2EFtX0ajyb3K/las= -howett.net/plist v1.0.0 h1:7CrbWYbPPO/PyNy38b2EB/+gYbjCe2DXBxgtOOZbSQM= -howett.net/plist v1.0.0/go.mod h1:lqaXoTrLY4hg8tnEzNru53gicrbv7rrk+2xJA/7hw9g= +howett.net/plist v1.0.1 h1:37GdZ8tP09Q35o9ych3ehygcsL+HqKSwzctveSlarvM= +howett.net/plist v1.0.1/go.mod h1:lqaXoTrLY4hg8tnEzNru53gicrbv7rrk+2xJA/7hw9g= k8s.io/api v0.17.5/go.mod h1:0zV5/ungglgy2Rlm3QK8fbxkXVs+BSJWpJP/+8gUVLY= k8s.io/api v0.21.1/go.mod h1:FstGROTmsSHBarKc8bylzXih8BLNYTiS3TZcsoEDg2s= k8s.io/api v0.23.4 h1:85gnfXQOWbJa1SiWGpE9EEtHs0UVvDyIsSMpEtl2D4E= diff --git a/heartbeat/monitors/active/dialchain/dialers.go b/heartbeat/monitors/active/dialchain/dialers.go index 7889ac82a27..44adf8301f7 100644 --- a/heartbeat/monitors/active/dialchain/dialers.go +++ b/heartbeat/monitors/active/dialchain/dialers.go @@ -18,6 +18,7 @@ package dialchain import ( + "context" "fmt" "net" "strconv" @@ -69,7 +70,7 @@ func UDPDialer(to time.Duration) NetDialer { // CreateNetDialer returns a NetDialer with the given timeout. func CreateNetDialer(timeout time.Duration) NetDialer { return func(event *beat.Event) (transport.Dialer, error) { - return makeDialer(func(network, address string) (net.Conn, error) { + return makeDialer(func(ctx context.Context, network, address string) (net.Conn, error) { var namespace string switch network { @@ -100,7 +101,7 @@ func CreateNetDialer(timeout time.Duration) NetDialer { dialer := &net.Dialer{Timeout: timeout} start := time.Now() - conn, err := transport.DialWith(dialer, network, host, addresses, port) + conn, err := transport.DialWith(ctx, dialer, network, host, addresses, port) if err != nil { return nil, ecserr.NewCouldNotConnectErr(host, port, err) } diff --git a/heartbeat/monitors/active/dialchain/util.go b/heartbeat/monitors/active/dialchain/util.go index cb4ddc64cfe..99a5381289e 100644 --- a/heartbeat/monitors/active/dialchain/util.go +++ b/heartbeat/monitors/active/dialchain/util.go @@ -18,6 +18,7 @@ package dialchain import ( + "context" "net" "time" @@ -58,7 +59,7 @@ func (t *timer) stop() { t.e = time.Now() } func (t *timer) duration() time.Duration { return t.e.Sub(t.s) } // makeDialer aliases transport.DialerFunc -func makeDialer(fn func(network, address string) (net.Conn, error)) transport.Dialer { +func makeDialer(fn func(ctx context.Context, network, address string) (net.Conn, error)) transport.Dialer { return transport.DialerFunc(fn) } @@ -66,7 +67,7 @@ func makeDialer(fn func(network, address string) (net.Conn, error)) transport.Di // The callback must return the original or a new address to be used with // the dialer. func beforeDial(dialer transport.Dialer, fn func(string) string) transport.Dialer { - return makeDialer(func(network, address string) (net.Conn, error) { + return makeDialer(func(ctx context.Context, network, address string) (net.Conn, error) { address = fn(address) return dialer.Dial(network, address) }) @@ -74,7 +75,7 @@ func beforeDial(dialer transport.Dialer, fn func(string) string) transport.Diale // afterDial will run fn after the dialer did successfully return a connection. func afterDial(dialer transport.Dialer, fn func(net.Conn) (net.Conn, error)) transport.Dialer { - return makeDialer(func(network, address string) (net.Conn, error) { + return makeDialer(func(ctx context.Context, network, address string) (net.Conn, error) { conn, err := dialer.Dial(network, address) if err == nil { conn, err = fn(conn) diff --git a/metricbeat/helper/dialer/dialer_windows.go b/metricbeat/helper/dialer/dialer_windows.go index 0ef34666d2a..94e383e4cb6 100644 --- a/metricbeat/helper/dialer/dialer_windows.go +++ b/metricbeat/helper/dialer/dialer_windows.go @@ -20,6 +20,7 @@ package dialer import ( + "context" "errors" "net" "strings" @@ -60,7 +61,7 @@ func (t *NpipeDialerBuilder) String() string { func (t *NpipeDialerBuilder) Make(timeout time.Duration) (transport.Dialer, error) { to := timeout return transport.DialerFunc( - func(_, _ string) (net.Conn, error) { + func(_ context.Context, _ string, _ string) (net.Conn, error) { return winio.DialPipe( strings.TrimSuffix(npipe.TransformString(t.Path), "/"), &to, diff --git a/x-pack/filebeat/input/cel/input.go b/x-pack/filebeat/input/cel/input.go index 3428a730ce3..88d7a20b458 100644 --- a/x-pack/filebeat/input/cel/input.go +++ b/x-pack/filebeat/input/cel/input.go @@ -808,6 +808,11 @@ func (d socketDialer) Dial(_, _ string) (net.Conn, error) { return net.Dial("unix", d.path) } +func (d socketDialer) DialContext(ctx context.Context, _, _ string) (net.Conn, error) { + var nd net.Dialer + return nd.DialContext(ctx, "unix", d.path) +} + func checkRedirect(cfg *ResourceConfig, log *logp.Logger) func(*http.Request, []*http.Request) error { return func(req *http.Request, via []*http.Request) error { log.Debug("http client: checking redirect") diff --git a/x-pack/filebeat/input/cel/transport_other.go b/x-pack/filebeat/input/cel/transport_other.go index 387d2f92ea5..46fe74ee84f 100644 --- a/x-pack/filebeat/input/cel/transport_other.go +++ b/x-pack/filebeat/input/cel/transport_other.go @@ -7,6 +7,7 @@ package cel import ( + "context" "errors" "net" ) @@ -19,3 +20,7 @@ type npipeDialer struct { func (npipeDialer) Dial(_, _ string) (net.Conn, error) { return nil, errors.New("named pipe only available on windows") } + +func (npipeDialer) DialContext(_ context.Context, _, _ string) (net.Conn, error) { + return nil, errors.New("named pipe only available on windows") +} diff --git a/x-pack/filebeat/input/cel/transport_windows.go b/x-pack/filebeat/input/cel/transport_windows.go index 7ab3ffc664b..1595917ff49 100644 --- a/x-pack/filebeat/input/cel/transport_windows.go +++ b/x-pack/filebeat/input/cel/transport_windows.go @@ -7,6 +7,7 @@ package cel import ( + "context" "net" "path/filepath" @@ -21,3 +22,7 @@ type npipeDialer struct { func (d npipeDialer) Dial(_, _ string) (net.Conn, error) { return winio.DialPipe(`\\.\pipe`+filepath.FromSlash(d.path), nil) } + +func (d npipeDialer) DialContext(ctx context.Context, _, _ string) (net.Conn, error) { + return winio.DialPipeContext(ctx, `\\.\pipe`+filepath.FromSlash(d.path)) +} diff --git a/x-pack/filebeat/input/httpjson/client_other.go b/x-pack/filebeat/input/httpjson/client_other.go index 59bfb7598e1..19afe99edbf 100644 --- a/x-pack/filebeat/input/httpjson/client_other.go +++ b/x-pack/filebeat/input/httpjson/client_other.go @@ -7,6 +7,7 @@ package httpjson import ( + "context" "errors" "net" ) @@ -19,3 +20,7 @@ type npipeDialer struct { func (npipeDialer) Dial(_, _ string) (net.Conn, error) { return nil, errors.New("named pipe only available on windows") } + +func (npipeDialer) DialContext(_ context.Context, _, _ string) (net.Conn, error) { + return nil, errors.New("named pipe only available on windows") +} diff --git a/x-pack/filebeat/input/httpjson/client_windows.go b/x-pack/filebeat/input/httpjson/client_windows.go index e6e5bb05f34..7fb4414877a 100644 --- a/x-pack/filebeat/input/httpjson/client_windows.go +++ b/x-pack/filebeat/input/httpjson/client_windows.go @@ -7,6 +7,7 @@ package httpjson import ( + "context" "net" "path/filepath" @@ -21,3 +22,7 @@ type npipeDialer struct { func (d npipeDialer) Dial(_, _ string) (net.Conn, error) { return winio.DialPipe(`\\.\pipe`+filepath.FromSlash(d.path), nil) } + +func (d npipeDialer) DialContext(ctx context.Context, _, _ string) (net.Conn, error) { + return winio.DialPipeContext(ctx, `\\.\pipe`+filepath.FromSlash(d.path)) +} diff --git a/x-pack/filebeat/input/httpjson/input.go b/x-pack/filebeat/input/httpjson/input.go index 0def1cbd8b6..0764259619b 100644 --- a/x-pack/filebeat/input/httpjson/input.go +++ b/x-pack/filebeat/input/httpjson/input.go @@ -358,6 +358,11 @@ func (d socketDialer) Dial(_, _ string) (net.Conn, error) { return net.Dial("unix", d.path) } +func (d socketDialer) DialContext(ctx context.Context, _, _ string) (net.Conn, error) { + var nd net.Dialer + return nd.DialContext(ctx, "unix", d.path) +} + func checkRedirect(config *requestConfig, log *logp.Logger) func(*http.Request, []*http.Request) error { return func(req *http.Request, via []*http.Request) error { log.Debug("http client: checking redirect")