diff --git a/Makefile b/Makefile index 7ff4889..b9b91ae 100644 --- a/Makefile +++ b/Makefile @@ -5,7 +5,7 @@ GOVET=$(GOCMD) vet BINARY_NAME=pure-fa-om-exporter MODULE_NAME=purestorage/fa-openmetrics-exporter UserAgentBase=Pure_FA_OpenMetrics_exporter -VERSION?=1.0.23 +VERSION?=1.0.24 SERVICE_PORT?=9490 DOCKER_REGISTRY?= quay.io/purestorage/ EXPORT_RESULT?=false # for CI please set EXPORT_RESULT to true diff --git a/build/docker/Dockerfile b/build/docker/Dockerfile index 71d6ad1..b1cb5d7 100644 --- a/build/docker/Dockerfile +++ b/build/docker/Dockerfile @@ -1,5 +1,5 @@ FROM golang:alpine as build -ARG VERSION=1.0.23 +ARG VERSION=1.0.24 ARG UserAgentBase=Pure_FA_OpenMetrics_exporter WORKDIR /usr/src/app diff --git a/go.mod b/go.mod index 42e11cc..f02ad67 100644 --- a/go.mod +++ b/go.mod @@ -1,12 +1,12 @@ module purestorage/fa-openmetrics-exporter -go 1.21.0 +go 1.23.0 require ( github.com/akamensky/argparse v1.4.0 - github.com/go-resty/resty/v2 v2.14.0 + github.com/go-resty/resty/v2 v2.15.3 github.com/google/go-cmp v0.6.0 - github.com/prometheus/client_golang v1.20.2 + github.com/prometheus/client_golang v1.20.5 github.com/prometheus/client_model v0.6.1 gopkg.in/yaml.v3 v3.0.1 ) @@ -14,12 +14,12 @@ require ( require ( github.com/beorn7/perks v1.0.1 // indirect github.com/cespare/xxhash/v2 v2.3.0 // indirect - github.com/klauspost/compress v1.17.9 // indirect + github.com/klauspost/compress v1.17.11 // indirect github.com/kr/text v0.2.0 // indirect github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect - github.com/prometheus/common v0.58.0 // indirect + github.com/prometheus/common v0.60.1 // indirect github.com/prometheus/procfs v0.15.1 // indirect - golang.org/x/net v0.28.0 // indirect - golang.org/x/sys v0.24.0 // indirect - google.golang.org/protobuf v1.34.2 // indirect + golang.org/x/net v0.30.0 // indirect + golang.org/x/sys v0.26.0 // indirect + google.golang.org/protobuf v1.35.1 // indirect ) diff --git a/go.sum b/go.sum index b5cc7cb..985bfe6 100644 --- a/go.sum +++ b/go.sum @@ -5,12 +5,14 @@ github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6r github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs= github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= -github.com/go-resty/resty/v2 v2.14.0 h1:/rhkzsAqGQkozwfKS5aFAbb6TyKd3zyFRWcdRXLPCAU= -github.com/go-resty/resty/v2 v2.14.0/go.mod h1:IW6mekUOsElt9C7oWr0XRt9BNSD6D5rr9mhk6NjmNHg= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/go-resty/resty/v2 v2.15.3 h1:bqff+hcqAflpiF591hhJzNdkRsFhlB96CYfBwSFvql8= +github.com/go-resty/resty/v2 v2.15.3/go.mod h1:0fHAoK7JoBy/Ch36N8VFeMsK7xQOHhvWaC3iOktwmIU= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= -github.com/klauspost/compress v1.17.9 h1:6KIumPrER1LHsvBVuDa0r5xaG0Es51mhhB9BQB2qeMA= -github.com/klauspost/compress v1.17.9/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw= +github.com/klauspost/compress v1.17.11 h1:In6xLpyWOi1+C7tXUUWv2ot1QvBjxevKAaI6IXrJmUc= +github.com/klauspost/compress v1.17.11/go.mod h1:pMDklpSncoRMuLFrf1W9Ss9KT+0rH90U12bZKk7uwG0= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= @@ -19,87 +21,28 @@ github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0 github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA= github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= -github.com/prometheus/client_golang v1.20.2 h1:5ctymQzZlyOON1666svgwn3s6IKWgfbjsejTMiXIyjg= -github.com/prometheus/client_golang v1.20.2/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/prometheus/client_golang v1.20.5 h1:cxppBPuYhUnsO6yo/aoRol4L7q7UFfdm+bR9r+8l63Y= +github.com/prometheus/client_golang v1.20.5/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE= github.com/prometheus/client_model v0.6.1 h1:ZKSh/rekM+n3CeS952MLRAdFwIKqeY8b62p8ais2e9E= github.com/prometheus/client_model v0.6.1/go.mod h1:OrxVMOVHjw3lKMa8+x6HeMGkHMQyHDk9E3jmP2AmGiY= -github.com/prometheus/common v0.58.0 h1:N+N8vY4/23r6iYfD3UQZUoJPnUYAo7v6LG5XZxjZTXo= -github.com/prometheus/common v0.58.0/go.mod h1:GpWM7dewqmVYcd7SmRaiWVe9SSqjf0UrwnYnpEZNuT0= +github.com/prometheus/common v0.60.1 h1:FUas6GcOw66yB/73KC+BOZoFJmbo/1pojoILArPAaSc= +github.com/prometheus/common v0.60.1/go.mod h1:h0LYf1R1deLSKtD4Vdg8gy4RuOvENW2J/h19V5NADQw= github.com/prometheus/procfs v0.15.1 h1:YagwOFzUgYfKKHX6Dr+sHT7km/hxC76UB0learggepc= github.com/prometheus/procfs v0.15.1/go.mod h1:fB45yRUv8NstnjriLhBQLuOUt+WW4BsoGhij/e3PBqk= github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ= github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncjaFoBhdsK/akog= -github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= -golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.13.0/go.mod h1:y6Z2r+Rw4iayiXXAIxJIDAJ1zMW4yaTpebo8fPOliYc= -golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU= -golang.org/x/crypto v0.23.0/go.mod h1:CKFgDieR+mRhux2Lsu27y0fO304Db0wZe70UKqHu0v8= -golang.org/x/crypto v0.25.0/go.mod h1:T+wALwcMOSE0kXgUAnPAHqTLW+XHgcELELW8VaDgm/M= -golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= -golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= -golang.org/x/mod v0.12.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= -golang.org/x/mod v0.15.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= -golang.org/x/mod v0.17.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= -golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= -golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= -golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= -golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= -golang.org/x/net v0.15.0/go.mod h1:idbUs1IY1+zTqbi8yxTbhexhEEk5ur9LInksu6HrEpk= -golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44= -golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM= -golang.org/x/net v0.27.0/go.mod h1:dDi0PyhWNoiUOrAS8uXv/vnScO4wnHQO4mj9fn/RytE= -golang.org/x/net v0.28.0 h1:a9JDOJc5GMUJ0+UDqmLT86WiEy7iWyIhz8gz8E4e5hE= -golang.org/x/net v0.28.0/go.mod h1:yqtgsTWOOnlGLG9GFRrK3++bGOUEkNBoHZc8MEDWPNg= -golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y= -golang.org/x/sync v0.6.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= -golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= -golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/sys v0.22.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/sys v0.24.0 h1:Twjiwq9dn6R1fQcyiK+wQyHWfaz/BJB+YIpzU/Cv3Xg= -golang.org/x/sys v0.24.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/telemetry v0.0.0-20240228155512-f48c80bd79b2/go.mod h1:TeRTkGYfJXctD9OcfyVLyj2J3IxLnKwHJR8f4D8a3YE= -golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= -golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= -golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= -golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo= -golang.org/x/term v0.12.0/go.mod h1:owVbMEjm3cBLCHdkQu9b1opXd4ETQWc3BhuQGKgXgvU= -golang.org/x/term v0.17.0/go.mod h1:lLRBjIVuehSbZlaOtGMbcMncT+aqLLLmKrsjNrUguwk= -golang.org/x/term v0.20.0/go.mod h1:8UkIAJTvZgivsXaD6/pH6U9ecQzZ45awqEOzuCvwpFY= -golang.org/x/term v0.22.0/go.mod h1:F3qCibpT5AMpCRfhfT53vVJwhLtIVHhB9XDjfFvnMI4= -golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= -golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= -golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= -golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= -golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= -golang.org/x/text v0.15.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= -golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI= +github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= +github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= +golang.org/x/net v0.30.0 h1:AcW1SDZMkb8IpzCdQUaIq2sP4sZ4zw+55h6ynffypl4= +golang.org/x/net v0.30.0/go.mod h1:2wGyMJ5iFasEhkwi13ChkO/t1ECNC4X4eBKkVFyYFlU= +golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo= +golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/time v0.6.0 h1:eTDhh4ZXt5Qf0augr54TN6suAUudPcawVZeIAPU7D4U= golang.org/x/time v0.6.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= -golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= -golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= -golang.org/x/tools v0.13.0/go.mod h1:HvlwmtVNQAhOuCjW7xxvovg8wbNq7LwfXh/k7wXUl58= -golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d/go.mod h1:aiJjzUbINMkxbQROHiO6hDPo2LHcIPhhQsa9DLh0yGk= -golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg= -google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw= +google.golang.org/protobuf v1.35.1 h1:m3LfL6/Ca+fqnjnlqQXNpFPABW1UD7mjh8KO2mKFytA= +google.golang.org/protobuf v1.35.1/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= diff --git a/vendor/github.com/go-resty/resty/v2/BUILD.bazel b/vendor/github.com/go-resty/resty/v2/BUILD.bazel index e41515b..7248abc 100644 --- a/vendor/github.com/go-resty/resty/v2/BUILD.bazel +++ b/vendor/github.com/go-resty/resty/v2/BUILD.bazel @@ -1,5 +1,5 @@ -load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test") load("@bazel_gazelle//:def.bzl", "gazelle") +load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test") # gazelle:prefix github.com/go-resty/resty/v2 # gazelle:go_naming_convention import_alias @@ -17,17 +17,19 @@ go_library( "resty.go", "retry.go", "trace.go", - "transport_js.go", - "transport_other.go", "transport.go", "transport112.go", + "transport_js.go", + "transport_other.go", "util.go", "util_curl.go", - "shellescape/shellescape.go" ], importpath = "github.com/go-resty/resty/v2", visibility = ["//visibility:public"], - deps = ["@org_golang_x_net//publicsuffix:go_default_library"], + deps = [ + "//shellescape", + "@org_golang_x_net//publicsuffix:go_default_library", + ], ) go_test( @@ -36,6 +38,7 @@ go_test( "client_test.go", "context_test.go", "example_test.go", + "middleware_test.go", "request_test.go", "resty_test.go", "retry_test.go", @@ -43,7 +46,10 @@ go_test( ], data = glob([".testdata/*"]), embed = [":resty"], - deps = ["@org_golang_x_net//proxy:go_default_library"], + deps = [ + "@org_golang_x_net//proxy:go_default_library", + "@org_golang_x_time//rate:go_default_library", + ], ) alias( diff --git a/vendor/github.com/go-resty/resty/v2/README.md b/vendor/github.com/go-resty/resty/v2/README.md index 2d3542b..68f9209 100644 --- a/vendor/github.com/go-resty/resty/v2/README.md +++ b/vendor/github.com/go-resty/resty/v2/README.md @@ -4,16 +4,12 @@

Features section describes in detail about Resty capabilities

-

Build Status Code Coverage Go Report Card Release Version GoDoc License Mentioned in Awesome Go

-

-

-

Resty Communication Channels

-

Chat on Gitter - Resty Community Twitter @go_resty

+

Build Status Code Coverage Go Report Card Release Version GoDoc License Mentioned in Awesome Go

## News - * v2.14.0 [released](https://github.com/go-resty/resty/releases/tag/v2.14.0) and tagged on Aug 04, 2024. + * v2.15.3 [released](https://github.com/go-resty/resty/releases/tag/v2.15.3) and tagged on Sep 26, 2024. * v2.0.0 [released](https://github.com/go-resty/resty/releases/tag/v2.0.0) and tagged on Jul 16, 2019. * v1.12.0 [released](https://github.com/go-resty/resty/releases/tag/v1.12.0) and tagged on Feb 27, 2019. * v1.0 released and tagged on Sep 25, 2017. - Resty's first version was released on Sep 15, 2015 then it grew gradually as a very handy and helpful library. Its been a two years since first release. I'm very thankful to Resty users and its [contributors](https://github.com/go-resty/resty/graphs/contributors). @@ -62,9 +58,10 @@ * goroutine concurrent safe * Resty Client trace, see [Client.EnableTrace](https://pkg.go.dev/github.com/go-resty/resty/v2#Client.EnableTrace) and [Request.EnableTrace](https://pkg.go.dev/github.com/go-resty/resty/v2#Request.EnableTrace) * Since v2.4.0, trace info contains a `RequestAttempt` value, and the `Request` object contains an `Attempt` attribute + * Supports on-demand CURL command generation, see [Client.EnableGenerateCurlOnDebug](https://pkg.go.dev/github.com/go-resty/resty/v2#Client.EnableGenerateCurlOnDebug), [Request.EnableGenerateCurlOnDebug](https://pkg.go.dev/github.com/go-resty/resty/v2#Request.EnableGenerateCurlOnDebug). It requires debug mode to be enabled. * Debug mode - clean and informative logging presentation * Gzip - Go does it automatically also resty has fallback handling too - * Works fine with `HTTP/2` and `HTTP/1.1` + * Works fine with `HTTP/2` and `HTTP/1.1`, also `HTTP/3` can be used with Resty, see this [comment](https://github.com/go-resty/resty/issues/846#issuecomment-2329696110) * [Bazel support](#bazel-support) * Easily mock Resty for testing, [for e.g.](#mocking-http-requests-using-httpmock-library) * Well tested client library @@ -86,7 +83,7 @@ #### Supported Go Versions -Recommended to use `go1.16` and above. +Recommended to use `go1.20` and above. Initially Resty started supporting `go modules` since `v1.10.0` release. @@ -101,8 +98,6 @@ Starting Resty v2 and higher versions, it fully embraces [go modules](https://gi Resty author also published following projects for Go Community. - * [aah framework](https://aahframework.org) - A secure, flexible, rapid Go web framework. - * [THUMBAI](https://thumbai.app) - Go Mod Repository, Go Vanity Service and Simple Proxy Server. * [go-model](https://github.com/jeevatkm/go-model) - Robust & Easy to use model mapper and utility methods for Go `struct`. @@ -110,7 +105,7 @@ Resty author also published following projects for Go Community. ```bash # Go Modules -require github.com/go-resty/resty/v2 v2.11.0 +require github.com/go-resty/resty/v2 v2.15.3 ``` ## Usage @@ -131,11 +126,6 @@ client := resty.New() resp, err := client.R(). EnableTrace(). Get("https://httpbin.org/get") -curlCmdExecuted := resp.Request.GenerateCurlCommand() - - -// Explore curl command -fmt.Println("Curl Command:\n ", curlCmdExecuted+"\n") // Explore response object fmt.Println("Response Info:") @@ -165,9 +155,6 @@ fmt.Println(" RequestAttempt:", ti.RequestAttempt) fmt.Println(" RemoteAddr :", ti.RemoteAddr.String()) /* Output -Curl Command: - curl -X GET -H 'User-Agent: go-resty/2.12.0 (https://github.com/go-resty/resty)' https://httpbin.org/get - Response Info: Error : Status Code: 200 @@ -566,6 +553,30 @@ client.OnError(func(req *resty.Request, err error) { }) ``` +#### Generate CURL Command +>Refer: [curl_cmd_test.go](https://github.com/go-resty/resty/blob/v2/curl_cmd_test.go) + +```go +// Create a Resty Client +client := resty.New() + +resp, err := client.R(). + SetDebug(true). + EnableGenerateCurlOnDebug(). // CURL command generated when debug mode enabled with this option + SetBody(map[string]string{"name": "Alex"}). + Post("https://httpbin.org/post") + +curlCmdExecuted := resp.Request.GenerateCurlCommand() + +// Explore curl command +fmt.Println("Curl Command:\n ", curlCmdExecuted+"\n") + +/* Output +Curl Command: + curl -X POST -H 'Content-Type: application/json' -H 'User-Agent: go-resty/2.14.0 (https://github.com/go-resty/resty)' -d '{"name":"Alex"}' https://httpbin.org/post +*/ +``` + #### Redirect Policy Resty provides few ready to use redirect policy(s) also it supports multiple policies together. diff --git a/vendor/github.com/go-resty/resty/v2/WORKSPACE b/vendor/github.com/go-resty/resty/v2/WORKSPACE index 9ef03e9..504de14 100644 --- a/vendor/github.com/go-resty/resty/v2/WORKSPACE +++ b/vendor/github.com/go-resty/resty/v2/WORKSPACE @@ -4,10 +4,10 @@ load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") http_archive( name = "io_bazel_rules_go", - sha256 = "69de5c704a05ff37862f7e0f5534d4f479418afc21806c887db544a316f3cb6b", + sha256 = "80a98277ad1311dacd837f9b16db62887702e9f1d1c4c9f796d0121a46c8e184", urls = [ - "https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.27.0/rules_go-v0.27.0.tar.gz", - "https://github.com/bazelbuild/rules_go/releases/download/v0.27.0/rules_go-v0.27.0.tar.gz", + "https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.46.0/rules_go-v0.46.0.zip", + "https://github.com/bazelbuild/rules_go/releases/download/v0.46.0/rules_go-v0.46.0.zip", ], ) @@ -24,7 +24,7 @@ load("@io_bazel_rules_go//go:deps.bzl", "go_register_toolchains", "go_rules_depe go_rules_dependencies() -go_register_toolchains(version = "1.16") +go_register_toolchains(version = "1.19") load("@bazel_gazelle//:deps.bzl", "gazelle_dependencies") diff --git a/vendor/github.com/go-resty/resty/v2/client.go b/vendor/github.com/go-resty/resty/v2/client.go index aeb5507..87a88da 100644 --- a/vendor/github.com/go-resty/resty/v2/client.go +++ b/vendor/github.com/go-resty/resty/v2/client.go @@ -92,11 +92,11 @@ type ( SuccessHook func(*Client, *Response) ) -// Client struct is used to create Resty client with client level settings, -// these settings are applicable to all the request raised from the client. +// Client struct is used to create a Resty client with client-level settings, +// these settings apply to all the requests raised from the client. // -// Resty also provides an options to override most of the client settings -// at request level. +// Resty also provides an option to override most of the client settings +// at [Request] level. type Client struct { BaseURL string HostURL string // Deprecated: use BaseURL instead. To be removed in v3.0.0 release. @@ -128,6 +128,7 @@ type Client struct { // HeaderAuthorizationKey is used to set/access Request Authorization header // value when `SetAuthToken` option is used. HeaderAuthorizationKey string + ResponseBodyLimit int jsonEscapeHTML bool setContentLength bool @@ -153,6 +154,7 @@ type Client struct { invalidHooks []ErrorHook panicHooks []ErrorHook rateLimiter RateLimiter + generateCurlOnDebug bool } // User type is to hold an username and password information @@ -164,8 +166,8 @@ type User struct { // Client methods //___________________________________ -// SetHostURL method is to set Host URL in the client instance. It will be used with request -// raised from this client with relative URL +// SetHostURL method sets the Host URL in the client instance. It will be used with a request +// raised from this client with a relative URL // // // Setting HTTP address // client.SetHostURL("http://myjeeva.com") @@ -173,22 +175,20 @@ type User struct { // // Setting HTTPS address // client.SetHostURL("https://myjeeva.com") // -// Deprecated: use SetBaseURL instead. To be removed in v3.0.0 release. +// Deprecated: use [Client.SetBaseURL] instead. To be removed in the v3.0.0 release. func (c *Client) SetHostURL(url string) *Client { c.SetBaseURL(url) return c } -// SetBaseURL method is to set Base URL in the client instance. It will be used with request -// raised from this client with relative URL +// SetBaseURL method sets the Base URL in the client instance. It will be used with a request +// raised from this client with a relative URL // // // Setting HTTP address // client.SetBaseURL("http://myjeeva.com") // // // Setting HTTPS address // client.SetBaseURL("https://myjeeva.com") -// -// Since v2.7.0 func (c *Client) SetBaseURL(url string) *Client { c.BaseURL = strings.TrimRight(url, "/") c.HostURL = c.BaseURL @@ -196,10 +196,10 @@ func (c *Client) SetBaseURL(url string) *Client { } // SetHeader method sets a single header field and its value in the client instance. -// These headers will be applied to all requests raised from this client instance. -// Also it can be overridden at request level header options. +// These headers will be applied to all requests from this client instance. +// Also, it can be overridden by request-level header options. // -// See `Request.SetHeader` or `Request.SetHeaders`. +// See [Request.SetHeader] or [Request.SetHeaders]. // // For Example: To set `Content-Type` and `Accept` as `application/json` // @@ -211,11 +211,11 @@ func (c *Client) SetHeader(header, value string) *Client { return c } -// SetHeaders method sets multiple headers field and its values at one go in the client instance. -// These headers will be applied to all requests raised from this client instance. Also it can be +// SetHeaders method sets multiple header fields and their values at one go in the client instance. +// These headers will be applied to all requests from this client instance. Also, it can be // overridden at request level headers options. // -// See `Request.SetHeaders` or `Request.SetHeader`. +// See [Request.SetHeaders] or [Request.SetHeader]. // // For Example: To set `Content-Type` and `Accept` as `application/json` // @@ -230,25 +230,21 @@ func (c *Client) SetHeaders(headers map[string]string) *Client { return c } -// SetHeaderVerbatim method is to set a single header field and its value verbatim in the current request. +// SetHeaderVerbatim method sets a single header field and its value verbatim in the current request. // // For Example: To set `all_lowercase` and `UPPERCASE` as `available`. // -// client.R(). +// client. // SetHeaderVerbatim("all_lowercase", "available"). // SetHeaderVerbatim("UPPERCASE", "available") -// -// Also you can override header value, which was set at client instance level. -// -// Since v2.6.0 func (c *Client) SetHeaderVerbatim(header, value string) *Client { c.Header[header] = []string{value} return c } -// SetCookieJar method sets custom http.CookieJar in the resty client. Its way to override default. +// SetCookieJar method sets custom [http.CookieJar] in the resty client. It's a way to override the default. // -// For Example: sometimes we don't want to save cookies in api contacting, we can remove the default +// For Example, sometimes we don't want to save cookies in API mode so that we can remove the default // CookieJar in resty client. // // client.SetCookieJar(nil) @@ -257,8 +253,8 @@ func (c *Client) SetCookieJar(jar http.CookieJar) *Client { return c } -// SetCookie method appends a single cookie in the client instance. -// These cookies will be added to all the request raised from this client instance. +// SetCookie method appends a single cookie to the client instance. +// These cookies will be added to all the requests from this client instance. // // client.SetCookie(&http.Cookie{ // Name:"go-resty", @@ -270,7 +266,7 @@ func (c *Client) SetCookie(hc *http.Cookie) *Client { } // SetCookies method sets an array of cookies in the client instance. -// These cookies will be added to all the request raised from this client instance. +// These cookies will be added to all the requests from this client instance. // // cookies := []*http.Cookie{ // &http.Cookie{ @@ -290,14 +286,15 @@ func (c *Client) SetCookies(cs []*http.Cookie) *Client { return c } -// SetQueryParam method sets single parameter and its value in the client instance. -// It will be formed as query string for the request. +// SetQueryParam method sets a single parameter and its value in the client instance. +// It will be formed as a query string for the request. +// +// For Example: `search=kitchen%20papers&size=large` // -// For Example: `search=kitchen%20papers&size=large` -// in the URL after `?` mark. These query params will be added to all the request raised from -// this client instance. Also it can be overridden at request level Query Param options. +// In the URL after the `?` mark. These query params will be added to all the requests raised from +// this client instance. Also, it can be overridden at the request level. // -// See `Request.SetQueryParam` or `Request.SetQueryParams`. +// See [Request.SetQueryParam] or [Request.SetQueryParams]. // // client. // SetQueryParam("search", "kitchen papers"). @@ -308,13 +305,14 @@ func (c *Client) SetQueryParam(param, value string) *Client { } // SetQueryParams method sets multiple parameters and their values at one go in the client instance. -// It will be formed as query string for the request. +// It will be formed as a query string for the request. +// +// For Example: `search=kitchen%20papers&size=large` // -// For Example: `search=kitchen%20papers&size=large` -// in the URL after `?` mark. These query params will be added to all the request raised from this -// client instance. Also it can be overridden at request level Query Param options. +// In the URL after the `?` mark. These query params will be added to all the requests raised from this +// client instance. Also, it can be overridden at the request level. // -// See `Request.SetQueryParams` or `Request.SetQueryParam`. +// See [Request.SetQueryParams] or [Request.SetQueryParam]. // // client.SetQueryParams(map[string]string{ // "search": "kitchen papers", @@ -328,11 +326,11 @@ func (c *Client) SetQueryParams(params map[string]string) *Client { } // SetFormData method sets Form parameters and their values in the client instance. -// It's applicable only HTTP method `POST` and `PUT` and request content type would be set as -// `application/x-www-form-urlencoded`. These form data will be added to all the request raised from -// this client instance. Also it can be overridden at request level form data. +// It applies only to HTTP methods `POST` and `PUT`, and the request content type would be set as +// `application/x-www-form-urlencoded`. These form data will be added to all the requests raised from +// this client instance. Also, it can be overridden at the request level. // -// See `Request.SetFormData`. +// See [Request.SetFormData]. // // client.SetFormData(map[string]string{ // "access_token": "BC594900-518B-4F7E-AC75-BD37F019E08F", @@ -353,17 +351,17 @@ func (c *Client) SetFormData(data map[string]string) *Client { // // client.SetBasicAuth("go-resty", "welcome") // -// This basic auth information gets added to all the request raised from this client instance. -// Also it can be overridden or set one at the request level is supported. +// This basic auth information is added to all requests from this client instance. +// It can also be overridden at the request level. // -// See `Request.SetBasicAuth`. +// See [Request.SetBasicAuth]. func (c *Client) SetBasicAuth(username, password string) *Client { c.UserInfo = &User{Username: username, Password: password} return c } // SetAuthToken method sets the auth token of the `Authorization` header for all HTTP requests. -// The default auth scheme is `Bearer`, it can be customized with the method `SetAuthScheme`. For Example: +// The default auth scheme is `Bearer`; it can be customized with the method [Client.SetAuthScheme]. For Example: // // Authorization: // @@ -372,9 +370,9 @@ func (c *Client) SetBasicAuth(username, password string) *Client { // client.SetAuthToken("BC594900518B4F7EAC75BD37F019E08FBC594900518B4F7EAC75BD37F019E08F") // // This auth token gets added to all the requests raised from this client instance. -// Also it can be overridden or set one at the request level is supported. +// Also, it can be overridden at the request level. // -// See `Request.SetAuthToken`. +// See [Request.SetAuthToken]. func (c *Client) SetAuthToken(token string) *Client { c.Token = token return c @@ -389,15 +387,14 @@ func (c *Client) SetAuthToken(token string) *Client { // client.SetAuthScheme("OAuth") // // This auth scheme gets added to all the requests raised from this client instance. -// Also it can be overridden or set one at the request level is supported. +// Also, it can be overridden at the request level. // -// Information about auth schemes can be found in RFC7235 which is linked to below -// along with the page containing the currently defined official authentication schemes: +// Information about auth schemes can be found in [RFC 7235], IANA [HTTP Auth schemes]. // -// https://tools.ietf.org/html/rfc7235 -// https://www.iana.org/assignments/http-authschemes/http-authschemes.xhtml#authschemes +// See [Request.SetAuthToken]. // -// See `Request.SetAuthToken`. +// [RFC 7235]: https://tools.ietf.org/html/rfc7235 +// [HTTP Auth schemes]: https://www.iana.org/assignments/http-authschemes/http-authschemes.xhtml#authschemes func (c *Client) SetAuthScheme(scheme string) *Client { c.AuthScheme = scheme return c @@ -410,11 +407,11 @@ func (c *Client) SetAuthScheme(scheme string) *Client { // // client.SetDigestAuth("Mufasa", "Circle Of Life") // -// Information about Digest Access Authentication can be found in RFC7616: +// Information about Digest Access Authentication can be found in [RFC 7616]. // -// https://datatracker.ietf.org/doc/html/rfc7616 +// See [Request.SetDigestAuth]. // -// See `Request.SetDigestAuth`. +// [RFC 7616]: https://datatracker.ietf.org/doc/html/rfc7616 func (c *Client) SetDigestAuth(username, password string) *Client { oldTransport := c.httpClient.Transport c.OnBeforeRequest(func(c *Client, _ *Request) error { @@ -431,7 +428,7 @@ func (c *Client) SetDigestAuth(username, password string) *Client { return c } -// R method creates a new request instance, its used for Get, Post, Put, Delete, Patch, Head, Options, etc. +// R method creates a new request instance; it's used for Get, Post, Put, Delete, Patch, Head, Options, etc. func (c *Client) R() *Request { r := &Request{ QueryParam: url.Values{}, @@ -442,30 +439,31 @@ func (c *Client) R() *Request { RawPathParams: map[string]string{}, Debug: c.Debug, - client: c, - multipartFiles: []*File{}, - multipartFields: []*MultipartField{}, - jsonEscapeHTML: c.jsonEscapeHTML, - log: c.log, + client: c, + multipartFiles: []*File{}, + multipartFields: []*MultipartField{}, + jsonEscapeHTML: c.jsonEscapeHTML, + log: c.log, + responseBodyLimit: c.ResponseBodyLimit, + generateCurlOnDebug: c.generateCurlOnDebug, } return r } -// NewRequest is an alias for method `R()`. Creates a new request instance, its used for -// Get, Post, Put, Delete, Patch, Head, Options, etc. +// NewRequest method is an alias for method `R()`. func (c *Client) NewRequest() *Request { return c.R() } -// OnBeforeRequest method appends a request middleware into the before request chain. -// The user defined middlewares get applied before the default Resty request middlewares. +// OnBeforeRequest method appends a request middleware to the before request chain. +// The user-defined middlewares are applied before the default Resty request middlewares. // After all middlewares have been applied, the request is sent from Resty to the host server. // // client.OnBeforeRequest(func(c *resty.Client, r *resty.Request) error { -// // Now you have access to Client and Request instance +// // Now you have access to the Client and Request instance // // manipulate it as per your need // -// return nil // if its success otherwise return error +// return nil // if its successful otherwise return error // }) func (c *Client) OnBeforeRequest(m RequestMiddleware) *Client { c.udBeforeRequestLock.Lock() @@ -476,15 +474,15 @@ func (c *Client) OnBeforeRequest(m RequestMiddleware) *Client { return c } -// OnAfterResponse method appends response middleware into the after response chain. -// Once we receive response from host server, default Resty response middleware -// gets applied and then user assigned response middlewares applied. +// OnAfterResponse method appends response middleware to the after-response chain. +// Once we receive a response from the host server, the default Resty response middleware +// gets applied, and then the user-assigned response middleware is applied. // // client.OnAfterResponse(func(c *resty.Client, r *resty.Response) error { -// // Now you have access to Client and Response instance +// // Now you have access to the Client and Response instance // // manipulate it as per your need // -// return nil // if its success otherwise return error +// return nil // if its successful otherwise return error // }) func (c *Client) OnAfterResponse(m ResponseMiddleware) *Client { c.afterResponseLock.Lock() @@ -497,7 +495,7 @@ func (c *Client) OnAfterResponse(m ResponseMiddleware) *Client { // OnError method adds a callback that will be run whenever a request execution fails. // This is called after all retries have been attempted (if any). -// If there was a response from the server, the error will be wrapped in *ResponseError +// If there was a response from the server, the error will be wrapped in [ResponseError] // which has the last response received from the server. // // client.OnError(func(req *resty.Request, err error) { @@ -507,8 +505,8 @@ func (c *Client) OnAfterResponse(m ResponseMiddleware) *Client { // // Log the error, increment a metric, etc... // }) // -// Out of the OnSuccess, OnError, OnInvalid, OnPanic callbacks, exactly one -// set will be invoked for each call to Request.Execute() that completes. +// Out of the [Client.OnSuccess], [Client.OnError], [Client.OnInvalid], [Client.OnPanic] +// callbacks, exactly one set will be invoked for each call to [Request.Execute] that completes. func (c *Client) OnError(h ErrorHook) *Client { c.errorHooks = append(c.errorHooks, h) return c @@ -517,10 +515,8 @@ func (c *Client) OnError(h ErrorHook) *Client { // OnSuccess method adds a callback that will be run whenever a request execution // succeeds. This is called after all retries have been attempted (if any). // -// Out of the OnSuccess, OnError, OnInvalid, OnPanic callbacks, exactly one -// set will be invoked for each call to Request.Execute() that completes. -// -// Since v2.8.0 +// Out of the [Client.OnSuccess], [Client.OnError], [Client.OnInvalid], [Client.OnPanic] +// callbacks, exactly one set will be invoked for each call to [Request.Execute] that completes. func (c *Client) OnSuccess(h SuccessHook) *Client { c.successHooks = append(c.successHooks, h) return c @@ -529,10 +525,8 @@ func (c *Client) OnSuccess(h SuccessHook) *Client { // OnInvalid method adds a callback that will be run whenever a request execution // fails before it starts because the request is invalid. // -// Out of the OnSuccess, OnError, OnInvalid, OnPanic callbacks, exactly one -// set will be invoked for each call to Request.Execute() that completes. -// -// Since v2.8.0 +// Out of the [Client.OnSuccess], [Client.OnError], [Client.OnInvalid], [Client.OnPanic] +// callbacks, exactly one set will be invoked for each call to [Request.Execute] that completes. func (c *Client) OnInvalid(h ErrorHook) *Client { c.invalidHooks = append(c.invalidHooks, h) return c @@ -541,21 +535,20 @@ func (c *Client) OnInvalid(h ErrorHook) *Client { // OnPanic method adds a callback that will be run whenever a request execution // panics. // -// Out of the OnSuccess, OnError, OnInvalid, OnPanic callbacks, exactly one -// set will be invoked for each call to Request.Execute() that completes. -// If an OnSuccess, OnError, or OnInvalid callback panics, then the exactly -// one rule can be violated. +// Out of the [Client.OnSuccess], [Client.OnError], [Client.OnInvalid], [Client.OnPanic] +// callbacks, exactly one set will be invoked for each call to [Request.Execute] that completes. // -// Since v2.8.0 +// If an [Client.OnSuccess], [Client.OnError], or [Client.OnInvalid] callback panics, +// then exactly one rule can be violated. func (c *Client) OnPanic(h ErrorHook) *Client { c.panicHooks = append(c.panicHooks, h) return c } -// SetPreRequestHook method sets the given pre-request function into resty client. +// SetPreRequestHook method sets the given pre-request function into a resty client. // It is called right before the request is fired. // -// Note: Only one pre-request hook can be registered. Use `client.OnBeforeRequest` for multiple. +// NOTE: Only one pre-request hook can be registered. Use [Client.OnBeforeRequest] for multiple. func (c *Client) SetPreRequestHook(h PreRequestHook) *Client { if c.preReqHook != nil { c.log.Warnf("Overwriting an existing pre-request hook: %s", functionName(h)) @@ -564,19 +557,23 @@ func (c *Client) SetPreRequestHook(h PreRequestHook) *Client { return c } -// SetDebug method enables the debug mode on Resty client. Client logs details of every request and response. -// For `Request` it logs information such as HTTP verb, Relative URL path, Host, Headers, Body if it has one. -// For `Response` it logs information such as Status, Response Time, Headers, Body if it has one. +// SetDebug method enables the debug mode on the Resty client. The client logs details +// of every request and response. // // client.SetDebug(true) // -// Also it can be enabled at request level for particular request, see `Request.SetDebug`. +// Also, it can be enabled at the request level for a particular request; see [Request.SetDebug]. +// - For [Request], it logs information such as HTTP verb, Relative URL path, +// Host, Headers, and Body if it has one. +// - For [Response], it logs information such as Status, Response Time, Headers, +// and Body if it has one. func (c *Client) SetDebug(d bool) *Client { c.Debug = d return c } -// SetDebugBodyLimit sets the maximum size for which the response and request body will be logged in debug mode. +// SetDebugBodyLimit sets the maximum size in bytes for which the response and +// request body will be logged in debug mode. // // client.SetDebugBodyLimit(1000000) func (c *Client) SetDebugBodyLimit(sl int64) *Client { @@ -584,8 +581,8 @@ func (c *Client) SetDebugBodyLimit(sl int64) *Client { return c } -// OnRequestLog method used to set request log callback into Resty. Registered callback gets -// called before the resty actually logs the information. +// OnRequestLog method sets the request log callback to Resty. Registered callback gets +// called before the resty logs the information. func (c *Client) OnRequestLog(rl RequestLogCallback) *Client { if c.requestLog != nil { c.log.Warnf("Overwriting an existing on-request-log callback from=%s to=%s", @@ -595,8 +592,8 @@ func (c *Client) OnRequestLog(rl RequestLogCallback) *Client { return c } -// OnResponseLog method used to set response log callback into Resty. Registered callback gets -// called before the resty actually logs the information. +// OnResponseLog method sets the response log callback to Resty. Registered callback gets +// called before the resty logs the information. func (c *Client) OnResponseLog(rl ResponseLogCallback) *Client { if c.responseLog != nil { c.log.Warnf("Overwriting an existing on-response-log callback from=%s to=%s", @@ -606,9 +603,9 @@ func (c *Client) OnResponseLog(rl ResponseLogCallback) *Client { return c } -// SetDisableWarn method disables the warning message on Resty client. +// SetDisableWarn method disables the warning log message on the Resty client. // -// For Example: Resty warns the user when BasicAuth used on non-TLS mode. +// For example, Resty warns users when BasicAuth is used in non-TLS mode. // // client.SetDisableWarn(true) func (c *Client) SetDisableWarn(d bool) *Client { @@ -616,9 +613,9 @@ func (c *Client) SetDisableWarn(d bool) *Client { return c } -// SetAllowGetMethodPayload method allows the GET method with payload on Resty client. +// SetAllowGetMethodPayload method allows the GET method with payload on the Resty client. // -// For Example: Resty allows the user sends request with a payload on HTTP GET method. +// For example, Resty allows the user to send a request with a payload using the HTTP GET method. // // client.SetAllowGetMethodPayload(true) func (c *Client) SetAllowGetMethodPayload(a bool) *Client { @@ -628,24 +625,24 @@ func (c *Client) SetAllowGetMethodPayload(a bool) *Client { // SetLogger method sets given writer for logging Resty request and response details. // -// Compliant to interface `resty.Logger`. +// Compliant to interface [resty.Logger] func (c *Client) SetLogger(l Logger) *Client { c.log = l return c } // SetContentLength method enables the HTTP header `Content-Length` value for every request. -// By default Resty won't set `Content-Length`. +// By default, Resty won't set `Content-Length`. // // client.SetContentLength(true) // -// Also you have an option to enable for particular request. See `Request.SetContentLength` +// Also, you have the option to enable a particular request. See [Request.SetContentLength] func (c *Client) SetContentLength(l bool) *Client { c.setContentLength = l return c } -// SetTimeout method sets timeout for request raised from client. +// SetTimeout method sets the timeout for a request raised by the client. // // client.SetTimeout(time.Duration(1 * time.Minute)) func (c *Client) SetTimeout(timeout time.Duration) *Client { @@ -653,9 +650,9 @@ func (c *Client) SetTimeout(timeout time.Duration) *Client { return c } -// SetError method is to register the global or client common `Error` object into Resty. -// It is used for automatic unmarshalling if response status code is greater than 399 and -// content type either JSON or XML. Can be pointer or non-pointer. +// SetError method registers the global or client common `Error` object into Resty. +// It is used for automatic unmarshalling if the response status code is greater than 399 and +// content type is JSON or XML. It can be a pointer or a non-pointer. // // client.SetError(&Error{}) // // OR @@ -665,8 +662,8 @@ func (c *Client) SetError(err interface{}) *Client { return c } -// SetRedirectPolicy method sets the client redirect policy. Resty provides ready to use -// redirect policies. Wanna create one for yourself refer to `redirect.go`. +// SetRedirectPolicy method sets the redirect policy for the client. Resty provides ready-to-use +// redirect policies. Wanna create one for yourself, refer to `redirect.go`. // // client.SetRedirectPolicy(FlexibleRedirectPolicy(20)) // @@ -699,7 +696,7 @@ func (c *Client) SetRetryCount(count int) *Client { return c } -// SetRetryWaitTime method sets default wait time to sleep before retrying +// SetRetryWaitTime method sets the default wait time for sleep before retrying // request. // // Default is 100 milliseconds. @@ -708,7 +705,7 @@ func (c *Client) SetRetryWaitTime(waitTime time.Duration) *Client { return c } -// SetRetryMaxWaitTime method sets max wait time to sleep before retrying +// SetRetryMaxWaitTime method sets the max wait time for sleep before retrying // request. // // Default is 2 seconds. @@ -717,7 +714,7 @@ func (c *Client) SetRetryMaxWaitTime(maxWaitTime time.Duration) *Client { return c } -// SetRetryAfter sets callback to calculate wait time between retries. +// SetRetryAfter sets a callback to calculate the wait time between retries. // Default (nil) implies exponential backoff with jitter func (c *Client) SetRetryAfter(callback RetryAfterFunc) *Client { c.RetryAfter = callback @@ -725,56 +722,46 @@ func (c *Client) SetRetryAfter(callback RetryAfterFunc) *Client { } // SetJSONMarshaler method sets the JSON marshaler function to marshal the request body. -// By default, Resty uses `encoding/json` package to marshal the request body. -// -// Since v2.8.0 +// By default, Resty uses [encoding/json] package to marshal the request body. func (c *Client) SetJSONMarshaler(marshaler func(v interface{}) ([]byte, error)) *Client { c.JSONMarshal = marshaler return c } // SetJSONUnmarshaler method sets the JSON unmarshaler function to unmarshal the response body. -// By default, Resty uses `encoding/json` package to unmarshal the response body. -// -// Since v2.8.0 +// By default, Resty uses [encoding/json] package to unmarshal the response body. func (c *Client) SetJSONUnmarshaler(unmarshaler func(data []byte, v interface{}) error) *Client { c.JSONUnmarshal = unmarshaler return c } // SetXMLMarshaler method sets the XML marshaler function to marshal the request body. -// By default, Resty uses `encoding/xml` package to marshal the request body. -// -// Since v2.8.0 +// By default, Resty uses [encoding/xml] package to marshal the request body. func (c *Client) SetXMLMarshaler(marshaler func(v interface{}) ([]byte, error)) *Client { c.XMLMarshal = marshaler return c } // SetXMLUnmarshaler method sets the XML unmarshaler function to unmarshal the response body. -// By default, Resty uses `encoding/xml` package to unmarshal the response body. -// -// Since v2.8.0 +// By default, Resty uses [encoding/xml] package to unmarshal the response body. func (c *Client) SetXMLUnmarshaler(unmarshaler func(data []byte, v interface{}) error) *Client { c.XMLUnmarshal = unmarshaler return c } -// AddRetryCondition method adds a retry condition function to array of functions +// AddRetryCondition method adds a retry condition function to an array of functions // that are checked to determine if the request is retried. The request will -// retry if any of the functions return true and error is nil. +// retry if any functions return true and the error is nil. // -// Note: These retry conditions are applied on all Request made using this Client. -// For Request specific retry conditions check *Request.AddRetryCondition +// NOTE: These retry conditions are applied on all requests made using this Client. +// For [Request] specific retry conditions, check [Request.AddRetryCondition] func (c *Client) AddRetryCondition(condition RetryConditionFunc) *Client { c.RetryConditions = append(c.RetryConditions, condition) return c } // AddRetryAfterErrorCondition adds the basic condition of retrying after encountering -// an error from the http response -// -// Since v2.6.0 +// an error from the HTTP response func (c *Client) AddRetryAfterErrorCondition() *Client { c.AddRetryCondition(func(response *Response, err error) bool { return response.IsError() @@ -784,33 +771,29 @@ func (c *Client) AddRetryAfterErrorCondition() *Client { // AddRetryHook adds a side-effecting retry hook to an array of hooks // that will be executed on each retry. -// -// Since v2.6.0 func (c *Client) AddRetryHook(hook OnRetryFunc) *Client { c.RetryHooks = append(c.RetryHooks, hook) return c } // SetRetryResetReaders method enables the Resty client to seek the start of all -// file readers given as multipart files, if the given object implements `io.ReadSeeker`. -// -// Since ... +// file readers are given as multipart files if the object implements [io.ReadSeeker]. func (c *Client) SetRetryResetReaders(b bool) *Client { c.RetryResetReaders = b return c } -// SetTLSClientConfig method sets TLSClientConfig for underling client Transport. +// SetTLSClientConfig method sets TLSClientConfig for underlying client Transport. // // For Example: // -// // One can set custom root-certificate. Refer: http://golang.org/pkg/crypto/tls/#example_Dial +// // One can set a custom root certificate. Refer: http://golang.org/pkg/crypto/tls/#example_Dial // client.SetTLSClientConfig(&tls.Config{ RootCAs: roots }) // // // or One can disable security check (https) // client.SetTLSClientConfig(&tls.Config{ InsecureSkipVerify: true }) // -// Note: This method overwrites existing `TLSClientConfig`. +// NOTE: This method overwrites existing [http.Transport.TLSClientConfig] func (c *Client) SetTLSClientConfig(config *tls.Config) *Client { transport, err := c.Transport() if err != nil { @@ -821,13 +804,11 @@ func (c *Client) SetTLSClientConfig(config *tls.Config) *Client { return c } -// SetProxy method sets the Proxy URL and Port for Resty client. +// SetProxy method sets the Proxy URL and Port for the Resty client. // // client.SetProxy("http://proxyserver:8888") // -// OR Without this `SetProxy` method, you could also set Proxy via environment variable. -// -// Refer to godoc `http.ProxyFromEnvironment`. +// OR you could also set Proxy via environment variable, refer to [http.ProxyFromEnvironment] func (c *Client) SetProxy(proxyURL string) *Client { transport, err := c.Transport() if err != nil { @@ -846,7 +827,7 @@ func (c *Client) SetProxy(proxyURL string) *Client { return c } -// RemoveProxy method removes the proxy configuration from Resty client +// RemoveProxy method removes the proxy configuration from the Resty client // // client.RemoveProxy() func (c *Client) RemoveProxy() *Client { @@ -860,7 +841,7 @@ func (c *Client) RemoveProxy() *Client { return c } -// SetCertificates method helps to set client certificates into Resty conveniently. +// SetCertificates method helps to conveniently set client certificates into Resty. func (c *Client) SetCertificates(certs ...tls.Certificate) *Client { config, err := c.tlsConfig() if err != nil { @@ -871,7 +852,7 @@ func (c *Client) SetCertificates(certs ...tls.Certificate) *Client { return c } -// SetRootCertificate method helps to add one or more root certificates into Resty client +// SetRootCertificate method helps to add one or more root certificates into the Resty client // // client.SetRootCertificate("/path/to/root/pemFile.pem") func (c *Client) SetRootCertificate(pemFilePath string) *Client { @@ -880,40 +861,66 @@ func (c *Client) SetRootCertificate(pemFilePath string) *Client { c.log.Errorf("%v", err) return c } + c.handleCAs("root", rootPemData) + return c +} - config, err := c.tlsConfig() +// SetRootCertificateFromString method helps to add one or more root certificates +// into the Resty client +// +// client.SetRootCertificateFromString("pem certs content") +func (c *Client) SetRootCertificateFromString(pemCerts string) *Client { + c.handleCAs("root", []byte(pemCerts)) + return c +} + +// SetClientRootCertificate method helps to add one or more client's root +// certificates into the Resty client +// +// client.SetClientRootCertificate("/path/to/root/pemFile.pem") +func (c *Client) SetClientRootCertificate(pemFilePath string) *Client { + rootPemData, err := os.ReadFile(pemFilePath) if err != nil { c.log.Errorf("%v", err) return c } - if config.RootCAs == nil { - config.RootCAs = x509.NewCertPool() - } - - config.RootCAs.AppendCertsFromPEM(rootPemData) + c.handleCAs("client", rootPemData) return c } -// SetRootCertificateFromString method helps to add one or more root certificates into Resty client +// SetClientRootCertificateFromString method helps to add one or more clients +// root certificates into the Resty client // -// client.SetRootCertificateFromString("pem file content") -func (c *Client) SetRootCertificateFromString(pemContent string) *Client { +// client.SetClientRootCertificateFromString("pem certs content") +func (c *Client) SetClientRootCertificateFromString(pemCerts string) *Client { + c.handleCAs("client", []byte(pemCerts)) + return c +} + +func (c *Client) handleCAs(scope string, permCerts []byte) { config, err := c.tlsConfig() if err != nil { c.log.Errorf("%v", err) - return c - } - if config.RootCAs == nil { - config.RootCAs = x509.NewCertPool() + return } - config.RootCAs.AppendCertsFromPEM([]byte(pemContent)) - return c + switch scope { + case "root": + if config.RootCAs == nil { + config.RootCAs = x509.NewCertPool() + } + config.RootCAs.AppendCertsFromPEM(permCerts) + case "client": + if config.ClientCAs == nil { + config.ClientCAs = x509.NewCertPool() + } + config.ClientCAs.AppendCertsFromPEM(permCerts) + } } -// SetOutputDirectory method sets output directory for saving HTTP response into file. -// If the output directory not exists then resty creates one. This setting is optional one, -// if you're planning using absolute path in `Request.SetOutput` and can used together. +// SetOutputDirectory method sets the output directory for saving HTTP responses in a file. +// Resty creates one if the output directory does not exist. This setting is optional, +// if you plan to use the absolute path in [Request.SetOutput] and can used together. // // client.SetOutputDirectory("/save/http/response/here") func (c *Client) SetOutputDirectory(dirPath string) *Client { @@ -921,24 +928,15 @@ func (c *Client) SetOutputDirectory(dirPath string) *Client { return c } -// SetRateLimiter sets an optional `RateLimiter`. If set the rate limiter will control -// all requests made with this client. -// -// Since v2.9.0 +// SetRateLimiter sets an optional [RateLimiter]. If set, the rate limiter will control +// all requests were made by this client. func (c *Client) SetRateLimiter(rl RateLimiter) *Client { c.rateLimiter = rl return c } -// SetTransport method sets custom `*http.Transport` or any `http.RoundTripper` -// compatible interface implementation in the resty client. -// -// Note: -// -// - If transport is not type of `*http.Transport` then you may not be able to -// take advantage of some of the Resty client settings. -// -// - It overwrites the Resty client transport instance and it's configurations. +// SetTransport method sets custom [http.Transport] or any [http.RoundTripper] +// compatible interface implementation in the Resty client. // // transport := &http.Transport{ // // something like Proxying to httptest.Server, etc... @@ -946,8 +944,12 @@ func (c *Client) SetRateLimiter(rl RateLimiter) *Client { // return url.Parse(server.URL) // }, // } -// // client.SetTransport(transport) +// +// NOTE: +// - If transport is not the type of `*http.Transport`, then you may not be able to +// take advantage of some of the Resty client settings. +// - It overwrites the Resty client transport instance and its configurations. func (c *Client) SetTransport(transport http.RoundTripper) *Client { if transport != nil { c.httpClient.Transport = transport @@ -955,7 +957,7 @@ func (c *Client) SetTransport(transport http.RoundTripper) *Client { return c } -// SetScheme method sets custom scheme in the Resty client. It's way to override default. +// SetScheme method sets a custom scheme for the Resty client. It's a way to override the default. // // client.SetScheme("http") func (c *Client) SetScheme(scheme string) *Client { @@ -965,25 +967,26 @@ func (c *Client) SetScheme(scheme string) *Client { return c } -// SetCloseConnection method sets variable `Close` in http request struct with the given +// SetCloseConnection method sets variable `Close` in HTTP request struct with the given // value. More info: https://golang.org/src/net/http/request.go func (c *Client) SetCloseConnection(close bool) *Client { c.closeConnection = close return c } -// SetDoNotParseResponse method instructs `Resty` not to parse the response body automatically. -// Resty exposes the raw response body as `io.ReadCloser`. Also do not forget to close the body, -// otherwise you might get into connection leaks, no connection reuse. +// SetDoNotParseResponse method instructs Resty not to parse the response body automatically. +// Resty exposes the raw response body as [io.ReadCloser]. If you use it, do not +// forget to close the body, otherwise, you might get into connection leaks, and connection +// reuse may not happen. // -// Note: Response middlewares are not applicable, if you use this option. Basically you have -// taken over the control of response parsing from `Resty`. -func (c *Client) SetDoNotParseResponse(parse bool) *Client { - c.notParseResponse = parse +// NOTE: [Response] middlewares are not executed using this option. You have +// taken over the control of response parsing from Resty. +func (c *Client) SetDoNotParseResponse(notParse bool) *Client { + c.notParseResponse = notParse return c } -// SetPathParam method sets single URL path key-value pair in the +// SetPathParam method sets a single URL path key-value pair in the // Resty client instance. // // client.SetPathParam("userId", "sample@sample.com") @@ -993,10 +996,10 @@ func (c *Client) SetDoNotParseResponse(parse bool) *Client { // Composed URL - /v1/users/sample@sample.com/details // // It replaces the value of the key while composing the request URL. -// The value will be escaped using `url.PathEscape` function. +// The value will be escaped using [url.PathEscape] function. // -// Also it can be overridden at request level Path Params options, -// see `Request.SetPathParam` or `Request.SetPathParams`. +// It can be overridden at the request level, +// see [Request.SetPathParam] or [Request.SetPathParams] func (c *Client) SetPathParam(param, value string) *Client { c.PathParams[param] = value return c @@ -1016,10 +1019,10 @@ func (c *Client) SetPathParam(param, value string) *Client { // Composed URL - /v1/users/sample@sample.com/100002/groups%2Fdevelopers/details // // It replaces the value of the key while composing the request URL. -// The values will be escaped using `url.PathEscape` function. +// The values will be escaped using [url.PathEscape] function. // -// Also it can be overridden at request level Path Params options, -// see `Request.SetPathParam` or `Request.SetPathParams`. +// It can be overridden at the request level, +// see [Request.SetPathParam] or [Request.SetPathParams] func (c *Client) SetPathParams(params map[string]string) *Client { for p, v := range params { c.SetPathParam(p, v) @@ -1027,7 +1030,7 @@ func (c *Client) SetPathParams(params map[string]string) *Client { return c } -// SetRawPathParam method sets single URL path key-value pair in the +// SetRawPathParam method sets a single URL path key-value pair in the // Resty client instance. // // client.SetPathParam("userId", "sample@sample.com") @@ -1045,10 +1048,8 @@ func (c *Client) SetPathParams(params map[string]string) *Client { // It replaces the value of the key while composing the request URL. // The value will be used as it is and will not be escaped. // -// Also it can be overridden at request level Path Params options, -// see `Request.SetPathParam` or `Request.SetPathParams`. -// -// Since v2.8.0 +// It can be overridden at the request level, +// see [Request.SetRawPathParam] or [Request.SetRawPathParams] func (c *Client) SetRawPathParam(param, value string) *Client { c.RawPathParams[param] = value return c @@ -1070,10 +1071,8 @@ func (c *Client) SetRawPathParam(param, value string) *Client { // It replaces the value of the key while composing the request URL. // The values will be used as they are and will not be escaped. // -// Also it can be overridden at request level Path Params options, -// see `Request.SetPathParam` or `Request.SetPathParams`. -// -// Since v2.8.0 +// It can be overridden at the request level, +// see [Request.SetRawPathParam] or [Request.SetRawPathParams] func (c *Client) SetRawPathParams(params map[string]string) *Client { for p, v := range params { c.SetRawPathParam(p, v) @@ -1081,16 +1080,35 @@ func (c *Client) SetRawPathParams(params map[string]string) *Client { return c } -// SetJSONEscapeHTML method is to enable/disable the HTML escape on JSON marshal. +// SetJSONEscapeHTML method enables or disables the HTML escape on JSON marshal. +// By default, escape HTML is false. +// +// NOTE: This option only applies to the standard JSON Marshaller used by Resty. // -// Note: This option only applicable to standard JSON Marshaller. +// It can be overridden at the request level, see [Client.SetJSONEscapeHTML] func (c *Client) SetJSONEscapeHTML(b bool) *Client { c.jsonEscapeHTML = b return c } +// SetResponseBodyLimit method sets a maximum body size limit in bytes on response, +// avoid reading too much data to memory. +// +// Client will return [resty.ErrResponseBodyTooLarge] if the body size of the body +// in the uncompressed response is larger than the limit. +// Body size limit will not be enforced in the following cases: +// - ResponseBodyLimit <= 0, which is the default behavior. +// - [Request.SetOutput] is called to save response data to the file. +// - "DoNotParseResponse" is set for client or request. +// +// It can be overridden at the request level; see [Request.SetResponseBodyLimit] +func (c *Client) SetResponseBodyLimit(v int) *Client { + c.ResponseBodyLimit = v + return c +} + // EnableTrace method enables the Resty client trace for the requests fired from -// the client using `httptrace.ClientTrace` and provides insights. +// the client using [httptrace.ClientTrace] and provides insights. // // client := resty.New().EnableTrace() // @@ -1098,42 +1116,53 @@ func (c *Client) SetJSONEscapeHTML(b bool) *Client { // fmt.Println("Error:", err) // fmt.Println("Trace Info:", resp.Request.TraceInfo()) // -// Also `Request.EnableTrace` available too to get trace info for single request. -// -// Since v2.0.0 +// The method [Request.EnableTrace] is also available to get trace info for a single request. func (c *Client) EnableTrace() *Client { c.trace = true return c } -// DisableTrace method disables the Resty client trace. Refer to `Client.EnableTrace`. -// -// Since v2.0.0 +// DisableTrace method disables the Resty client trace. Refer to [Client.EnableTrace]. func (c *Client) DisableTrace() *Client { c.trace = false return c } -// IsProxySet method returns the true is proxy is set from resty client otherwise -// false. By default proxy is set from environment, refer to `http.ProxyFromEnvironment`. +// EnableGenerateCurlOnDebug method enables the generation of CURL commands in the debug log. +// It works in conjunction with debug mode. +// +// NOTE: Use with care. +// - Potential to leak sensitive data from [Request] and [Response] in the debug log. +// - Beware of memory usage since the request body is reread. +func (c *Client) EnableGenerateCurlOnDebug() *Client { + c.generateCurlOnDebug = true + return c +} + +// DisableGenerateCurlOnDebug method disables the option set by [Client.EnableGenerateCurlOnDebug]. +func (c *Client) DisableGenerateCurlOnDebug() *Client { + c.generateCurlOnDebug = false + return c +} + +// IsProxySet method returns the true is proxy is set from the Resty client; otherwise +// false. By default, the proxy is set from the environment variable; refer to [http.ProxyFromEnvironment]. func (c *Client) IsProxySet() bool { return c.proxyURL != nil } -// GetClient method returns the current `http.Client` used by the resty client. +// GetClient method returns the underlying [http.Client] used by the Resty. func (c *Client) GetClient() *http.Client { return c.httpClient } // Clone returns a clone of the original client. // -// Be careful when using this function: -// - Interface values are not deeply cloned. Thus, both the original and the clone will use the -// same value. -// - This function is not safe for concurrent use. You should only use this when you are sure that -// the client is not being used by any other goroutine. -// -// Since v2.12.0 +// NOTE: Use with care: +// - Interface values are not deeply cloned. Thus, both the original and the +// clone will use the same value. +// - This function is not safe for concurrent use. You should only use this method +// when you are sure that any other goroutine is not using the client. func (c *Client) Clone() *Client { // dereference the pointer and copy the value cc := *c @@ -1144,10 +1173,6 @@ func (c *Client) Clone() *Client { return &cc } -//‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾ -// Client Unexported methods -//_______________________________________________________________________ - func (c *Client) executeBefore(req *Request) error { // Lock the user-defined pre-request hooks. c.udBeforeRequestLock.RLock() @@ -1202,8 +1227,8 @@ func (c *Client) executeBefore(req *Request) error { return nil } -// Executes method executes the given `Request` object and returns response -// error. +// Executes method executes the given `Request` object and returns +// response or error. func (c *Client) execute(req *Request) (*Response, error) { if err := c.executeBefore(req); err != nil { return nil, err @@ -1219,7 +1244,13 @@ func (c *Client) execute(req *Request) (*Response, error) { if err != nil || req.notParseResponse || c.notParseResponse { response.setReceivedAt() - return response, err + if logErr := responseLogger(c, response); logErr != nil { + return response, wrapErrors(logErr, err) + } + if err != nil { + return response, err + } + return response, nil } if !req.isSaveResponse { @@ -1231,6 +1262,7 @@ func (c *Client) execute(req *Request) (*Response, error) { if _, ok := body.(*gzip.Reader); !ok { body, err = gzip.NewReader(body) if err != nil { + err = wrapErrors(responseLogger(c, response), err) response.setReceivedAt() return response, err } @@ -1238,7 +1270,8 @@ func (c *Client) execute(req *Request) (*Response, error) { } } - if response.body, err = io.ReadAll(body); err != nil { + if response.body, err = readAllWithLimit(body, req.responseBodyLimit); err != nil { + err = wrapErrors(responseLogger(c, response), err) response.setReceivedAt() return response, err } @@ -1249,6 +1282,11 @@ func (c *Client) execute(req *Request) (*Response, error) { response.setReceivedAt() // after we read the body // Apply Response middleware + err = responseLogger(c, response) + if err != nil { + return response, wrapNoRetryErr(err) + } + for _, f := range c.afterResponse { if err = f(c, response); err != nil { break @@ -1258,6 +1296,39 @@ func (c *Client) execute(req *Request) (*Response, error) { return response, wrapNoRetryErr(err) } +var ErrResponseBodyTooLarge = errors.New("resty: response body too large") + +// https://github.com/golang/go/issues/51115 +// [io.LimitedReader] can only return [io.EOF] +func readAllWithLimit(r io.Reader, maxSize int) ([]byte, error) { + if maxSize <= 0 { + return io.ReadAll(r) + } + + var buf [512]byte // make buf stack allocated + result := make([]byte, 0, 512) + total := 0 + for { + n, err := r.Read(buf[:]) + total += n + if total > maxSize { + return nil, ErrResponseBodyTooLarge + } + + if err != nil { + if err == io.EOF { + result = append(result, buf[:n]...) + break + } + return nil, err + } + + result = append(result, buf[:n]...) + } + + return result, nil +} + // getting TLS client config if not exists then create one func (c *Client) tlsConfig() (*tls.Config, error) { transport, err := c.Transport() @@ -1270,10 +1341,10 @@ func (c *Client) tlsConfig() (*tls.Config, error) { return transport.TLSClientConfig, nil } -// Transport method returns `*http.Transport` currently in use or error -// in case currently used `transport` is not a `*http.Transport`. +// Transport method returns [http.Transport] currently in use or error +// in case the currently used `transport` is not a [http.Transport]. // -// Since v2.8.0 become exported method. +// Since v2.8.0 has become exported method. func (c *Client) Transport() (*http.Transport, error) { if transport, ok := c.httpClient.Transport.(*http.Transport); ok { return transport, nil @@ -1287,7 +1358,7 @@ func (c *Client) outputLogTo(w io.Writer) *Client { return c } -// ResponseError is a wrapper for including the server response with an error. +// ResponseError is a wrapper that includes the server response with an error. // Neither the err nor the response should be nil. type ResponseError struct { Response *Response @@ -1303,7 +1374,7 @@ func (e *ResponseError) Unwrap() error { } // Helper to run errorHooks hooks. -// It wraps the error in a ResponseError if the resp is not nil +// It wraps the error in a [ResponseError] if the resp is not nil // so hooks can access it. func (c *Client) onErrorHooks(req *Request, resp *Response, err error) { if err != nil { @@ -1338,14 +1409,14 @@ func (c *Client) onInvalidHooks(req *Request, err error) { // File struct and its methods //_______________________________________________________________________ -// File struct represent file information for multipart request +// File struct represents file information for multipart request type File struct { Name string ParamName string io.Reader } -// String returns string value of current file details +// String method returns the string value of current file details func (f *File) String() string { return fmt.Sprintf("ParamName: %v; FileName: %v", f.ParamName, f.Name) } @@ -1354,7 +1425,7 @@ func (f *File) String() string { // MultipartField struct //_______________________________________________________________________ -// MultipartField struct represent custom data part for multipart request +// MultipartField struct represents the custom data part for a multipart request type MultipartField struct { Param string FileName string @@ -1362,10 +1433,6 @@ type MultipartField struct { io.Reader } -//‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾ -// Unexported package methods -//_______________________________________________________________________ - func createClient(hc *http.Client) *Client { if hc.Transport == nil { hc.Transport = createTransport(nil) @@ -1411,7 +1478,6 @@ func createClient(hc *http.Client) *Client { // default after response middlewares c.afterResponse = []ResponseMiddleware{ - responseLogger, parseResponseBody, saveResponseIntoFile, } diff --git a/vendor/github.com/go-resty/resty/v2/middleware.go b/vendor/github.com/go-resty/resty/v2/middleware.go index 41e6561..4f57915 100644 --- a/vendor/github.com/go-resty/resty/v2/middleware.go +++ b/vendor/github.com/go-resty/resty/v2/middleware.go @@ -308,7 +308,7 @@ func addCredentials(c *Client, r *Request) error { } func createCurlCmd(c *Client, r *Request) (err error) { - if r.trace { + if r.Debug && r.generateCurlOnDebug { if r.resultCurlCmd == nil { r.resultCurlCmd = new(string) } @@ -338,10 +338,14 @@ func requestLogger(c *Client, r *Request) error { } } - reqLog := "\n==============================================================================\n" + - "~~~ REQUEST(curl) ~~~\n" + - fmt.Sprintf("CURL:\n %v\n", buildCurlRequest(r.RawRequest, r.client.httpClient.Jar)) + - "~~~ REQUEST ~~~\n" + + reqLog := "\n==============================================================================\n" + + if r.Debug && r.generateCurlOnDebug { + reqLog += "~~~ REQUEST(CURL) ~~~\n" + + fmt.Sprintf(" %v\n", *r.resultCurlCmd) + } + + reqLog += "~~~ REQUEST ~~~\n" + fmt.Sprintf("%s %s %s\n", r.Method, rr.URL.RequestURI(), rr.Proto) + fmt.Sprintf("HOST : %s\n", rr.URL.Host) + fmt.Sprintf("HEADERS:\n%s\n", composeHeaders(c, r, rl.Header)) + @@ -371,7 +375,7 @@ func responseLogger(c *Client, res *Response) error { debugLog := res.Request.values[debugRequestLogKey].(string) debugLog += "~~~ RESPONSE ~~~\n" + fmt.Sprintf("STATUS : %s\n", res.Status()) + - fmt.Sprintf("PROTO : %s\n", res.RawResponse.Proto) + + fmt.Sprintf("PROTO : %s\n", res.Proto()) + fmt.Sprintf("RECEIVED AT : %v\n", res.ReceivedAt().Format(time.RFC3339Nano)) + fmt.Sprintf("TIME DURATION: %v\n", res.Time()) + "HEADERS :\n" + @@ -429,6 +433,13 @@ func handleMultipart(c *Client, r *Request) error { r.bodyBuf = acquireBuffer() w := multipart.NewWriter(r.bodyBuf) + // Set boundary if not set by user + if r.multipartBoundary != "" { + if err := w.SetBoundary(r.multipartBoundary); err != nil { + return err + } + } + for k, v := range c.FormData { for _, iv := range v { if err := w.WriteField(k, iv); err != nil { diff --git a/vendor/github.com/go-resty/resty/v2/redirect.go b/vendor/github.com/go-resty/resty/v2/redirect.go index 19bd587..bb016e2 100644 --- a/vendor/github.com/go-resty/resty/v2/redirect.go +++ b/vendor/github.com/go-resty/resty/v2/redirect.go @@ -13,22 +13,22 @@ import ( ) var ( - // Since v2.8.0 ErrAutoRedirectDisabled = errors.New("auto redirect is disabled") ) type ( - // RedirectPolicy to regulate the redirects in the resty client. - // Objects implementing the RedirectPolicy interface can be registered as + // RedirectPolicy to regulate the redirects in the Resty client. + // Objects implementing the [RedirectPolicy] interface can be registered as // - // Apply function should return nil to continue the redirect journey, otherwise + // Apply function should return nil to continue the redirect journey; otherwise // return error to stop the redirect. RedirectPolicy interface { Apply(req *http.Request, via []*http.Request) error } - // The RedirectPolicyFunc type is an adapter to allow the use of ordinary functions as RedirectPolicy. - // If f is a function with the appropriate signature, RedirectPolicyFunc(f) is a RedirectPolicy object that calls f. + // The [RedirectPolicyFunc] type is an adapter to allow the use of ordinary + // functions as [RedirectPolicy]. If `f` is a function with the appropriate + // signature, RedirectPolicyFunc(f) is a RedirectPolicy object that calls `f`. RedirectPolicyFunc func(*http.Request, []*http.Request) error ) @@ -37,7 +37,7 @@ func (f RedirectPolicyFunc) Apply(req *http.Request, via []*http.Request) error return f(req, via) } -// NoRedirectPolicy is used to disable redirects in the HTTP client +// NoRedirectPolicy is used to disable redirects in the Resty client // // resty.SetRedirectPolicy(NoRedirectPolicy()) func NoRedirectPolicy() RedirectPolicy { @@ -46,7 +46,7 @@ func NoRedirectPolicy() RedirectPolicy { }) } -// FlexibleRedirectPolicy is convenient method to create No of redirect policy for HTTP client. +// FlexibleRedirectPolicy method is convenient for creating several redirect policies for Resty clients. // // resty.SetRedirectPolicy(FlexibleRedirectPolicy(20)) func FlexibleRedirectPolicy(noOfRedirect int) RedirectPolicy { @@ -59,8 +59,8 @@ func FlexibleRedirectPolicy(noOfRedirect int) RedirectPolicy { }) } -// DomainCheckRedirectPolicy is convenient method to define domain name redirect rule in resty client. -// Redirect is allowed for only mentioned host in the policy. +// DomainCheckRedirectPolicy method is convenient for defining domain name redirect rules in Resty clients. +// Redirect is allowed only for the host mentioned in the policy. // // resty.SetRedirectPolicy(DomainCheckRedirectPolicy("host1.com", "host2.org", "host3.net")) func DomainCheckRedirectPolicy(hostnames ...string) RedirectPolicy { @@ -80,10 +80,6 @@ func DomainCheckRedirectPolicy(hostnames ...string) RedirectPolicy { return fn } -//‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾ -// Package Unexported methods -//_______________________________________________________________________ - func getHostname(host string) (hostname string) { if strings.Index(host, ":") > 0 { host, _, _ = net.SplitHostPort(host) @@ -92,10 +88,11 @@ func getHostname(host string) (hostname string) { return } -// By default Golang will not redirect request headers -// after go throwing various discussion comments from thread +// By default, Golang will not redirect request headers. +// After reading through the various discussion comments from the thread - // https://github.com/golang/go/issues/4800 -// Resty will add all the headers during a redirect for the same host +// Resty will add all the headers during a redirect for the same host and +// adds library user-agent if the Host is different. func checkHostAndAddHeaders(cur *http.Request, pre *http.Request) { curHostname := getHostname(cur.URL.Host) preHostname := getHostname(pre.URL.Host) diff --git a/vendor/github.com/go-resty/resty/v2/request.go b/vendor/github.com/go-resty/resty/v2/request.go index 336925d..1834071 100644 --- a/vendor/github.com/go-resty/resty/v2/request.go +++ b/vendor/github.com/go-resty/resty/v2/request.go @@ -23,9 +23,9 @@ import ( // Request struct and methods //_______________________________________________________________________ -// Request struct is used to compose and fire individual request from -// resty client. Request provides an options to override client level -// settings and also an options for the request composition. +// Request struct is used to compose and fire individual requests from +// Resty client. The [Request] provides an option to override client-level +// settings and also an option for the request composition. type Request struct { URL string Method string @@ -49,8 +49,6 @@ type Request struct { // Attempt is to represent the request attempt made during a Resty // request execution flow, including retry count. - // - // Since v2.4.0 Attempt int isMultiPart bool @@ -69,31 +67,36 @@ type Request struct { bodyBuf *bytes.Buffer clientTrace *clientTrace log Logger + multipartBoundary string multipartFiles []*File multipartFields []*MultipartField retryConditions []RetryConditionFunc + responseBodyLimit int + generateCurlOnDebug bool } -// Generate curl command for the request. +// GenerateCurlCommand method generates the CURL command for the request. func (r *Request) GenerateCurlCommand() string { + if !(r.Debug && r.generateCurlOnDebug) { + return "" + } + if r.resultCurlCmd != nil { return *r.resultCurlCmd - } else { - if r.RawRequest == nil { - r.client.executeBefore(r) // mock with r.Get("/") - } - if r.resultCurlCmd == nil { - r.resultCurlCmd = new(string) - } - if *r.resultCurlCmd == "" { - *r.resultCurlCmd = buildCurlRequest(r.RawRequest, r.client.httpClient.Jar) - } - return *r.resultCurlCmd } + + if r.RawRequest == nil { + r.client.executeBefore(r) // mock with r.Get("/") + } + if r.resultCurlCmd == nil { + r.resultCurlCmd = new(string) + } + *r.resultCurlCmd = buildCurlRequest(r.RawRequest, r.client.httpClient.Jar) + return *r.resultCurlCmd } -// Context method returns the Context if its already set in request -// otherwise it creates new one using `context.Background()`. +// Context method returns the Context if it is already set in the [Request] +// otherwise, it creates a new one using [context.Background]. func (r *Request) Context() context.Context { if r.ctx == nil { return context.Background() @@ -101,16 +104,16 @@ func (r *Request) Context() context.Context { return r.ctx } -// SetContext method sets the context.Context for current Request. It allows -// to interrupt the request execution if ctx.Done() channel is closed. -// See https://blog.golang.org/context article and the "context" package +// SetContext method sets the [context.Context] for current [Request]. It allows +// to interrupt the request execution if `ctx.Done()` channel is closed. +// See https://blog.golang.org/context article and the package [context] // documentation. func (r *Request) SetContext(ctx context.Context) *Request { r.ctx = ctx return r } -// SetHeader method is to set a single header field and its value in the current request. +// SetHeader method sets a single header field and its value in the current request. // // For Example: To set `Content-Type` and `Accept` as `application/json`. // @@ -118,13 +121,13 @@ func (r *Request) SetContext(ctx context.Context) *Request { // SetHeader("Content-Type", "application/json"). // SetHeader("Accept", "application/json") // -// Also you can override header value, which was set at client instance level. +// It overrides the header value set at the client instance level. func (r *Request) SetHeader(header, value string) *Request { r.Header.Set(header, value) return r } -// SetHeaders method sets multiple headers field and its values at one go in the current request. +// SetHeaders method sets multiple header fields and their values at one go in the current request. // // For Example: To set `Content-Type` and `Accept` as `application/json` // @@ -134,7 +137,7 @@ func (r *Request) SetHeader(header, value string) *Request { // "Accept": "application/json", // }) // -// Also you can override header value, which was set at client instance level. +// It overrides the header value set at the client instance level. func (r *Request) SetHeaders(headers map[string]string) *Request { for h, v := range headers { r.SetHeader(h, v) @@ -142,7 +145,7 @@ func (r *Request) SetHeaders(headers map[string]string) *Request { return r } -// SetHeaderMultiValues sets multiple headers fields and its values is list of strings at one go in the current request. +// SetHeaderMultiValues sets multiple header fields and their values as a list of strings in the current request. // // For Example: To set `Accept` as `text/html, application/xhtml+xml, application/xml;q=0.9, image/webp, */*;q=0.8` // @@ -151,7 +154,7 @@ func (r *Request) SetHeaders(headers map[string]string) *Request { // "Accept": []string{"text/html", "application/xhtml+xml", "application/xml;q=0.9", "image/webp", "*/*;q=0.8"}, // }) // -// Also you can override header value, which was set at client instance level. +// It overrides the header value set at the client instance level. func (r *Request) SetHeaderMultiValues(headers map[string][]string) *Request { for key, values := range headers { r.SetHeader(key, strings.Join(values, ", ")) @@ -159,7 +162,7 @@ func (r *Request) SetHeaderMultiValues(headers map[string][]string) *Request { return r } -// SetHeaderVerbatim method is to set a single header field and its value verbatim in the current request. +// SetHeaderVerbatim method sets a single header field and its value verbatim in the current request. // // For Example: To set `all_lowercase` and `UPPERCASE` as `available`. // @@ -167,33 +170,31 @@ func (r *Request) SetHeaderMultiValues(headers map[string][]string) *Request { // SetHeaderVerbatim("all_lowercase", "available"). // SetHeaderVerbatim("UPPERCASE", "available") // -// Also you can override header value, which was set at client instance level. -// -// Since v2.6.0 +// It overrides the header value set at the client instance level. func (r *Request) SetHeaderVerbatim(header, value string) *Request { r.Header[header] = []string{value} return r } -// SetQueryParam method sets single parameter and its value in the current request. -// It will be formed as query string for the request. +// SetQueryParam method sets a single parameter and its value in the current request. +// It will be formed as a query string for the request. // -// For Example: `search=kitchen%20papers&size=large` in the URL after `?` mark. +// For Example: `search=kitchen%20papers&size=large` in the URL after the `?` mark. // // client.R(). // SetQueryParam("search", "kitchen papers"). // SetQueryParam("size", "large") // -// Also you can override query params value, which was set at client instance level. +// It overrides the query parameter value set at the client instance level. func (r *Request) SetQueryParam(param, value string) *Request { r.QueryParam.Set(param, value) return r } -// SetQueryParams method sets multiple parameters and its values at one go in the current request. -// It will be formed as query string for the request. +// SetQueryParams method sets multiple parameters and their values at one go in the current request. +// It will be formed as a query string for the request. // -// For Example: `search=kitchen%20papers&size=large` in the URL after `?` mark. +// For Example: `search=kitchen%20papers&size=large` in the URL after the `?` mark. // // client.R(). // SetQueryParams(map[string]string{ @@ -201,7 +202,7 @@ func (r *Request) SetQueryParam(param, value string) *Request { // "size": "large", // }) // -// Also you can override query params value, which was set at client instance level. +// It overrides the query parameter value set at the client instance level. func (r *Request) SetQueryParams(params map[string]string) *Request { for p, v := range params { r.SetQueryParam(p, v) @@ -210,17 +211,17 @@ func (r *Request) SetQueryParams(params map[string]string) *Request { } // SetQueryParamsFromValues method appends multiple parameters with multi-value -// (`url.Values`) at one go in the current request. It will be formed as +// ([url.Values]) at one go in the current request. It will be formed as // query string for the request. // -// For Example: `status=pending&status=approved&status=open` in the URL after `?` mark. +// For Example: `status=pending&status=approved&status=open` in the URL after the `?` mark. // // client.R(). // SetQueryParamsFromValues(url.Values{ // "status": []string{"pending", "approved", "open"}, // }) // -// Also you can override query params value, which was set at client instance level. +// It overrides the query parameter value set at the client instance level. func (r *Request) SetQueryParamsFromValues(params url.Values) *Request { for p, v := range params { for _, pv := range v { @@ -230,12 +231,12 @@ func (r *Request) SetQueryParamsFromValues(params url.Values) *Request { return r } -// SetQueryString method provides ability to use string as an input to set URL query string for the request. -// -// Using String as an input +// SetQueryString method provides the ability to use string as an input to set URL query string for the request. // // client.R(). // SetQueryString("productId=232&template=fresh-sample&cat=resty&source=google&kw=buy a lot more") +// +// It overrides the query parameter value set at the client instance level. func (r *Request) SetQueryString(query string) *Request { params, err := url.ParseQuery(strings.TrimSpace(query)) if err == nil { @@ -250,9 +251,9 @@ func (r *Request) SetQueryString(query string) *Request { return r } -// SetFormData method sets Form parameters and their values in the current request. -// It's applicable only HTTP method `POST` and `PUT` and requests content type would be set as -// `application/x-www-form-urlencoded`. +// SetFormData method sets Form parameters and their values for the current request. +// It applies only to HTTP methods `POST` and `PUT`, and by default requests +// content type would be set as `application/x-www-form-urlencoded`. // // client.R(). // SetFormData(map[string]string{ @@ -260,7 +261,7 @@ func (r *Request) SetQueryString(query string) *Request { // "user_id": "3455454545", // }) // -// Also you can override form data value, which was set at client instance level. +// It overrides the form data value set at the client instance level. func (r *Request) SetFormData(data map[string]string) *Request { for k, v := range data { r.FormData.Set(k, v) @@ -269,14 +270,14 @@ func (r *Request) SetFormData(data map[string]string) *Request { } // SetFormDataFromValues method appends multiple form parameters with multi-value -// (`url.Values`) at one go in the current request. +// ([url.Values]) at one go in the current request. // // client.R(). // SetFormDataFromValues(url.Values{ // "search_criteria": []string{"book", "glass", "pencil"}, // }) // -// Also you can override form data value, which was set at client instance level. +// It overrides the form data value set at the client instance level. func (r *Request) SetFormDataFromValues(data url.Values) *Request { for k, v := range data { for _, kv := range v { @@ -286,14 +287,17 @@ func (r *Request) SetFormDataFromValues(data url.Values) *Request { return r } -// SetBody method sets the request body for the request. It supports various realtime needs as easy. -// We can say its quite handy or powerful. Supported request body data types is `string`, -// `[]byte`, `struct`, `map`, `slice` and `io.Reader`. Body value can be pointer or non-pointer. -// Automatic marshalling for JSON and XML content type, if it is `struct`, `map`, or `slice`. +// SetBody method sets the request body for the request. It supports various practical needs as easy. +// It's quite handy and powerful. Supported request body data types are `string`, +// `[]byte`, `struct`, `map`, `slice` and [io.Reader]. +// +// Body value can be pointer or non-pointer. Automatic marshalling for JSON and XML content type, if it is `struct`, `map`, or `slice`. +// +// NOTE: [io.Reader] is processed in bufferless mode while sending a request. // -// Note: `io.Reader` is processed as bufferless mode while sending request. +// For Example: // -// For Example: Struct as a body input, based on content type, it will be marshalled. +// `struct` gets marshaled based on the request header `Content-Type`. // // client.R(). // SetBody(User{ @@ -301,7 +305,7 @@ func (r *Request) SetFormDataFromValues(data url.Values) *Request { // Password: "welcome2resty", // }) // -// Map as a body input, based on content type, it will be marshalled. +// 'map` gets marshaled based on the request header `Content-Type`. // // client.R(). // SetBody(map[string]interface{}{ @@ -316,7 +320,7 @@ func (r *Request) SetFormDataFromValues(data url.Values) *Request { // }, // }) // -// String as a body input. Suitable for any need as a string input. +// `string` as a body input. Suitable for any need as a string input. // // client.R(). // SetBody(`{ @@ -324,27 +328,41 @@ func (r *Request) SetFormDataFromValues(data url.Values) *Request { // "password": "admin" // }`) // -// []byte as a body input. Suitable for raw request such as file upload, serialize & deserialize, etc. +// `[]byte` as a body input. Suitable for raw requests such as file upload, serialize & deserialize, etc. // // client.R(). // SetBody([]byte("This is my raw request, sent as-is")) +// +// and so on. func (r *Request) SetBody(body interface{}) *Request { r.Body = body return r } -// SetResult method is to register the response `Result` object for automatic unmarshalling for the request, -// if response status code is between 200 and 299 and content type either JSON or XML. +// SetResult method is to register the response `Result` object for automatic +// unmarshalling of the HTTP response if the response status code is +// between 200 and 299, and the content type is JSON or XML. +// +// Note: [Request.SetResult] input can be a pointer or non-pointer. +// +// The pointer with handle // -// Note: Result object can be pointer or non-pointer. +// authToken := &AuthToken{} +// client.R().SetResult(authToken) +// +// // Can be accessed via - +// fmt.Println(authToken) OR fmt.Println(response.Result().(*AuthToken)) +// +// OR - +// +// The pointer without handle or non-pointer // // client.R().SetResult(&AuthToken{}) // // OR // client.R().SetResult(AuthToken{}) // -// Accessing a result value from response instance. -// -// response.Result().(*AuthToken) +// // Can be accessed via - +// fmt.Println(response.Result().(*AuthToken)) func (r *Request) SetResult(res interface{}) *Request { if res != nil { r.Result = getPointer(res) @@ -353,23 +371,25 @@ func (r *Request) SetResult(res interface{}) *Request { } // SetError method is to register the request `Error` object for automatic unmarshalling for the request, -// if response status code is greater than 399 and content type either JSON or XML. +// if the response status code is greater than 399 and the content type is either JSON or XML. // -// Note: Error object can be pointer or non-pointer. +// NOTE: [Request.SetError] input can be a pointer or non-pointer. // // client.R().SetError(&AuthError{}) // // OR // client.R().SetError(AuthError{}) // -// Accessing a error value from response instance. +// Accessing an error value from response instance. // // response.Error().(*AuthError) +// +// If this request Error object is nil, Resty will use the client-level error object Type if it is set. func (r *Request) SetError(err interface{}) *Request { r.Error = getPointer(err) return r } -// SetFile method is to set single file field name and its path for multipart upload. +// SetFile method sets a single file field name and its path for multipart upload. // // client.R(). // SetFile("my_file", "/Users/jeeva/Gas Bill - Sep.pdf") @@ -379,7 +399,7 @@ func (r *Request) SetFile(param, filePath string) *Request { return r } -// SetFiles method is to set multiple file field name and its path for multipart upload. +// SetFiles method sets multiple file field names and their paths for multipart uploads. // // client.R(). // SetFiles(map[string]string{ @@ -395,7 +415,7 @@ func (r *Request) SetFiles(files map[string]string) *Request { return r } -// SetFileReader method is to set single file using io.Reader for multipart upload. +// SetFileReader method is to set a file using [io.Reader] for multipart upload. // // client.R(). // SetFileReader("profile_img", "my-profile-img.png", bytes.NewReader(profileImgBytes)). @@ -410,7 +430,8 @@ func (r *Request) SetFileReader(param, fileName string, reader io.Reader) *Reque return r } -// SetMultipartFormData method allows simple form data to be attached to the request as `multipart:form-data` +// SetMultipartFormData method allows simple form data to be attached to the request +// as `multipart:form-data` func (r *Request) SetMultipartFormData(data map[string]string) *Request { for k, v := range data { r = r.SetMultipartField(k, "", "", strings.NewReader(v)) @@ -419,7 +440,7 @@ func (r *Request) SetMultipartFormData(data map[string]string) *Request { return r } -// SetMultipartField method is to set custom data using io.Reader for multipart upload. +// SetMultipartField method sets custom data with Content-Type using [io.Reader] for multipart upload. func (r *Request) SetMultipartField(param, fileName, contentType string, reader io.Reader) *Request { r.isMultiPart = true r.multipartFields = append(r.multipartFields, &MultipartField{ @@ -431,7 +452,7 @@ func (r *Request) SetMultipartField(param, fileName, contentType string, reader return r } -// SetMultipartFields method is to set multiple data fields using io.Reader for multipart upload. +// SetMultipartFields method sets multiple data fields using [io.Reader] for multipart upload. // // For Example: // @@ -449,7 +470,7 @@ func (r *Request) SetMultipartField(param, fileName, contentType string, reader // Reader: strings.NewReader(`{"input": {"name": "Uploaded document 2", "_filename" : ["file2.txt"]}}`), // }) // -// If you have slice already, then simply call- +// If you have a `slice` of fields already, then call- // // client.R().SetMultipartFields(fields...) func (r *Request) SetMultipartFields(fields ...*MultipartField) *Request { @@ -458,13 +479,21 @@ func (r *Request) SetMultipartFields(fields ...*MultipartField) *Request { return r } -// SetContentLength method sets the HTTP header `Content-Length` value for current request. -// By default Resty won't set `Content-Length`. Also you have an option to enable for every -// request. +// SetMultipartBoundary method sets the custom multipart boundary for the multipart request. +// Typically, the `mime/multipart` package generates a random multipart boundary if not provided. +func (r *Request) SetMultipartBoundary(boundary string) *Request { + r.multipartBoundary = boundary + return r +} + +// SetContentLength method sets the current request's HTTP header `Content-Length` value. +// By default, Resty won't set `Content-Length`. // -// See `Client.SetContentLength` +// See [Client.SetContentLength] // // client.R().SetContentLength(true) +// +// It overrides the value set at the client instance level. func (r *Request) SetContentLength(l bool) *Request { r.setContentLength = l return r @@ -480,7 +509,7 @@ func (r *Request) SetContentLength(l bool) *Request { // // client.R().SetBasicAuth("go-resty", "welcome") // -// This method overrides the credentials set by method `Client.SetBasicAuth`. +// It overrides the credentials set by method [Client.SetBasicAuth]. func (r *Request) SetBasicAuth(username, password string) *Request { r.UserInfo = &User{Username: username, Password: password} return r @@ -494,13 +523,15 @@ func (r *Request) SetBasicAuth(username, password string) *Request { // // client.R().SetAuthToken("BC594900518B4F7EAC75BD37F019E08FBC594900518B4F7EAC75BD37F019E08F") // -// This method overrides the Auth token set by method `Client.SetAuthToken`. +// It overrides the Auth token set by method [Client.SetAuthToken]. func (r *Request) SetAuthToken(token string) *Request { r.Token = token return r } -// SetAuthScheme method sets the auth token scheme type in the HTTP request. For Example: +// SetAuthScheme method sets the auth token scheme type in the HTTP request. +// +// Example Header value structure: // // Authorization: // @@ -508,33 +539,33 @@ func (r *Request) SetAuthToken(token string) *Request { // // client.R().SetAuthScheme("OAuth") // -// This auth header scheme gets added to all the request raised from this client instance. -// Also it can be overridden or set one at the request level is supported. +// // The outcome will be - +// Authorization: OAuth // -// Information about Auth schemes can be found in RFC7235 which is linked to below along with the page containing -// the currently defined official authentication schemes: +// Information about Auth schemes can be found in [RFC 7235], IANA [HTTP Auth schemes] // -// https://tools.ietf.org/html/rfc7235 -// https://www.iana.org/assignments/http-authschemes/http-authschemes.xhtml#authschemes +// It overrides the `Authorization` scheme set by method [Client.SetAuthScheme]. // -// This method overrides the Authorization scheme set by method `Client.SetAuthScheme`. +// [RFC 7235]: https://tools.ietf.org/html/rfc7235 +// [HTTP Auth schemes]: https://www.iana.org/assignments/http-authschemes/http-authschemes.xhtml#authschemes func (r *Request) SetAuthScheme(scheme string) *Request { r.AuthScheme = scheme return r } -// SetDigestAuth method sets the Digest Access auth scheme for the HTTP request. If a server responds with 401 and sends -// a Digest challenge in the WWW-Authenticate Header, the request will be resent with the appropriate Authorization Header. +// SetDigestAuth method sets the Digest Access auth scheme for the HTTP request. +// If a server responds with 401 and sends a Digest challenge in the WWW-Authenticate Header, +// the request will be resent with the appropriate Authorization Header. // // For Example: To set the Digest scheme with username "Mufasa" and password "Circle Of Life" // // client.R().SetDigestAuth("Mufasa", "Circle Of Life") // -// Information about Digest Access Authentication can be found in RFC7616: +// Information about Digest Access Authentication can be found in [RFC 7616] // -// https://datatracker.ietf.org/doc/html/rfc7616 +// It overrides the digest username and password set by method [Client.SetDigestAuth]. // -// This method overrides the username and password set by method `Client.SetDigestAuth`. +// [RFC 7616]: https://datatracker.ietf.org/doc/html/rfc7616 func (r *Request) SetDigestAuth(username, password string) *Request { oldTransport := r.client.httpClient.Transport r.client.OnBeforeRequest(func(c *Client, _ *Request) error { @@ -552,16 +583,19 @@ func (r *Request) SetDigestAuth(username, password string) *Request { return r } -// SetOutput method sets the output file for current HTTP request. Current HTTP response will be -// saved into given file. It is similar to `curl -o` flag. Absolute path or relative path can be used. -// If is it relative path then output file goes under the output directory, as mentioned -// in the `Client.SetOutputDirectory`. +// SetOutput method sets the output file for the current HTTP request. The current +// HTTP response will be saved in the given file. It is similar to the `curl -o` flag. +// +// Absolute path or relative path can be used. +// +// If it is a relative path, then the output file goes under the output directory, as mentioned +// in the [Client.SetOutputDirectory]. // // client.R(). // SetOutput("/Users/jeeva/Downloads/ReplyWithHeader-v5.1-beta.zip"). // Get("http://bit.ly/1LouEKr") // -// Note: In this scenario `Response.Body` might be nil. +// NOTE: In this scenario [Response.Body] might be nil. func (r *Request) SetOutput(file string) *Request { r.outputFile = file r.isSaveResponse = true @@ -579,18 +613,35 @@ func (r *Request) SetSRV(srv *SRVRecord) *Request { return r } -// SetDoNotParseResponse method instructs `Resty` not to parse the response body automatically. -// Resty exposes the raw response body as `io.ReadCloser`. Also do not forget to close the body, -// otherwise you might get into connection leaks, no connection reuse. +// SetDoNotParseResponse method instructs Resty not to parse the response body automatically. +// Resty exposes the raw response body as [io.ReadCloser]. If you use it, do not +// forget to close the body, otherwise, you might get into connection leaks, and connection +// reuse may not happen. // -// Note: Response middlewares are not applicable, if you use this option. Basically you have -// taken over the control of response parsing from `Resty`. +// NOTE: [Response] middlewares are not executed using this option. You have +// taken over the control of response parsing from Resty. func (r *Request) SetDoNotParseResponse(parse bool) *Request { r.notParseResponse = parse return r } -// SetPathParam method sets single URL path key-value pair in the +// SetResponseBodyLimit method sets a maximum body size limit in bytes on response, +// avoid reading too much data to memory. +// +// Client will return [resty.ErrResponseBodyTooLarge] if the body size of the body +// in the uncompressed response is larger than the limit. +// Body size limit will not be enforced in the following cases: +// - ResponseBodyLimit <= 0, which is the default behavior. +// - [Request.SetOutput] is called to save response data to the file. +// - "DoNotParseResponse" is set for client or request. +// +// It overrides the value set at the client instance level. see [Client.SetResponseBodyLimit] +func (r *Request) SetResponseBodyLimit(v int) *Request { + r.responseBodyLimit = v + return r +} + +// SetPathParam method sets a single URL path key-value pair in the // Resty current request instance. // // client.R().SetPathParam("userId", "sample@sample.com") @@ -606,10 +657,9 @@ func (r *Request) SetDoNotParseResponse(parse bool) *Request { // Composed URL - /v1/users/groups%2Fdevelopers/details // // It replaces the value of the key while composing the request URL. -// The values will be escaped using `url.PathEscape` function. +// The values will be escaped using function [url.PathEscape]. // -// Also you can override Path Params value, which was set at client instance -// level. +// It overrides the path parameter set at the client instance level. func (r *Request) SetPathParam(param, value string) *Request { r.PathParams[param] = value return r @@ -628,11 +678,10 @@ func (r *Request) SetPathParam(param, value string) *Request { // URL - /v1/users/{userId}/{subAccountId}/{path}/details // Composed URL - /v1/users/sample@sample.com/100002/groups%2Fdevelopers/details // -// It replaces the value of the key while composing request URL. -// The value will be used as it is and will not be escaped. +// It replaces the value of the key while composing the request URL. +// The values will be escaped using function [url.PathEscape]. // -// Also you can override Path Params value, which was set at client instance -// level. +// It overrides the path parameter set at the client instance level. func (r *Request) SetPathParams(params map[string]string) *Request { for p, v := range params { r.SetPathParam(p, v) @@ -640,7 +689,7 @@ func (r *Request) SetPathParams(params map[string]string) *Request { return r } -// SetRawPathParam method sets single URL path key-value pair in the +// SetRawPathParam method sets a single URL path key-value pair in the // Resty current request instance. // // client.R().SetPathParam("userId", "sample@sample.com") @@ -656,12 +705,9 @@ func (r *Request) SetPathParams(params map[string]string) *Request { // Composed URL - /v1/users/groups/developers/details // // It replaces the value of the key while composing the request URL. -// The value will be used as it is and will not be escaped. +// The value will be used as-is and has not been escaped. // -// Also you can override Path Params value, which was set at client instance -// level. -// -// Since v2.8.0 +// It overrides the raw path parameter set at the client instance level. func (r *Request) SetRawPathParam(param, value string) *Request { r.RawPathParams[param] = value return r @@ -680,13 +726,10 @@ func (r *Request) SetRawPathParam(param, value string) *Request { // URL - /v1/users/{userId}/{subAccountId}/{path}/details // Composed URL - /v1/users/sample@sample.com/100002/groups/developers/details // -// It replaces the value of the key while composing request URL. -// The values will be used as they are and will not be escaped. -// -// Also you can override Path Params value, which was set at client instance -// level. +// It replaces the value of the key while composing the request URL. +// The value will be used as-is and has not been escaped. // -// Since v2.8.0 +// It overrides the raw path parameter set at the client instance level. func (r *Request) SetRawPathParams(params map[string]string) *Request { for p, v := range params { r.SetRawPathParam(p, v) @@ -695,23 +738,29 @@ func (r *Request) SetRawPathParams(params map[string]string) *Request { } // ExpectContentType method allows to provide fallback `Content-Type` for automatic unmarshalling -// when `Content-Type` response header is unavailable. +// when the `Content-Type` response header is unavailable. func (r *Request) ExpectContentType(contentType string) *Request { r.fallbackContentType = contentType return r } -// ForceContentType method provides a strong sense of response `Content-Type` for automatic unmarshalling. -// Resty gives this a higher priority than the `Content-Type` response header. This means that if both -// `Request.ForceContentType` is set and the response `Content-Type` is available, `ForceContentType` will win. +// ForceContentType method provides a strong sense of response `Content-Type` for +// automatic unmarshalling. Resty gives this a higher priority than the `Content-Type` +// response header. +// +// This means that if both [Request.ForceContentType] is set and +// the response `Content-Type` is available, `ForceContentType` will win. func (r *Request) ForceContentType(contentType string) *Request { r.forceContentType = contentType return r } -// SetJSONEscapeHTML method is to enable/disable the HTML escape on JSON marshal. +// SetJSONEscapeHTML method enables or disables the HTML escape on JSON marshal. +// By default, escape HTML is false. // -// Note: This option only applicable to standard JSON Marshaller. +// NOTE: This option only applies to the standard JSON Marshaller used by Resty. +// +// It overrides the value set at the client instance level, see [Client.SetJSONEscapeHTML] func (r *Request) SetJSONEscapeHTML(b bool) *Request { r.jsonEscapeHTML = b return r @@ -724,9 +773,7 @@ func (r *Request) SetJSONEscapeHTML(b bool) *Request { // Value:"This is cookie value", // }) // -// Note: Method appends the Cookie value into existing Cookie if already existing. -// -// Since v2.1.0 +// NOTE: Method appends the Cookie value into existing Cookie even if its already existing. func (r *Request) SetCookie(hc *http.Cookie) *Request { r.Cookies = append(r.Cookies, hc) return r @@ -748,9 +795,7 @@ func (r *Request) SetCookie(hc *http.Cookie) *Request { // // Setting a cookies into resty's current request // client.R().SetCookies(cookies) // -// Note: Method appends the Cookie value into existing Cookie if already existing. -// -// Since v2.1.0 +// NOTE: Method appends the Cookie value into existing Cookie even if its already existing. func (r *Request) SetCookies(rs []*http.Cookie) *Request { r.Cookies = append(r.Cookies, rs...) return r @@ -759,30 +804,35 @@ func (r *Request) SetCookies(rs []*http.Cookie) *Request { // SetLogger method sets given writer for logging Resty request and response details. // By default, requests and responses inherit their logger from the client. // -// Compliant to interface `resty.Logger`. +// Compliant to interface [resty.Logger]. +// +// It overrides the logger value set at the client instance level. func (r *Request) SetLogger(l Logger) *Request { r.log = l return r } -// SetDebug method enables the debug mode on current request Resty request, It logs +// SetDebug method enables the debug mode on the current request. It logs // the details current request and response. -// For `Request` it logs information such as HTTP verb, Relative URL path, Host, Headers, Body if it has one. -// For `Response` it logs information such as Status, Response Time, Headers, Body if it has one. // -// client.R().SetDebug(true) +// client.SetDebug(true) +// +// Also, it can be enabled at the request level for a particular request; see [Request.SetDebug]. +// - For [Request], it logs information such as HTTP verb, Relative URL path, +// Host, Headers, and Body if it has one. +// - For [Response], it logs information such as Status, Response Time, Headers, +// and Body if it has one. func (r *Request) SetDebug(d bool) *Request { r.Debug = d return r } // AddRetryCondition method adds a retry condition function to the request's -// array of functions that are checked to determine if the request is retried. -// The request will retry if any of the functions return true and error is nil. +// array of functions is checked to determine if the request can be retried. +// The request will retry if any functions return true and the error is nil. // -// Note: These retry conditions are checked before all retry conditions of the client. -// -// Since v2.7.0 +// NOTE: The request level retry conditions are checked before all retry +// conditions from the client instance. func (r *Request) AddRetryCondition(condition RetryConditionFunc) *Request { r.retryConditions = append(r.retryConditions, condition) return r @@ -793,7 +843,7 @@ func (r *Request) AddRetryCondition(condition RetryConditionFunc) *Request { //_______________________________________________________________________ // EnableTrace method enables trace for the current request -// using `httptrace.ClientTrace` and provides insights. +// using [httptrace.ClientTrace] and provides insights. // // client := resty.New() // @@ -801,19 +851,33 @@ func (r *Request) AddRetryCondition(condition RetryConditionFunc) *Request { // fmt.Println("Error:", err) // fmt.Println("Trace Info:", resp.Request.TraceInfo()) // -// See `Client.EnableTrace` available too to get trace info for all requests. -// -// Since v2.0.0 +// See [Client.EnableTrace] is also available to get trace info for all requests. func (r *Request) EnableTrace() *Request { r.trace = true return r } -// TraceInfo method returns the trace info for the request. -// If either the Client or Request EnableTrace function has not been called -// prior to the request being made, an empty TraceInfo object will be returned. +// EnableGenerateCurlOnDebug method enables the generation of CURL commands in the debug log. +// It works in conjunction with debug mode. It overrides the options set by the [Client]. // -// Since v2.0.0 +// NOTE: Use with care. +// - Potential to leak sensitive data from [Request] and [Response] in the debug log. +// - Beware of memory usage since the request body is reread. +func (r *Request) EnableGenerateCurlOnDebug() *Request { + r.generateCurlOnDebug = true + return r +} + +// DisableGenerateCurlOnDebug method disables the option set by [Request.EnableGenerateCurlOnDebug]. +// It overrides the options set by the [Client]. +func (r *Request) DisableGenerateCurlOnDebug() *Request { + r.generateCurlOnDebug = false + return r +} + +// TraceInfo method returns the trace info for the request. +// If either the [Client.EnableTrace] or [Request.EnableTrace] function has not been called +// before the request is made, an empty [resty.TraceInfo] object is returned. func (r *Request) TraceInfo() TraceInfo { ct := r.clientTrace @@ -902,7 +966,7 @@ func (r *Request) Patch(url string) (*Response, error) { } // Send method performs the HTTP request using the method and URL already defined -// for current `Request`. +// for current [Request]. // // req := client.R() // req.Method = resty.MethodGet @@ -912,8 +976,8 @@ func (r *Request) Send() (*Response, error) { return r.Execute(r.Method, r.URL) } -// Execute method performs the HTTP request with given HTTP method and URL -// for current `Request`. +// Execute method performs the HTTP request with the given HTTP method and URL +// for current [Request]. // // resp, err := client.R().Execute(resty.MethodGet, "http://httpbin.org/get") func (r *Request) Execute(method, url string) (*Response, error) { @@ -997,10 +1061,6 @@ type SRVRecord struct { Domain string } -//‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾ -// Request Unexported methods -//_______________________________________________________________________ - func (r *Request) fmtBodyString(sl int64) (body string) { body = "***** NO CONTENT *****" if !isPayloadSupported(r.Method, r.client.AllowGetMethodPayload) { diff --git a/vendor/github.com/go-resty/resty/v2/response.go b/vendor/github.com/go-resty/resty/v2/response.go index 58a8e81..f52b5c6 100644 --- a/vendor/github.com/go-resty/resty/v2/response.go +++ b/vendor/github.com/go-resty/resty/v2/response.go @@ -17,7 +17,7 @@ import ( // Response struct and methods //_______________________________________________________________________ -// Response struct holds response values of executed request. +// Response struct holds response values of executed requests. type Response struct { Request *Request RawResponse *http.Response @@ -27,9 +27,10 @@ type Response struct { receivedAt time.Time } -// Body method returns HTTP response as []byte array for the executed request. +// Body method returns the HTTP response as `[]byte` slice for the executed request. // -// Note: `Response.Body` might be nil, if `Request.SetOutput` is used. +// NOTE: [Response.Body] might be nil if [Request.SetOutput] is used. +// Also see [Request.SetDoNotParseResponse], [Client.SetDoNotParseResponse] func (r *Response) Body() []byte { if r.RawResponse == nil { return []byte{} @@ -37,13 +38,11 @@ func (r *Response) Body() []byte { return r.body } -// SetBody method is to set Response body in byte slice. Typically, -// its helpful for test cases. +// SetBody method sets [Response] body in byte slice. Typically, +// It is helpful for test cases. // // resp.SetBody([]byte("This is test body content")) // resp.SetBody(nil) -// -// Since v2.10.0 func (r *Response) SetBody(b []byte) *Response { r.body = b return r @@ -78,11 +77,15 @@ func (r *Response) Proto() string { } // Result method returns the response value as an object if it has one +// +// See [Request.SetResult] func (r *Response) Result() interface{} { return r.Request.Result } // Error method returns the error object if it has one +// +// See [Request.SetError], [Client.SetError] func (r *Response) Error() interface{} { return r.Request.Error } @@ -95,7 +98,7 @@ func (r *Response) Header() http.Header { return r.RawResponse.Header } -// Cookies method to access all the response cookies +// Cookies method to returns all the response cookies func (r *Response) Cookies() []*http.Cookie { if r.RawResponse == nil { return make([]*http.Cookie, 0) @@ -103,7 +106,8 @@ func (r *Response) Cookies() []*http.Cookie { return r.RawResponse.Cookies() } -// String method returns the body of the server response as String. +// String method returns the body of the HTTP response as a `string`. +// It returns an empty string if it is nil or the body is zero length. func (r *Response) String() string { if len(r.body) == 0 { return "" @@ -111,10 +115,11 @@ func (r *Response) String() string { return strings.TrimSpace(string(r.body)) } -// Time method returns the time of HTTP response time that from request we sent and received a request. +// Time method returns the duration of HTTP response time from the request we sent +// and received a request. // -// See `Response.ReceivedAt` to know when client received response and see `Response.Request.Time` to know -// when client sent a request. +// See [Response.ReceivedAt] to know when the client received a response and see +// `Response.Request.Time` to know when the client sent a request. func (r *Response) Time() time.Duration { if r.Request.clientTrace != nil { return r.Request.TraceInfo().TotalTime @@ -122,23 +127,25 @@ func (r *Response) Time() time.Duration { return r.receivedAt.Sub(r.Request.Time) } -// ReceivedAt method returns when response got received from server for the request. +// ReceivedAt method returns the time we received a response from the server for the request. func (r *Response) ReceivedAt() time.Time { return r.receivedAt } -// Size method returns the HTTP response size in bytes. Ya, you can relay on HTTP `Content-Length` header, -// however it won't be good for chucked transfer/compressed response. Since Resty calculates response size -// at the client end. You will get actual size of the http response. +// Size method returns the HTTP response size in bytes. Yeah, you can rely on HTTP `Content-Length` +// header, however it won't be available for chucked transfer/compressed response. +// Since Resty captures response size details when processing the response body +// when possible. So that users get the actual size of response bytes. func (r *Response) Size() int64 { return r.size } -// RawBody method exposes the HTTP raw response body. Use this method in-conjunction with `SetDoNotParseResponse` -// option otherwise you get an error as `read err: http: read on closed response body`. +// RawBody method exposes the HTTP raw response body. Use this method in conjunction with +// [Client.SetDoNotParseResponse] or [Request.SetDoNotParseResponse] +// option; otherwise, you get an error as `read err: http: read on closed response body.` // // Do not forget to close the body, otherwise you might get into connection leaks, no connection reuse. -// Basically you have taken over the control of response parsing from `Resty`. +// You have taken over the control of response parsing from Resty. func (r *Response) RawBody() io.ReadCloser { if r.RawResponse == nil { return nil @@ -156,10 +163,6 @@ func (r *Response) IsError() bool { return r.StatusCode() > 399 } -//‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾ -// Response Unexported methods -//_______________________________________________________________________ - func (r *Response) setReceivedAt() { r.receivedAt = time.Now() if r.Request.clientTrace != nil { @@ -168,6 +171,9 @@ func (r *Response) setReceivedAt() { } func (r *Response) fmtBodyString(sl int64) string { + if r.Request.client.notParseResponse || r.Request.notParseResponse { + return "***** DO NOT PARSE RESPONSE - Enabled *****" + } if len(r.body) > 0 { if int64(len(r.body)) > sl { return fmt.Sprintf("***** RESPONSE TOO LARGE (size - %d) *****", len(r.body)) diff --git a/vendor/github.com/go-resty/resty/v2/resty.go b/vendor/github.com/go-resty/resty/v2/resty.go index 7458af7..8f3d35b 100644 --- a/vendor/github.com/go-resty/resty/v2/resty.go +++ b/vendor/github.com/go-resty/resty/v2/resty.go @@ -14,7 +14,7 @@ import ( ) // Version # of resty -const Version = "2.14.0" +const Version = "2.15.3" // New method creates a new Resty client. func New() *Client { @@ -24,12 +24,12 @@ func New() *Client { }) } -// NewWithClient method creates a new Resty client with given `http.Client`. +// NewWithClient method creates a new Resty client with given [http.Client]. func NewWithClient(hc *http.Client) *Client { return createClient(hc) } -// NewWithLocalAddr method creates a new Resty client with given Local Address +// NewWithLocalAddr method creates a new Resty client with the given Local Address. // to dial from. func NewWithLocalAddr(localAddr net.Addr) *Client { cookieJar, _ := cookiejar.New(&cookiejar.Options{PublicSuffixList: publicsuffix.List}) diff --git a/vendor/github.com/go-resty/resty/v2/retry.go b/vendor/github.com/go-resty/resty/v2/retry.go index 932a266..416107e 100644 --- a/vendor/github.com/go-resty/resty/v2/retry.go +++ b/vendor/github.com/go-resty/resty/v2/retry.go @@ -23,7 +23,7 @@ type ( // Option is to create convenient retry options like wait time, max retries, etc. Option func(*Options) - // RetryConditionFunc type is for retry condition function + // RetryConditionFunc type is for the retry condition function // input: non-nil Response OR request execution error RetryConditionFunc func(*Response, error) bool @@ -33,8 +33,8 @@ type ( // RetryAfterFunc returns time to wait before retry // For example, it can parse HTTP Retry-After header // https://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html - // Non-nil error is returned if it is found that request is not retryable - // (0, nil) is a special result means 'use default algorithm' + // Non-nil error is returned if it is found that the request is not retryable + // (0, nil) is a special result that means 'use default algorithm' RetryAfterFunc func(*Client, *Response) (time.Duration, error) // Options struct is used to hold retry settings. @@ -69,7 +69,7 @@ func MaxWaitTime(value time.Duration) Option { } } -// RetryConditions sets the conditions that will be checked for retry. +// RetryConditions sets the conditions that will be checked for retry func RetryConditions(conditions []RetryConditionFunc) Option { return func(o *Options) { o.retryConditions = conditions @@ -84,7 +84,7 @@ func RetryHooks(hooks []OnRetryFunc) Option { } // ResetMultipartReaders sets a boolean value which will lead the start being seeked out -// on all multipart file readers, if they implement io.ReadSeeker +// on all multipart file readers if they implement [io.ReadSeeker] func ResetMultipartReaders(value bool) Option { return func(o *Options) { o.resetReaders = value @@ -202,7 +202,7 @@ func sleepDuration(resp *Response, min, max time.Duration, attempt int) (time.Du } // Return capped exponential backoff with jitter -// http://www.awsarchitectureblog.com/2015/03/backoff.html +// https://aws.amazon.com/blogs/architecture/exponential-backoff-and-jitter/ func jitterBackoff(min, max time.Duration, attempt int) time.Duration { base := float64(min) capLevel := float64(max) diff --git a/vendor/github.com/go-resty/resty/v2/shellescape/BUILD.bazel b/vendor/github.com/go-resty/resty/v2/shellescape/BUILD.bazel new file mode 100644 index 0000000..fe829e3 --- /dev/null +++ b/vendor/github.com/go-resty/resty/v2/shellescape/BUILD.bazel @@ -0,0 +1,14 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") + +go_library( + name = "shellescape", + srcs = ["shellescape.go"], + importpath = "github.com/go-resty/resty/v2/shellescape", + visibility = ["//visibility:public"], +) + +alias( + name = "go_default_library", + actual = ":shellescape", + visibility = ["//visibility:public"], +) diff --git a/vendor/github.com/go-resty/resty/v2/shellescape/shellescape.go b/vendor/github.com/go-resty/resty/v2/shellescape/shellescape.go index 5e6a379..1e835cb 100644 --- a/vendor/github.com/go-resty/resty/v2/shellescape/shellescape.go +++ b/vendor/github.com/go-resty/resty/v2/shellescape/shellescape.go @@ -1,5 +1,11 @@ +// Copyright (c) 2015-present Jeevanandam M (jeeva@myjeeva.com) +// 2024 Ahuigo (https://github.com/ahuigo) +// All rights reserved. +// resty source code and usage is governed by a MIT style +// license that can be found in the LICENSE file. + /* -Package shellescape provides the shellescape.Quote to escape arbitrary +Package shellescape provides the methods to escape arbitrary strings for a safe use as command line arguments in the most common POSIX shells. @@ -19,8 +25,8 @@ func init() { pattern = regexp.MustCompile(`[^\w@%+=:,./-]`) } -// Quote returns a shell-escaped version of the string s. The returned value -// is a string that can safely be used as one token in a shell command line. +// Quote method returns a shell-escaped version of the string. The returned value +// can safely be used as one token in a shell command line. func Quote(s string) string { if len(s) == 0 { return "''" diff --git a/vendor/github.com/go-resty/resty/v2/trace.go b/vendor/github.com/go-resty/resty/v2/trace.go index 7798a39..226bfbf 100644 --- a/vendor/github.com/go-resty/resty/v2/trace.go +++ b/vendor/github.com/go-resty/resty/v2/trace.go @@ -16,32 +16,30 @@ import ( // TraceInfo struct //_______________________________________________________________________ -// TraceInfo struct is used provide request trace info such as DNS lookup +// TraceInfo struct is used to provide request trace info such as DNS lookup // duration, Connection obtain duration, Server processing duration, etc. -// -// Since v2.0.0 type TraceInfo struct { - // DNSLookup is a duration that transport took to perform + // DNSLookup is the duration that transport took to perform // DNS lookup. DNSLookup time.Duration - // ConnTime is a duration that took to obtain a successful connection. + // ConnTime is the duration it took to obtain a successful connection. ConnTime time.Duration - // TCPConnTime is a duration that took to obtain the TCP connection. + // TCPConnTime is the duration it took to obtain the TCP connection. TCPConnTime time.Duration - // TLSHandshake is a duration that TLS handshake took place. + // TLSHandshake is the duration of the TLS handshake. TLSHandshake time.Duration - // ServerTime is a duration that server took to respond first byte. + // ServerTime is the server's duration for responding to the first byte. ServerTime time.Duration - // ResponseTime is a duration since first response byte from server to + // ResponseTime is the duration since the first response byte from the server to // request completion. ResponseTime time.Duration - // TotalTime is a duration that total request took end-to-end. + // TotalTime is the duration of the total time request taken end-to-end. TotalTime time.Duration // IsConnReused is whether this connection has been previously @@ -52,7 +50,7 @@ type TraceInfo struct { // idle pool. IsConnWasIdle bool - // ConnIdleTime is a duration how long the connection was previously + // ConnIdleTime is the duration how long the connection that was previously // idle, if IsConnWasIdle is true. ConnIdleTime time.Duration @@ -68,9 +66,9 @@ type TraceInfo struct { // ClientTrace struct and its methods //_______________________________________________________________________ -// tracer struct maps the `httptrace.ClientTrace` hooks into Fields -// with same naming for easy understanding. Plus additional insights -// Request. +// clientTrace struct maps the [httptrace.ClientTrace] hooks into Fields +// with the same naming for easy understanding. Plus additional insights +// [Request]. type clientTrace struct { getConn time.Time dnsStart time.Time @@ -84,10 +82,6 @@ type clientTrace struct { gotConnInfo httptrace.GotConnInfo } -//‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾ -// Trace unexported methods -//_______________________________________________________________________ - func (t *clientTrace) createContext(ctx context.Context) context.Context { return httptrace.WithClientTrace( ctx, diff --git a/vendor/github.com/go-resty/resty/v2/util.go b/vendor/github.com/go-resty/resty/v2/util.go index 7bbba91..e1a66ff 100644 --- a/vendor/github.com/go-resty/resty/v2/util.go +++ b/vendor/github.com/go-resty/resty/v2/util.go @@ -145,10 +145,6 @@ type ResponseLog struct { Body string } -//‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾ -// Package Unexported methods -//_______________________________________________________________________ - // way to disable the HTML escape as opt-in func jsonMarshal(c *Client, r *Request, d interface{}) (*bytes.Buffer, error) { if !r.jsonEscapeHTML || !c.jsonEscapeHTML { @@ -361,6 +357,32 @@ func copyHeaders(hdrs http.Header) http.Header { return nh } +func wrapErrors(n error, inner error) error { + if inner == nil { + return n + } + if n == nil { + return inner + } + return &restyError{ + err: n, + inner: inner, + } +} + +type restyError struct { + err error + inner error +} + +func (e *restyError) Error() string { + return e.err.Error() +} + +func (e *restyError) Unwrap() error { + return e.inner +} + type noRetryErr struct { err error } diff --git a/vendor/github.com/go-resty/resty/v2/util_curl.go b/vendor/github.com/go-resty/resty/v2/util_curl.go index e50c3b3..2bd9127 100644 --- a/vendor/github.com/go-resty/resty/v2/util_curl.go +++ b/vendor/github.com/go-resty/resty/v2/util_curl.go @@ -14,6 +14,7 @@ import ( func buildCurlRequest(req *http.Request, httpCookiejar http.CookieJar) (curl string) { // 1. Generate curl raw headers + curl = "curl -X " + req.Method + " " // req.Host + req.URL.Path + "?" + req.URL.RawQuery + " " + req.Proto + " " headers := dumpCurlHeaders(req) @@ -22,6 +23,7 @@ func buildCurlRequest(req *http.Request, httpCookiejar http.CookieJar) (curl str } // 2. Generate curl cookies + // TODO validate this block of code, I think its not required since cookie captured via Headers if cookieJar, ok := httpCookiejar.(*cookiejar.Jar); ok { cookies := cookieJar.Cookies(req.URL) if len(cookies) > 0 { diff --git a/vendor/github.com/klauspost/compress/.goreleaser.yml b/vendor/github.com/klauspost/compress/.goreleaser.yml index a229538..4528059 100644 --- a/vendor/github.com/klauspost/compress/.goreleaser.yml +++ b/vendor/github.com/klauspost/compress/.goreleaser.yml @@ -1,5 +1,5 @@ -# This is an example goreleaser.yaml file with some sane defaults. -# Make sure to check the documentation at http://goreleaser.com +version: 2 + before: hooks: - ./gen.sh @@ -99,7 +99,7 @@ archives: checksum: name_template: 'checksums.txt' snapshot: - name_template: "{{ .Tag }}-next" + version_template: "{{ .Tag }}-next" changelog: sort: asc filters: diff --git a/vendor/github.com/klauspost/compress/README.md b/vendor/github.com/klauspost/compress/README.md index 05c7359..de264c8 100644 --- a/vendor/github.com/klauspost/compress/README.md +++ b/vendor/github.com/klauspost/compress/README.md @@ -16,6 +16,27 @@ This package provides various compression algorithms. # changelog +* Sep 23rd, 2024 - [1.17.10](https://github.com/klauspost/compress/releases/tag/v1.17.10) + * gzhttp: Add TransportAlwaysDecompress option. https://github.com/klauspost/compress/pull/978 + * gzhttp: Add supported decompress request body by @mirecl in https://github.com/klauspost/compress/pull/1002 + * s2: Add EncodeBuffer buffer recycling callback https://github.com/klauspost/compress/pull/982 + * zstd: Improve memory usage on small streaming encodes https://github.com/klauspost/compress/pull/1007 + * flate: read data written with partial flush by @vajexal in https://github.com/klauspost/compress/pull/996 + +* Jun 12th, 2024 - [1.17.9](https://github.com/klauspost/compress/releases/tag/v1.17.9) + * s2: Reduce ReadFrom temporary allocations https://github.com/klauspost/compress/pull/949 + * flate, zstd: Shave some bytes off amd64 matchLen by @greatroar in https://github.com/klauspost/compress/pull/963 + * Upgrade zip/zlib to 1.22.4 upstream https://github.com/klauspost/compress/pull/970 https://github.com/klauspost/compress/pull/971 + * zstd: BuildDict fails with RLE table https://github.com/klauspost/compress/pull/951 + +* Apr 9th, 2024 - [1.17.8](https://github.com/klauspost/compress/releases/tag/v1.17.8) + * zstd: Reject blocks where reserved values are not 0 https://github.com/klauspost/compress/pull/885 + * zstd: Add RLE detection+encoding https://github.com/klauspost/compress/pull/938 + +* Feb 21st, 2024 - [1.17.7](https://github.com/klauspost/compress/releases/tag/v1.17.7) + * s2: Add AsyncFlush method: Complete the block without flushing by @Jille in https://github.com/klauspost/compress/pull/927 + * s2: Fix literal+repeat exceeds dst crash https://github.com/klauspost/compress/pull/930 + * Feb 5th, 2024 - [1.17.6](https://github.com/klauspost/compress/releases/tag/v1.17.6) * zstd: Fix incorrect repeat coding in best mode https://github.com/klauspost/compress/pull/923 * s2: Fix DecodeConcurrent deadlock on errors https://github.com/klauspost/compress/pull/925 @@ -81,7 +102,7 @@ https://github.com/klauspost/compress/pull/919 https://github.com/klauspost/comp * zstd: Various minor improvements by @greatroar in https://github.com/klauspost/compress/pull/788 https://github.com/klauspost/compress/pull/794 https://github.com/klauspost/compress/pull/795 * s2: Fix huge block overflow https://github.com/klauspost/compress/pull/779 * s2: Allow CustomEncoder fallback https://github.com/klauspost/compress/pull/780 - * gzhttp: Suppport ResponseWriter Unwrap() in gzhttp handler by @jgimenez in https://github.com/klauspost/compress/pull/799 + * gzhttp: Support ResponseWriter Unwrap() in gzhttp handler by @jgimenez in https://github.com/klauspost/compress/pull/799 * Mar 13, 2023 - [v1.16.1](https://github.com/klauspost/compress/releases/tag/v1.16.1) * zstd: Speed up + improve best encoder by @greatroar in https://github.com/klauspost/compress/pull/776 @@ -136,7 +157,7 @@ https://github.com/klauspost/compress/pull/919 https://github.com/klauspost/comp * zstd: Add [WithDecodeAllCapLimit](https://pkg.go.dev/github.com/klauspost/compress@v1.15.10/zstd#WithDecodeAllCapLimit) https://github.com/klauspost/compress/pull/649 * Add Go 1.19 - deprecate Go 1.16 https://github.com/klauspost/compress/pull/651 * flate: Improve level 5+6 compression https://github.com/klauspost/compress/pull/656 - * zstd: Improve "better" compresssion https://github.com/klauspost/compress/pull/657 + * zstd: Improve "better" compression https://github.com/klauspost/compress/pull/657 * s2: Improve "best" compression https://github.com/klauspost/compress/pull/658 * s2: Improve "better" compression. https://github.com/klauspost/compress/pull/635 * s2: Slightly faster non-assembly decompression https://github.com/klauspost/compress/pull/646 @@ -339,7 +360,7 @@ While the release has been extensively tested, it is recommended to testing when * s2: Fix binaries. * Feb 25, 2021 (v1.11.8) - * s2: Fixed occational out-of-bounds write on amd64. Upgrade recommended. + * s2: Fixed occasional out-of-bounds write on amd64. Upgrade recommended. * s2: Add AMD64 assembly for better mode. 25-50% faster. [#315](https://github.com/klauspost/compress/pull/315) * s2: Less upfront decoder allocation. [#322](https://github.com/klauspost/compress/pull/322) * zstd: Faster "compression" of incompressible data. [#314](https://github.com/klauspost/compress/pull/314) @@ -518,7 +539,7 @@ While the release has been extensively tested, it is recommended to testing when * Feb 19, 2016: Faster bit writer, level -2 is 15% faster, level 1 is 4% faster. * Feb 19, 2016: Handle small payloads faster in level 1-3. * Feb 19, 2016: Added faster level 2 + 3 compression modes. -* Feb 19, 2016: [Rebalanced compression levels](https://blog.klauspost.com/rebalancing-deflate-compression-levels/), so there is a more even progresssion in terms of compression. New default level is 5. +* Feb 19, 2016: [Rebalanced compression levels](https://blog.klauspost.com/rebalancing-deflate-compression-levels/), so there is a more even progression in terms of compression. New default level is 5. * Feb 14, 2016: Snappy: Merge upstream changes. * Feb 14, 2016: Snappy: Fix aggressive skipping. * Feb 14, 2016: Snappy: Update benchmark. diff --git a/vendor/github.com/klauspost/compress/fse/decompress.go b/vendor/github.com/klauspost/compress/fse/decompress.go index cc05d0f..0c7dd4f 100644 --- a/vendor/github.com/klauspost/compress/fse/decompress.go +++ b/vendor/github.com/klauspost/compress/fse/decompress.go @@ -15,7 +15,7 @@ const ( // It is possible, but by no way guaranteed that corrupt data will // return an error. // It is up to the caller to verify integrity of the returned data. -// Use a predefined Scrach to set maximum acceptable output size. +// Use a predefined Scratch to set maximum acceptable output size. func Decompress(b []byte, s *Scratch) ([]byte, error) { s, err := s.prepare(b) if err != nil { diff --git a/vendor/github.com/klauspost/compress/huff0/decompress.go b/vendor/github.com/klauspost/compress/huff0/decompress.go index 54bd08b..0f56b02 100644 --- a/vendor/github.com/klauspost/compress/huff0/decompress.go +++ b/vendor/github.com/klauspost/compress/huff0/decompress.go @@ -1136,7 +1136,7 @@ func (s *Scratch) matches(ct cTable, w io.Writer) { errs++ } if errs > 0 { - fmt.Fprintf(w, "%d errros in base, stopping\n", errs) + fmt.Fprintf(w, "%d errors in base, stopping\n", errs) continue } // Ensure that all combinations are covered. @@ -1152,7 +1152,7 @@ func (s *Scratch) matches(ct cTable, w io.Writer) { errs++ } if errs > 20 { - fmt.Fprintf(w, "%d errros, stopping\n", errs) + fmt.Fprintf(w, "%d errors, stopping\n", errs) break } } diff --git a/vendor/github.com/klauspost/compress/zstd/blockdec.go b/vendor/github.com/klauspost/compress/zstd/blockdec.go index 03744fb..9c28840 100644 --- a/vendor/github.com/klauspost/compress/zstd/blockdec.go +++ b/vendor/github.com/klauspost/compress/zstd/blockdec.go @@ -598,7 +598,9 @@ func (b *blockDec) prepareSequences(in []byte, hist *history) (err error) { printf("RLE set to 0x%x, code: %v", symb, v) } case compModeFSE: - println("Reading table for", tableIndex(i)) + if debugDecoder { + println("Reading table for", tableIndex(i)) + } if seq.fse == nil || seq.fse.preDefined { seq.fse = fseDecoderPool.Get().(*fseDecoder) } diff --git a/vendor/github.com/klauspost/compress/zstd/enc_better.go b/vendor/github.com/klauspost/compress/zstd/enc_better.go index a4f5bf9..84a79fd 100644 --- a/vendor/github.com/klauspost/compress/zstd/enc_better.go +++ b/vendor/github.com/klauspost/compress/zstd/enc_better.go @@ -179,9 +179,9 @@ encodeLoop: if repIndex >= 0 && load3232(src, repIndex) == uint32(cv>>(repOff*8)) { // Consider history as well. var seq seq - lenght := 4 + e.matchlen(s+4+repOff, repIndex+4, src) + length := 4 + e.matchlen(s+4+repOff, repIndex+4, src) - seq.matchLen = uint32(lenght - zstdMinMatch) + seq.matchLen = uint32(length - zstdMinMatch) // We might be able to match backwards. // Extend as long as we can. @@ -210,12 +210,12 @@ encodeLoop: // Index match start+1 (long) -> s - 1 index0 := s + repOff - s += lenght + repOff + s += length + repOff nextEmit = s if s >= sLimit { if debugEncoder { - println("repeat ended", s, lenght) + println("repeat ended", s, length) } break encodeLoop @@ -241,9 +241,9 @@ encodeLoop: if false && repIndex >= 0 && load6432(src, repIndex) == load6432(src, s+repOff) { // Consider history as well. var seq seq - lenght := 8 + e.matchlen(s+8+repOff2, repIndex+8, src) + length := 8 + e.matchlen(s+8+repOff2, repIndex+8, src) - seq.matchLen = uint32(lenght - zstdMinMatch) + seq.matchLen = uint32(length - zstdMinMatch) // We might be able to match backwards. // Extend as long as we can. @@ -270,11 +270,11 @@ encodeLoop: } blk.sequences = append(blk.sequences, seq) - s += lenght + repOff2 + s += length + repOff2 nextEmit = s if s >= sLimit { if debugEncoder { - println("repeat ended", s, lenght) + println("repeat ended", s, length) } break encodeLoop @@ -708,9 +708,9 @@ encodeLoop: if repIndex >= 0 && load3232(src, repIndex) == uint32(cv>>(repOff*8)) { // Consider history as well. var seq seq - lenght := 4 + e.matchlen(s+4+repOff, repIndex+4, src) + length := 4 + e.matchlen(s+4+repOff, repIndex+4, src) - seq.matchLen = uint32(lenght - zstdMinMatch) + seq.matchLen = uint32(length - zstdMinMatch) // We might be able to match backwards. // Extend as long as we can. @@ -738,12 +738,12 @@ encodeLoop: blk.sequences = append(blk.sequences, seq) // Index match start+1 (long) -> s - 1 - s += lenght + repOff + s += length + repOff nextEmit = s if s >= sLimit { if debugEncoder { - println("repeat ended", s, lenght) + println("repeat ended", s, length) } break encodeLoop @@ -772,9 +772,9 @@ encodeLoop: if false && repIndex >= 0 && load6432(src, repIndex) == load6432(src, s+repOff) { // Consider history as well. var seq seq - lenght := 8 + e.matchlen(s+8+repOff2, repIndex+8, src) + length := 8 + e.matchlen(s+8+repOff2, repIndex+8, src) - seq.matchLen = uint32(lenght - zstdMinMatch) + seq.matchLen = uint32(length - zstdMinMatch) // We might be able to match backwards. // Extend as long as we can. @@ -801,11 +801,11 @@ encodeLoop: } blk.sequences = append(blk.sequences, seq) - s += lenght + repOff2 + s += length + repOff2 nextEmit = s if s >= sLimit { if debugEncoder { - println("repeat ended", s, lenght) + println("repeat ended", s, length) } break encodeLoop diff --git a/vendor/github.com/klauspost/compress/zstd/enc_dfast.go b/vendor/github.com/klauspost/compress/zstd/enc_dfast.go index a154c18..d36be7b 100644 --- a/vendor/github.com/klauspost/compress/zstd/enc_dfast.go +++ b/vendor/github.com/klauspost/compress/zstd/enc_dfast.go @@ -138,9 +138,9 @@ encodeLoop: if repIndex >= 0 && load3232(src, repIndex) == uint32(cv>>(repOff*8)) { // Consider history as well. var seq seq - lenght := 4 + e.matchlen(s+4+repOff, repIndex+4, src) + length := 4 + e.matchlen(s+4+repOff, repIndex+4, src) - seq.matchLen = uint32(lenght - zstdMinMatch) + seq.matchLen = uint32(length - zstdMinMatch) // We might be able to match backwards. // Extend as long as we can. @@ -166,11 +166,11 @@ encodeLoop: println("repeat sequence", seq, "next s:", s) } blk.sequences = append(blk.sequences, seq) - s += lenght + repOff + s += length + repOff nextEmit = s if s >= sLimit { if debugEncoder { - println("repeat ended", s, lenght) + println("repeat ended", s, length) } break encodeLoop @@ -798,9 +798,9 @@ encodeLoop: if repIndex >= 0 && load3232(src, repIndex) == uint32(cv>>(repOff*8)) { // Consider history as well. var seq seq - lenght := 4 + e.matchlen(s+4+repOff, repIndex+4, src) + length := 4 + e.matchlen(s+4+repOff, repIndex+4, src) - seq.matchLen = uint32(lenght - zstdMinMatch) + seq.matchLen = uint32(length - zstdMinMatch) // We might be able to match backwards. // Extend as long as we can. @@ -826,11 +826,11 @@ encodeLoop: println("repeat sequence", seq, "next s:", s) } blk.sequences = append(blk.sequences, seq) - s += lenght + repOff + s += length + repOff nextEmit = s if s >= sLimit { if debugEncoder { - println("repeat ended", s, lenght) + println("repeat ended", s, length) } break encodeLoop diff --git a/vendor/github.com/klauspost/compress/zstd/encoder.go b/vendor/github.com/klauspost/compress/zstd/encoder.go index 72af7ef..8f8223c 100644 --- a/vendor/github.com/klauspost/compress/zstd/encoder.go +++ b/vendor/github.com/klauspost/compress/zstd/encoder.go @@ -6,6 +6,7 @@ package zstd import ( "crypto/rand" + "errors" "fmt" "io" "math" @@ -149,6 +150,9 @@ func (e *Encoder) ResetContentSize(w io.Writer, size int64) { // and write CRC if requested. func (e *Encoder) Write(p []byte) (n int, err error) { s := &e.state + if s.eofWritten { + return 0, ErrEncoderClosed + } for len(p) > 0 { if len(p)+len(s.filling) < e.o.blockSize { if e.o.crc { @@ -202,7 +206,7 @@ func (e *Encoder) nextBlock(final bool) error { return nil } if final && len(s.filling) > 0 { - s.current = e.EncodeAll(s.filling, s.current[:0]) + s.current = e.encodeAll(s.encoder, s.filling, s.current[:0]) var n2 int n2, s.err = s.w.Write(s.current) if s.err != nil { @@ -288,6 +292,9 @@ func (e *Encoder) nextBlock(final bool) error { s.filling, s.current, s.previous = s.previous[:0], s.filling, s.current s.nInput += int64(len(s.current)) s.wg.Add(1) + if final { + s.eofWritten = true + } go func(src []byte) { if debugEncoder { println("Adding block,", len(src), "bytes, final:", final) @@ -303,9 +310,6 @@ func (e *Encoder) nextBlock(final bool) error { blk := enc.Block() enc.Encode(blk, src) blk.last = final - if final { - s.eofWritten = true - } // Wait for pending writes. s.wWg.Wait() if s.writeErr != nil { @@ -401,12 +405,20 @@ func (e *Encoder) Flush() error { if len(s.filling) > 0 { err := e.nextBlock(false) if err != nil { + // Ignore Flush after Close. + if errors.Is(s.err, ErrEncoderClosed) { + return nil + } return err } } s.wg.Wait() s.wWg.Wait() if s.err != nil { + // Ignore Flush after Close. + if errors.Is(s.err, ErrEncoderClosed) { + return nil + } return s.err } return s.writeErr @@ -422,6 +434,9 @@ func (e *Encoder) Close() error { } err := e.nextBlock(true) if err != nil { + if errors.Is(s.err, ErrEncoderClosed) { + return nil + } return err } if s.frameContentSize > 0 { @@ -459,6 +474,11 @@ func (e *Encoder) Close() error { } _, s.err = s.w.Write(frame) } + if s.err == nil { + s.err = ErrEncoderClosed + return nil + } + return s.err } @@ -469,6 +489,15 @@ func (e *Encoder) Close() error { // Data compressed with EncodeAll can be decoded with the Decoder, // using either a stream or DecodeAll. func (e *Encoder) EncodeAll(src, dst []byte) []byte { + e.init.Do(e.initialize) + enc := <-e.encoders + defer func() { + e.encoders <- enc + }() + return e.encodeAll(enc, src, dst) +} + +func (e *Encoder) encodeAll(enc encoder, src, dst []byte) []byte { if len(src) == 0 { if e.o.fullZero { // Add frame header. @@ -491,13 +520,7 @@ func (e *Encoder) EncodeAll(src, dst []byte) []byte { } return dst } - e.init.Do(e.initialize) - enc := <-e.encoders - defer func() { - // Release encoder reference to last block. - // If a non-single block is needed the encoder will reset again. - e.encoders <- enc - }() + // Use single segments when above minimum window and below window size. single := len(src) <= e.o.windowSize && len(src) > MinWindowSize if e.o.single != nil { diff --git a/vendor/github.com/klauspost/compress/zstd/framedec.go b/vendor/github.com/klauspost/compress/zstd/framedec.go index 53e160f..e47af66 100644 --- a/vendor/github.com/klauspost/compress/zstd/framedec.go +++ b/vendor/github.com/klauspost/compress/zstd/framedec.go @@ -146,7 +146,9 @@ func (d *frameDec) reset(br byteBuffer) error { } return err } - printf("raw: %x, mantissa: %d, exponent: %d\n", wd, wd&7, wd>>3) + if debugDecoder { + printf("raw: %x, mantissa: %d, exponent: %d\n", wd, wd&7, wd>>3) + } windowLog := 10 + (wd >> 3) windowBase := uint64(1) << windowLog windowAdd := (windowBase / 8) * uint64(wd&0x7) diff --git a/vendor/github.com/klauspost/compress/zstd/seqdec_amd64.go b/vendor/github.com/klauspost/compress/zstd/seqdec_amd64.go index 8adabd8..c59f17e 100644 --- a/vendor/github.com/klauspost/compress/zstd/seqdec_amd64.go +++ b/vendor/github.com/klauspost/compress/zstd/seqdec_amd64.go @@ -146,7 +146,7 @@ func (s *sequenceDecs) decodeSyncSimple(hist []byte) (bool, error) { return true, fmt.Errorf("output bigger than max block size (%d)", maxBlockSize) default: - return true, fmt.Errorf("sequenceDecs_decode returned erronous code %d", errCode) + return true, fmt.Errorf("sequenceDecs_decode returned erroneous code %d", errCode) } s.seqSize += ctx.litRemain @@ -292,7 +292,7 @@ func (s *sequenceDecs) decode(seqs []seqVals) error { return io.ErrUnexpectedEOF } - return fmt.Errorf("sequenceDecs_decode_amd64 returned erronous code %d", errCode) + return fmt.Errorf("sequenceDecs_decode_amd64 returned erroneous code %d", errCode) } if ctx.litRemain < 0 { diff --git a/vendor/github.com/klauspost/compress/zstd/seqdec_amd64.s b/vendor/github.com/klauspost/compress/zstd/seqdec_amd64.s index 5b06174..f5591fa 100644 --- a/vendor/github.com/klauspost/compress/zstd/seqdec_amd64.s +++ b/vendor/github.com/klauspost/compress/zstd/seqdec_amd64.s @@ -1814,7 +1814,7 @@ TEXT ·sequenceDecs_decodeSync_amd64(SB), $64-32 MOVQ 40(SP), AX ADDQ AX, 48(SP) - // Calculate poiter to s.out[cap(s.out)] (a past-end pointer) + // Calculate pointer to s.out[cap(s.out)] (a past-end pointer) ADDQ R10, 32(SP) // outBase += outPosition @@ -2376,7 +2376,7 @@ TEXT ·sequenceDecs_decodeSync_bmi2(SB), $64-32 MOVQ 40(SP), CX ADDQ CX, 48(SP) - // Calculate poiter to s.out[cap(s.out)] (a past-end pointer) + // Calculate pointer to s.out[cap(s.out)] (a past-end pointer) ADDQ R9, 32(SP) // outBase += outPosition @@ -2896,7 +2896,7 @@ TEXT ·sequenceDecs_decodeSync_safe_amd64(SB), $64-32 MOVQ 40(SP), AX ADDQ AX, 48(SP) - // Calculate poiter to s.out[cap(s.out)] (a past-end pointer) + // Calculate pointer to s.out[cap(s.out)] (a past-end pointer) ADDQ R10, 32(SP) // outBase += outPosition @@ -3560,7 +3560,7 @@ TEXT ·sequenceDecs_decodeSync_safe_bmi2(SB), $64-32 MOVQ 40(SP), CX ADDQ CX, 48(SP) - // Calculate poiter to s.out[cap(s.out)] (a past-end pointer) + // Calculate pointer to s.out[cap(s.out)] (a past-end pointer) ADDQ R9, 32(SP) // outBase += outPosition diff --git a/vendor/github.com/klauspost/compress/zstd/zstd.go b/vendor/github.com/klauspost/compress/zstd/zstd.go index 4be7cc7..066bef2 100644 --- a/vendor/github.com/klauspost/compress/zstd/zstd.go +++ b/vendor/github.com/klauspost/compress/zstd/zstd.go @@ -88,6 +88,10 @@ var ( // Close has been called. ErrDecoderClosed = errors.New("decoder used after Close") + // ErrEncoderClosed will be returned if the Encoder was used after + // Close has been called. + ErrEncoderClosed = errors.New("encoder used after Close") + // ErrDecoderNilInput is returned when a nil Reader was provided // and an operation other than Reset/DecodeAll/Close was attempted. ErrDecoderNilInput = errors.New("nil input provided as reader") diff --git a/vendor/github.com/prometheus/client_golang/prometheus/histogram.go b/vendor/github.com/prometheus/client_golang/prometheus/histogram.go index 8d35f2d..519db34 100644 --- a/vendor/github.com/prometheus/client_golang/prometheus/histogram.go +++ b/vendor/github.com/prometheus/client_golang/prometheus/histogram.go @@ -844,9 +844,7 @@ func (h *histogram) Write(out *dto.Metric) error { }} } - // If exemplars are not configured, the cap will be 0. - // So append is not needed in this case. - if cap(h.nativeExemplars.exemplars) > 0 { + if h.nativeExemplars.isEnabled() { h.nativeExemplars.Lock() his.Exemplars = append(his.Exemplars, h.nativeExemplars.exemplars...) h.nativeExemplars.Unlock() @@ -1658,10 +1656,17 @@ func addAndResetCounts(hot, cold *histogramCounts) { type nativeExemplars struct { sync.Mutex - ttl time.Duration + // Time-to-live for exemplars, it is set to -1 if exemplars are disabled, that is NativeHistogramMaxExemplars is below 0. + // The ttl is used on insertion to remove an exemplar that is older than ttl, if present. + ttl time.Duration + exemplars []*dto.Exemplar } +func (n *nativeExemplars) isEnabled() bool { + return n.ttl != -1 +} + func makeNativeExemplars(ttl time.Duration, maxCount int) nativeExemplars { if ttl == 0 { ttl = 5 * time.Minute @@ -1673,6 +1678,7 @@ func makeNativeExemplars(ttl time.Duration, maxCount int) nativeExemplars { if maxCount < 0 { maxCount = 0 + ttl = -1 } return nativeExemplars{ @@ -1682,20 +1688,18 @@ func makeNativeExemplars(ttl time.Duration, maxCount int) nativeExemplars { } func (n *nativeExemplars) addExemplar(e *dto.Exemplar) { - if cap(n.exemplars) == 0 { + if !n.isEnabled() { return } n.Lock() defer n.Unlock() - // The index where to insert the new exemplar. - var nIdx int = -1 - // When the number of exemplars has not yet exceeded or // is equal to cap(n.exemplars), then // insert the new exemplar directly. if len(n.exemplars) < cap(n.exemplars) { + var nIdx int for nIdx = 0; nIdx < len(n.exemplars); nIdx++ { if *e.Value < *n.exemplars[nIdx].Value { break @@ -1705,17 +1709,46 @@ func (n *nativeExemplars) addExemplar(e *dto.Exemplar) { return } + if len(n.exemplars) == 1 { + // When the number of exemplars is 1, then + // replace the existing exemplar with the new exemplar. + n.exemplars[0] = e + return + } + // From this point on, the number of exemplars is greater than 1. + // When the number of exemplars exceeds the limit, remove one exemplar. var ( - rIdx int // The index where to remove the old exemplar. - - ot = time.Now() // Oldest timestamp seen. - otIdx = -1 // Index of the exemplar with the oldest timestamp. - - md = -1.0 // Logarithm of the delta of the closest pair of exemplars. - mdIdx = -1 // Index of the older exemplar within the closest pair. - cLog float64 // Logarithm of the current exemplar. - pLog float64 // Logarithm of the previous exemplar. + ot = time.Time{} // Oldest timestamp seen. Initial value doesn't matter as we replace it due to otIdx == -1 in the loop. + otIdx = -1 // Index of the exemplar with the oldest timestamp. + + md = -1.0 // Logarithm of the delta of the closest pair of exemplars. + + // The insertion point of the new exemplar in the exemplars slice after insertion. + // This is calculated purely based on the order of the exemplars by value. + // nIdx == len(n.exemplars) means the new exemplar is to be inserted after the end. + nIdx = -1 + + // rIdx is ultimately the index for the exemplar that we are replacing with the new exemplar. + // The aim is to keep a good spread of exemplars by value and not let them bunch up too much. + // It is calculated in 3 steps: + // 1. First we set rIdx to the index of the older exemplar within the closest pair by value. + // That is the following will be true (on log scale): + // either the exemplar pair on index (rIdx-1, rIdx) or (rIdx, rIdx+1) will have + // the closest values to each other from all pairs. + // For example, suppose the values are distributed like this: + // |-----------x-------------x----------------x----x-----| + // ^--rIdx as this is older. + // Or like this: + // |-----------x-------------x----------------x----x-----| + // ^--rIdx as this is older. + // 2. If there is an exemplar that expired, then we simple reset rIdx to that index. + // 3. We check if by inserting the new exemplar we would create a closer pair at + // (nIdx-1, nIdx) or (nIdx, nIdx+1) and set rIdx to nIdx-1 or nIdx accordingly to + // keep the spread of exemplars by value; otherwise we keep rIdx as it is. + rIdx = -1 + cLog float64 // Logarithm of the current exemplar. + pLog float64 // Logarithm of the previous exemplar. ) for i, exemplar := range n.exemplars { @@ -1726,7 +1759,7 @@ func (n *nativeExemplars) addExemplar(e *dto.Exemplar) { } // Find the index at which to insert new the exemplar. - if *e.Value <= *exemplar.Value && nIdx == -1 { + if nIdx == -1 && *e.Value <= *exemplar.Value { nIdx = i } @@ -1738,11 +1771,13 @@ func (n *nativeExemplars) addExemplar(e *dto.Exemplar) { } diff := math.Abs(cLog - pLog) if md == -1 || diff < md { + // The closest exemplar pair is at index: i-1, i. + // Choose the exemplar with the older timestamp for replacement. md = diff if n.exemplars[i].Timestamp.AsTime().Before(n.exemplars[i-1].Timestamp.AsTime()) { - mdIdx = i + rIdx = i } else { - mdIdx = i - 1 + rIdx = i - 1 } } @@ -1753,8 +1788,12 @@ func (n *nativeExemplars) addExemplar(e *dto.Exemplar) { if nIdx == -1 { nIdx = len(n.exemplars) } + // Here, we have the following relationships: + // n.exemplars[nIdx-1].Value < e.Value (if nIdx > 0) + // e.Value <= n.exemplars[nIdx].Value (if nIdx < len(n.exemplars)) if otIdx != -1 && e.Timestamp.AsTime().Sub(ot) > n.ttl { + // If the oldest exemplar has expired, then replace it with the new exemplar. rIdx = otIdx } else { // In the previous for loop, when calculating the closest pair of exemplars, @@ -1764,23 +1803,26 @@ func (n *nativeExemplars) addExemplar(e *dto.Exemplar) { if nIdx > 0 { diff := math.Abs(elog - math.Log(n.exemplars[nIdx-1].GetValue())) if diff < md { + // The value we are about to insert is closer to the previous exemplar at the insertion point than what we calculated before in rIdx. + // v--rIdx + // |-----------x-n-----------x----------------x----x-----| + // nIdx-1--^ ^--new exemplar value + // Do not make the spread worse, replace nIdx-1 and not rIdx. md = diff - mdIdx = nIdx - if n.exemplars[nIdx-1].Timestamp.AsTime().Before(e.Timestamp.AsTime()) { - mdIdx = nIdx - 1 - } + rIdx = nIdx - 1 } } if nIdx < len(n.exemplars) { diff := math.Abs(math.Log(n.exemplars[nIdx].GetValue()) - elog) if diff < md { - mdIdx = nIdx - if n.exemplars[nIdx].Timestamp.AsTime().Before(e.Timestamp.AsTime()) { - mdIdx = nIdx - } + // The value we are about to insert is closer to the next exemplar at the insertion point than what we calculated before in rIdx. + // v--rIdx + // |-----------x-----------n-x----------------x----x-----| + // new exemplar value--^ ^--nIdx + // Do not make the spread worse, replace nIdx-1 and not rIdx. + rIdx = nIdx } } - rIdx = mdIdx } // Adjust the slice according to rIdx and nIdx. diff --git a/vendor/github.com/prometheus/common/expfmt/expfmt.go b/vendor/github.com/prometheus/common/expfmt/expfmt.go index 14034a6..d942af8 100644 --- a/vendor/github.com/prometheus/common/expfmt/expfmt.go +++ b/vendor/github.com/prometheus/common/expfmt/expfmt.go @@ -112,6 +112,29 @@ func NewOpenMetricsFormat(version string) (Format, error) { return FmtUnknown, fmt.Errorf("unknown open metrics version string") } +// WithEscapingScheme returns a copy of Format with the specified escaping +// scheme appended to the end. If an escaping scheme already exists it is +// removed. +func (f Format) WithEscapingScheme(s model.EscapingScheme) Format { + var terms []string + for _, p := range strings.Split(string(f), ";") { + toks := strings.Split(p, "=") + if len(toks) != 2 { + trimmed := strings.TrimSpace(p) + if len(trimmed) > 0 { + terms = append(terms, trimmed) + } + continue + } + key := strings.TrimSpace(toks[0]) + if key != model.EscapingKey { + terms = append(terms, strings.TrimSpace(p)) + } + } + terms = append(terms, model.EscapingKey+"="+s.String()) + return Format(strings.Join(terms, "; ")) +} + // FormatType deduces an overall FormatType for the given format. func (f Format) FormatType() FormatType { toks := strings.Split(string(f), ";") diff --git a/vendor/github.com/prometheus/common/expfmt/text_parse.go b/vendor/github.com/prometheus/common/expfmt/text_parse.go index 25db4f2..f085a92 100644 --- a/vendor/github.com/prometheus/common/expfmt/text_parse.go +++ b/vendor/github.com/prometheus/common/expfmt/text_parse.go @@ -75,7 +75,9 @@ type TextParser struct { // count and sum of that summary/histogram. currentIsSummaryCount, currentIsSummarySum bool currentIsHistogramCount, currentIsHistogramSum bool - currentMetricIsInsideBraces bool + // These indicate if the metric name from the current line being parsed is inside + // braces and if that metric name was found respectively. + currentMetricIsInsideBraces, currentMetricInsideBracesIsPresent bool } // TextToMetricFamilies reads 'in' as the simple and flat text-based exchange @@ -147,6 +149,7 @@ func (p *TextParser) reset(in io.Reader) { func (p *TextParser) startOfLine() stateFn { p.lineCount++ p.currentMetricIsInsideBraces = false + p.currentMetricInsideBracesIsPresent = false if p.skipBlankTab(); p.err != nil { // This is the only place that we expect to see io.EOF, // which is not an error but the signal that we are done. @@ -301,17 +304,24 @@ func (p *TextParser) startLabelName() stateFn { } if p.currentByte != '=' { if p.currentMetricIsInsideBraces { - if p.currentMF != nil && p.currentMF.GetName() != p.currentToken.String() { - p.parseError(fmt.Sprintf("multiple metric names %s %s", p.currentMF.GetName(), p.currentToken.String())) + if p.currentMetricInsideBracesIsPresent { + p.parseError(fmt.Sprintf("multiple metric names for metric %q", p.currentMF.GetName())) return nil } switch p.currentByte { case ',': p.setOrCreateCurrentMF() + if p.currentMF.Type == nil { + p.currentMF.Type = dto.MetricType_UNTYPED.Enum() + } p.currentMetric = &dto.Metric{} + p.currentMetricInsideBracesIsPresent = true return p.startLabelName case '}': p.setOrCreateCurrentMF() + if p.currentMF.Type == nil { + p.currentMF.Type = dto.MetricType_UNTYPED.Enum() + } p.currentMetric = &dto.Metric{} p.currentMetric.Label = append(p.currentMetric.Label, p.currentLabelPairs...) p.currentLabelPairs = nil diff --git a/vendor/github.com/prometheus/common/model/labelset_string.go b/vendor/github.com/prometheus/common/model/labelset_string.go index 481c47b..abb2c90 100644 --- a/vendor/github.com/prometheus/common/model/labelset_string.go +++ b/vendor/github.com/prometheus/common/model/labelset_string.go @@ -11,8 +11,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -//go:build go1.21 - package model import ( diff --git a/vendor/github.com/prometheus/common/model/labelset_string_go120.go b/vendor/github.com/prometheus/common/model/labelset_string_go120.go deleted file mode 100644 index c421268..0000000 --- a/vendor/github.com/prometheus/common/model/labelset_string_go120.go +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright 2024 The Prometheus Authors -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//go:build !go1.21 - -package model - -import ( - "fmt" - "sort" - "strings" -) - -// String was optimized using functions not available for go 1.20 -// or lower. We keep the old implementation for compatibility with client_golang. -// Once client golang drops support for go 1.20 (scheduled for August 2024), this -// file can be removed. -func (l LabelSet) String() string { - labelNames := make([]string, 0, len(l)) - for name := range l { - labelNames = append(labelNames, string(name)) - } - sort.Strings(labelNames) - lstrs := make([]string, 0, len(l)) - for _, name := range labelNames { - lstrs = append(lstrs, fmt.Sprintf("%s=%q", name, l[LabelName(name)])) - } - return fmt.Sprintf("{%s}", strings.Join(lstrs, ", ")) -} diff --git a/vendor/github.com/prometheus/common/model/metric.go b/vendor/github.com/prometheus/common/model/metric.go index c44f93f..f50966b 100644 --- a/vendor/github.com/prometheus/common/model/metric.go +++ b/vendor/github.com/prometheus/common/model/metric.go @@ -34,10 +34,13 @@ var ( // goroutines are started. NameValidationScheme = LegacyValidation - // NameEscapingScheme defines the default way that names will be - // escaped when presented to systems that do not support UTF-8 names. If the - // Content-Type "escaping" term is specified, that will override this value. - NameEscapingScheme = ValueEncodingEscaping + // NameEscapingScheme defines the default way that names will be escaped when + // presented to systems that do not support UTF-8 names. If the Content-Type + // "escaping" term is specified, that will override this value. + // NameEscapingScheme should not be set to the NoEscaping value. That string + // is used in content negotiation to indicate that a system supports UTF-8 and + // has that feature enabled. + NameEscapingScheme = UnderscoreEscaping ) // ValidationScheme is a Go enum for determining how metric and label names will diff --git a/vendor/golang.org/x/sys/unix/README.md b/vendor/golang.org/x/sys/unix/README.md index 7d3c060..6e08a76 100644 --- a/vendor/golang.org/x/sys/unix/README.md +++ b/vendor/golang.org/x/sys/unix/README.md @@ -156,7 +156,7 @@ from the generated architecture-specific files listed below, and merge these into a common file for each OS. The merge is performed in the following steps: -1. Construct the set of common code that is idential in all architecture-specific files. +1. Construct the set of common code that is identical in all architecture-specific files. 2. Write this common code to the merged file. 3. Remove the common code from all architecture-specific files. diff --git a/vendor/golang.org/x/sys/unix/mkerrors.sh b/vendor/golang.org/x/sys/unix/mkerrors.sh index d07dd09..ac54eca 100644 --- a/vendor/golang.org/x/sys/unix/mkerrors.sh +++ b/vendor/golang.org/x/sys/unix/mkerrors.sh @@ -552,6 +552,7 @@ ccflags="$@" $2 !~ /^RTC_VL_(ACCURACY|BACKUP|DATA)/ && $2 ~ /^(NETLINK|NLM|NLMSG|NLA|IFA|IFAN|RT|RTC|RTCF|RTN|RTPROT|RTNH|ARPHRD|ETH_P|NETNSA)_/ || $2 ~ /^SOCK_|SK_DIAG_|SKNLGRP_$/ || + $2 ~ /^(CONNECT|SAE)_/ || $2 ~ /^FIORDCHK$/ || $2 ~ /^SIOC/ || $2 ~ /^TIOC/ || @@ -655,7 +656,7 @@ errors=$( signals=$( echo '#include ' | $CC -x c - -E -dM $ccflags | awk '$1=="#define" && $2 ~ /^SIG[A-Z0-9]+$/ { print $2 }' | - grep -v 'SIGSTKSIZE\|SIGSTKSZ\|SIGRT\|SIGMAX64' | + grep -E -v '(SIGSTKSIZE|SIGSTKSZ|SIGRT|SIGMAX64)' | sort ) @@ -665,7 +666,7 @@ echo '#include ' | $CC -x c - -E -dM $ccflags | sort >_error.grep echo '#include ' | $CC -x c - -E -dM $ccflags | awk '$1=="#define" && $2 ~ /^SIG[A-Z0-9]+$/ { print "^\t" $2 "[ \t]*=" }' | - grep -v 'SIGSTKSIZE\|SIGSTKSZ\|SIGRT\|SIGMAX64' | + grep -E -v '(SIGSTKSIZE|SIGSTKSZ|SIGRT|SIGMAX64)' | sort >_signal.grep echo '// mkerrors.sh' "$@" diff --git a/vendor/golang.org/x/sys/unix/syscall_aix.go b/vendor/golang.org/x/sys/unix/syscall_aix.go index 67ce6ce..6f15ba1 100644 --- a/vendor/golang.org/x/sys/unix/syscall_aix.go +++ b/vendor/golang.org/x/sys/unix/syscall_aix.go @@ -360,7 +360,7 @@ func Wait4(pid int, wstatus *WaitStatus, options int, rusage *Rusage) (wpid int, var status _C_int var r Pid_t err = ERESTART - // AIX wait4 may return with ERESTART errno, while the processus is still + // AIX wait4 may return with ERESTART errno, while the process is still // active. for err == ERESTART { r, err = wait4(Pid_t(pid), &status, options, rusage) diff --git a/vendor/golang.org/x/sys/unix/syscall_darwin.go b/vendor/golang.org/x/sys/unix/syscall_darwin.go index 2d15200..099867d 100644 --- a/vendor/golang.org/x/sys/unix/syscall_darwin.go +++ b/vendor/golang.org/x/sys/unix/syscall_darwin.go @@ -566,6 +566,43 @@ func PthreadFchdir(fd int) (err error) { return pthread_fchdir_np(fd) } +// Connectx calls connectx(2) to initiate a connection on a socket. +// +// srcIf, srcAddr, and dstAddr are filled into a [SaEndpoints] struct and passed as the endpoints argument. +// +// - srcIf is the optional source interface index. 0 means unspecified. +// - srcAddr is the optional source address. nil means unspecified. +// - dstAddr is the destination address. +// +// On success, Connectx returns the number of bytes enqueued for transmission. +func Connectx(fd int, srcIf uint32, srcAddr, dstAddr Sockaddr, associd SaeAssocID, flags uint32, iov []Iovec, connid *SaeConnID) (n uintptr, err error) { + endpoints := SaEndpoints{ + Srcif: srcIf, + } + + if srcAddr != nil { + addrp, addrlen, err := srcAddr.sockaddr() + if err != nil { + return 0, err + } + endpoints.Srcaddr = (*RawSockaddr)(addrp) + endpoints.Srcaddrlen = uint32(addrlen) + } + + if dstAddr != nil { + addrp, addrlen, err := dstAddr.sockaddr() + if err != nil { + return 0, err + } + endpoints.Dstaddr = (*RawSockaddr)(addrp) + endpoints.Dstaddrlen = uint32(addrlen) + } + + err = connectx(fd, &endpoints, associd, flags, iov, &n, connid) + return +} + +//sys connectx(fd int, endpoints *SaEndpoints, associd SaeAssocID, flags uint32, iov []Iovec, n *uintptr, connid *SaeConnID) (err error) //sys sendfile(infd int, outfd int, offset int64, len *int64, hdtr unsafe.Pointer, flags int) (err error) //sys shmat(id int, addr uintptr, flag int) (ret uintptr, err error) diff --git a/vendor/golang.org/x/sys/unix/syscall_hurd.go b/vendor/golang.org/x/sys/unix/syscall_hurd.go index ba46651..a6a2d2f 100644 --- a/vendor/golang.org/x/sys/unix/syscall_hurd.go +++ b/vendor/golang.org/x/sys/unix/syscall_hurd.go @@ -11,6 +11,7 @@ package unix int ioctl(int, unsigned long int, uintptr_t); */ import "C" +import "unsafe" func ioctl(fd int, req uint, arg uintptr) (err error) { r0, er := C.ioctl(C.int(fd), C.ulong(req), C.uintptr_t(arg)) diff --git a/vendor/golang.org/x/sys/unix/syscall_linux.go b/vendor/golang.org/x/sys/unix/syscall_linux.go index 3f1d3d4..f08abd4 100644 --- a/vendor/golang.org/x/sys/unix/syscall_linux.go +++ b/vendor/golang.org/x/sys/unix/syscall_linux.go @@ -1295,6 +1295,48 @@ func GetsockoptTCPInfo(fd, level, opt int) (*TCPInfo, error) { return &value, err } +// GetsockoptTCPCCVegasInfo returns algorithm specific congestion control information for a socket using the "vegas" +// algorithm. +// +// The socket's congestion control algorighm can be retrieved via [GetsockoptString] with the [TCP_CONGESTION] option: +// +// algo, err := unix.GetsockoptString(fd, unix.IPPROTO_TCP, unix.TCP_CONGESTION) +func GetsockoptTCPCCVegasInfo(fd, level, opt int) (*TCPVegasInfo, error) { + var value [SizeofTCPCCInfo / 4]uint32 // ensure proper alignment + vallen := _Socklen(SizeofTCPCCInfo) + err := getsockopt(fd, level, opt, unsafe.Pointer(&value[0]), &vallen) + out := (*TCPVegasInfo)(unsafe.Pointer(&value[0])) + return out, err +} + +// GetsockoptTCPCCDCTCPInfo returns algorithm specific congestion control information for a socket using the "dctp" +// algorithm. +// +// The socket's congestion control algorighm can be retrieved via [GetsockoptString] with the [TCP_CONGESTION] option: +// +// algo, err := unix.GetsockoptString(fd, unix.IPPROTO_TCP, unix.TCP_CONGESTION) +func GetsockoptTCPCCDCTCPInfo(fd, level, opt int) (*TCPDCTCPInfo, error) { + var value [SizeofTCPCCInfo / 4]uint32 // ensure proper alignment + vallen := _Socklen(SizeofTCPCCInfo) + err := getsockopt(fd, level, opt, unsafe.Pointer(&value[0]), &vallen) + out := (*TCPDCTCPInfo)(unsafe.Pointer(&value[0])) + return out, err +} + +// GetsockoptTCPCCBBRInfo returns algorithm specific congestion control information for a socket using the "bbr" +// algorithm. +// +// The socket's congestion control algorighm can be retrieved via [GetsockoptString] with the [TCP_CONGESTION] option: +// +// algo, err := unix.GetsockoptString(fd, unix.IPPROTO_TCP, unix.TCP_CONGESTION) +func GetsockoptTCPCCBBRInfo(fd, level, opt int) (*TCPBBRInfo, error) { + var value [SizeofTCPCCInfo / 4]uint32 // ensure proper alignment + vallen := _Socklen(SizeofTCPCCInfo) + err := getsockopt(fd, level, opt, unsafe.Pointer(&value[0]), &vallen) + out := (*TCPBBRInfo)(unsafe.Pointer(&value[0])) + return out, err +} + // GetsockoptString returns the string value of the socket option opt for the // socket associated with fd at the given socket level. func GetsockoptString(fd, level, opt int) (string, error) { @@ -1959,7 +2001,26 @@ func Getpgrp() (pid int) { //sysnb Getpid() (pid int) //sysnb Getppid() (ppid int) //sys Getpriority(which int, who int) (prio int, err error) -//sys Getrandom(buf []byte, flags int) (n int, err error) + +func Getrandom(buf []byte, flags int) (n int, err error) { + vdsoRet, supported := vgetrandom(buf, uint32(flags)) + if supported { + if vdsoRet < 0 { + return 0, errnoErr(syscall.Errno(-vdsoRet)) + } + return vdsoRet, nil + } + var p *byte + if len(buf) > 0 { + p = &buf[0] + } + r, _, e := Syscall(SYS_GETRANDOM, uintptr(unsafe.Pointer(p)), uintptr(len(buf)), uintptr(flags)) + if e != 0 { + return 0, errnoErr(e) + } + return int(r), nil +} + //sysnb Getrusage(who int, rusage *Rusage) (err error) //sysnb Getsid(pid int) (sid int, err error) //sysnb Gettid() (tid int) diff --git a/vendor/golang.org/x/sys/unix/syscall_linux_arm64.go b/vendor/golang.org/x/sys/unix/syscall_linux_arm64.go index cf2ee6c..745e5c7 100644 --- a/vendor/golang.org/x/sys/unix/syscall_linux_arm64.go +++ b/vendor/golang.org/x/sys/unix/syscall_linux_arm64.go @@ -182,3 +182,5 @@ func KexecFileLoad(kernelFd int, initrdFd int, cmdline string, flags int) error } return kexecFileLoad(kernelFd, initrdFd, cmdlineLen, cmdline, flags) } + +const SYS_FSTATAT = SYS_NEWFSTATAT diff --git a/vendor/golang.org/x/sys/unix/syscall_linux_loong64.go b/vendor/golang.org/x/sys/unix/syscall_linux_loong64.go index 3d0e984..dd2262a 100644 --- a/vendor/golang.org/x/sys/unix/syscall_linux_loong64.go +++ b/vendor/golang.org/x/sys/unix/syscall_linux_loong64.go @@ -214,3 +214,5 @@ func KexecFileLoad(kernelFd int, initrdFd int, cmdline string, flags int) error } return kexecFileLoad(kernelFd, initrdFd, cmdlineLen, cmdline, flags) } + +const SYS_FSTATAT = SYS_NEWFSTATAT diff --git a/vendor/golang.org/x/sys/unix/syscall_linux_riscv64.go b/vendor/golang.org/x/sys/unix/syscall_linux_riscv64.go index 6f5a288..8cf3670 100644 --- a/vendor/golang.org/x/sys/unix/syscall_linux_riscv64.go +++ b/vendor/golang.org/x/sys/unix/syscall_linux_riscv64.go @@ -187,3 +187,5 @@ func RISCVHWProbe(pairs []RISCVHWProbePairs, set *CPUSet, flags uint) (err error } return riscvHWProbe(pairs, setSize, set, flags) } + +const SYS_FSTATAT = SYS_NEWFSTATAT diff --git a/vendor/golang.org/x/sys/unix/vgetrandom_linux.go b/vendor/golang.org/x/sys/unix/vgetrandom_linux.go new file mode 100644 index 0000000..07ac8e0 --- /dev/null +++ b/vendor/golang.org/x/sys/unix/vgetrandom_linux.go @@ -0,0 +1,13 @@ +// Copyright 2024 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build linux && go1.24 + +package unix + +import _ "unsafe" + +//go:linkname vgetrandom runtime.vgetrandom +//go:noescape +func vgetrandom(p []byte, flags uint32) (ret int, supported bool) diff --git a/vendor/golang.org/x/sys/unix/vgetrandom_unsupported.go b/vendor/golang.org/x/sys/unix/vgetrandom_unsupported.go new file mode 100644 index 0000000..297e97b --- /dev/null +++ b/vendor/golang.org/x/sys/unix/vgetrandom_unsupported.go @@ -0,0 +1,11 @@ +// Copyright 2024 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build !linux || !go1.24 + +package unix + +func vgetrandom(p []byte, flags uint32) (ret int, supported bool) { + return -1, false +} diff --git a/vendor/golang.org/x/sys/unix/zerrors_darwin_amd64.go b/vendor/golang.org/x/sys/unix/zerrors_darwin_amd64.go index 4308ac1..d73c465 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_darwin_amd64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_darwin_amd64.go @@ -237,6 +237,9 @@ const ( CLOCK_UPTIME_RAW_APPROX = 0x9 CLONE_NOFOLLOW = 0x1 CLONE_NOOWNERCOPY = 0x2 + CONNECT_DATA_AUTHENTICATED = 0x4 + CONNECT_DATA_IDEMPOTENT = 0x2 + CONNECT_RESUME_ON_READ_WRITE = 0x1 CR0 = 0x0 CR1 = 0x1000 CR2 = 0x2000 @@ -1265,6 +1268,10 @@ const ( RTV_SSTHRESH = 0x20 RUSAGE_CHILDREN = -0x1 RUSAGE_SELF = 0x0 + SAE_ASSOCID_ALL = 0xffffffff + SAE_ASSOCID_ANY = 0x0 + SAE_CONNID_ALL = 0xffffffff + SAE_CONNID_ANY = 0x0 SCM_CREDS = 0x3 SCM_RIGHTS = 0x1 SCM_TIMESTAMP = 0x2 diff --git a/vendor/golang.org/x/sys/unix/zerrors_darwin_arm64.go b/vendor/golang.org/x/sys/unix/zerrors_darwin_arm64.go index c8068a7..4a55a40 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_darwin_arm64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_darwin_arm64.go @@ -237,6 +237,9 @@ const ( CLOCK_UPTIME_RAW_APPROX = 0x9 CLONE_NOFOLLOW = 0x1 CLONE_NOOWNERCOPY = 0x2 + CONNECT_DATA_AUTHENTICATED = 0x4 + CONNECT_DATA_IDEMPOTENT = 0x2 + CONNECT_RESUME_ON_READ_WRITE = 0x1 CR0 = 0x0 CR1 = 0x1000 CR2 = 0x2000 @@ -1265,6 +1268,10 @@ const ( RTV_SSTHRESH = 0x20 RUSAGE_CHILDREN = -0x1 RUSAGE_SELF = 0x0 + SAE_ASSOCID_ALL = 0xffffffff + SAE_ASSOCID_ANY = 0x0 + SAE_CONNID_ALL = 0xffffffff + SAE_CONNID_ANY = 0x0 SCM_CREDS = 0x3 SCM_RIGHTS = 0x1 SCM_TIMESTAMP = 0x2 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux.go b/vendor/golang.org/x/sys/unix/zerrors_linux.go index 01a70b2..de3b462 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux.go @@ -495,6 +495,7 @@ const ( BPF_F_TEST_REG_INVARIANTS = 0x80 BPF_F_TEST_RND_HI32 = 0x4 BPF_F_TEST_RUN_ON_CPU = 0x1 + BPF_F_TEST_SKB_CHECKSUM_COMPLETE = 0x4 BPF_F_TEST_STATE_FREQ = 0x8 BPF_F_TEST_XDP_LIVE_FRAMES = 0x2 BPF_F_XDP_DEV_BOUND_ONLY = 0x40 @@ -1922,6 +1923,7 @@ const ( MNT_EXPIRE = 0x4 MNT_FORCE = 0x1 MNT_ID_REQ_SIZE_VER0 = 0x18 + MNT_ID_REQ_SIZE_VER1 = 0x20 MODULE_INIT_COMPRESSED_FILE = 0x4 MODULE_INIT_IGNORE_MODVERSIONS = 0x1 MODULE_INIT_IGNORE_VERMAGIC = 0x2 @@ -2187,7 +2189,7 @@ const ( NFT_REG_SIZE = 0x10 NFT_REJECT_ICMPX_MAX = 0x3 NFT_RT_MAX = 0x4 - NFT_SECMARK_CTX_MAXLEN = 0x100 + NFT_SECMARK_CTX_MAXLEN = 0x1000 NFT_SET_MAXNAMELEN = 0x100 NFT_SOCKET_MAX = 0x3 NFT_TABLE_F_MASK = 0x7 @@ -2356,9 +2358,11 @@ const ( PERF_MEM_LVLNUM_IO = 0xa PERF_MEM_LVLNUM_L1 = 0x1 PERF_MEM_LVLNUM_L2 = 0x2 + PERF_MEM_LVLNUM_L2_MHB = 0x5 PERF_MEM_LVLNUM_L3 = 0x3 PERF_MEM_LVLNUM_L4 = 0x4 PERF_MEM_LVLNUM_LFB = 0xc + PERF_MEM_LVLNUM_MSC = 0x6 PERF_MEM_LVLNUM_NA = 0xf PERF_MEM_LVLNUM_PMEM = 0xe PERF_MEM_LVLNUM_RAM = 0xd @@ -2431,6 +2435,7 @@ const ( PRIO_PGRP = 0x1 PRIO_PROCESS = 0x0 PRIO_USER = 0x2 + PROCFS_IOCTL_MAGIC = 'f' PROC_SUPER_MAGIC = 0x9fa0 PROT_EXEC = 0x4 PROT_GROWSDOWN = 0x1000000 @@ -2933,11 +2938,12 @@ const ( RUSAGE_SELF = 0x0 RUSAGE_THREAD = 0x1 RWF_APPEND = 0x10 + RWF_ATOMIC = 0x40 RWF_DSYNC = 0x2 RWF_HIPRI = 0x1 RWF_NOAPPEND = 0x20 RWF_NOWAIT = 0x8 - RWF_SUPPORTED = 0x3f + RWF_SUPPORTED = 0x7f RWF_SYNC = 0x4 RWF_WRITE_LIFE_NOT_SET = 0x0 SCHED_BATCH = 0x3 @@ -3210,6 +3216,7 @@ const ( STATX_ATTR_MOUNT_ROOT = 0x2000 STATX_ATTR_NODUMP = 0x40 STATX_ATTR_VERITY = 0x100000 + STATX_ATTR_WRITE_ATOMIC = 0x400000 STATX_BASIC_STATS = 0x7ff STATX_BLOCKS = 0x400 STATX_BTIME = 0x800 @@ -3226,6 +3233,7 @@ const ( STATX_SUBVOL = 0x8000 STATX_TYPE = 0x1 STATX_UID = 0x8 + STATX_WRITE_ATOMIC = 0x10000 STATX__RESERVED = 0x80000000 SYNC_FILE_RANGE_WAIT_AFTER = 0x4 SYNC_FILE_RANGE_WAIT_BEFORE = 0x1 @@ -3624,6 +3632,7 @@ const ( XDP_UMEM_PGOFF_COMPLETION_RING = 0x180000000 XDP_UMEM_PGOFF_FILL_RING = 0x100000000 XDP_UMEM_REG = 0x4 + XDP_UMEM_TX_METADATA_LEN = 0x4 XDP_UMEM_TX_SW_CSUM = 0x2 XDP_UMEM_UNALIGNED_CHUNK_FLAG = 0x1 XDP_USE_NEED_WAKEUP = 0x8 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_386.go b/vendor/golang.org/x/sys/unix/zerrors_linux_386.go index 684a516..8aa6d77 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_386.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_386.go @@ -153,9 +153,14 @@ const ( NFDBITS = 0x20 NLDLY = 0x100 NOFLSH = 0x80 + NS_GET_MNTNS_ID = 0x8008b705 NS_GET_NSTYPE = 0xb703 NS_GET_OWNER_UID = 0xb704 NS_GET_PARENT = 0xb702 + NS_GET_PID_FROM_PIDNS = 0x8004b706 + NS_GET_PID_IN_PIDNS = 0x8004b708 + NS_GET_TGID_FROM_PIDNS = 0x8004b707 + NS_GET_TGID_IN_PIDNS = 0x8004b709 NS_GET_USERNS = 0xb701 OLCUC = 0x2 ONLCR = 0x4 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_amd64.go b/vendor/golang.org/x/sys/unix/zerrors_linux_amd64.go index 61d74b5..da428f4 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_amd64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_amd64.go @@ -153,9 +153,14 @@ const ( NFDBITS = 0x40 NLDLY = 0x100 NOFLSH = 0x80 + NS_GET_MNTNS_ID = 0x8008b705 NS_GET_NSTYPE = 0xb703 NS_GET_OWNER_UID = 0xb704 NS_GET_PARENT = 0xb702 + NS_GET_PID_FROM_PIDNS = 0x8004b706 + NS_GET_PID_IN_PIDNS = 0x8004b708 + NS_GET_TGID_FROM_PIDNS = 0x8004b707 + NS_GET_TGID_IN_PIDNS = 0x8004b709 NS_GET_USERNS = 0xb701 OLCUC = 0x2 ONLCR = 0x4 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_arm.go b/vendor/golang.org/x/sys/unix/zerrors_linux_arm.go index a28c9e3..bf45bfe 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_arm.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_arm.go @@ -150,9 +150,14 @@ const ( NFDBITS = 0x20 NLDLY = 0x100 NOFLSH = 0x80 + NS_GET_MNTNS_ID = 0x8008b705 NS_GET_NSTYPE = 0xb703 NS_GET_OWNER_UID = 0xb704 NS_GET_PARENT = 0xb702 + NS_GET_PID_FROM_PIDNS = 0x8004b706 + NS_GET_PID_IN_PIDNS = 0x8004b708 + NS_GET_TGID_FROM_PIDNS = 0x8004b707 + NS_GET_TGID_IN_PIDNS = 0x8004b709 NS_GET_USERNS = 0xb701 OLCUC = 0x2 ONLCR = 0x4 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_arm64.go b/vendor/golang.org/x/sys/unix/zerrors_linux_arm64.go index ab5d1fe..71c6716 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_arm64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_arm64.go @@ -154,9 +154,14 @@ const ( NFDBITS = 0x40 NLDLY = 0x100 NOFLSH = 0x80 + NS_GET_MNTNS_ID = 0x8008b705 NS_GET_NSTYPE = 0xb703 NS_GET_OWNER_UID = 0xb704 NS_GET_PARENT = 0xb702 + NS_GET_PID_FROM_PIDNS = 0x8004b706 + NS_GET_PID_IN_PIDNS = 0x8004b708 + NS_GET_TGID_FROM_PIDNS = 0x8004b707 + NS_GET_TGID_IN_PIDNS = 0x8004b709 NS_GET_USERNS = 0xb701 OLCUC = 0x2 ONLCR = 0x4 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_loong64.go b/vendor/golang.org/x/sys/unix/zerrors_linux_loong64.go index c523090..9476628 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_loong64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_loong64.go @@ -154,9 +154,14 @@ const ( NFDBITS = 0x40 NLDLY = 0x100 NOFLSH = 0x80 + NS_GET_MNTNS_ID = 0x8008b705 NS_GET_NSTYPE = 0xb703 NS_GET_OWNER_UID = 0xb704 NS_GET_PARENT = 0xb702 + NS_GET_PID_FROM_PIDNS = 0x8004b706 + NS_GET_PID_IN_PIDNS = 0x8004b708 + NS_GET_TGID_FROM_PIDNS = 0x8004b707 + NS_GET_TGID_IN_PIDNS = 0x8004b709 NS_GET_USERNS = 0xb701 OLCUC = 0x2 ONLCR = 0x4 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_mips.go b/vendor/golang.org/x/sys/unix/zerrors_linux_mips.go index 01e6ea7..b9e85f3 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_mips.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_mips.go @@ -150,9 +150,14 @@ const ( NFDBITS = 0x20 NLDLY = 0x100 NOFLSH = 0x80 + NS_GET_MNTNS_ID = 0x4008b705 NS_GET_NSTYPE = 0x2000b703 NS_GET_OWNER_UID = 0x2000b704 NS_GET_PARENT = 0x2000b702 + NS_GET_PID_FROM_PIDNS = 0x4004b706 + NS_GET_PID_IN_PIDNS = 0x4004b708 + NS_GET_TGID_FROM_PIDNS = 0x4004b707 + NS_GET_TGID_IN_PIDNS = 0x4004b709 NS_GET_USERNS = 0x2000b701 OLCUC = 0x2 ONLCR = 0x4 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_mips64.go b/vendor/golang.org/x/sys/unix/zerrors_linux_mips64.go index 7aa610b..a48b68a 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_mips64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_mips64.go @@ -150,9 +150,14 @@ const ( NFDBITS = 0x40 NLDLY = 0x100 NOFLSH = 0x80 + NS_GET_MNTNS_ID = 0x4008b705 NS_GET_NSTYPE = 0x2000b703 NS_GET_OWNER_UID = 0x2000b704 NS_GET_PARENT = 0x2000b702 + NS_GET_PID_FROM_PIDNS = 0x4004b706 + NS_GET_PID_IN_PIDNS = 0x4004b708 + NS_GET_TGID_FROM_PIDNS = 0x4004b707 + NS_GET_TGID_IN_PIDNS = 0x4004b709 NS_GET_USERNS = 0x2000b701 OLCUC = 0x2 ONLCR = 0x4 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_mips64le.go b/vendor/golang.org/x/sys/unix/zerrors_linux_mips64le.go index 92af771..ea00e85 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_mips64le.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_mips64le.go @@ -150,9 +150,14 @@ const ( NFDBITS = 0x40 NLDLY = 0x100 NOFLSH = 0x80 + NS_GET_MNTNS_ID = 0x4008b705 NS_GET_NSTYPE = 0x2000b703 NS_GET_OWNER_UID = 0x2000b704 NS_GET_PARENT = 0x2000b702 + NS_GET_PID_FROM_PIDNS = 0x4004b706 + NS_GET_PID_IN_PIDNS = 0x4004b708 + NS_GET_TGID_FROM_PIDNS = 0x4004b707 + NS_GET_TGID_IN_PIDNS = 0x4004b709 NS_GET_USERNS = 0x2000b701 OLCUC = 0x2 ONLCR = 0x4 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_mipsle.go b/vendor/golang.org/x/sys/unix/zerrors_linux_mipsle.go index b27ef5e..91c6468 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_mipsle.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_mipsle.go @@ -150,9 +150,14 @@ const ( NFDBITS = 0x20 NLDLY = 0x100 NOFLSH = 0x80 + NS_GET_MNTNS_ID = 0x4008b705 NS_GET_NSTYPE = 0x2000b703 NS_GET_OWNER_UID = 0x2000b704 NS_GET_PARENT = 0x2000b702 + NS_GET_PID_FROM_PIDNS = 0x4004b706 + NS_GET_PID_IN_PIDNS = 0x4004b708 + NS_GET_TGID_FROM_PIDNS = 0x4004b707 + NS_GET_TGID_IN_PIDNS = 0x4004b709 NS_GET_USERNS = 0x2000b701 OLCUC = 0x2 ONLCR = 0x4 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_ppc.go b/vendor/golang.org/x/sys/unix/zerrors_linux_ppc.go index 237a2ce..8cbf38d 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_ppc.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_ppc.go @@ -152,9 +152,14 @@ const ( NL3 = 0x300 NLDLY = 0x300 NOFLSH = 0x80000000 + NS_GET_MNTNS_ID = 0x4008b705 NS_GET_NSTYPE = 0x2000b703 NS_GET_OWNER_UID = 0x2000b704 NS_GET_PARENT = 0x2000b702 + NS_GET_PID_FROM_PIDNS = 0x4004b706 + NS_GET_PID_IN_PIDNS = 0x4004b708 + NS_GET_TGID_FROM_PIDNS = 0x4004b707 + NS_GET_TGID_IN_PIDNS = 0x4004b709 NS_GET_USERNS = 0x2000b701 OLCUC = 0x4 ONLCR = 0x2 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64.go b/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64.go index 4a5c555..a2df734 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64.go @@ -152,9 +152,14 @@ const ( NL3 = 0x300 NLDLY = 0x300 NOFLSH = 0x80000000 + NS_GET_MNTNS_ID = 0x4008b705 NS_GET_NSTYPE = 0x2000b703 NS_GET_OWNER_UID = 0x2000b704 NS_GET_PARENT = 0x2000b702 + NS_GET_PID_FROM_PIDNS = 0x4004b706 + NS_GET_PID_IN_PIDNS = 0x4004b708 + NS_GET_TGID_FROM_PIDNS = 0x4004b707 + NS_GET_TGID_IN_PIDNS = 0x4004b709 NS_GET_USERNS = 0x2000b701 OLCUC = 0x4 ONLCR = 0x2 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64le.go b/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64le.go index a02fb49..2479137 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64le.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64le.go @@ -152,9 +152,14 @@ const ( NL3 = 0x300 NLDLY = 0x300 NOFLSH = 0x80000000 + NS_GET_MNTNS_ID = 0x4008b705 NS_GET_NSTYPE = 0x2000b703 NS_GET_OWNER_UID = 0x2000b704 NS_GET_PARENT = 0x2000b702 + NS_GET_PID_FROM_PIDNS = 0x4004b706 + NS_GET_PID_IN_PIDNS = 0x4004b708 + NS_GET_TGID_FROM_PIDNS = 0x4004b707 + NS_GET_TGID_IN_PIDNS = 0x4004b709 NS_GET_USERNS = 0x2000b701 OLCUC = 0x4 ONLCR = 0x2 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_riscv64.go b/vendor/golang.org/x/sys/unix/zerrors_linux_riscv64.go index e26a7c6..d265f14 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_riscv64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_riscv64.go @@ -150,9 +150,14 @@ const ( NFDBITS = 0x40 NLDLY = 0x100 NOFLSH = 0x80 + NS_GET_MNTNS_ID = 0x8008b705 NS_GET_NSTYPE = 0xb703 NS_GET_OWNER_UID = 0xb704 NS_GET_PARENT = 0xb702 + NS_GET_PID_FROM_PIDNS = 0x8004b706 + NS_GET_PID_IN_PIDNS = 0x8004b708 + NS_GET_TGID_FROM_PIDNS = 0x8004b707 + NS_GET_TGID_IN_PIDNS = 0x8004b709 NS_GET_USERNS = 0xb701 OLCUC = 0x2 ONLCR = 0x4 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_s390x.go b/vendor/golang.org/x/sys/unix/zerrors_linux_s390x.go index c48f7c2..3f2d644 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_s390x.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_s390x.go @@ -150,9 +150,14 @@ const ( NFDBITS = 0x40 NLDLY = 0x100 NOFLSH = 0x80 + NS_GET_MNTNS_ID = 0x8008b705 NS_GET_NSTYPE = 0xb703 NS_GET_OWNER_UID = 0xb704 NS_GET_PARENT = 0xb702 + NS_GET_PID_FROM_PIDNS = 0x8004b706 + NS_GET_PID_IN_PIDNS = 0x8004b708 + NS_GET_TGID_FROM_PIDNS = 0x8004b707 + NS_GET_TGID_IN_PIDNS = 0x8004b709 NS_GET_USERNS = 0xb701 OLCUC = 0x2 ONLCR = 0x4 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_sparc64.go b/vendor/golang.org/x/sys/unix/zerrors_linux_sparc64.go index ad4b9aa..5d8b727 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_sparc64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_sparc64.go @@ -155,9 +155,14 @@ const ( NFDBITS = 0x40 NLDLY = 0x100 NOFLSH = 0x80 + NS_GET_MNTNS_ID = 0x4008b705 NS_GET_NSTYPE = 0x2000b703 NS_GET_OWNER_UID = 0x2000b704 NS_GET_PARENT = 0x2000b702 + NS_GET_PID_FROM_PIDNS = 0x4004b706 + NS_GET_PID_IN_PIDNS = 0x4004b708 + NS_GET_TGID_FROM_PIDNS = 0x4004b707 + NS_GET_TGID_IN_PIDNS = 0x4004b709 NS_GET_USERNS = 0x2000b701 OLCUC = 0x2 ONLCR = 0x4 diff --git a/vendor/golang.org/x/sys/unix/zerrors_zos_s390x.go b/vendor/golang.org/x/sys/unix/zerrors_zos_s390x.go index da08b2a..1ec2b14 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_zos_s390x.go +++ b/vendor/golang.org/x/sys/unix/zerrors_zos_s390x.go @@ -581,6 +581,8 @@ const ( AT_EMPTY_PATH = 0x1000 AT_REMOVEDIR = 0x200 RENAME_NOREPLACE = 1 << 0 + ST_RDONLY = 1 + ST_NOSUID = 2 ) const ( diff --git a/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.go b/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.go index b622533..24b346e 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.go @@ -841,6 +841,26 @@ var libc_pthread_fchdir_np_trampoline_addr uintptr // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func connectx(fd int, endpoints *SaEndpoints, associd SaeAssocID, flags uint32, iov []Iovec, n *uintptr, connid *SaeConnID) (err error) { + var _p0 unsafe.Pointer + if len(iov) > 0 { + _p0 = unsafe.Pointer(&iov[0]) + } else { + _p0 = unsafe.Pointer(&_zero) + } + _, _, e1 := syscall_syscall9(libc_connectx_trampoline_addr, uintptr(fd), uintptr(unsafe.Pointer(endpoints)), uintptr(associd), uintptr(flags), uintptr(_p0), uintptr(len(iov)), uintptr(unsafe.Pointer(n)), uintptr(unsafe.Pointer(connid)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_connectx_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_connectx connectx "/usr/lib/libSystem.B.dylib" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func sendfile(infd int, outfd int, offset int64, len *int64, hdtr unsafe.Pointer, flags int) (err error) { _, _, e1 := syscall_syscall6(libc_sendfile_trampoline_addr, uintptr(infd), uintptr(outfd), uintptr(offset), uintptr(unsafe.Pointer(len)), uintptr(hdtr), uintptr(flags)) if e1 != 0 { diff --git a/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.s b/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.s index cfe6646..ebd2131 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.s +++ b/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.s @@ -248,6 +248,11 @@ TEXT libc_pthread_fchdir_np_trampoline<>(SB),NOSPLIT,$0-0 GLOBL ·libc_pthread_fchdir_np_trampoline_addr(SB), RODATA, $8 DATA ·libc_pthread_fchdir_np_trampoline_addr(SB)/8, $libc_pthread_fchdir_np_trampoline<>(SB) +TEXT libc_connectx_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_connectx(SB) +GLOBL ·libc_connectx_trampoline_addr(SB), RODATA, $8 +DATA ·libc_connectx_trampoline_addr(SB)/8, $libc_connectx_trampoline<>(SB) + TEXT libc_sendfile_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_sendfile(SB) GLOBL ·libc_sendfile_trampoline_addr(SB), RODATA, $8 diff --git a/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.go b/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.go index 13f624f..824b9c2 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.go @@ -841,6 +841,26 @@ var libc_pthread_fchdir_np_trampoline_addr uintptr // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func connectx(fd int, endpoints *SaEndpoints, associd SaeAssocID, flags uint32, iov []Iovec, n *uintptr, connid *SaeConnID) (err error) { + var _p0 unsafe.Pointer + if len(iov) > 0 { + _p0 = unsafe.Pointer(&iov[0]) + } else { + _p0 = unsafe.Pointer(&_zero) + } + _, _, e1 := syscall_syscall9(libc_connectx_trampoline_addr, uintptr(fd), uintptr(unsafe.Pointer(endpoints)), uintptr(associd), uintptr(flags), uintptr(_p0), uintptr(len(iov)), uintptr(unsafe.Pointer(n)), uintptr(unsafe.Pointer(connid)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_connectx_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_connectx connectx "/usr/lib/libSystem.B.dylib" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func sendfile(infd int, outfd int, offset int64, len *int64, hdtr unsafe.Pointer, flags int) (err error) { _, _, e1 := syscall_syscall6(libc_sendfile_trampoline_addr, uintptr(infd), uintptr(outfd), uintptr(offset), uintptr(unsafe.Pointer(len)), uintptr(hdtr), uintptr(flags)) if e1 != 0 { diff --git a/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.s b/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.s index fe222b7..4f178a2 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.s +++ b/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.s @@ -248,6 +248,11 @@ TEXT libc_pthread_fchdir_np_trampoline<>(SB),NOSPLIT,$0-0 GLOBL ·libc_pthread_fchdir_np_trampoline_addr(SB), RODATA, $8 DATA ·libc_pthread_fchdir_np_trampoline_addr(SB)/8, $libc_pthread_fchdir_np_trampoline<>(SB) +TEXT libc_connectx_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_connectx(SB) +GLOBL ·libc_connectx_trampoline_addr(SB), RODATA, $8 +DATA ·libc_connectx_trampoline_addr(SB)/8, $libc_connectx_trampoline<>(SB) + TEXT libc_sendfile_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_sendfile(SB) GLOBL ·libc_sendfile_trampoline_addr(SB), RODATA, $8 diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux.go b/vendor/golang.org/x/sys/unix/zsyscall_linux.go index 1bc1a5a..af30da5 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_linux.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_linux.go @@ -971,23 +971,6 @@ func Getpriority(which int, who int) (prio int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Getrandom(buf []byte, flags int) (n int, err error) { - var _p0 unsafe.Pointer - if len(buf) > 0 { - _p0 = unsafe.Pointer(&buf[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - r0, _, e1 := Syscall(SYS_GETRANDOM, uintptr(_p0), uintptr(len(buf)), uintptr(flags)) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Getrusage(who int, rusage *Rusage) (err error) { _, _, e1 := RawSyscall(SYS_GETRUSAGE, uintptr(who), uintptr(unsafe.Pointer(rusage)), 0) if e1 != 0 { diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_amd64.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_amd64.go index d3e38f6..f485dbf 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_amd64.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_amd64.go @@ -341,6 +341,7 @@ const ( SYS_STATX = 332 SYS_IO_PGETEVENTS = 333 SYS_RSEQ = 334 + SYS_URETPROBE = 335 SYS_PIDFD_SEND_SIGNAL = 424 SYS_IO_URING_SETUP = 425 SYS_IO_URING_ENTER = 426 diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_arm64.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_arm64.go index 6c778c2..1893e2f 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_arm64.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_arm64.go @@ -85,7 +85,7 @@ const ( SYS_SPLICE = 76 SYS_TEE = 77 SYS_READLINKAT = 78 - SYS_FSTATAT = 79 + SYS_NEWFSTATAT = 79 SYS_FSTAT = 80 SYS_SYNC = 81 SYS_FSYNC = 82 diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_loong64.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_loong64.go index 37281cf..16a4017 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_loong64.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_loong64.go @@ -84,6 +84,8 @@ const ( SYS_SPLICE = 76 SYS_TEE = 77 SYS_READLINKAT = 78 + SYS_NEWFSTATAT = 79 + SYS_FSTAT = 80 SYS_SYNC = 81 SYS_FSYNC = 82 SYS_FDATASYNC = 83 diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_riscv64.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_riscv64.go index 9889f6a..a5459e7 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_riscv64.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_riscv64.go @@ -84,7 +84,7 @@ const ( SYS_SPLICE = 76 SYS_TEE = 77 SYS_READLINKAT = 78 - SYS_FSTATAT = 79 + SYS_NEWFSTATAT = 79 SYS_FSTAT = 80 SYS_SYNC = 81 SYS_FSYNC = 82 diff --git a/vendor/golang.org/x/sys/unix/ztypes_darwin_amd64.go b/vendor/golang.org/x/sys/unix/ztypes_darwin_amd64.go index 091d107..d003c3d 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_darwin_amd64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_darwin_amd64.go @@ -306,6 +306,19 @@ type XVSockPgen struct { type _Socklen uint32 +type SaeAssocID uint32 + +type SaeConnID uint32 + +type SaEndpoints struct { + Srcif uint32 + Srcaddr *RawSockaddr + Srcaddrlen uint32 + Dstaddr *RawSockaddr + Dstaddrlen uint32 + _ [4]byte +} + type Xucred struct { Version uint32 Uid uint32 diff --git a/vendor/golang.org/x/sys/unix/ztypes_darwin_arm64.go b/vendor/golang.org/x/sys/unix/ztypes_darwin_arm64.go index 28ff4ef..0d45a94 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_darwin_arm64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_darwin_arm64.go @@ -306,6 +306,19 @@ type XVSockPgen struct { type _Socklen uint32 +type SaeAssocID uint32 + +type SaeConnID uint32 + +type SaEndpoints struct { + Srcif uint32 + Srcaddr *RawSockaddr + Srcaddrlen uint32 + Dstaddr *RawSockaddr + Dstaddrlen uint32 + _ [4]byte +} + type Xucred struct { Version uint32 Uid uint32 diff --git a/vendor/golang.org/x/sys/unix/ztypes_freebsd_386.go b/vendor/golang.org/x/sys/unix/ztypes_freebsd_386.go index 6cbd094..51e13eb 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_freebsd_386.go +++ b/vendor/golang.org/x/sys/unix/ztypes_freebsd_386.go @@ -625,6 +625,7 @@ const ( POLLRDNORM = 0x40 POLLWRBAND = 0x100 POLLWRNORM = 0x4 + POLLRDHUP = 0x4000 ) type CapRights struct { diff --git a/vendor/golang.org/x/sys/unix/ztypes_freebsd_amd64.go b/vendor/golang.org/x/sys/unix/ztypes_freebsd_amd64.go index 7c03b6e..d002d8e 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_freebsd_amd64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_freebsd_amd64.go @@ -630,6 +630,7 @@ const ( POLLRDNORM = 0x40 POLLWRBAND = 0x100 POLLWRNORM = 0x4 + POLLRDHUP = 0x4000 ) type CapRights struct { diff --git a/vendor/golang.org/x/sys/unix/ztypes_freebsd_arm.go b/vendor/golang.org/x/sys/unix/ztypes_freebsd_arm.go index 422107e..3f863d8 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_freebsd_arm.go +++ b/vendor/golang.org/x/sys/unix/ztypes_freebsd_arm.go @@ -616,6 +616,7 @@ const ( POLLRDNORM = 0x40 POLLWRBAND = 0x100 POLLWRNORM = 0x4 + POLLRDHUP = 0x4000 ) type CapRights struct { diff --git a/vendor/golang.org/x/sys/unix/ztypes_freebsd_arm64.go b/vendor/golang.org/x/sys/unix/ztypes_freebsd_arm64.go index 505a12a..61c7293 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_freebsd_arm64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_freebsd_arm64.go @@ -610,6 +610,7 @@ const ( POLLRDNORM = 0x40 POLLWRBAND = 0x100 POLLWRNORM = 0x4 + POLLRDHUP = 0x4000 ) type CapRights struct { diff --git a/vendor/golang.org/x/sys/unix/ztypes_freebsd_riscv64.go b/vendor/golang.org/x/sys/unix/ztypes_freebsd_riscv64.go index cc986c7..b5d1741 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_freebsd_riscv64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_freebsd_riscv64.go @@ -612,6 +612,7 @@ const ( POLLRDNORM = 0x40 POLLWRBAND = 0x100 POLLWRNORM = 0x4 + POLLRDHUP = 0x4000 ) type CapRights struct { diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux.go b/vendor/golang.org/x/sys/unix/ztypes_linux.go index 7f1961b..3a69e45 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux.go @@ -87,31 +87,35 @@ type StatxTimestamp struct { } type Statx_t struct { - Mask uint32 - Blksize uint32 - Attributes uint64 - Nlink uint32 - Uid uint32 - Gid uint32 - Mode uint16 - _ [1]uint16 - Ino uint64 - Size uint64 - Blocks uint64 - Attributes_mask uint64 - Atime StatxTimestamp - Btime StatxTimestamp - Ctime StatxTimestamp - Mtime StatxTimestamp - Rdev_major uint32 - Rdev_minor uint32 - Dev_major uint32 - Dev_minor uint32 - Mnt_id uint64 - Dio_mem_align uint32 - Dio_offset_align uint32 - Subvol uint64 - _ [11]uint64 + Mask uint32 + Blksize uint32 + Attributes uint64 + Nlink uint32 + Uid uint32 + Gid uint32 + Mode uint16 + _ [1]uint16 + Ino uint64 + Size uint64 + Blocks uint64 + Attributes_mask uint64 + Atime StatxTimestamp + Btime StatxTimestamp + Ctime StatxTimestamp + Mtime StatxTimestamp + Rdev_major uint32 + Rdev_minor uint32 + Dev_major uint32 + Dev_minor uint32 + Mnt_id uint64 + Dio_mem_align uint32 + Dio_offset_align uint32 + Subvol uint64 + Atomic_write_unit_min uint32 + Atomic_write_unit_max uint32 + Atomic_write_segments_max uint32 + _ [1]uint32 + _ [9]uint64 } type Fsid struct { @@ -516,6 +520,29 @@ type TCPInfo struct { Total_rto_time uint32 } +type TCPVegasInfo struct { + Enabled uint32 + Rttcnt uint32 + Rtt uint32 + Minrtt uint32 +} + +type TCPDCTCPInfo struct { + Enabled uint16 + Ce_state uint16 + Alpha uint32 + Ab_ecn uint32 + Ab_tot uint32 +} + +type TCPBBRInfo struct { + Bw_lo uint32 + Bw_hi uint32 + Min_rtt uint32 + Pacing_gain uint32 + Cwnd_gain uint32 +} + type CanFilter struct { Id uint32 Mask uint32 @@ -557,6 +584,7 @@ const ( SizeofICMPv6Filter = 0x20 SizeofUcred = 0xc SizeofTCPInfo = 0xf8 + SizeofTCPCCInfo = 0x14 SizeofCanFilter = 0x8 SizeofTCPRepairOpt = 0x8 ) @@ -2486,7 +2514,7 @@ type XDPMmapOffsets struct { type XDPUmemReg struct { Addr uint64 Len uint64 - Chunk_size uint32 + Size uint32 Headroom uint32 Flags uint32 Tx_metadata_len uint32 @@ -3766,7 +3794,7 @@ const ( ETHTOOL_MSG_PSE_GET = 0x24 ETHTOOL_MSG_PSE_SET = 0x25 ETHTOOL_MSG_RSS_GET = 0x26 - ETHTOOL_MSG_USER_MAX = 0x2b + ETHTOOL_MSG_USER_MAX = 0x2c ETHTOOL_MSG_KERNEL_NONE = 0x0 ETHTOOL_MSG_STRSET_GET_REPLY = 0x1 ETHTOOL_MSG_LINKINFO_GET_REPLY = 0x2 @@ -3806,7 +3834,7 @@ const ( ETHTOOL_MSG_MODULE_NTF = 0x24 ETHTOOL_MSG_PSE_GET_REPLY = 0x25 ETHTOOL_MSG_RSS_GET_REPLY = 0x26 - ETHTOOL_MSG_KERNEL_MAX = 0x2b + ETHTOOL_MSG_KERNEL_MAX = 0x2c ETHTOOL_FLAG_COMPACT_BITSETS = 0x1 ETHTOOL_FLAG_OMIT_REPLY = 0x2 ETHTOOL_FLAG_STATS = 0x4 @@ -3951,7 +3979,7 @@ const ( ETHTOOL_A_COALESCE_RATE_SAMPLE_INTERVAL = 0x17 ETHTOOL_A_COALESCE_USE_CQE_MODE_TX = 0x18 ETHTOOL_A_COALESCE_USE_CQE_MODE_RX = 0x19 - ETHTOOL_A_COALESCE_MAX = 0x1c + ETHTOOL_A_COALESCE_MAX = 0x1e ETHTOOL_A_PAUSE_UNSPEC = 0x0 ETHTOOL_A_PAUSE_HEADER = 0x1 ETHTOOL_A_PAUSE_AUTONEG = 0x2 @@ -4609,7 +4637,7 @@ const ( NL80211_ATTR_MAC_HINT = 0xc8 NL80211_ATTR_MAC_MASK = 0xd7 NL80211_ATTR_MAX_AP_ASSOC_STA = 0xca - NL80211_ATTR_MAX = 0x14a + NL80211_ATTR_MAX = 0x14c NL80211_ATTR_MAX_CRIT_PROT_DURATION = 0xb4 NL80211_ATTR_MAX_CSA_COUNTERS = 0xce NL80211_ATTR_MAX_MATCH_SETS = 0x85 @@ -5213,7 +5241,7 @@ const ( NL80211_FREQUENCY_ATTR_GO_CONCURRENT = 0xf NL80211_FREQUENCY_ATTR_INDOOR_ONLY = 0xe NL80211_FREQUENCY_ATTR_IR_CONCURRENT = 0xf - NL80211_FREQUENCY_ATTR_MAX = 0x20 + NL80211_FREQUENCY_ATTR_MAX = 0x21 NL80211_FREQUENCY_ATTR_MAX_TX_POWER = 0x6 NL80211_FREQUENCY_ATTR_NO_10MHZ = 0x11 NL80211_FREQUENCY_ATTR_NO_160MHZ = 0xc diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_riscv64.go b/vendor/golang.org/x/sys/unix/ztypes_linux_riscv64.go index 15adc04..ad05b51 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_riscv64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_riscv64.go @@ -727,6 +727,37 @@ const ( RISCV_HWPROBE_EXT_ZBA = 0x8 RISCV_HWPROBE_EXT_ZBB = 0x10 RISCV_HWPROBE_EXT_ZBS = 0x20 + RISCV_HWPROBE_EXT_ZICBOZ = 0x40 + RISCV_HWPROBE_EXT_ZBC = 0x80 + RISCV_HWPROBE_EXT_ZBKB = 0x100 + RISCV_HWPROBE_EXT_ZBKC = 0x200 + RISCV_HWPROBE_EXT_ZBKX = 0x400 + RISCV_HWPROBE_EXT_ZKND = 0x800 + RISCV_HWPROBE_EXT_ZKNE = 0x1000 + RISCV_HWPROBE_EXT_ZKNH = 0x2000 + RISCV_HWPROBE_EXT_ZKSED = 0x4000 + RISCV_HWPROBE_EXT_ZKSH = 0x8000 + RISCV_HWPROBE_EXT_ZKT = 0x10000 + RISCV_HWPROBE_EXT_ZVBB = 0x20000 + RISCV_HWPROBE_EXT_ZVBC = 0x40000 + RISCV_HWPROBE_EXT_ZVKB = 0x80000 + RISCV_HWPROBE_EXT_ZVKG = 0x100000 + RISCV_HWPROBE_EXT_ZVKNED = 0x200000 + RISCV_HWPROBE_EXT_ZVKNHA = 0x400000 + RISCV_HWPROBE_EXT_ZVKNHB = 0x800000 + RISCV_HWPROBE_EXT_ZVKSED = 0x1000000 + RISCV_HWPROBE_EXT_ZVKSH = 0x2000000 + RISCV_HWPROBE_EXT_ZVKT = 0x4000000 + RISCV_HWPROBE_EXT_ZFH = 0x8000000 + RISCV_HWPROBE_EXT_ZFHMIN = 0x10000000 + RISCV_HWPROBE_EXT_ZIHINTNTL = 0x20000000 + RISCV_HWPROBE_EXT_ZVFH = 0x40000000 + RISCV_HWPROBE_EXT_ZVFHMIN = 0x80000000 + RISCV_HWPROBE_EXT_ZFA = 0x100000000 + RISCV_HWPROBE_EXT_ZTSO = 0x200000000 + RISCV_HWPROBE_EXT_ZACAS = 0x400000000 + RISCV_HWPROBE_EXT_ZICOND = 0x800000000 + RISCV_HWPROBE_EXT_ZIHINTPAUSE = 0x1000000000 RISCV_HWPROBE_KEY_CPUPERF_0 = 0x5 RISCV_HWPROBE_MISALIGNED_UNKNOWN = 0x0 RISCV_HWPROBE_MISALIGNED_EMULATED = 0x1 @@ -734,4 +765,6 @@ const ( RISCV_HWPROBE_MISALIGNED_FAST = 0x3 RISCV_HWPROBE_MISALIGNED_UNSUPPORTED = 0x4 RISCV_HWPROBE_MISALIGNED_MASK = 0x7 + RISCV_HWPROBE_KEY_ZICBOZ_BLOCK_SIZE = 0x6 + RISCV_HWPROBE_WHICH_CPUS = 0x1 ) diff --git a/vendor/golang.org/x/sys/windows/dll_windows.go b/vendor/golang.org/x/sys/windows/dll_windows.go index 115341f..4e613cf 100644 --- a/vendor/golang.org/x/sys/windows/dll_windows.go +++ b/vendor/golang.org/x/sys/windows/dll_windows.go @@ -65,7 +65,7 @@ func LoadDLL(name string) (dll *DLL, err error) { return d, nil } -// MustLoadDLL is like LoadDLL but panics if load operation failes. +// MustLoadDLL is like LoadDLL but panics if load operation fails. func MustLoadDLL(name string) *DLL { d, e := LoadDLL(name) if e != nil { diff --git a/vendor/golang.org/x/sys/windows/syscall_windows.go b/vendor/golang.org/x/sys/windows/syscall_windows.go index 1fa34fd..5cee9a3 100644 --- a/vendor/golang.org/x/sys/windows/syscall_windows.go +++ b/vendor/golang.org/x/sys/windows/syscall_windows.go @@ -313,6 +313,10 @@ func NewCallbackCDecl(fn interface{}) uintptr { //sys SetConsoleMode(console Handle, mode uint32) (err error) = kernel32.SetConsoleMode //sys GetConsoleScreenBufferInfo(console Handle, info *ConsoleScreenBufferInfo) (err error) = kernel32.GetConsoleScreenBufferInfo //sys setConsoleCursorPosition(console Handle, position uint32) (err error) = kernel32.SetConsoleCursorPosition +//sys GetConsoleCP() (cp uint32, err error) = kernel32.GetConsoleCP +//sys GetConsoleOutputCP() (cp uint32, err error) = kernel32.GetConsoleOutputCP +//sys SetConsoleCP(cp uint32) (err error) = kernel32.SetConsoleCP +//sys SetConsoleOutputCP(cp uint32) (err error) = kernel32.SetConsoleOutputCP //sys WriteConsole(console Handle, buf *uint16, towrite uint32, written *uint32, reserved *byte) (err error) = kernel32.WriteConsoleW //sys ReadConsole(console Handle, buf *uint16, toread uint32, read *uint32, inputControl *byte) (err error) = kernel32.ReadConsoleW //sys resizePseudoConsole(pconsole Handle, size uint32) (hr error) = kernel32.ResizePseudoConsole diff --git a/vendor/golang.org/x/sys/windows/types_windows.go b/vendor/golang.org/x/sys/windows/types_windows.go index 3f03b3d..7b97a15 100644 --- a/vendor/golang.org/x/sys/windows/types_windows.go +++ b/vendor/golang.org/x/sys/windows/types_windows.go @@ -1060,6 +1060,7 @@ const ( SIO_GET_EXTENSION_FUNCTION_POINTER = IOC_INOUT | IOC_WS2 | 6 SIO_KEEPALIVE_VALS = IOC_IN | IOC_VENDOR | 4 SIO_UDP_CONNRESET = IOC_IN | IOC_VENDOR | 12 + SIO_UDP_NETRESET = IOC_IN | IOC_VENDOR | 15 // cf. http://support.microsoft.com/default.aspx?scid=kb;en-us;257460 diff --git a/vendor/golang.org/x/sys/windows/zsyscall_windows.go b/vendor/golang.org/x/sys/windows/zsyscall_windows.go index 9bb979a..4c2e1bd 100644 --- a/vendor/golang.org/x/sys/windows/zsyscall_windows.go +++ b/vendor/golang.org/x/sys/windows/zsyscall_windows.go @@ -247,7 +247,9 @@ var ( procGetCommandLineW = modkernel32.NewProc("GetCommandLineW") procGetComputerNameExW = modkernel32.NewProc("GetComputerNameExW") procGetComputerNameW = modkernel32.NewProc("GetComputerNameW") + procGetConsoleCP = modkernel32.NewProc("GetConsoleCP") procGetConsoleMode = modkernel32.NewProc("GetConsoleMode") + procGetConsoleOutputCP = modkernel32.NewProc("GetConsoleOutputCP") procGetConsoleScreenBufferInfo = modkernel32.NewProc("GetConsoleScreenBufferInfo") procGetCurrentDirectoryW = modkernel32.NewProc("GetCurrentDirectoryW") procGetCurrentProcessId = modkernel32.NewProc("GetCurrentProcessId") @@ -347,8 +349,10 @@ var ( procSetCommMask = modkernel32.NewProc("SetCommMask") procSetCommState = modkernel32.NewProc("SetCommState") procSetCommTimeouts = modkernel32.NewProc("SetCommTimeouts") + procSetConsoleCP = modkernel32.NewProc("SetConsoleCP") procSetConsoleCursorPosition = modkernel32.NewProc("SetConsoleCursorPosition") procSetConsoleMode = modkernel32.NewProc("SetConsoleMode") + procSetConsoleOutputCP = modkernel32.NewProc("SetConsoleOutputCP") procSetCurrentDirectoryW = modkernel32.NewProc("SetCurrentDirectoryW") procSetDefaultDllDirectories = modkernel32.NewProc("SetDefaultDllDirectories") procSetDllDirectoryW = modkernel32.NewProc("SetDllDirectoryW") @@ -2162,6 +2166,15 @@ func GetComputerName(buf *uint16, n *uint32) (err error) { return } +func GetConsoleCP() (cp uint32, err error) { + r0, _, e1 := syscall.Syscall(procGetConsoleCP.Addr(), 0, 0, 0, 0) + cp = uint32(r0) + if cp == 0 { + err = errnoErr(e1) + } + return +} + func GetConsoleMode(console Handle, mode *uint32) (err error) { r1, _, e1 := syscall.Syscall(procGetConsoleMode.Addr(), 2, uintptr(console), uintptr(unsafe.Pointer(mode)), 0) if r1 == 0 { @@ -2170,6 +2183,15 @@ func GetConsoleMode(console Handle, mode *uint32) (err error) { return } +func GetConsoleOutputCP() (cp uint32, err error) { + r0, _, e1 := syscall.Syscall(procGetConsoleOutputCP.Addr(), 0, 0, 0, 0) + cp = uint32(r0) + if cp == 0 { + err = errnoErr(e1) + } + return +} + func GetConsoleScreenBufferInfo(console Handle, info *ConsoleScreenBufferInfo) (err error) { r1, _, e1 := syscall.Syscall(procGetConsoleScreenBufferInfo.Addr(), 2, uintptr(console), uintptr(unsafe.Pointer(info)), 0) if r1 == 0 { @@ -3038,6 +3060,14 @@ func SetCommTimeouts(handle Handle, timeouts *CommTimeouts) (err error) { return } +func SetConsoleCP(cp uint32) (err error) { + r1, _, e1 := syscall.Syscall(procSetConsoleCP.Addr(), 1, uintptr(cp), 0, 0) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + func setConsoleCursorPosition(console Handle, position uint32) (err error) { r1, _, e1 := syscall.Syscall(procSetConsoleCursorPosition.Addr(), 2, uintptr(console), uintptr(position), 0) if r1 == 0 { @@ -3054,6 +3084,14 @@ func SetConsoleMode(console Handle, mode uint32) (err error) { return } +func SetConsoleOutputCP(cp uint32) (err error) { + r1, _, e1 := syscall.Syscall(procSetConsoleOutputCP.Addr(), 1, uintptr(cp), 0, 0) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + func SetCurrentDirectory(path *uint16) (err error) { r1, _, e1 := syscall.Syscall(procSetCurrentDirectoryW.Addr(), 1, uintptr(unsafe.Pointer(path)), 0, 0) if r1 == 0 { diff --git a/vendor/google.golang.org/protobuf/internal/descopts/options.go b/vendor/google.golang.org/protobuf/internal/descopts/options.go index 8401be8..024ffeb 100644 --- a/vendor/google.golang.org/protobuf/internal/descopts/options.go +++ b/vendor/google.golang.org/protobuf/internal/descopts/options.go @@ -9,7 +9,7 @@ // dependency on the descriptor proto package). package descopts -import pref "google.golang.org/protobuf/reflect/protoreflect" +import "google.golang.org/protobuf/reflect/protoreflect" // These variables are set by the init function in descriptor.pb.go via logic // in internal/filetype. In other words, so long as the descriptor proto package @@ -17,13 +17,13 @@ import pref "google.golang.org/protobuf/reflect/protoreflect" // // Each variable is populated with a nil pointer to the options struct. var ( - File pref.ProtoMessage - Enum pref.ProtoMessage - EnumValue pref.ProtoMessage - Message pref.ProtoMessage - Field pref.ProtoMessage - Oneof pref.ProtoMessage - ExtensionRange pref.ProtoMessage - Service pref.ProtoMessage - Method pref.ProtoMessage + File protoreflect.ProtoMessage + Enum protoreflect.ProtoMessage + EnumValue protoreflect.ProtoMessage + Message protoreflect.ProtoMessage + Field protoreflect.ProtoMessage + Oneof protoreflect.ProtoMessage + ExtensionRange protoreflect.ProtoMessage + Service protoreflect.ProtoMessage + Method protoreflect.ProtoMessage ) diff --git a/vendor/google.golang.org/protobuf/internal/filedesc/desc.go b/vendor/google.golang.org/protobuf/internal/filedesc/desc.go index df53ff4..fa790e0 100644 --- a/vendor/google.golang.org/protobuf/internal/filedesc/desc.go +++ b/vendor/google.golang.org/protobuf/internal/filedesc/desc.go @@ -258,6 +258,7 @@ type ( StringName stringName IsProto3Optional bool // promoted from google.protobuf.FieldDescriptorProto IsWeak bool // promoted from google.protobuf.FieldOptions + IsLazy bool // promoted from google.protobuf.FieldOptions Default defaultValue ContainingOneof protoreflect.OneofDescriptor // must be consistent with Message.Oneofs.Fields Enum protoreflect.EnumDescriptor @@ -351,6 +352,7 @@ func (fd *Field) IsPacked() bool { } func (fd *Field) IsExtension() bool { return false } func (fd *Field) IsWeak() bool { return fd.L1.IsWeak } +func (fd *Field) IsLazy() bool { return fd.L1.IsLazy } func (fd *Field) IsList() bool { return fd.Cardinality() == protoreflect.Repeated && !fd.IsMap() } func (fd *Field) IsMap() bool { return fd.Message() != nil && fd.Message().IsMapEntry() } func (fd *Field) MapKey() protoreflect.FieldDescriptor { @@ -425,6 +427,7 @@ type ( Extendee protoreflect.MessageDescriptor Cardinality protoreflect.Cardinality Kind protoreflect.Kind + IsLazy bool EditionFeatures EditionFeatures } ExtensionL2 struct { @@ -465,6 +468,7 @@ func (xd *Extension) IsPacked() bool { } func (xd *Extension) IsExtension() bool { return true } func (xd *Extension) IsWeak() bool { return false } +func (xd *Extension) IsLazy() bool { return xd.L1.IsLazy } func (xd *Extension) IsList() bool { return xd.Cardinality() == protoreflect.Repeated } func (xd *Extension) IsMap() bool { return false } func (xd *Extension) MapKey() protoreflect.FieldDescriptor { return nil } diff --git a/vendor/google.golang.org/protobuf/internal/filedesc/desc_init.go b/vendor/google.golang.org/protobuf/internal/filedesc/desc_init.go index 8a57d60..d2f5494 100644 --- a/vendor/google.golang.org/protobuf/internal/filedesc/desc_init.go +++ b/vendor/google.golang.org/protobuf/internal/filedesc/desc_init.go @@ -495,6 +495,8 @@ func (xd *Extension) unmarshalOptions(b []byte) { switch num { case genid.FieldOptions_Packed_field_number: xd.L1.EditionFeatures.IsPacked = protowire.DecodeBool(v) + case genid.FieldOptions_Lazy_field_number: + xd.L1.IsLazy = protowire.DecodeBool(v) } case protowire.BytesType: v, m := protowire.ConsumeBytes(b) diff --git a/vendor/google.golang.org/protobuf/internal/filedesc/desc_lazy.go b/vendor/google.golang.org/protobuf/internal/filedesc/desc_lazy.go index e56c91a..67a51b3 100644 --- a/vendor/google.golang.org/protobuf/internal/filedesc/desc_lazy.go +++ b/vendor/google.golang.org/protobuf/internal/filedesc/desc_lazy.go @@ -504,6 +504,8 @@ func (fd *Field) unmarshalOptions(b []byte) { fd.L1.EditionFeatures.IsPacked = protowire.DecodeBool(v) case genid.FieldOptions_Weak_field_number: fd.L1.IsWeak = protowire.DecodeBool(v) + case genid.FieldOptions_Lazy_field_number: + fd.L1.IsLazy = protowire.DecodeBool(v) case FieldOptions_EnforceUTF8: fd.L1.EditionFeatures.IsUTF8Validated = protowire.DecodeBool(v) } diff --git a/vendor/google.golang.org/protobuf/internal/filedesc/editions.go b/vendor/google.golang.org/protobuf/internal/filedesc/editions.go index 11f5f35..fd4d0c8 100644 --- a/vendor/google.golang.org/protobuf/internal/filedesc/editions.go +++ b/vendor/google.golang.org/protobuf/internal/filedesc/editions.go @@ -68,7 +68,7 @@ func unmarshalFeatureSet(b []byte, parent EditionFeatures) EditionFeatures { v, m := protowire.ConsumeBytes(b) b = b[m:] switch num { - case genid.GoFeatures_LegacyUnmarshalJsonEnum_field_number: + case genid.FeatureSet_Go_ext_number: parent = unmarshalGoFeature(v, parent) } } diff --git a/vendor/google.golang.org/protobuf/internal/genid/doc.go b/vendor/google.golang.org/protobuf/internal/genid/doc.go index 45ccd01..d9b9d91 100644 --- a/vendor/google.golang.org/protobuf/internal/genid/doc.go +++ b/vendor/google.golang.org/protobuf/internal/genid/doc.go @@ -6,6 +6,6 @@ // and the well-known types. package genid -import protoreflect "google.golang.org/protobuf/reflect/protoreflect" +import "google.golang.org/protobuf/reflect/protoreflect" const GoogleProtobuf_package protoreflect.FullName = "google.protobuf" diff --git a/vendor/google.golang.org/protobuf/internal/genid/go_features_gen.go b/vendor/google.golang.org/protobuf/internal/genid/go_features_gen.go index 9a652a2..7f67cbb 100644 --- a/vendor/google.golang.org/protobuf/internal/genid/go_features_gen.go +++ b/vendor/google.golang.org/protobuf/internal/genid/go_features_gen.go @@ -12,20 +12,25 @@ import ( const File_google_protobuf_go_features_proto = "google/protobuf/go_features.proto" -// Names for google.protobuf.GoFeatures. +// Names for pb.GoFeatures. const ( GoFeatures_message_name protoreflect.Name = "GoFeatures" - GoFeatures_message_fullname protoreflect.FullName = "google.protobuf.GoFeatures" + GoFeatures_message_fullname protoreflect.FullName = "pb.GoFeatures" ) -// Field names for google.protobuf.GoFeatures. +// Field names for pb.GoFeatures. const ( GoFeatures_LegacyUnmarshalJsonEnum_field_name protoreflect.Name = "legacy_unmarshal_json_enum" - GoFeatures_LegacyUnmarshalJsonEnum_field_fullname protoreflect.FullName = "google.protobuf.GoFeatures.legacy_unmarshal_json_enum" + GoFeatures_LegacyUnmarshalJsonEnum_field_fullname protoreflect.FullName = "pb.GoFeatures.legacy_unmarshal_json_enum" ) -// Field numbers for google.protobuf.GoFeatures. +// Field numbers for pb.GoFeatures. const ( GoFeatures_LegacyUnmarshalJsonEnum_field_number protoreflect.FieldNumber = 1 ) + +// Extension numbers +const ( + FeatureSet_Go_ext_number protoreflect.FieldNumber = 1002 +) diff --git a/vendor/google.golang.org/protobuf/internal/genid/map_entry.go b/vendor/google.golang.org/protobuf/internal/genid/map_entry.go index 8f9ea02..bef5a25 100644 --- a/vendor/google.golang.org/protobuf/internal/genid/map_entry.go +++ b/vendor/google.golang.org/protobuf/internal/genid/map_entry.go @@ -4,7 +4,7 @@ package genid -import protoreflect "google.golang.org/protobuf/reflect/protoreflect" +import "google.golang.org/protobuf/reflect/protoreflect" // Generic field names and numbers for synthetic map entry messages. const ( diff --git a/vendor/google.golang.org/protobuf/internal/genid/wrappers.go b/vendor/google.golang.org/protobuf/internal/genid/wrappers.go index 429384b..9404270 100644 --- a/vendor/google.golang.org/protobuf/internal/genid/wrappers.go +++ b/vendor/google.golang.org/protobuf/internal/genid/wrappers.go @@ -4,7 +4,7 @@ package genid -import protoreflect "google.golang.org/protobuf/reflect/protoreflect" +import "google.golang.org/protobuf/reflect/protoreflect" // Generic field name and number for messages in wrappers.proto. const ( diff --git a/vendor/google.golang.org/protobuf/internal/impl/codec_extension.go b/vendor/google.golang.org/protobuf/internal/impl/codec_extension.go index 4bb0a7a..0d5b546 100644 --- a/vendor/google.golang.org/protobuf/internal/impl/codec_extension.go +++ b/vendor/google.golang.org/protobuf/internal/impl/codec_extension.go @@ -67,7 +67,6 @@ type lazyExtensionValue struct { xi *extensionFieldInfo value protoreflect.Value b []byte - fn func() protoreflect.Value } type ExtensionField struct { @@ -158,10 +157,9 @@ func (f *ExtensionField) lazyInit() { } f.lazy.value = val } else { - f.lazy.value = f.lazy.fn() + panic("No support for lazy fns for ExtensionField") } f.lazy.xi = nil - f.lazy.fn = nil f.lazy.b = nil atomic.StoreUint32(&f.lazy.atomicOnce, 1) } @@ -174,13 +172,6 @@ func (f *ExtensionField) Set(t protoreflect.ExtensionType, v protoreflect.Value) f.lazy = nil } -// SetLazy sets the type and a value that is to be lazily evaluated upon first use. -// This must not be called concurrently. -func (f *ExtensionField) SetLazy(t protoreflect.ExtensionType, fn func() protoreflect.Value) { - f.typ = t - f.lazy = &lazyExtensionValue{fn: fn} -} - // Value returns the value of the extension field. // This may be called concurrently. func (f *ExtensionField) Value() protoreflect.Value { diff --git a/vendor/google.golang.org/protobuf/internal/impl/codec_field.go b/vendor/google.golang.org/protobuf/internal/impl/codec_field.go index 78ee47e..7c1f66c 100644 --- a/vendor/google.golang.org/protobuf/internal/impl/codec_field.go +++ b/vendor/google.golang.org/protobuf/internal/impl/codec_field.go @@ -65,6 +65,9 @@ func (mi *MessageInfo) initOneofFieldCoders(od protoreflect.OneofDescriptor, si if err != nil { return out, err } + if cf.funcs.isInit == nil { + out.initialized = true + } vi.Set(vw) return out, nil } diff --git a/vendor/google.golang.org/protobuf/internal/impl/codec_message.go b/vendor/google.golang.org/protobuf/internal/impl/codec_message.go index 6b2fdbb..78be9df 100644 --- a/vendor/google.golang.org/protobuf/internal/impl/codec_message.go +++ b/vendor/google.golang.org/protobuf/internal/impl/codec_message.go @@ -189,6 +189,9 @@ func (mi *MessageInfo) makeCoderMethods(t reflect.Type, si structInfo) { if mi.methods.Merge == nil { mi.methods.Merge = mi.merge } + if mi.methods.Equal == nil { + mi.methods.Equal = equal + } } // getUnknownBytes returns a *[]byte for the unknown fields. diff --git a/vendor/google.golang.org/protobuf/internal/impl/codec_reflect.go b/vendor/google.golang.org/protobuf/internal/impl/codec_reflect.go deleted file mode 100644 index 145c577..0000000 --- a/vendor/google.golang.org/protobuf/internal/impl/codec_reflect.go +++ /dev/null @@ -1,210 +0,0 @@ -// Copyright 2019 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -//go:build purego || appengine -// +build purego appengine - -package impl - -import ( - "reflect" - - "google.golang.org/protobuf/encoding/protowire" -) - -func sizeEnum(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) { - v := p.v.Elem().Int() - return f.tagsize + protowire.SizeVarint(uint64(v)) -} - -func appendEnum(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) { - v := p.v.Elem().Int() - b = protowire.AppendVarint(b, f.wiretag) - b = protowire.AppendVarint(b, uint64(v)) - return b, nil -} - -func consumeEnum(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) { - if wtyp != protowire.VarintType { - return out, errUnknown - } - v, n := protowire.ConsumeVarint(b) - if n < 0 { - return out, errDecode - } - p.v.Elem().SetInt(int64(v)) - out.n = n - return out, nil -} - -func mergeEnum(dst, src pointer, _ *coderFieldInfo, _ mergeOptions) { - dst.v.Elem().Set(src.v.Elem()) -} - -var coderEnum = pointerCoderFuncs{ - size: sizeEnum, - marshal: appendEnum, - unmarshal: consumeEnum, - merge: mergeEnum, -} - -func sizeEnumNoZero(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) { - if p.v.Elem().Int() == 0 { - return 0 - } - return sizeEnum(p, f, opts) -} - -func appendEnumNoZero(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) { - if p.v.Elem().Int() == 0 { - return b, nil - } - return appendEnum(b, p, f, opts) -} - -func mergeEnumNoZero(dst, src pointer, _ *coderFieldInfo, _ mergeOptions) { - if src.v.Elem().Int() != 0 { - dst.v.Elem().Set(src.v.Elem()) - } -} - -var coderEnumNoZero = pointerCoderFuncs{ - size: sizeEnumNoZero, - marshal: appendEnumNoZero, - unmarshal: consumeEnum, - merge: mergeEnumNoZero, -} - -func sizeEnumPtr(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) { - return sizeEnum(pointer{p.v.Elem()}, f, opts) -} - -func appendEnumPtr(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) { - return appendEnum(b, pointer{p.v.Elem()}, f, opts) -} - -func consumeEnumPtr(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) { - if wtyp != protowire.VarintType { - return out, errUnknown - } - if p.v.Elem().IsNil() { - p.v.Elem().Set(reflect.New(p.v.Elem().Type().Elem())) - } - return consumeEnum(b, pointer{p.v.Elem()}, wtyp, f, opts) -} - -func mergeEnumPtr(dst, src pointer, _ *coderFieldInfo, _ mergeOptions) { - if !src.v.Elem().IsNil() { - v := reflect.New(dst.v.Type().Elem().Elem()) - v.Elem().Set(src.v.Elem().Elem()) - dst.v.Elem().Set(v) - } -} - -var coderEnumPtr = pointerCoderFuncs{ - size: sizeEnumPtr, - marshal: appendEnumPtr, - unmarshal: consumeEnumPtr, - merge: mergeEnumPtr, -} - -func sizeEnumSlice(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) { - s := p.v.Elem() - for i, llen := 0, s.Len(); i < llen; i++ { - size += protowire.SizeVarint(uint64(s.Index(i).Int())) + f.tagsize - } - return size -} - -func appendEnumSlice(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) { - s := p.v.Elem() - for i, llen := 0, s.Len(); i < llen; i++ { - b = protowire.AppendVarint(b, f.wiretag) - b = protowire.AppendVarint(b, uint64(s.Index(i).Int())) - } - return b, nil -} - -func consumeEnumSlice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) { - s := p.v.Elem() - if wtyp == protowire.BytesType { - b, n := protowire.ConsumeBytes(b) - if n < 0 { - return out, errDecode - } - for len(b) > 0 { - v, n := protowire.ConsumeVarint(b) - if n < 0 { - return out, errDecode - } - rv := reflect.New(s.Type().Elem()).Elem() - rv.SetInt(int64(v)) - s.Set(reflect.Append(s, rv)) - b = b[n:] - } - out.n = n - return out, nil - } - if wtyp != protowire.VarintType { - return out, errUnknown - } - v, n := protowire.ConsumeVarint(b) - if n < 0 { - return out, errDecode - } - rv := reflect.New(s.Type().Elem()).Elem() - rv.SetInt(int64(v)) - s.Set(reflect.Append(s, rv)) - out.n = n - return out, nil -} - -func mergeEnumSlice(dst, src pointer, _ *coderFieldInfo, _ mergeOptions) { - dst.v.Elem().Set(reflect.AppendSlice(dst.v.Elem(), src.v.Elem())) -} - -var coderEnumSlice = pointerCoderFuncs{ - size: sizeEnumSlice, - marshal: appendEnumSlice, - unmarshal: consumeEnumSlice, - merge: mergeEnumSlice, -} - -func sizeEnumPackedSlice(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) { - s := p.v.Elem() - llen := s.Len() - if llen == 0 { - return 0 - } - n := 0 - for i := 0; i < llen; i++ { - n += protowire.SizeVarint(uint64(s.Index(i).Int())) - } - return f.tagsize + protowire.SizeBytes(n) -} - -func appendEnumPackedSlice(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) { - s := p.v.Elem() - llen := s.Len() - if llen == 0 { - return b, nil - } - b = protowire.AppendVarint(b, f.wiretag) - n := 0 - for i := 0; i < llen; i++ { - n += protowire.SizeVarint(uint64(s.Index(i).Int())) - } - b = protowire.AppendVarint(b, uint64(n)) - for i := 0; i < llen; i++ { - b = protowire.AppendVarint(b, uint64(s.Index(i).Int())) - } - return b, nil -} - -var coderEnumPackedSlice = pointerCoderFuncs{ - size: sizeEnumPackedSlice, - marshal: appendEnumPackedSlice, - unmarshal: consumeEnumSlice, - merge: mergeEnumSlice, -} diff --git a/vendor/google.golang.org/protobuf/internal/impl/codec_unsafe.go b/vendor/google.golang.org/protobuf/internal/impl/codec_unsafe.go index 757642e..077712c 100644 --- a/vendor/google.golang.org/protobuf/internal/impl/codec_unsafe.go +++ b/vendor/google.golang.org/protobuf/internal/impl/codec_unsafe.go @@ -2,9 +2,6 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -//go:build !purego && !appengine -// +build !purego,!appengine - package impl // When using unsafe pointers, we can just treat enum values as int32s. diff --git a/vendor/google.golang.org/protobuf/internal/impl/convert.go b/vendor/google.golang.org/protobuf/internal/impl/convert.go index e06ece5..f72ddd8 100644 --- a/vendor/google.golang.org/protobuf/internal/impl/convert.go +++ b/vendor/google.golang.org/protobuf/internal/impl/convert.go @@ -322,7 +322,7 @@ func (c *stringConverter) PBValueOf(v reflect.Value) protoreflect.Value { return protoreflect.ValueOfString(v.Convert(stringType).String()) } func (c *stringConverter) GoValueOf(v protoreflect.Value) reflect.Value { - // pref.Value.String never panics, so we go through an interface + // protoreflect.Value.String never panics, so we go through an interface // conversion here to check the type. s := v.Interface().(string) if c.goType.Kind() == reflect.Slice && s == "" { diff --git a/vendor/google.golang.org/protobuf/internal/impl/encode.go b/vendor/google.golang.org/protobuf/internal/impl/encode.go index febd212..6254f5d 100644 --- a/vendor/google.golang.org/protobuf/internal/impl/encode.go +++ b/vendor/google.golang.org/protobuf/internal/impl/encode.go @@ -10,7 +10,7 @@ import ( "sync/atomic" "google.golang.org/protobuf/internal/flags" - proto "google.golang.org/protobuf/proto" + "google.golang.org/protobuf/proto" piface "google.golang.org/protobuf/runtime/protoiface" ) diff --git a/vendor/google.golang.org/protobuf/internal/impl/equal.go b/vendor/google.golang.org/protobuf/internal/impl/equal.go new file mode 100644 index 0000000..9f6c32a --- /dev/null +++ b/vendor/google.golang.org/protobuf/internal/impl/equal.go @@ -0,0 +1,224 @@ +// Copyright 2024 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package impl + +import ( + "bytes" + + "google.golang.org/protobuf/encoding/protowire" + "google.golang.org/protobuf/reflect/protoreflect" + "google.golang.org/protobuf/runtime/protoiface" +) + +func equal(in protoiface.EqualInput) protoiface.EqualOutput { + return protoiface.EqualOutput{Equal: equalMessage(in.MessageA, in.MessageB)} +} + +// equalMessage is a fast-path variant of protoreflect.equalMessage. +// It takes advantage of the internal messageState type to avoid +// unnecessary allocations, type assertions. +func equalMessage(mx, my protoreflect.Message) bool { + if mx == nil || my == nil { + return mx == my + } + if mx.Descriptor() != my.Descriptor() { + return false + } + + msx, ok := mx.(*messageState) + if !ok { + return protoreflect.ValueOfMessage(mx).Equal(protoreflect.ValueOfMessage(my)) + } + msy, ok := my.(*messageState) + if !ok { + return protoreflect.ValueOfMessage(mx).Equal(protoreflect.ValueOfMessage(my)) + } + + mi := msx.messageInfo() + miy := msy.messageInfo() + if mi != miy { + return protoreflect.ValueOfMessage(mx).Equal(protoreflect.ValueOfMessage(my)) + } + mi.init() + // Compares regular fields + // Modified Message.Range code that compares two messages of the same type + // while going over the fields. + for _, ri := range mi.rangeInfos { + var fd protoreflect.FieldDescriptor + var vx, vy protoreflect.Value + + switch ri := ri.(type) { + case *fieldInfo: + hx := ri.has(msx.pointer()) + hy := ri.has(msy.pointer()) + if hx != hy { + return false + } + if !hx { + continue + } + fd = ri.fieldDesc + vx = ri.get(msx.pointer()) + vy = ri.get(msy.pointer()) + case *oneofInfo: + fnx := ri.which(msx.pointer()) + fny := ri.which(msy.pointer()) + if fnx != fny { + return false + } + if fnx <= 0 { + continue + } + fi := mi.fields[fnx] + fd = fi.fieldDesc + vx = fi.get(msx.pointer()) + vy = fi.get(msy.pointer()) + } + + if !equalValue(fd, vx, vy) { + return false + } + } + + // Compare extensions. + // This is more complicated because mx or my could have empty/nil extension maps, + // however some populated extension map values are equal to nil extension maps. + emx := mi.extensionMap(msx.pointer()) + emy := mi.extensionMap(msy.pointer()) + if emx != nil { + for k, x := range *emx { + xd := x.Type().TypeDescriptor() + xv := x.Value() + var y ExtensionField + ok := false + if emy != nil { + y, ok = (*emy)[k] + } + // We need to treat empty lists as equal to nil values + if emy == nil || !ok { + if xd.IsList() && xv.List().Len() == 0 { + continue + } + return false + } + + if !equalValue(xd, xv, y.Value()) { + return false + } + } + } + if emy != nil { + // emy may have extensions emx does not have, need to check them as well + for k, y := range *emy { + if emx != nil { + // emx has the field, so we already checked it + if _, ok := (*emx)[k]; ok { + continue + } + } + // Empty lists are equal to nil + if y.Type().TypeDescriptor().IsList() && y.Value().List().Len() == 0 { + continue + } + + // Cant be equal if the extension is populated + return false + } + } + + return equalUnknown(mx.GetUnknown(), my.GetUnknown()) +} + +func equalValue(fd protoreflect.FieldDescriptor, vx, vy protoreflect.Value) bool { + // slow path + if fd.Kind() != protoreflect.MessageKind { + return vx.Equal(vy) + } + + // fast path special cases + if fd.IsMap() { + if fd.MapValue().Kind() == protoreflect.MessageKind { + return equalMessageMap(vx.Map(), vy.Map()) + } + return vx.Equal(vy) + } + + if fd.IsList() { + return equalMessageList(vx.List(), vy.List()) + } + + return equalMessage(vx.Message(), vy.Message()) +} + +// Mostly copied from protoreflect.equalMap. +// This variant only works for messages as map types. +// All other map types should be handled via Value.Equal. +func equalMessageMap(mx, my protoreflect.Map) bool { + if mx.Len() != my.Len() { + return false + } + equal := true + mx.Range(func(k protoreflect.MapKey, vx protoreflect.Value) bool { + if !my.Has(k) { + equal = false + return false + } + vy := my.Get(k) + equal = equalMessage(vx.Message(), vy.Message()) + return equal + }) + return equal +} + +// Mostly copied from protoreflect.equalList. +// The only change is the usage of equalImpl instead of protoreflect.equalValue. +func equalMessageList(lx, ly protoreflect.List) bool { + if lx.Len() != ly.Len() { + return false + } + for i := 0; i < lx.Len(); i++ { + // We only operate on messages here since equalImpl will not call us in any other case. + if !equalMessage(lx.Get(i).Message(), ly.Get(i).Message()) { + return false + } + } + return true +} + +// equalUnknown compares unknown fields by direct comparison on the raw bytes +// of each individual field number. +// Copied from protoreflect.equalUnknown. +func equalUnknown(x, y protoreflect.RawFields) bool { + if len(x) != len(y) { + return false + } + if bytes.Equal([]byte(x), []byte(y)) { + return true + } + + mx := make(map[protoreflect.FieldNumber]protoreflect.RawFields) + my := make(map[protoreflect.FieldNumber]protoreflect.RawFields) + for len(x) > 0 { + fnum, _, n := protowire.ConsumeField(x) + mx[fnum] = append(mx[fnum], x[:n]...) + x = x[n:] + } + for len(y) > 0 { + fnum, _, n := protowire.ConsumeField(y) + my[fnum] = append(my[fnum], y[:n]...) + y = y[n:] + } + if len(mx) != len(my) { + return false + } + + for k, v1 := range mx { + if v2, ok := my[k]; !ok || !bytes.Equal([]byte(v1), []byte(v2)) { + return false + } + } + + return true +} diff --git a/vendor/google.golang.org/protobuf/internal/impl/legacy_extension.go b/vendor/google.golang.org/protobuf/internal/impl/legacy_extension.go index 6e8677e..b6849d6 100644 --- a/vendor/google.golang.org/protobuf/internal/impl/legacy_extension.go +++ b/vendor/google.golang.org/protobuf/internal/impl/legacy_extension.go @@ -160,6 +160,7 @@ func (x placeholderExtension) HasPresence() bool func (x placeholderExtension) HasOptionalKeyword() bool { return false } func (x placeholderExtension) IsExtension() bool { return true } func (x placeholderExtension) IsWeak() bool { return false } +func (x placeholderExtension) IsLazy() bool { return false } func (x placeholderExtension) IsPacked() bool { return false } func (x placeholderExtension) IsList() bool { return false } func (x placeholderExtension) IsMap() bool { return false } diff --git a/vendor/google.golang.org/protobuf/internal/impl/message.go b/vendor/google.golang.org/protobuf/internal/impl/message.go index 019399d..741b5ed 100644 --- a/vendor/google.golang.org/protobuf/internal/impl/message.go +++ b/vendor/google.golang.org/protobuf/internal/impl/message.go @@ -30,8 +30,8 @@ type MessageInfo struct { // Desc is the underlying message descriptor type and must be populated. Desc protoreflect.MessageDescriptor - // Exporter must be provided in a purego environment in order to provide - // access to unexported fields. + // Deprecated: Exporter will be removed the next time we bump + // protoimpl.GenVersion. See https://github.com/golang/protobuf/issues/1640 Exporter exporter // OneofWrappers is list of pointers to oneof wrapper struct types. diff --git a/vendor/google.golang.org/protobuf/internal/impl/pointer_reflect.go b/vendor/google.golang.org/protobuf/internal/impl/pointer_reflect.go deleted file mode 100644 index da685e8..0000000 --- a/vendor/google.golang.org/protobuf/internal/impl/pointer_reflect.go +++ /dev/null @@ -1,215 +0,0 @@ -// Copyright 2018 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -//go:build purego || appengine -// +build purego appengine - -package impl - -import ( - "fmt" - "reflect" - "sync" -) - -const UnsafeEnabled = false - -// Pointer is an opaque pointer type. -type Pointer any - -// offset represents the offset to a struct field, accessible from a pointer. -// The offset is the field index into a struct. -type offset struct { - index int - export exporter -} - -// offsetOf returns a field offset for the struct field. -func offsetOf(f reflect.StructField, x exporter) offset { - if len(f.Index) != 1 { - panic("embedded structs are not supported") - } - if f.PkgPath == "" { - return offset{index: f.Index[0]} // field is already exported - } - if x == nil { - panic("exporter must be provided for unexported field") - } - return offset{index: f.Index[0], export: x} -} - -// IsValid reports whether the offset is valid. -func (f offset) IsValid() bool { return f.index >= 0 } - -// invalidOffset is an invalid field offset. -var invalidOffset = offset{index: -1} - -// zeroOffset is a noop when calling pointer.Apply. -var zeroOffset = offset{index: 0} - -// pointer is an abstract representation of a pointer to a struct or field. -type pointer struct{ v reflect.Value } - -// pointerOf returns p as a pointer. -func pointerOf(p Pointer) pointer { - return pointerOfIface(p) -} - -// pointerOfValue returns v as a pointer. -func pointerOfValue(v reflect.Value) pointer { - return pointer{v: v} -} - -// pointerOfIface returns the pointer portion of an interface. -func pointerOfIface(v any) pointer { - return pointer{v: reflect.ValueOf(v)} -} - -// IsNil reports whether the pointer is nil. -func (p pointer) IsNil() bool { - return p.v.IsNil() -} - -// Apply adds an offset to the pointer to derive a new pointer -// to a specified field. The current pointer must be pointing at a struct. -func (p pointer) Apply(f offset) pointer { - if f.export != nil { - if v := reflect.ValueOf(f.export(p.v.Interface(), f.index)); v.IsValid() { - return pointer{v: v} - } - } - return pointer{v: p.v.Elem().Field(f.index).Addr()} -} - -// AsValueOf treats p as a pointer to an object of type t and returns the value. -// It is equivalent to reflect.ValueOf(p.AsIfaceOf(t)) -func (p pointer) AsValueOf(t reflect.Type) reflect.Value { - if got := p.v.Type().Elem(); got != t { - panic(fmt.Sprintf("invalid type: got %v, want %v", got, t)) - } - return p.v -} - -// AsIfaceOf treats p as a pointer to an object of type t and returns the value. -// It is equivalent to p.AsValueOf(t).Interface() -func (p pointer) AsIfaceOf(t reflect.Type) any { - return p.AsValueOf(t).Interface() -} - -func (p pointer) Bool() *bool { return p.v.Interface().(*bool) } -func (p pointer) BoolPtr() **bool { return p.v.Interface().(**bool) } -func (p pointer) BoolSlice() *[]bool { return p.v.Interface().(*[]bool) } -func (p pointer) Int32() *int32 { return p.v.Interface().(*int32) } -func (p pointer) Int32Ptr() **int32 { return p.v.Interface().(**int32) } -func (p pointer) Int32Slice() *[]int32 { return p.v.Interface().(*[]int32) } -func (p pointer) Int64() *int64 { return p.v.Interface().(*int64) } -func (p pointer) Int64Ptr() **int64 { return p.v.Interface().(**int64) } -func (p pointer) Int64Slice() *[]int64 { return p.v.Interface().(*[]int64) } -func (p pointer) Uint32() *uint32 { return p.v.Interface().(*uint32) } -func (p pointer) Uint32Ptr() **uint32 { return p.v.Interface().(**uint32) } -func (p pointer) Uint32Slice() *[]uint32 { return p.v.Interface().(*[]uint32) } -func (p pointer) Uint64() *uint64 { return p.v.Interface().(*uint64) } -func (p pointer) Uint64Ptr() **uint64 { return p.v.Interface().(**uint64) } -func (p pointer) Uint64Slice() *[]uint64 { return p.v.Interface().(*[]uint64) } -func (p pointer) Float32() *float32 { return p.v.Interface().(*float32) } -func (p pointer) Float32Ptr() **float32 { return p.v.Interface().(**float32) } -func (p pointer) Float32Slice() *[]float32 { return p.v.Interface().(*[]float32) } -func (p pointer) Float64() *float64 { return p.v.Interface().(*float64) } -func (p pointer) Float64Ptr() **float64 { return p.v.Interface().(**float64) } -func (p pointer) Float64Slice() *[]float64 { return p.v.Interface().(*[]float64) } -func (p pointer) String() *string { return p.v.Interface().(*string) } -func (p pointer) StringPtr() **string { return p.v.Interface().(**string) } -func (p pointer) StringSlice() *[]string { return p.v.Interface().(*[]string) } -func (p pointer) Bytes() *[]byte { return p.v.Interface().(*[]byte) } -func (p pointer) BytesPtr() **[]byte { return p.v.Interface().(**[]byte) } -func (p pointer) BytesSlice() *[][]byte { return p.v.Interface().(*[][]byte) } -func (p pointer) WeakFields() *weakFields { return (*weakFields)(p.v.Interface().(*WeakFields)) } -func (p pointer) Extensions() *map[int32]ExtensionField { - return p.v.Interface().(*map[int32]ExtensionField) -} - -func (p pointer) Elem() pointer { - return pointer{v: p.v.Elem()} -} - -// PointerSlice copies []*T from p as a new []pointer. -// This behavior differs from the implementation in pointer_unsafe.go. -func (p pointer) PointerSlice() []pointer { - // TODO: reconsider this - if p.v.IsNil() { - return nil - } - n := p.v.Elem().Len() - s := make([]pointer, n) - for i := 0; i < n; i++ { - s[i] = pointer{v: p.v.Elem().Index(i)} - } - return s -} - -// AppendPointerSlice appends v to p, which must be a []*T. -func (p pointer) AppendPointerSlice(v pointer) { - sp := p.v.Elem() - sp.Set(reflect.Append(sp, v.v)) -} - -// SetPointer sets *p to v. -func (p pointer) SetPointer(v pointer) { - p.v.Elem().Set(v.v) -} - -func growSlice(p pointer, addCap int) { - // TODO: Once we only support Go 1.20 and newer, use reflect.Grow. - in := p.v.Elem() - out := reflect.MakeSlice(in.Type(), in.Len(), in.Len()+addCap) - reflect.Copy(out, in) - p.v.Elem().Set(out) -} - -func (p pointer) growBoolSlice(addCap int) { - growSlice(p, addCap) -} - -func (p pointer) growInt32Slice(addCap int) { - growSlice(p, addCap) -} - -func (p pointer) growUint32Slice(addCap int) { - growSlice(p, addCap) -} - -func (p pointer) growInt64Slice(addCap int) { - growSlice(p, addCap) -} - -func (p pointer) growUint64Slice(addCap int) { - growSlice(p, addCap) -} - -func (p pointer) growFloat64Slice(addCap int) { - growSlice(p, addCap) -} - -func (p pointer) growFloat32Slice(addCap int) { - growSlice(p, addCap) -} - -func (Export) MessageStateOf(p Pointer) *messageState { panic("not supported") } -func (ms *messageState) pointer() pointer { panic("not supported") } -func (ms *messageState) messageInfo() *MessageInfo { panic("not supported") } -func (ms *messageState) LoadMessageInfo() *MessageInfo { panic("not supported") } -func (ms *messageState) StoreMessageInfo(mi *MessageInfo) { panic("not supported") } - -type atomicNilMessage struct { - once sync.Once - m messageReflectWrapper -} - -func (m *atomicNilMessage) Init(mi *MessageInfo) *messageReflectWrapper { - m.once.Do(func() { - m.m.p = pointerOfIface(reflect.Zero(mi.GoReflectType).Interface()) - m.m.mi = mi - }) - return &m.m -} diff --git a/vendor/google.golang.org/protobuf/internal/impl/pointer_unsafe.go b/vendor/google.golang.org/protobuf/internal/impl/pointer_unsafe.go index 5f20ca5..79e1866 100644 --- a/vendor/google.golang.org/protobuf/internal/impl/pointer_unsafe.go +++ b/vendor/google.golang.org/protobuf/internal/impl/pointer_unsafe.go @@ -2,9 +2,6 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -//go:build !purego && !appengine -// +build !purego,!appengine - package impl import ( diff --git a/vendor/google.golang.org/protobuf/internal/strs/strings_pure.go b/vendor/google.golang.org/protobuf/internal/strs/strings_pure.go deleted file mode 100644 index a1f6f33..0000000 --- a/vendor/google.golang.org/protobuf/internal/strs/strings_pure.go +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright 2018 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -//go:build purego || appengine -// +build purego appengine - -package strs - -import pref "google.golang.org/protobuf/reflect/protoreflect" - -func UnsafeString(b []byte) string { - return string(b) -} - -func UnsafeBytes(s string) []byte { - return []byte(s) -} - -type Builder struct{} - -func (*Builder) AppendFullName(prefix pref.FullName, name pref.Name) pref.FullName { - return prefix.Append(name) -} - -func (*Builder) MakeString(b []byte) string { - return string(b) -} diff --git a/vendor/google.golang.org/protobuf/internal/strs/strings_unsafe_go120.go b/vendor/google.golang.org/protobuf/internal/strs/strings_unsafe_go120.go index a008acd..832a798 100644 --- a/vendor/google.golang.org/protobuf/internal/strs/strings_unsafe_go120.go +++ b/vendor/google.golang.org/protobuf/internal/strs/strings_unsafe_go120.go @@ -2,8 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -//go:build !purego && !appengine && !go1.21 -// +build !purego,!appengine,!go1.21 +//go:build !go1.21 package strs diff --git a/vendor/google.golang.org/protobuf/internal/strs/strings_unsafe_go121.go b/vendor/google.golang.org/protobuf/internal/strs/strings_unsafe_go121.go index 60166f2..1ffddf6 100644 --- a/vendor/google.golang.org/protobuf/internal/strs/strings_unsafe_go121.go +++ b/vendor/google.golang.org/protobuf/internal/strs/strings_unsafe_go121.go @@ -2,8 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -//go:build !purego && !appengine && go1.21 -// +build !purego,!appengine,go1.21 +//go:build go1.21 package strs diff --git a/vendor/google.golang.org/protobuf/internal/version/version.go b/vendor/google.golang.org/protobuf/internal/version/version.go index dbbf1f6..fb8e15e 100644 --- a/vendor/google.golang.org/protobuf/internal/version/version.go +++ b/vendor/google.golang.org/protobuf/internal/version/version.go @@ -51,8 +51,8 @@ import ( // 10. Send out the CL for review and submit it. const ( Major = 1 - Minor = 34 - Patch = 2 + Minor = 35 + Patch = 1 PreRelease = "" ) diff --git a/vendor/google.golang.org/protobuf/proto/equal.go b/vendor/google.golang.org/protobuf/proto/equal.go index 1a0be1b..c36d4a9 100644 --- a/vendor/google.golang.org/protobuf/proto/equal.go +++ b/vendor/google.golang.org/protobuf/proto/equal.go @@ -8,6 +8,7 @@ import ( "reflect" "google.golang.org/protobuf/reflect/protoreflect" + "google.golang.org/protobuf/runtime/protoiface" ) // Equal reports whether two messages are equal, @@ -51,6 +52,14 @@ func Equal(x, y Message) bool { if mx.IsValid() != my.IsValid() { return false } + + // Only one of the messages needs to implement the fast-path for it to work. + pmx := protoMethods(mx) + pmy := protoMethods(my) + if pmx != nil && pmy != nil && pmx.Equal != nil && pmy.Equal != nil { + return pmx.Equal(protoiface.EqualInput{MessageA: mx, MessageB: my}).Equal + } + vx := protoreflect.ValueOfMessage(mx) vy := protoreflect.ValueOfMessage(my) return vx.Equal(vy) diff --git a/vendor/google.golang.org/protobuf/proto/extension.go b/vendor/google.golang.org/protobuf/proto/extension.go index d248f29..78445d1 100644 --- a/vendor/google.golang.org/protobuf/proto/extension.go +++ b/vendor/google.golang.org/protobuf/proto/extension.go @@ -39,6 +39,48 @@ func ClearExtension(m Message, xt protoreflect.ExtensionType) { // If the field is unpopulated, it returns the default value for // scalars and an immutable, empty value for lists or messages. // It panics if xt does not extend m. +// +// The type of the value is dependent on the field type of the extension. +// For extensions generated by protoc-gen-go, the Go type is as follows: +// +// ╔═══════════════════╤═════════════════════════╗ +// ║ Go type │ Protobuf kind ║ +// ╠═══════════════════╪═════════════════════════╣ +// ║ bool │ bool ║ +// ║ int32 │ int32, sint32, sfixed32 ║ +// ║ int64 │ int64, sint64, sfixed64 ║ +// ║ uint32 │ uint32, fixed32 ║ +// ║ uint64 │ uint64, fixed64 ║ +// ║ float32 │ float ║ +// ║ float64 │ double ║ +// ║ string │ string ║ +// ║ []byte │ bytes ║ +// ║ protoreflect.Enum │ enum ║ +// ║ proto.Message │ message, group ║ +// ╚═══════════════════╧═════════════════════════╝ +// +// The protoreflect.Enum and proto.Message types are the concrete Go type +// associated with the named enum or message. Repeated fields are represented +// using a Go slice of the base element type. +// +// If a generated extension descriptor variable is directly passed to +// GetExtension, then the call should be followed immediately by a +// type assertion to the expected output value. For example: +// +// mm := proto.GetExtension(m, foopb.E_MyExtension).(*foopb.MyMessage) +// +// This pattern enables static analysis tools to verify that the asserted type +// matches the Go type associated with the extension field and +// also enables a possible future migration to a type-safe extension API. +// +// Since singular messages are the most common extension type, the pattern of +// calling HasExtension followed by GetExtension may be simplified to: +// +// if mm := proto.GetExtension(m, foopb.E_MyExtension).(*foopb.MyMessage); mm != nil { +// ... // make use of mm +// } +// +// The mm variable is non-nil if and only if HasExtension reports true. func GetExtension(m Message, xt protoreflect.ExtensionType) any { // Treat nil message interface as an empty message; return the default. if m == nil { @@ -51,6 +93,35 @@ func GetExtension(m Message, xt protoreflect.ExtensionType) any { // SetExtension stores the value of an extension field. // It panics if m is invalid, xt does not extend m, or if type of v // is invalid for the specified extension field. +// +// The type of the value is dependent on the field type of the extension. +// For extensions generated by protoc-gen-go, the Go type is as follows: +// +// ╔═══════════════════╤═════════════════════════╗ +// ║ Go type │ Protobuf kind ║ +// ╠═══════════════════╪═════════════════════════╣ +// ║ bool │ bool ║ +// ║ int32 │ int32, sint32, sfixed32 ║ +// ║ int64 │ int64, sint64, sfixed64 ║ +// ║ uint32 │ uint32, fixed32 ║ +// ║ uint64 │ uint64, fixed64 ║ +// ║ float32 │ float ║ +// ║ float64 │ double ║ +// ║ string │ string ║ +// ║ []byte │ bytes ║ +// ║ protoreflect.Enum │ enum ║ +// ║ proto.Message │ message, group ║ +// ╚═══════════════════╧═════════════════════════╝ +// +// The protoreflect.Enum and proto.Message types are the concrete Go type +// associated with the named enum or message. Repeated fields are represented +// using a Go slice of the base element type. +// +// If a generated extension descriptor variable is directly passed to +// SetExtension (e.g., foopb.E_MyExtension), then the value should be a +// concrete type that matches the expected Go type for the extension descriptor +// so that static analysis tools can verify type correctness. +// This also enables a possible future migration to a type-safe extension API. func SetExtension(m Message, xt protoreflect.ExtensionType, v any) { xd := xt.TypeDescriptor() pv := xt.ValueOf(v) diff --git a/vendor/google.golang.org/protobuf/reflect/protoreflect/methods.go b/vendor/google.golang.org/protobuf/reflect/protoreflect/methods.go index d5d5af6..742cb51 100644 --- a/vendor/google.golang.org/protobuf/reflect/protoreflect/methods.go +++ b/vendor/google.golang.org/protobuf/reflect/protoreflect/methods.go @@ -23,6 +23,7 @@ type ( Unmarshal func(unmarshalInput) (unmarshalOutput, error) Merge func(mergeInput) mergeOutput CheckInitialized func(checkInitializedInput) (checkInitializedOutput, error) + Equal func(equalInput) equalOutput } supportFlags = uint64 sizeInput = struct { @@ -75,4 +76,13 @@ type ( checkInitializedOutput = struct { pragma.NoUnkeyedLiterals } + equalInput = struct { + pragma.NoUnkeyedLiterals + MessageA Message + MessageB Message + } + equalOutput = struct { + pragma.NoUnkeyedLiterals + Equal bool + } ) diff --git a/vendor/google.golang.org/protobuf/reflect/protoreflect/value_pure.go b/vendor/google.golang.org/protobuf/reflect/protoreflect/value_pure.go deleted file mode 100644 index 75f83a2..0000000 --- a/vendor/google.golang.org/protobuf/reflect/protoreflect/value_pure.go +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright 2018 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -//go:build purego || appengine -// +build purego appengine - -package protoreflect - -import "google.golang.org/protobuf/internal/pragma" - -type valueType int - -const ( - nilType valueType = iota - boolType - int32Type - int64Type - uint32Type - uint64Type - float32Type - float64Type - stringType - bytesType - enumType - ifaceType -) - -// value is a union where only one type can be represented at a time. -// This uses a distinct field for each type. This is type safe in Go, but -// occupies more memory than necessary (72B). -type value struct { - pragma.DoNotCompare // 0B - - typ valueType // 8B - num uint64 // 8B - str string // 16B - bin []byte // 24B - iface any // 16B -} - -func valueOfString(v string) Value { - return Value{typ: stringType, str: v} -} -func valueOfBytes(v []byte) Value { - return Value{typ: bytesType, bin: v} -} -func valueOfIface(v any) Value { - return Value{typ: ifaceType, iface: v} -} - -func (v Value) getString() string { - return v.str -} -func (v Value) getBytes() []byte { - return v.bin -} -func (v Value) getIface() any { - return v.iface -} diff --git a/vendor/google.golang.org/protobuf/reflect/protoreflect/value_unsafe_go120.go b/vendor/google.golang.org/protobuf/reflect/protoreflect/value_unsafe_go120.go index 7f3583e..0015fcb 100644 --- a/vendor/google.golang.org/protobuf/reflect/protoreflect/value_unsafe_go120.go +++ b/vendor/google.golang.org/protobuf/reflect/protoreflect/value_unsafe_go120.go @@ -2,8 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -//go:build !purego && !appengine && !go1.21 -// +build !purego,!appengine,!go1.21 +//go:build !go1.21 package protoreflect diff --git a/vendor/google.golang.org/protobuf/reflect/protoreflect/value_unsafe_go121.go b/vendor/google.golang.org/protobuf/reflect/protoreflect/value_unsafe_go121.go index f7d3869..479527b 100644 --- a/vendor/google.golang.org/protobuf/reflect/protoreflect/value_unsafe_go121.go +++ b/vendor/google.golang.org/protobuf/reflect/protoreflect/value_unsafe_go121.go @@ -2,8 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -//go:build !purego && !appengine && go1.21 -// +build !purego,!appengine,go1.21 +//go:build go1.21 package protoreflect diff --git a/vendor/google.golang.org/protobuf/runtime/protoiface/methods.go b/vendor/google.golang.org/protobuf/runtime/protoiface/methods.go index 44cf467..2461565 100644 --- a/vendor/google.golang.org/protobuf/runtime/protoiface/methods.go +++ b/vendor/google.golang.org/protobuf/runtime/protoiface/methods.go @@ -39,6 +39,9 @@ type Methods = struct { // CheckInitialized returns an error if any required fields in the message are not set. CheckInitialized func(CheckInitializedInput) (CheckInitializedOutput, error) + + // Equal compares two messages and returns EqualOutput.Equal == true if they are equal. + Equal func(EqualInput) EqualOutput } // SupportFlags indicate support for optional features. @@ -166,3 +169,18 @@ type CheckInitializedInput = struct { type CheckInitializedOutput = struct { pragma.NoUnkeyedLiterals } + +// EqualInput is input to the Equal method. +type EqualInput = struct { + pragma.NoUnkeyedLiterals + + MessageA protoreflect.Message + MessageB protoreflect.Message +} + +// EqualOutput is output from the Equal method. +type EqualOutput = struct { + pragma.NoUnkeyedLiterals + + Equal bool +} diff --git a/vendor/google.golang.org/protobuf/types/known/timestamppb/timestamp.pb.go b/vendor/google.golang.org/protobuf/types/known/timestamppb/timestamp.pb.go index 83a5a64..0d20722 100644 --- a/vendor/google.golang.org/protobuf/types/known/timestamppb/timestamp.pb.go +++ b/vendor/google.golang.org/protobuf/types/known/timestamppb/timestamp.pb.go @@ -254,11 +254,9 @@ func (x *Timestamp) check() uint { func (x *Timestamp) Reset() { *x = Timestamp{} - if protoimpl.UnsafeEnabled { - mi := &file_google_protobuf_timestamp_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_google_protobuf_timestamp_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *Timestamp) String() string { @@ -269,7 +267,7 @@ func (*Timestamp) ProtoMessage() {} func (x *Timestamp) ProtoReflect() protoreflect.Message { mi := &file_google_protobuf_timestamp_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -348,20 +346,6 @@ func file_google_protobuf_timestamp_proto_init() { if File_google_protobuf_timestamp_proto != nil { return } - if !protoimpl.UnsafeEnabled { - file_google_protobuf_timestamp_proto_msgTypes[0].Exporter = func(v any, i int) any { - switch v := v.(*Timestamp); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ diff --git a/vendor/modules.txt b/vendor/modules.txt index 02e707c..50b0327 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -7,8 +7,8 @@ github.com/beorn7/perks/quantile # github.com/cespare/xxhash/v2 v2.3.0 ## explicit; go 1.11 github.com/cespare/xxhash/v2 -# github.com/go-resty/resty/v2 v2.14.0 -## explicit; go 1.16 +# github.com/go-resty/resty/v2 v2.15.3 +## explicit; go 1.20 github.com/go-resty/resty/v2 github.com/go-resty/resty/v2/shellescape # github.com/google/go-cmp v0.6.0 @@ -18,8 +18,8 @@ github.com/google/go-cmp/cmp/internal/diff github.com/google/go-cmp/cmp/internal/flags github.com/google/go-cmp/cmp/internal/function github.com/google/go-cmp/cmp/internal/value -# github.com/klauspost/compress v1.17.9 -## explicit; go 1.20 +# github.com/klauspost/compress v1.17.11 +## explicit; go 1.21 github.com/klauspost/compress github.com/klauspost/compress/fse github.com/klauspost/compress/huff0 @@ -32,7 +32,7 @@ github.com/klauspost/compress/zstd/internal/xxhash # github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 ## explicit github.com/munnerz/goautoneg -# github.com/prometheus/client_golang v1.20.2 +# github.com/prometheus/client_golang v1.20.5 ## explicit; go 1.20 github.com/prometheus/client_golang/internal/github.com/golang/gddo/httputil github.com/prometheus/client_golang/internal/github.com/golang/gddo/httputil/header @@ -42,8 +42,8 @@ github.com/prometheus/client_golang/prometheus/promhttp # github.com/prometheus/client_model v0.6.1 ## explicit; go 1.19 github.com/prometheus/client_model/go -# github.com/prometheus/common v0.58.0 -## explicit; go 1.20 +# github.com/prometheus/common v0.60.1 +## explicit; go 1.21 github.com/prometheus/common/expfmt github.com/prometheus/common/model # github.com/prometheus/procfs v0.15.1 @@ -51,15 +51,15 @@ github.com/prometheus/common/model github.com/prometheus/procfs github.com/prometheus/procfs/internal/fs github.com/prometheus/procfs/internal/util -# golang.org/x/net v0.28.0 +# golang.org/x/net v0.30.0 ## explicit; go 1.18 golang.org/x/net/publicsuffix -# golang.org/x/sys v0.24.0 +# golang.org/x/sys v0.26.0 ## explicit; go 1.18 golang.org/x/sys/unix golang.org/x/sys/windows -# google.golang.org/protobuf v1.34.2 -## explicit; go 1.20 +# google.golang.org/protobuf v1.35.1 +## explicit; go 1.21 google.golang.org/protobuf/encoding/protodelim google.golang.org/protobuf/encoding/prototext google.golang.org/protobuf/encoding/protowire