mirror of
https://github.com/containers/skopeo.git
synced 2025-06-28 07:37:41 +00:00
fix(deps): update module github.com/containers/storage to v1.50.1
Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
This commit is contained in:
parent
ea0a627e64
commit
9563e3b84b
8
go.mod
8
go.mod
@ -6,7 +6,7 @@ require (
|
|||||||
github.com/containers/common v0.55.4
|
github.com/containers/common v0.55.4
|
||||||
github.com/containers/image/v5 v5.27.1-0.20230904180722-58d5eb632da1
|
github.com/containers/image/v5 v5.27.1-0.20230904180722-58d5eb632da1
|
||||||
github.com/containers/ocicrypt v1.1.8
|
github.com/containers/ocicrypt v1.1.8
|
||||||
github.com/containers/storage v1.49.0
|
github.com/containers/storage v1.50.1
|
||||||
github.com/docker/distribution v2.8.2+incompatible
|
github.com/docker/distribution v2.8.2+incompatible
|
||||||
github.com/opencontainers/go-digest v1.0.0
|
github.com/opencontainers/go-digest v1.0.0
|
||||||
github.com/opencontainers/image-spec v1.1.0-rc4
|
github.com/opencontainers/image-spec v1.1.0-rc4
|
||||||
@ -25,7 +25,7 @@ require (
|
|||||||
dario.cat/mergo v1.0.0 // indirect
|
dario.cat/mergo v1.0.0 // indirect
|
||||||
github.com/BurntSushi/toml v1.3.2 // indirect
|
github.com/BurntSushi/toml v1.3.2 // indirect
|
||||||
github.com/Microsoft/go-winio v0.6.1 // indirect
|
github.com/Microsoft/go-winio v0.6.1 // indirect
|
||||||
github.com/Microsoft/hcsshim v0.10.0 // indirect
|
github.com/Microsoft/hcsshim v0.12.0-rc.0 // indirect
|
||||||
github.com/VividCortex/ewma v1.2.0 // indirect
|
github.com/VividCortex/ewma v1.2.0 // indirect
|
||||||
github.com/acarl005/stripansi v0.0.0-20180116102854-5a71ef0e047d // indirect
|
github.com/acarl005/stripansi v0.0.0-20180116102854-5a71ef0e047d // indirect
|
||||||
github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 // indirect
|
github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 // indirect
|
||||||
@ -35,7 +35,7 @@ require (
|
|||||||
github.com/containers/libtrust v0.0.0-20230121012942-c1716e8a8d01 // indirect
|
github.com/containers/libtrust v0.0.0-20230121012942-c1716e8a8d01 // indirect
|
||||||
github.com/coreos/go-oidc/v3 v3.6.0 // indirect
|
github.com/coreos/go-oidc/v3 v3.6.0 // indirect
|
||||||
github.com/cyberphone/json-canonicalization v0.0.0-20230710064741-aa7fe85c7dbd // indirect
|
github.com/cyberphone/json-canonicalization v0.0.0-20230710064741-aa7fe85c7dbd // indirect
|
||||||
github.com/cyphar/filepath-securejoin v0.2.3 // indirect
|
github.com/cyphar/filepath-securejoin v0.2.4 // indirect
|
||||||
github.com/davecgh/go-spew v1.1.1 // indirect
|
github.com/davecgh/go-spew v1.1.1 // indirect
|
||||||
github.com/docker/docker v24.0.5+incompatible // indirect
|
github.com/docker/docker v24.0.5+incompatible // indirect
|
||||||
github.com/docker/docker-credential-helpers v0.8.0 // indirect
|
github.com/docker/docker-credential-helpers v0.8.0 // indirect
|
||||||
@ -126,7 +126,7 @@ require (
|
|||||||
golang.org/x/tools v0.13.0 // indirect
|
golang.org/x/tools v0.13.0 // indirect
|
||||||
google.golang.org/appengine v1.6.7 // indirect
|
google.golang.org/appengine v1.6.7 // indirect
|
||||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98 // indirect
|
google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98 // indirect
|
||||||
google.golang.org/grpc v1.56.2 // indirect
|
google.golang.org/grpc v1.57.0 // indirect
|
||||||
google.golang.org/protobuf v1.31.0 // indirect
|
google.golang.org/protobuf v1.31.0 // indirect
|
||||||
gopkg.in/go-jose/go-jose.v2 v2.6.1 // indirect
|
gopkg.in/go-jose/go-jose.v2 v2.6.1 // indirect
|
||||||
gopkg.in/yaml.v2 v2.4.0 // indirect
|
gopkg.in/yaml.v2 v2.4.0 // indirect
|
||||||
|
16
go.sum
16
go.sum
@ -8,8 +8,8 @@ github.com/BurntSushi/toml v1.3.2 h1:o7IhLm0Msx3BaB+n3Ag7L8EVlByGnpq14C4YWiu/gL8
|
|||||||
github.com/BurntSushi/toml v1.3.2/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ=
|
github.com/BurntSushi/toml v1.3.2/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ=
|
||||||
github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migciow=
|
github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migciow=
|
||||||
github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM=
|
github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM=
|
||||||
github.com/Microsoft/hcsshim v0.10.0 h1:PbvoxdUGgXxyirmN5Oncp3POLkxEG5LbWCEBfWmHTGA=
|
github.com/Microsoft/hcsshim v0.12.0-rc.0 h1:wX/F5huJxH9APBkhKSEAqaiZsuBvbbDnyBROZAqsSaY=
|
||||||
github.com/Microsoft/hcsshim v0.10.0/go.mod h1:3j1trOamcUdi86J5Tr5+1BpqMjSv/QeRWkX2whBF6dY=
|
github.com/Microsoft/hcsshim v0.12.0-rc.0/go.mod h1:rvOnw3YlfoNnEp45wReUngvsXbwRW+AFQ10GVjG1kMU=
|
||||||
github.com/PuerkitoBio/purell v1.1.1/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0=
|
github.com/PuerkitoBio/purell v1.1.1/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0=
|
||||||
github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE=
|
github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE=
|
||||||
github.com/VividCortex/ewma v1.2.0 h1:f58SaIzcDXrSy3kWaHNvuJgJ3Nmz59Zji6XoJR/q1ow=
|
github.com/VividCortex/ewma v1.2.0 h1:f58SaIzcDXrSy3kWaHNvuJgJ3Nmz59Zji6XoJR/q1ow=
|
||||||
@ -38,16 +38,16 @@ github.com/containers/libtrust v0.0.0-20230121012942-c1716e8a8d01 h1:Qzk5C6cYgle
|
|||||||
github.com/containers/libtrust v0.0.0-20230121012942-c1716e8a8d01/go.mod h1:9rfv8iPl1ZP7aqh9YA68wnZv2NUDbXdcdPHVz0pFbPY=
|
github.com/containers/libtrust v0.0.0-20230121012942-c1716e8a8d01/go.mod h1:9rfv8iPl1ZP7aqh9YA68wnZv2NUDbXdcdPHVz0pFbPY=
|
||||||
github.com/containers/ocicrypt v1.1.8 h1:saSBF0/8DyPUjzcxMVzL2OBUWCkvRvqIm75pu0ADSZk=
|
github.com/containers/ocicrypt v1.1.8 h1:saSBF0/8DyPUjzcxMVzL2OBUWCkvRvqIm75pu0ADSZk=
|
||||||
github.com/containers/ocicrypt v1.1.8/go.mod h1:jM362hyBtbwLMWzXQZTlkjKGAQf/BN/LFMtH0FIRt34=
|
github.com/containers/ocicrypt v1.1.8/go.mod h1:jM362hyBtbwLMWzXQZTlkjKGAQf/BN/LFMtH0FIRt34=
|
||||||
github.com/containers/storage v1.49.0 h1:7Vqj8OKlwlcWZ4U61+eS2bNwyIG/qXQo/UZVW5kXn74=
|
github.com/containers/storage v1.50.1 h1:1r5k4N2BNa94WZZFw116tozj08zJg7SxihQZ3iccyCs=
|
||||||
github.com/containers/storage v1.49.0/go.mod h1:fCvGMWQ0BOvlReQf9DqRAcl73ofTfRXE8l6ifnI4a3g=
|
github.com/containers/storage v1.50.1/go.mod h1:dpspZsUrcKD8SpTofvKWhwPDHD0MkO4Q7VE+oYdWkiA=
|
||||||
github.com/coreos/go-oidc/v3 v3.6.0 h1:AKVxfYw1Gmkn/w96z0DbT/B/xFnzTd3MkZvWLjF4n/o=
|
github.com/coreos/go-oidc/v3 v3.6.0 h1:AKVxfYw1Gmkn/w96z0DbT/B/xFnzTd3MkZvWLjF4n/o=
|
||||||
github.com/coreos/go-oidc/v3 v3.6.0/go.mod h1:ZpHUsHBucTUj6WOkrP4E20UPynbLZzhTQ1XKCXkxyPc=
|
github.com/coreos/go-oidc/v3 v3.6.0/go.mod h1:ZpHUsHBucTUj6WOkrP4E20UPynbLZzhTQ1XKCXkxyPc=
|
||||||
github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
|
github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
|
||||||
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
|
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
|
||||||
github.com/cyberphone/json-canonicalization v0.0.0-20230710064741-aa7fe85c7dbd h1:0av0vtcjA8Hqv5gyWj79CLCFVwOOyBNWPjrfUWceMNg=
|
github.com/cyberphone/json-canonicalization v0.0.0-20230710064741-aa7fe85c7dbd h1:0av0vtcjA8Hqv5gyWj79CLCFVwOOyBNWPjrfUWceMNg=
|
||||||
github.com/cyberphone/json-canonicalization v0.0.0-20230710064741-aa7fe85c7dbd/go.mod h1:uzvlm1mxhHkdfqitSA92i7Se+S9ksOn3a3qmv/kyOCw=
|
github.com/cyberphone/json-canonicalization v0.0.0-20230710064741-aa7fe85c7dbd/go.mod h1:uzvlm1mxhHkdfqitSA92i7Se+S9ksOn3a3qmv/kyOCw=
|
||||||
github.com/cyphar/filepath-securejoin v0.2.3 h1:YX6ebbZCZP7VkM3scTTokDgBL2TY741X51MTk3ycuNI=
|
github.com/cyphar/filepath-securejoin v0.2.4 h1:Ugdm7cg7i6ZK6x3xDF1oEu1nfkyfH53EtKeQYTC3kyg=
|
||||||
github.com/cyphar/filepath-securejoin v0.2.3/go.mod h1:aPGpWjXOXUn2NCNjFvBE6aRxGGx79pTxQpKOJNYHHl4=
|
github.com/cyphar/filepath-securejoin v0.2.4/go.mod h1:aPGpWjXOXUn2NCNjFvBE6aRxGGx79pTxQpKOJNYHHl4=
|
||||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
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/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
@ -515,8 +515,8 @@ google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyac
|
|||||||
google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY=
|
google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY=
|
||||||
google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk=
|
google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk=
|
||||||
google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc=
|
google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc=
|
||||||
google.golang.org/grpc v1.56.2 h1:fVRFRnXvU+x6C4IlHZewvJOVHoOv1TUuQyoRsYnB4bI=
|
google.golang.org/grpc v1.57.0 h1:kfzNeI/klCGD2YPMUlaGNT3pxvYfga7smW3Vth8Zsiw=
|
||||||
google.golang.org/grpc v1.56.2/go.mod h1:I9bI3vqKfayGqPUAwGdOSu7kt6oIJLixfffKrpXqQ9s=
|
google.golang.org/grpc v1.57.0/go.mod h1:Sd+9RMTACXwmub0zcNY2c4arhtrbBYD1AUHI/dt16Mo=
|
||||||
google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
|
google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
|
||||||
google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0=
|
google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0=
|
||||||
google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM=
|
google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM=
|
||||||
|
24
vendor/github.com/Microsoft/hcsshim/.golangci.yml
generated
vendored
24
vendor/github.com/Microsoft/hcsshim/.golangci.yml
generated
vendored
@ -21,17 +21,31 @@ linters:
|
|||||||
# - unused
|
# - unused
|
||||||
|
|
||||||
- gofmt # whether code was gofmt-ed
|
- gofmt # whether code was gofmt-ed
|
||||||
|
- govet # enabled by default, but just to be sure
|
||||||
- nolintlint # ill-formed or insufficient nolint directives
|
- nolintlint # ill-formed or insufficient nolint directives
|
||||||
- stylecheck # golint replacement
|
- stylecheck # golint replacement
|
||||||
- thelper # test helpers without t.Helper()
|
- thelper # test helpers without t.Helper()
|
||||||
|
|
||||||
linters-settings:
|
linters-settings:
|
||||||
|
govet:
|
||||||
|
enable-all: true
|
||||||
|
disable:
|
||||||
|
# struct order is often for Win32 compat
|
||||||
|
# also, ignore pointer bytes/GC issues for now until performance becomes an issue
|
||||||
|
- fieldalignment
|
||||||
|
check-shadowing: true
|
||||||
|
|
||||||
stylecheck:
|
stylecheck:
|
||||||
# https://staticcheck.io/docs/checks
|
# https://staticcheck.io/docs/checks
|
||||||
checks: ["all"]
|
checks: ["all"]
|
||||||
|
|
||||||
issues:
|
issues:
|
||||||
exclude-rules:
|
exclude-rules:
|
||||||
|
# err is very often shadowed in nested scopes
|
||||||
|
- linters:
|
||||||
|
- govet
|
||||||
|
text: '^shadow: declaration of "err" shadows declaration'
|
||||||
|
|
||||||
# path is relative to module root, which is ./test/
|
# path is relative to module root, which is ./test/
|
||||||
- path: cri-containerd
|
- path: cri-containerd
|
||||||
linters:
|
linters:
|
||||||
@ -141,3 +155,13 @@ issues:
|
|||||||
linters:
|
linters:
|
||||||
- staticcheck
|
- staticcheck
|
||||||
text: "^SA1019: .*(ncproxygrpc|nodenetsvc)[/]?v0"
|
text: "^SA1019: .*(ncproxygrpc|nodenetsvc)[/]?v0"
|
||||||
|
|
||||||
|
- path: internal\\tools\\networkagent
|
||||||
|
linters:
|
||||||
|
- staticcheck
|
||||||
|
text: "^SA1019: .*nodenetsvc[/]?v0"
|
||||||
|
|
||||||
|
- path: internal\\vhdx\\info
|
||||||
|
linters:
|
||||||
|
- stylecheck
|
||||||
|
Text: "ST1003:"
|
||||||
|
4
vendor/github.com/Microsoft/hcsshim/computestorage/helpers.go
generated
vendored
4
vendor/github.com/Microsoft/hcsshim/computestorage/helpers.go
generated
vendored
@ -16,7 +16,9 @@ import (
|
|||||||
"github.com/Microsoft/hcsshim/internal/security"
|
"github.com/Microsoft/hcsshim/internal/security"
|
||||||
)
|
)
|
||||||
|
|
||||||
const defaultVHDXBlockSizeInMB = 1
|
const (
|
||||||
|
defaultVHDXBlockSizeInMB = 1
|
||||||
|
)
|
||||||
|
|
||||||
// SetupContainerBaseLayer is a helper to setup a containers scratch. It
|
// SetupContainerBaseLayer is a helper to setup a containers scratch. It
|
||||||
// will create and format the vhdx's inside and the size is configurable with the sizeInGB
|
// will create and format the vhdx's inside and the size is configurable with the sizeInGB
|
||||||
|
2
vendor/github.com/Microsoft/hcsshim/computestorage/storage.go
generated
vendored
2
vendor/github.com/Microsoft/hcsshim/computestorage/storage.go
generated
vendored
@ -11,7 +11,7 @@ import (
|
|||||||
|
|
||||||
//sys hcsImportLayer(layerPath string, sourceFolderPath string, layerData string) (hr error) = computestorage.HcsImportLayer?
|
//sys hcsImportLayer(layerPath string, sourceFolderPath string, layerData string) (hr error) = computestorage.HcsImportLayer?
|
||||||
//sys hcsExportLayer(layerPath string, exportFolderPath string, layerData string, options string) (hr error) = computestorage.HcsExportLayer?
|
//sys hcsExportLayer(layerPath string, exportFolderPath string, layerData string, options string) (hr error) = computestorage.HcsExportLayer?
|
||||||
//sys hcsDestroyLayer(layerPath string) (hr error) = computestorage.HcsDestoryLayer?
|
//sys hcsDestroyLayer(layerPath string) (hr error) = computestorage.HcsDestroyLayer?
|
||||||
//sys hcsSetupBaseOSLayer(layerPath string, handle windows.Handle, options string) (hr error) = computestorage.HcsSetupBaseOSLayer?
|
//sys hcsSetupBaseOSLayer(layerPath string, handle windows.Handle, options string) (hr error) = computestorage.HcsSetupBaseOSLayer?
|
||||||
//sys hcsInitializeWritableLayer(writableLayerPath string, layerData string, options string) (hr error) = computestorage.HcsInitializeWritableLayer?
|
//sys hcsInitializeWritableLayer(writableLayerPath string, layerData string, options string) (hr error) = computestorage.HcsInitializeWritableLayer?
|
||||||
//sys hcsAttachLayerStorageFilter(layerPath string, layerData string) (hr error) = computestorage.HcsAttachLayerStorageFilter?
|
//sys hcsAttachLayerStorageFilter(layerPath string, layerData string) (hr error) = computestorage.HcsAttachLayerStorageFilter?
|
||||||
|
6
vendor/github.com/Microsoft/hcsshim/computestorage/zsyscall_windows.go
generated
vendored
6
vendor/github.com/Microsoft/hcsshim/computestorage/zsyscall_windows.go
generated
vendored
@ -43,7 +43,7 @@ var (
|
|||||||
modcomputestorage = windows.NewLazySystemDLL("computestorage.dll")
|
modcomputestorage = windows.NewLazySystemDLL("computestorage.dll")
|
||||||
|
|
||||||
procHcsAttachLayerStorageFilter = modcomputestorage.NewProc("HcsAttachLayerStorageFilter")
|
procHcsAttachLayerStorageFilter = modcomputestorage.NewProc("HcsAttachLayerStorageFilter")
|
||||||
procHcsDestoryLayer = modcomputestorage.NewProc("HcsDestoryLayer")
|
procHcsDestroyLayer = modcomputestorage.NewProc("HcsDestroyLayer")
|
||||||
procHcsDetachLayerStorageFilter = modcomputestorage.NewProc("HcsDetachLayerStorageFilter")
|
procHcsDetachLayerStorageFilter = modcomputestorage.NewProc("HcsDetachLayerStorageFilter")
|
||||||
procHcsExportLayer = modcomputestorage.NewProc("HcsExportLayer")
|
procHcsExportLayer = modcomputestorage.NewProc("HcsExportLayer")
|
||||||
procHcsFormatWritableLayerVhd = modcomputestorage.NewProc("HcsFormatWritableLayerVhd")
|
procHcsFormatWritableLayerVhd = modcomputestorage.NewProc("HcsFormatWritableLayerVhd")
|
||||||
@ -93,11 +93,11 @@ func hcsDestroyLayer(layerPath string) (hr error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func _hcsDestroyLayer(layerPath *uint16) (hr error) {
|
func _hcsDestroyLayer(layerPath *uint16) (hr error) {
|
||||||
hr = procHcsDestoryLayer.Find()
|
hr = procHcsDestroyLayer.Find()
|
||||||
if hr != nil {
|
if hr != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
r0, _, _ := syscall.Syscall(procHcsDestoryLayer.Addr(), 1, uintptr(unsafe.Pointer(layerPath)), 0, 0)
|
r0, _, _ := syscall.Syscall(procHcsDestroyLayer.Addr(), 1, uintptr(unsafe.Pointer(layerPath)), 0, 0)
|
||||||
if int32(r0) < 0 {
|
if int32(r0) < 0 {
|
||||||
if r0&0x1fff0000 == 0x00070000 {
|
if r0&0x1fff0000 == 0x00070000 {
|
||||||
r0 &= 0xffff
|
r0 &= 0xffff
|
||||||
|
2
vendor/github.com/Microsoft/hcsshim/internal/hcs/schema2/isolation_settings.go
generated
vendored
2
vendor/github.com/Microsoft/hcsshim/internal/hcs/schema2/isolation_settings.go
generated
vendored
@ -17,5 +17,5 @@ type IsolationSettings struct {
|
|||||||
DebugPort int64 `json:"DebugPort,omitempty"`
|
DebugPort int64 `json:"DebugPort,omitempty"`
|
||||||
// Optional data passed by host on isolated virtual machine start
|
// Optional data passed by host on isolated virtual machine start
|
||||||
LaunchData string `json:"LaunchData,omitempty"`
|
LaunchData string `json:"LaunchData,omitempty"`
|
||||||
HclEnabled bool `json:"HclEnabled,omitempty"`
|
HclEnabled *bool `json:"HclEnabled,omitempty"`
|
||||||
}
|
}
|
||||||
|
2
vendor/github.com/Microsoft/hcsshim/internal/jobobject/jobobject.go
generated
vendored
2
vendor/github.com/Microsoft/hcsshim/internal/jobobject/jobobject.go
generated
vendored
@ -167,7 +167,7 @@ func Create(ctx context.Context, options *Options) (_ *JobObject, err error) {
|
|||||||
//
|
//
|
||||||
// Returns a JobObject structure and an error if there is one.
|
// Returns a JobObject structure and an error if there is one.
|
||||||
func Open(ctx context.Context, options *Options) (_ *JobObject, err error) {
|
func Open(ctx context.Context, options *Options) (_ *JobObject, err error) {
|
||||||
if options == nil || (options != nil && options.Name == "") {
|
if options == nil || options.Name == "" {
|
||||||
return nil, errors.New("no job object name specified to open")
|
return nil, errors.New("no job object name specified to open")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
29
vendor/github.com/Microsoft/hcsshim/internal/log/format.go
generated
vendored
29
vendor/github.com/Microsoft/hcsshim/internal/log/format.go
generated
vendored
@ -4,11 +4,13 @@ import (
|
|||||||
"bytes"
|
"bytes"
|
||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
"fmt"
|
||||||
"net"
|
"net"
|
||||||
"reflect"
|
"reflect"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/containerd/containerd/log"
|
"github.com/containerd/containerd/log"
|
||||||
|
"github.com/sirupsen/logrus"
|
||||||
"google.golang.org/protobuf/encoding/protojson"
|
"google.golang.org/protobuf/encoding/protojson"
|
||||||
"google.golang.org/protobuf/proto"
|
"google.golang.org/protobuf/proto"
|
||||||
)
|
)
|
||||||
@ -60,22 +62,35 @@ func formatAddr(a net.Addr) string {
|
|||||||
func Format(ctx context.Context, v interface{}) string {
|
func Format(ctx context.Context, v interface{}) string {
|
||||||
b, err := encode(v)
|
b, err := encode(v)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
G(ctx).WithError(err).Warning("could not format value")
|
// logging errors aren't really warning worthy, and can potentially spam a lot of logs out
|
||||||
|
G(ctx).WithFields(logrus.Fields{
|
||||||
|
logrus.ErrorKey: err,
|
||||||
|
"type": fmt.Sprintf("%T", v),
|
||||||
|
}).Debug("could not format value")
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
return string(b)
|
return string(b)
|
||||||
}
|
}
|
||||||
|
|
||||||
func encode(v interface{}) ([]byte, error) {
|
func encode(v interface{}) (_ []byte, err error) {
|
||||||
if m, ok := v.(proto.Message); ok {
|
if m, ok := v.(proto.Message); ok {
|
||||||
// use canonical JSON encoding for protobufs (instead of [encoding/json])
|
// use canonical JSON encoding for protobufs (instead of [encoding/json])
|
||||||
// https://protobuf.dev/programming-guides/proto3/#json
|
// https://protobuf.dev/programming-guides/proto3/#json
|
||||||
return protojson.MarshalOptions{
|
var b []byte
|
||||||
|
b, err = protojson.MarshalOptions{
|
||||||
AllowPartial: true,
|
AllowPartial: true,
|
||||||
// protobuf defaults to camel case for JSON encoding; use proto field name instead (snake case)
|
// protobuf defaults to camel case for JSON encoding; use proto field name instead (snake case)
|
||||||
UseProtoNames: true,
|
UseProtoNames: true,
|
||||||
}.Marshal(m)
|
}.Marshal(m)
|
||||||
|
if err == nil {
|
||||||
|
// the protojson marshaller tries to unmarshal anypb.Any fields, which can
|
||||||
|
// fail for types encoded with "github.com/containerd/typeurl/v2"
|
||||||
|
// we can try creating a dedicated protoregistry.MessageTypeResolver that uses typeurl, but, its
|
||||||
|
// more robust to fall back on json marshalling for errors in general
|
||||||
|
return b, nil
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
buf := &bytes.Buffer{}
|
buf := &bytes.Buffer{}
|
||||||
@ -83,8 +98,12 @@ func encode(v interface{}) ([]byte, error) {
|
|||||||
enc.SetEscapeHTML(false)
|
enc.SetEscapeHTML(false)
|
||||||
enc.SetIndent("", "")
|
enc.SetIndent("", "")
|
||||||
|
|
||||||
if err := enc.Encode(v); err != nil {
|
if jErr := enc.Encode(v); jErr != nil {
|
||||||
return nil, err
|
if err != nil {
|
||||||
|
// TODO (go1.20): use multierror via fmt.Errorf("...: %w; ...: %w", ...)
|
||||||
|
return nil, fmt.Errorf("protojson encoding: %v; json encoding: %w", err, jErr)
|
||||||
|
}
|
||||||
|
return nil, fmt.Errorf("json encoding: %w", jErr)
|
||||||
}
|
}
|
||||||
|
|
||||||
// encoder.Encode appends a newline to the end
|
// encoder.Encode appends a newline to the end
|
||||||
|
6
vendor/github.com/Microsoft/hcsshim/internal/log/scrub.go
generated
vendored
6
vendor/github.com/Microsoft/hcsshim/internal/log/scrub.go
generated
vendored
@ -89,11 +89,11 @@ func scrubBridgeCreate(m genMap) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func scrubLinuxHostedSystem(m genMap) error {
|
func scrubLinuxHostedSystem(m genMap) error {
|
||||||
if m, ok := index(m, "OciSpecification"); ok {
|
if m, ok := index(m, "OciSpecification"); ok { //nolint:govet // shadow
|
||||||
if _, ok := m["annotations"]; ok {
|
if _, ok := m["annotations"]; ok {
|
||||||
m["annotations"] = map[string]string{_scrubbedReplacement: _scrubbedReplacement}
|
m["annotations"] = map[string]string{_scrubbedReplacement: _scrubbedReplacement}
|
||||||
}
|
}
|
||||||
if m, ok := index(m, "process"); ok {
|
if m, ok := index(m, "process"); ok { //nolint:govet // shadow
|
||||||
if _, ok := m["env"]; ok {
|
if _, ok := m["env"]; ok {
|
||||||
m["env"] = []string{_scrubbedReplacement}
|
m["env"] = []string{_scrubbedReplacement}
|
||||||
return nil
|
return nil
|
||||||
@ -113,7 +113,7 @@ func scrubExecuteProcess(m genMap) error {
|
|||||||
if !isRequestBase(m) {
|
if !isRequestBase(m) {
|
||||||
return ErrUnknownType
|
return ErrUnknownType
|
||||||
}
|
}
|
||||||
if m, ok := index(m, "Settings"); ok {
|
if m, ok := index(m, "Settings"); ok { //nolint:govet // shadow
|
||||||
if ss, ok := m["ProcessParameters"]; ok {
|
if ss, ok := m["ProcessParameters"]; ok {
|
||||||
// ProcessParameters is a json encoded struct passed as a regular sting field
|
// ProcessParameters is a json encoded struct passed as a regular sting field
|
||||||
s, ok := ss.(string)
|
s, ok := ss.(string)
|
||||||
|
8
vendor/github.com/Microsoft/hcsshim/internal/safefile/safeopen.go
generated
vendored
8
vendor/github.com/Microsoft/hcsshim/internal/safefile/safeopen.go
generated
vendored
@ -276,7 +276,7 @@ func RemoveAllRelative(path string, root *os.File) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// It is necessary to use os.Open as Readdirnames does not work with
|
// It is necessary to use os.Open as Readdirnames does not work with
|
||||||
// OpenRelative. This is safe because the above lstatrelative fails
|
// OpenRelative. This is safe because the above LstatRelative fails
|
||||||
// if the target is outside the root, and we know this is not a
|
// if the target is outside the root, and we know this is not a
|
||||||
// symlink from the above FILE_ATTRIBUTE_REPARSE_POINT check.
|
// symlink from the above FILE_ATTRIBUTE_REPARSE_POINT check.
|
||||||
fd, err := os.Open(filepath.Join(root.Name(), path))
|
fd, err := os.Open(filepath.Join(root.Name(), path))
|
||||||
@ -293,12 +293,12 @@ func RemoveAllRelative(path string, root *os.File) error {
|
|||||||
for {
|
for {
|
||||||
names, err1 := fd.Readdirnames(100)
|
names, err1 := fd.Readdirnames(100)
|
||||||
for _, name := range names {
|
for _, name := range names {
|
||||||
err1 := RemoveAllRelative(path+string(os.PathSeparator)+name, root)
|
if err2 := RemoveAllRelative(path+string(os.PathSeparator)+name, root); err == nil {
|
||||||
if err == nil {
|
err = err2
|
||||||
err = err1
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if err1 == io.EOF {
|
if err1 == io.EOF {
|
||||||
|
// Readdirnames has no more files to return
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
// If Readdirnames returned an error, use it.
|
// If Readdirnames returned an error, use it.
|
||||||
|
4
vendor/github.com/Microsoft/hcsshim/internal/wclayer/baselayerreader.go
generated
vendored
4
vendor/github.com/Microsoft/hcsshim/internal/wclayer/baselayerreader.go
generated
vendored
@ -72,8 +72,8 @@ func (r *baseLayerReader) walkUntilCancelled() error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
utilityVMAbsPath := filepath.Join(r.root, utilityVMPath)
|
utilityVMAbsPath := filepath.Join(r.root, UtilityVMPath)
|
||||||
utilityVMFilesAbsPath := filepath.Join(r.root, utilityVMFilesPath)
|
utilityVMFilesAbsPath := filepath.Join(r.root, UtilityVMFilesPath)
|
||||||
|
|
||||||
// Ignore a UtilityVM without Files, that's not _really_ a UtiltyVM
|
// Ignore a UtilityVM without Files, that's not _really_ a UtiltyVM
|
||||||
if _, err = os.Lstat(utilityVMFilesAbsPath); err != nil {
|
if _, err = os.Lstat(utilityVMFilesAbsPath); err != nil {
|
||||||
|
13
vendor/github.com/Microsoft/hcsshim/internal/wclayer/converttobaselayer.go
generated
vendored
13
vendor/github.com/Microsoft/hcsshim/internal/wclayer/converttobaselayer.go
generated
vendored
@ -5,7 +5,6 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"syscall"
|
|
||||||
|
|
||||||
"github.com/Microsoft/hcsshim/internal/hcserror"
|
"github.com/Microsoft/hcsshim/internal/hcserror"
|
||||||
"github.com/Microsoft/hcsshim/internal/longpath"
|
"github.com/Microsoft/hcsshim/internal/longpath"
|
||||||
@ -37,7 +36,7 @@ func ensureHive(path string, root *os.File) (err error) {
|
|||||||
return fmt.Errorf("getting path: %w", err)
|
return fmt.Errorf("getting path: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
var key syscall.Handle
|
var key winapi.ORHKey
|
||||||
err = winapi.ORCreateHive(&key)
|
err = winapi.ORCreateHive(&key)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("creating hive: %w", err)
|
return fmt.Errorf("creating hive: %w", err)
|
||||||
@ -72,7 +71,7 @@ func ensureBaseLayer(root *os.File) (hasUtilityVM bool, err error) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
stat, err := safefile.LstatRelative(utilityVMFilesPath, root)
|
stat, err := safefile.LstatRelative(UtilityVMFilesPath, root)
|
||||||
|
|
||||||
if os.IsNotExist(err) {
|
if os.IsNotExist(err) {
|
||||||
return false, nil
|
return false, nil
|
||||||
@ -83,7 +82,7 @@ func ensureBaseLayer(root *os.File) (hasUtilityVM bool, err error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if !stat.Mode().IsDir() {
|
if !stat.Mode().IsDir() {
|
||||||
fullPath := filepath.Join(root.Name(), utilityVMFilesPath)
|
fullPath := filepath.Join(root.Name(), UtilityVMFilesPath)
|
||||||
return false, errors.Errorf("%s has unexpected file mode %s", fullPath, stat.Mode().String())
|
return false, errors.Errorf("%s has unexpected file mode %s", fullPath, stat.Mode().String())
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -92,7 +91,7 @@ func ensureBaseLayer(root *os.File) (hasUtilityVM bool, err error) {
|
|||||||
// Just check that this exists as a regular file. If it exists but is not a valid registry hive,
|
// Just check that this exists as a regular file. If it exists but is not a valid registry hive,
|
||||||
// ProcessUtilityVMImage will complain:
|
// ProcessUtilityVMImage will complain:
|
||||||
// "The registry could not read in, or write out, or flush, one of the files that contain the system's image of the registry."
|
// "The registry could not read in, or write out, or flush, one of the files that contain the system's image of the registry."
|
||||||
bcdPath := filepath.Join(utilityVMFilesPath, bcdRelativePath)
|
bcdPath := filepath.Join(UtilityVMFilesPath, bcdRelativePath)
|
||||||
|
|
||||||
stat, err = safefile.LstatRelative(bcdPath, root)
|
stat, err = safefile.LstatRelative(bcdPath, root)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -122,12 +121,12 @@ func convertToBaseLayer(ctx context.Context, root *os.File) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
err = safefile.EnsureNotReparsePointRelative(utilityVMPath, root)
|
err = safefile.EnsureNotReparsePointRelative(UtilityVMPath, root)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
utilityVMPath := filepath.Join(root.Name(), utilityVMPath)
|
utilityVMPath := filepath.Join(root.Name(), UtilityVMPath)
|
||||||
return ProcessUtilityVMImage(ctx, utilityVMPath)
|
return ProcessUtilityVMImage(ctx, utilityVMPath)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
39
vendor/github.com/Microsoft/hcsshim/internal/wclayer/legacy.go
generated
vendored
39
vendor/github.com/Microsoft/hcsshim/internal/wclayer/legacy.go
generated
vendored
@ -29,10 +29,19 @@ var mutatedUtilityVMFiles = map[string]bool{
|
|||||||
}
|
}
|
||||||
|
|
||||||
const (
|
const (
|
||||||
filesPath = `Files`
|
filesPath = `Files`
|
||||||
hivesPath = `Hives`
|
HivesPath = `Hives`
|
||||||
utilityVMPath = `UtilityVM`
|
UtilityVMPath = `UtilityVM`
|
||||||
utilityVMFilesPath = `UtilityVM\Files`
|
UtilityVMFilesPath = `UtilityVM\Files`
|
||||||
|
RegFilesPath = `Files\Windows\System32\config`
|
||||||
|
BcdFilePath = `UtilityVM\Files\EFI\Microsoft\Boot\BCD`
|
||||||
|
BootMgrFilePath = `UtilityVM\Files\EFI\Microsoft\Boot\bootmgfw.efi`
|
||||||
|
ContainerBaseVhd = `blank-base.vhdx`
|
||||||
|
ContainerScratchVhd = `blank.vhdx`
|
||||||
|
UtilityVMBaseVhd = `SystemTemplateBase.vhdx`
|
||||||
|
UtilityVMScratchVhd = `SystemTemplate.vhdx`
|
||||||
|
LayoutFileName = `layout`
|
||||||
|
UvmBuildFileName = `uvmbuildversion`
|
||||||
)
|
)
|
||||||
|
|
||||||
func openFileOrDir(path string, mode uint32, createDisposition uint32) (file *os.File, err error) {
|
func openFileOrDir(path string, mode uint32, createDisposition uint32) (file *os.File, err error) {
|
||||||
@ -243,11 +252,11 @@ func (r *legacyLayerReader) Next() (path string, size int64, fileInfo *winio.Fil
|
|||||||
if !hasPathPrefix(path, filesPath) {
|
if !hasPathPrefix(path, filesPath) {
|
||||||
size = fe.fi.Size()
|
size = fe.fi.Size()
|
||||||
r.backupReader = winio.NewBackupFileReader(f, false)
|
r.backupReader = winio.NewBackupFileReader(f, false)
|
||||||
if path == hivesPath || path == filesPath {
|
if path == HivesPath || path == filesPath {
|
||||||
// The Hives directory has a non-deterministic file time because of the
|
// The Hives directory has a non-deterministic file time because of the
|
||||||
// nature of the import process. Use the times from System_Delta.
|
// nature of the import process. Use the times from System_Delta.
|
||||||
var g *os.File
|
var g *os.File
|
||||||
g, err = os.Open(filepath.Join(r.root, hivesPath, `System_Delta`))
|
g, err = os.Open(filepath.Join(r.root, HivesPath, `System_Delta`))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -409,7 +418,7 @@ func (w *legacyLayerWriter) CloseRoots() {
|
|||||||
|
|
||||||
func (w *legacyLayerWriter) initUtilityVM() error {
|
func (w *legacyLayerWriter) initUtilityVM() error {
|
||||||
if !w.HasUtilityVM {
|
if !w.HasUtilityVM {
|
||||||
err := safefile.MkdirRelative(utilityVMPath, w.destRoot)
|
err := safefile.MkdirRelative(UtilityVMPath, w.destRoot)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -417,7 +426,7 @@ func (w *legacyLayerWriter) initUtilityVM() error {
|
|||||||
// clone the utility VM from the parent layer into this layer. Use hard
|
// clone the utility VM from the parent layer into this layer. Use hard
|
||||||
// links to avoid unnecessary copying, since most of the files are
|
// links to avoid unnecessary copying, since most of the files are
|
||||||
// immutable.
|
// immutable.
|
||||||
err = cloneTree(w.parentRoots[0], w.destRoot, utilityVMFilesPath, mutatedUtilityVMFiles)
|
err = cloneTree(w.parentRoots[0], w.destRoot, UtilityVMFilesPath, mutatedUtilityVMFiles)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("cloning the parent utility VM image failed: %s", err)
|
return fmt.Errorf("cloning the parent utility VM image failed: %s", err)
|
||||||
}
|
}
|
||||||
@ -592,7 +601,7 @@ func (w *legacyLayerWriter) Add(name string, fileInfo *winio.FileBasicInfo) erro
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
if name == utilityVMPath {
|
if name == UtilityVMPath {
|
||||||
return w.initUtilityVM()
|
return w.initUtilityVM()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -601,11 +610,11 @@ func (w *legacyLayerWriter) Add(name string, fileInfo *winio.FileBasicInfo) erro
|
|||||||
}
|
}
|
||||||
|
|
||||||
name = filepath.Clean(name)
|
name = filepath.Clean(name)
|
||||||
if hasPathPrefix(name, utilityVMPath) {
|
if hasPathPrefix(name, UtilityVMPath) {
|
||||||
if !w.HasUtilityVM {
|
if !w.HasUtilityVM {
|
||||||
return errors.New("missing UtilityVM directory")
|
return errors.New("missing UtilityVM directory")
|
||||||
}
|
}
|
||||||
if !hasPathPrefix(name, utilityVMFilesPath) && name != utilityVMFilesPath {
|
if !hasPathPrefix(name, UtilityVMFilesPath) && name != UtilityVMFilesPath {
|
||||||
return errors.New("invalid UtilityVM layer")
|
return errors.New("invalid UtilityVM layer")
|
||||||
}
|
}
|
||||||
createDisposition := uint32(winapi.FILE_OPEN)
|
createDisposition := uint32(winapi.FILE_OPEN)
|
||||||
@ -699,7 +708,7 @@ func (w *legacyLayerWriter) Add(name string, fileInfo *winio.FileBasicInfo) erro
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
if hasPathPrefix(name, hivesPath) {
|
if hasPathPrefix(name, HivesPath) {
|
||||||
w.backupWriter = winio.NewBackupFileWriter(f, false)
|
w.backupWriter = winio.NewBackupFileWriter(f, false)
|
||||||
w.bufWriter.Reset(w.backupWriter)
|
w.bufWriter.Reset(w.backupWriter)
|
||||||
} else {
|
} else {
|
||||||
@ -731,14 +740,14 @@ func (w *legacyLayerWriter) AddLink(name string, target string) error {
|
|||||||
// Look for cross-layer hard link targets in the parent layers, since
|
// Look for cross-layer hard link targets in the parent layers, since
|
||||||
// nothing is in the destination path yet.
|
// nothing is in the destination path yet.
|
||||||
roots = w.parentRoots
|
roots = w.parentRoots
|
||||||
} else if hasPathPrefix(target, utilityVMFilesPath) {
|
} else if hasPathPrefix(target, UtilityVMFilesPath) {
|
||||||
// Since the utility VM is fully cloned into the destination path
|
// Since the utility VM is fully cloned into the destination path
|
||||||
// already, look for cross-layer hard link targets directly in the
|
// already, look for cross-layer hard link targets directly in the
|
||||||
// destination path.
|
// destination path.
|
||||||
roots = []*os.File{w.destRoot}
|
roots = []*os.File{w.destRoot}
|
||||||
}
|
}
|
||||||
|
|
||||||
if roots == nil || (!hasPathPrefix(name, filesPath) && !hasPathPrefix(name, utilityVMFilesPath)) {
|
if roots == nil || (!hasPathPrefix(name, filesPath) && !hasPathPrefix(name, UtilityVMFilesPath)) {
|
||||||
return errors.New("invalid hard link in layer")
|
return errors.New("invalid hard link in layer")
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -777,7 +786,7 @@ func (w *legacyLayerWriter) Remove(name string) error {
|
|||||||
name = filepath.Clean(name)
|
name = filepath.Clean(name)
|
||||||
if hasPathPrefix(name, filesPath) {
|
if hasPathPrefix(name, filesPath) {
|
||||||
w.Tombstones = append(w.Tombstones, name)
|
w.Tombstones = append(w.Tombstones, name)
|
||||||
} else if hasPathPrefix(name, utilityVMFilesPath) {
|
} else if hasPathPrefix(name, UtilityVMFilesPath) {
|
||||||
err := w.initUtilityVM()
|
err := w.initUtilityVM()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
37
vendor/github.com/Microsoft/hcsshim/internal/winapi/offlinereg.go
generated
vendored
Normal file
37
vendor/github.com/Microsoft/hcsshim/internal/winapi/offlinereg.go
generated
vendored
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
package winapi
|
||||||
|
|
||||||
|
// Offline registry management API
|
||||||
|
|
||||||
|
type ORHKey uintptr
|
||||||
|
|
||||||
|
type RegType uint32
|
||||||
|
|
||||||
|
const (
|
||||||
|
// Registry value types: https://docs.microsoft.com/en-us/windows/win32/sysinfo/registry-value-types
|
||||||
|
REG_TYPE_NONE RegType = 0
|
||||||
|
REG_TYPE_SZ RegType = 1
|
||||||
|
REG_TYPE_EXPAND_SZ RegType = 2
|
||||||
|
REG_TYPE_BINARY RegType = 3
|
||||||
|
REG_TYPE_DWORD RegType = 4
|
||||||
|
REG_TYPE_DWORD_LITTLE_ENDIAN RegType = 4
|
||||||
|
REG_TYPE_DWORD_BIG_ENDIAN RegType = 5
|
||||||
|
REG_TYPE_LINK RegType = 6
|
||||||
|
REG_TYPE_MULTI_SZ RegType = 7
|
||||||
|
REG_TYPE_RESOURCE_LIST RegType = 8
|
||||||
|
REG_TYPE_FULL_RESOURCE_DESCRIPTOR RegType = 9
|
||||||
|
REG_TYPE_RESOURCE_REQUIREMENTS_LIST RegType = 10
|
||||||
|
REG_TYPE_QWORD RegType = 11
|
||||||
|
REG_TYPE_QWORD_LITTLE_ENDIAN RegType = 11
|
||||||
|
)
|
||||||
|
|
||||||
|
//sys ORCreateHive(key *ORHKey) (win32err error) = offreg.ORCreateHive
|
||||||
|
//sys ORMergeHives(hiveHandles []ORHKey, result *ORHKey) (win32err error) = offreg.ORMergeHives
|
||||||
|
//sys OROpenHive(hivePath string, result *ORHKey) (win32err error) = offreg.OROpenHive
|
||||||
|
//sys ORCloseHive(handle ORHKey) (win32err error) = offreg.ORCloseHive
|
||||||
|
//sys ORSaveHive(handle ORHKey, hivePath string, osMajorVersion uint32, osMinorVersion uint32) (win32err error) = offreg.ORSaveHive
|
||||||
|
//sys OROpenKey(handle ORHKey, subKey string, result *ORHKey) (win32err error) = offreg.OROpenKey
|
||||||
|
//sys ORCloseKey(handle ORHKey) (win32err error) = offreg.ORCloseKey
|
||||||
|
//sys ORCreateKey(handle ORHKey, subKey string, class uintptr, options uint32, securityDescriptor uintptr, result *ORHKey, disposition *uint32) (win32err error) = offreg.ORCreateKey
|
||||||
|
//sys ORDeleteKey(handle ORHKey, subKey string) (win32err error) = offreg.ORDeleteKey
|
||||||
|
//sys ORGetValue(handle ORHKey, subKey string, value string, valueType *uint32, data *byte, dataLen *uint32) (win32err error) = offreg.ORGetValue
|
||||||
|
//sys ORSetValue(handle ORHKey, valueName string, valueType uint32, data *byte, dataLen uint32) (win32err error) = offreg.ORSetValue
|
5
vendor/github.com/Microsoft/hcsshim/internal/winapi/ofreg.go
generated
vendored
5
vendor/github.com/Microsoft/hcsshim/internal/winapi/ofreg.go
generated
vendored
@ -1,5 +0,0 @@
|
|||||||
package winapi
|
|
||||||
|
|
||||||
//sys ORCreateHive(key *syscall.Handle) (regerrno error) = offreg.ORCreateHive
|
|
||||||
//sys ORSaveHive(key syscall.Handle, file string, OsMajorVersion uint32, OsMinorVersion uint32) (regerrno error) = offreg.ORSaveHive
|
|
||||||
//sys ORCloseHive(key syscall.Handle) (regerrno error) = offreg.ORCloseHive
|
|
159
vendor/github.com/Microsoft/hcsshim/internal/winapi/zsyscall_windows.go
generated
vendored
159
vendor/github.com/Microsoft/hcsshim/internal/winapi/zsyscall_windows.go
generated
vendored
@ -96,8 +96,16 @@ var (
|
|||||||
procNtSetInformationFile = modntdll.NewProc("NtSetInformationFile")
|
procNtSetInformationFile = modntdll.NewProc("NtSetInformationFile")
|
||||||
procRtlNtStatusToDosError = modntdll.NewProc("RtlNtStatusToDosError")
|
procRtlNtStatusToDosError = modntdll.NewProc("RtlNtStatusToDosError")
|
||||||
procORCloseHive = modoffreg.NewProc("ORCloseHive")
|
procORCloseHive = modoffreg.NewProc("ORCloseHive")
|
||||||
|
procORCloseKey = modoffreg.NewProc("ORCloseKey")
|
||||||
procORCreateHive = modoffreg.NewProc("ORCreateHive")
|
procORCreateHive = modoffreg.NewProc("ORCreateHive")
|
||||||
|
procORCreateKey = modoffreg.NewProc("ORCreateKey")
|
||||||
|
procORDeleteKey = modoffreg.NewProc("ORDeleteKey")
|
||||||
|
procORGetValue = modoffreg.NewProc("ORGetValue")
|
||||||
|
procORMergeHives = modoffreg.NewProc("ORMergeHives")
|
||||||
|
procOROpenHive = modoffreg.NewProc("OROpenHive")
|
||||||
|
procOROpenKey = modoffreg.NewProc("OROpenKey")
|
||||||
procORSaveHive = modoffreg.NewProc("ORSaveHive")
|
procORSaveHive = modoffreg.NewProc("ORSaveHive")
|
||||||
|
procORSetValue = modoffreg.NewProc("ORSetValue")
|
||||||
)
|
)
|
||||||
|
|
||||||
func LogonUser(username *uint16, domain *uint16, password *uint16, logonType uint32, logonProvider uint32, token *windows.Token) (err error) {
|
func LogonUser(username *uint16, domain *uint16, password *uint16, logonType uint32, logonProvider uint32, token *windows.Token) (err error) {
|
||||||
@ -622,35 +630,162 @@ func RtlNtStatusToDosError(status uint32) (winerr error) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func ORCloseHive(key syscall.Handle) (regerrno error) {
|
func ORCloseHive(handle ORHKey) (win32err error) {
|
||||||
r0, _, _ := syscall.Syscall(procORCloseHive.Addr(), 1, uintptr(key), 0, 0)
|
r0, _, _ := syscall.Syscall(procORCloseHive.Addr(), 1, uintptr(handle), 0, 0)
|
||||||
if r0 != 0 {
|
if r0 != 0 {
|
||||||
regerrno = syscall.Errno(r0)
|
win32err = syscall.Errno(r0)
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func ORCreateHive(key *syscall.Handle) (regerrno error) {
|
func ORCloseKey(handle ORHKey) (win32err error) {
|
||||||
|
r0, _, _ := syscall.Syscall(procORCloseKey.Addr(), 1, uintptr(handle), 0, 0)
|
||||||
|
if r0 != 0 {
|
||||||
|
win32err = syscall.Errno(r0)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
func ORCreateHive(key *ORHKey) (win32err error) {
|
||||||
r0, _, _ := syscall.Syscall(procORCreateHive.Addr(), 1, uintptr(unsafe.Pointer(key)), 0, 0)
|
r0, _, _ := syscall.Syscall(procORCreateHive.Addr(), 1, uintptr(unsafe.Pointer(key)), 0, 0)
|
||||||
if r0 != 0 {
|
if r0 != 0 {
|
||||||
regerrno = syscall.Errno(r0)
|
win32err = syscall.Errno(r0)
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func ORSaveHive(key syscall.Handle, file string, OsMajorVersion uint32, OsMinorVersion uint32) (regerrno error) {
|
func ORCreateKey(handle ORHKey, subKey string, class uintptr, options uint32, securityDescriptor uintptr, result *ORHKey, disposition *uint32) (win32err error) {
|
||||||
var _p0 *uint16
|
var _p0 *uint16
|
||||||
_p0, regerrno = syscall.UTF16PtrFromString(file)
|
_p0, win32err = syscall.UTF16PtrFromString(subKey)
|
||||||
if regerrno != nil {
|
if win32err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
return _ORSaveHive(key, _p0, OsMajorVersion, OsMinorVersion)
|
return _ORCreateKey(handle, _p0, class, options, securityDescriptor, result, disposition)
|
||||||
}
|
}
|
||||||
|
|
||||||
func _ORSaveHive(key syscall.Handle, file *uint16, OsMajorVersion uint32, OsMinorVersion uint32) (regerrno error) {
|
func _ORCreateKey(handle ORHKey, subKey *uint16, class uintptr, options uint32, securityDescriptor uintptr, result *ORHKey, disposition *uint32) (win32err error) {
|
||||||
r0, _, _ := syscall.Syscall6(procORSaveHive.Addr(), 4, uintptr(key), uintptr(unsafe.Pointer(file)), uintptr(OsMajorVersion), uintptr(OsMinorVersion), 0, 0)
|
r0, _, _ := syscall.Syscall9(procORCreateKey.Addr(), 7, uintptr(handle), uintptr(unsafe.Pointer(subKey)), uintptr(class), uintptr(options), uintptr(securityDescriptor), uintptr(unsafe.Pointer(result)), uintptr(unsafe.Pointer(disposition)), 0, 0)
|
||||||
if r0 != 0 {
|
if r0 != 0 {
|
||||||
regerrno = syscall.Errno(r0)
|
win32err = syscall.Errno(r0)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
func ORDeleteKey(handle ORHKey, subKey string) (win32err error) {
|
||||||
|
var _p0 *uint16
|
||||||
|
_p0, win32err = syscall.UTF16PtrFromString(subKey)
|
||||||
|
if win32err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
return _ORDeleteKey(handle, _p0)
|
||||||
|
}
|
||||||
|
|
||||||
|
func _ORDeleteKey(handle ORHKey, subKey *uint16) (win32err error) {
|
||||||
|
r0, _, _ := syscall.Syscall(procORDeleteKey.Addr(), 2, uintptr(handle), uintptr(unsafe.Pointer(subKey)), 0)
|
||||||
|
if r0 != 0 {
|
||||||
|
win32err = syscall.Errno(r0)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
func ORGetValue(handle ORHKey, subKey string, value string, valueType *uint32, data *byte, dataLen *uint32) (win32err error) {
|
||||||
|
var _p0 *uint16
|
||||||
|
_p0, win32err = syscall.UTF16PtrFromString(subKey)
|
||||||
|
if win32err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
var _p1 *uint16
|
||||||
|
_p1, win32err = syscall.UTF16PtrFromString(value)
|
||||||
|
if win32err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
return _ORGetValue(handle, _p0, _p1, valueType, data, dataLen)
|
||||||
|
}
|
||||||
|
|
||||||
|
func _ORGetValue(handle ORHKey, subKey *uint16, value *uint16, valueType *uint32, data *byte, dataLen *uint32) (win32err error) {
|
||||||
|
r0, _, _ := syscall.Syscall6(procORGetValue.Addr(), 6, uintptr(handle), uintptr(unsafe.Pointer(subKey)), uintptr(unsafe.Pointer(value)), uintptr(unsafe.Pointer(valueType)), uintptr(unsafe.Pointer(data)), uintptr(unsafe.Pointer(dataLen)))
|
||||||
|
if r0 != 0 {
|
||||||
|
win32err = syscall.Errno(r0)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
func ORMergeHives(hiveHandles []ORHKey, result *ORHKey) (win32err error) {
|
||||||
|
var _p0 *ORHKey
|
||||||
|
if len(hiveHandles) > 0 {
|
||||||
|
_p0 = &hiveHandles[0]
|
||||||
|
}
|
||||||
|
r0, _, _ := syscall.Syscall(procORMergeHives.Addr(), 3, uintptr(unsafe.Pointer(_p0)), uintptr(len(hiveHandles)), uintptr(unsafe.Pointer(result)))
|
||||||
|
if r0 != 0 {
|
||||||
|
win32err = syscall.Errno(r0)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
func OROpenHive(hivePath string, result *ORHKey) (win32err error) {
|
||||||
|
var _p0 *uint16
|
||||||
|
_p0, win32err = syscall.UTF16PtrFromString(hivePath)
|
||||||
|
if win32err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
return _OROpenHive(_p0, result)
|
||||||
|
}
|
||||||
|
|
||||||
|
func _OROpenHive(hivePath *uint16, result *ORHKey) (win32err error) {
|
||||||
|
r0, _, _ := syscall.Syscall(procOROpenHive.Addr(), 2, uintptr(unsafe.Pointer(hivePath)), uintptr(unsafe.Pointer(result)), 0)
|
||||||
|
if r0 != 0 {
|
||||||
|
win32err = syscall.Errno(r0)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
func OROpenKey(handle ORHKey, subKey string, result *ORHKey) (win32err error) {
|
||||||
|
var _p0 *uint16
|
||||||
|
_p0, win32err = syscall.UTF16PtrFromString(subKey)
|
||||||
|
if win32err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
return _OROpenKey(handle, _p0, result)
|
||||||
|
}
|
||||||
|
|
||||||
|
func _OROpenKey(handle ORHKey, subKey *uint16, result *ORHKey) (win32err error) {
|
||||||
|
r0, _, _ := syscall.Syscall(procOROpenKey.Addr(), 3, uintptr(handle), uintptr(unsafe.Pointer(subKey)), uintptr(unsafe.Pointer(result)))
|
||||||
|
if r0 != 0 {
|
||||||
|
win32err = syscall.Errno(r0)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
func ORSaveHive(handle ORHKey, hivePath string, osMajorVersion uint32, osMinorVersion uint32) (win32err error) {
|
||||||
|
var _p0 *uint16
|
||||||
|
_p0, win32err = syscall.UTF16PtrFromString(hivePath)
|
||||||
|
if win32err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
return _ORSaveHive(handle, _p0, osMajorVersion, osMinorVersion)
|
||||||
|
}
|
||||||
|
|
||||||
|
func _ORSaveHive(handle ORHKey, hivePath *uint16, osMajorVersion uint32, osMinorVersion uint32) (win32err error) {
|
||||||
|
r0, _, _ := syscall.Syscall6(procORSaveHive.Addr(), 4, uintptr(handle), uintptr(unsafe.Pointer(hivePath)), uintptr(osMajorVersion), uintptr(osMinorVersion), 0, 0)
|
||||||
|
if r0 != 0 {
|
||||||
|
win32err = syscall.Errno(r0)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
func ORSetValue(handle ORHKey, valueName string, valueType uint32, data *byte, dataLen uint32) (win32err error) {
|
||||||
|
var _p0 *uint16
|
||||||
|
_p0, win32err = syscall.UTF16PtrFromString(valueName)
|
||||||
|
if win32err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
return _ORSetValue(handle, _p0, valueType, data, dataLen)
|
||||||
|
}
|
||||||
|
|
||||||
|
func _ORSetValue(handle ORHKey, valueName *uint16, valueType uint32, data *byte, dataLen uint32) (win32err error) {
|
||||||
|
r0, _, _ := syscall.Syscall6(procORSetValue.Addr(), 5, uintptr(handle), uintptr(unsafe.Pointer(valueName)), uintptr(valueType), uintptr(unsafe.Pointer(data)), uintptr(dataLen), 0)
|
||||||
|
if r0 != 0 {
|
||||||
|
win32err = syscall.Errno(r0)
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
17
vendor/github.com/Microsoft/hcsshim/osversion/osversion_windows.go
generated
vendored
17
vendor/github.com/Microsoft/hcsshim/osversion/osversion_windows.go
generated
vendored
@ -26,16 +26,15 @@ var (
|
|||||||
// The calling application must be manifested to get the correct version information.
|
// The calling application must be manifested to get the correct version information.
|
||||||
func Get() OSVersion {
|
func Get() OSVersion {
|
||||||
once.Do(func() {
|
once.Do(func() {
|
||||||
var err error
|
v := *windows.RtlGetVersion()
|
||||||
osv = OSVersion{}
|
osv = OSVersion{}
|
||||||
osv.Version, err = windows.GetVersion()
|
osv.MajorVersion = uint8(v.MajorVersion)
|
||||||
if err != nil {
|
osv.MinorVersion = uint8(v.MinorVersion)
|
||||||
// GetVersion never fails.
|
osv.Build = uint16(v.BuildNumber)
|
||||||
panic(err)
|
// Fill version value so that existing clients don't break
|
||||||
}
|
osv.Version = v.BuildNumber << 16
|
||||||
osv.MajorVersion = uint8(osv.Version & 0xFF)
|
osv.Version = osv.Version | (uint32(v.MinorVersion) << 8)
|
||||||
osv.MinorVersion = uint8(osv.Version >> 8 & 0xFF)
|
osv.Version = osv.Version | v.MajorVersion
|
||||||
osv.Build = uint16(osv.Version >> 16)
|
|
||||||
})
|
})
|
||||||
return osv
|
return osv
|
||||||
}
|
}
|
||||||
|
2
vendor/github.com/containers/storage/VERSION
generated
vendored
2
vendor/github.com/containers/storage/VERSION
generated
vendored
@ -1 +1 @@
|
|||||||
1.49.0
|
1.50.2-dev
|
||||||
|
8
vendor/github.com/containers/storage/drivers/overlay/overlay.go
generated
vendored
8
vendor/github.com/containers/storage/drivers/overlay/overlay.go
generated
vendored
@ -1113,7 +1113,7 @@ func (d *Driver) create(id, parent string, opts *graphdriver.CreateOpts, disable
|
|||||||
if err := idtools.MkdirAs(path.Join(workDirBase, "work"), 0o700, rootUID, rootGID); err != nil {
|
if err := idtools.MkdirAs(path.Join(workDirBase, "work"), 0o700, rootUID, rootGID); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if err := idtools.MkdirAs(path.Join(dir, "merged"), 0o700, rootUID, rootGID); err != nil {
|
if err := idtools.MkdirAs(path.Join(workDirBase, "merged"), 0o700, rootUID, rootGID); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1671,7 +1671,7 @@ func (d *Driver) get(id string, disableShifting bool, options graphdriver.MountO
|
|||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
|
|
||||||
mergedDir := path.Join(dir, "merged")
|
mergedDir := path.Join(workDirBase, "merged")
|
||||||
// Create the driver merged dir
|
// Create the driver merged dir
|
||||||
if err := idtools.MkdirAs(mergedDir, 0o700, rootUID, rootGID); err != nil && !os.IsExist(err) {
|
if err := idtools.MkdirAs(mergedDir, 0o700, rootUID, rootGID); err != nil && !os.IsExist(err) {
|
||||||
return "", err
|
return "", err
|
||||||
@ -2170,6 +2170,10 @@ func (d *Driver) getLowerDiffPaths(id string) ([]string, error) {
|
|||||||
// and its parent and returns the size in bytes of the changes
|
// and its parent and returns the size in bytes of the changes
|
||||||
// relative to its base filesystem directory.
|
// relative to its base filesystem directory.
|
||||||
func (d *Driver) DiffSize(id string, idMappings *idtools.IDMappings, parent string, parentMappings *idtools.IDMappings, mountLabel string) (size int64, err error) {
|
func (d *Driver) DiffSize(id string, idMappings *idtools.IDMappings, parent string, parentMappings *idtools.IDMappings, mountLabel string) (size int64, err error) {
|
||||||
|
if !d.isParent(id, parent) {
|
||||||
|
return d.naiveDiff.DiffSize(id, idMappings, parent, parentMappings, mountLabel)
|
||||||
|
}
|
||||||
|
|
||||||
p, err := d.getDiffPath(id)
|
p, err := d.getDiffPath(id)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return 0, err
|
return 0, err
|
||||||
|
67
vendor/github.com/containers/storage/pkg/chunked/compression_linux.go
generated
vendored
67
vendor/github.com/containers/storage/pkg/chunked/compression_linux.go
generated
vendored
@ -2,8 +2,6 @@ package chunked
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
archivetar "archive/tar"
|
archivetar "archive/tar"
|
||||||
"bytes"
|
|
||||||
"encoding/binary"
|
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
@ -35,13 +33,6 @@ func typeToTarType(t string) (byte, error) {
|
|||||||
return r, nil
|
return r, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func isZstdChunkedFrameMagic(data []byte) bool {
|
|
||||||
if len(data) < 8 {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
return bytes.Equal(internal.ZstdChunkedFrameMagic, data[:8])
|
|
||||||
}
|
|
||||||
|
|
||||||
func readEstargzChunkedManifest(blobStream ImageSourceSeekable, blobSize int64, annotations map[string]string) ([]byte, int64, error) {
|
func readEstargzChunkedManifest(blobStream ImageSourceSeekable, blobSize int64, annotations map[string]string) ([]byte, int64, error) {
|
||||||
// information on the format here https://github.com/containerd/stargz-snapshotter/blob/main/docs/stargz-estargz.md
|
// information on the format here https://github.com/containerd/stargz-snapshotter/blob/main/docs/stargz-estargz.md
|
||||||
footerSize := int64(51)
|
footerSize := int64(51)
|
||||||
@ -155,27 +146,14 @@ func readZstdChunkedManifest(blobStream ImageSourceSeekable, blobSize int64, ann
|
|||||||
return nil, nil, 0, errors.New("blob too small")
|
return nil, nil, 0, errors.New("blob too small")
|
||||||
}
|
}
|
||||||
|
|
||||||
manifestChecksumAnnotation := annotations[internal.ManifestChecksumKey]
|
var footerData internal.ZstdChunkedFooterData
|
||||||
if manifestChecksumAnnotation == "" {
|
|
||||||
return nil, nil, 0, fmt.Errorf("manifest checksum annotation %q not found", internal.ManifestChecksumKey)
|
|
||||||
}
|
|
||||||
|
|
||||||
var offset, length, lengthUncompressed, manifestType uint64
|
|
||||||
|
|
||||||
var offsetTarSplit, lengthTarSplit, lengthUncompressedTarSplit uint64
|
|
||||||
tarSplitChecksumAnnotation := ""
|
|
||||||
|
|
||||||
if offsetMetadata := annotations[internal.ManifestInfoKey]; offsetMetadata != "" {
|
if offsetMetadata := annotations[internal.ManifestInfoKey]; offsetMetadata != "" {
|
||||||
if _, err := fmt.Sscanf(offsetMetadata, "%d:%d:%d:%d", &offset, &length, &lengthUncompressed, &manifestType); err != nil {
|
var err error
|
||||||
|
footerData, err = internal.ReadFooterDataFromAnnotations(annotations)
|
||||||
|
if err != nil {
|
||||||
return nil, nil, 0, err
|
return nil, nil, 0, err
|
||||||
}
|
}
|
||||||
|
|
||||||
if tarSplitInfoKeyAnnotation, found := annotations[internal.TarSplitInfoKey]; found {
|
|
||||||
if _, err := fmt.Sscanf(tarSplitInfoKeyAnnotation, "%d:%d:%d", &offsetTarSplit, &lengthTarSplit, &lengthUncompressedTarSplit); err != nil {
|
|
||||||
return nil, nil, 0, err
|
|
||||||
}
|
|
||||||
tarSplitChecksumAnnotation = annotations[internal.TarSplitChecksumKey]
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
chunk := ImageSourceChunk{
|
chunk := ImageSourceChunk{
|
||||||
Offset: uint64(blobSize - footerSize),
|
Offset: uint64(blobSize - footerSize),
|
||||||
@ -197,38 +175,35 @@ func readZstdChunkedManifest(blobStream ImageSourceSeekable, blobSize int64, ann
|
|||||||
return nil, nil, 0, err
|
return nil, nil, 0, err
|
||||||
}
|
}
|
||||||
|
|
||||||
offset = binary.LittleEndian.Uint64(footer[0:8])
|
footerData, err = internal.ReadFooterDataFromBlob(footer)
|
||||||
length = binary.LittleEndian.Uint64(footer[8:16])
|
if err != nil {
|
||||||
lengthUncompressed = binary.LittleEndian.Uint64(footer[16:24])
|
return nil, nil, 0, err
|
||||||
manifestType = binary.LittleEndian.Uint64(footer[24:32])
|
|
||||||
if !isZstdChunkedFrameMagic(footer[48:56]) {
|
|
||||||
return nil, nil, 0, errors.New("invalid magic number")
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if manifestType != internal.ManifestTypeCRFS {
|
if footerData.ManifestType != internal.ManifestTypeCRFS {
|
||||||
return nil, nil, 0, errors.New("invalid manifest type")
|
return nil, nil, 0, errors.New("invalid manifest type")
|
||||||
}
|
}
|
||||||
|
|
||||||
// set a reasonable limit
|
// set a reasonable limit
|
||||||
if length > (1<<20)*50 {
|
if footerData.LengthCompressed > (1<<20)*50 {
|
||||||
return nil, nil, 0, errors.New("manifest too big")
|
return nil, nil, 0, errors.New("manifest too big")
|
||||||
}
|
}
|
||||||
if lengthUncompressed > (1<<20)*50 {
|
if footerData.LengthUncompressed > (1<<20)*50 {
|
||||||
return nil, nil, 0, errors.New("manifest too big")
|
return nil, nil, 0, errors.New("manifest too big")
|
||||||
}
|
}
|
||||||
|
|
||||||
chunk := ImageSourceChunk{
|
chunk := ImageSourceChunk{
|
||||||
Offset: offset,
|
Offset: footerData.Offset,
|
||||||
Length: length,
|
Length: footerData.LengthCompressed,
|
||||||
}
|
}
|
||||||
|
|
||||||
chunks := []ImageSourceChunk{chunk}
|
chunks := []ImageSourceChunk{chunk}
|
||||||
|
|
||||||
if offsetTarSplit > 0 {
|
if footerData.OffsetTarSplit > 0 {
|
||||||
chunkTarSplit := ImageSourceChunk{
|
chunkTarSplit := ImageSourceChunk{
|
||||||
Offset: offsetTarSplit,
|
Offset: footerData.OffsetTarSplit,
|
||||||
Length: lengthTarSplit,
|
Length: footerData.LengthCompressedTarSplit,
|
||||||
}
|
}
|
||||||
chunks = append(chunks, chunkTarSplit)
|
chunks = append(chunks, chunkTarSplit)
|
||||||
}
|
}
|
||||||
@ -258,28 +233,28 @@ func readZstdChunkedManifest(blobStream ImageSourceSeekable, blobSize int64, ann
|
|||||||
return blob, nil
|
return blob, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
manifest, err := readBlob(length)
|
manifest, err := readBlob(footerData.LengthCompressed)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, nil, 0, err
|
return nil, nil, 0, err
|
||||||
}
|
}
|
||||||
|
|
||||||
decodedBlob, err := decodeAndValidateBlob(manifest, lengthUncompressed, manifestChecksumAnnotation)
|
decodedBlob, err := decodeAndValidateBlob(manifest, footerData.LengthUncompressed, footerData.ChecksumAnnotation)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, nil, 0, err
|
return nil, nil, 0, err
|
||||||
}
|
}
|
||||||
decodedTarSplit := []byte{}
|
decodedTarSplit := []byte{}
|
||||||
if offsetTarSplit > 0 {
|
if footerData.OffsetTarSplit > 0 {
|
||||||
tarSplit, err := readBlob(lengthTarSplit)
|
tarSplit, err := readBlob(footerData.LengthCompressedTarSplit)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, nil, 0, err
|
return nil, nil, 0, err
|
||||||
}
|
}
|
||||||
|
|
||||||
decodedTarSplit, err = decodeAndValidateBlob(tarSplit, lengthUncompressedTarSplit, tarSplitChecksumAnnotation)
|
decodedTarSplit, err = decodeAndValidateBlob(tarSplit, footerData.LengthUncompressedTarSplit, footerData.ChecksumAnnotationTarSplit)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, nil, 0, err
|
return nil, nil, 0, err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return decodedBlob, decodedTarSplit, int64(offset), err
|
return decodedBlob, decodedTarSplit, int64(footerData.Offset), err
|
||||||
}
|
}
|
||||||
|
|
||||||
func decodeAndValidateBlob(blob []byte, lengthUncompressed uint64, expectedUncompressedChecksum string) ([]byte, error) {
|
func decodeAndValidateBlob(blob []byte, lengthUncompressed uint64, expectedUncompressedChecksum string) ([]byte, error) {
|
||||||
|
101
vendor/github.com/containers/storage/pkg/chunked/internal/compression.go
generated
vendored
101
vendor/github.com/containers/storage/pkg/chunked/internal/compression.go
generated
vendored
@ -8,6 +8,7 @@ import (
|
|||||||
"archive/tar"
|
"archive/tar"
|
||||||
"bytes"
|
"bytes"
|
||||||
"encoding/binary"
|
"encoding/binary"
|
||||||
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"time"
|
"time"
|
||||||
@ -99,7 +100,7 @@ const (
|
|||||||
// FooterSizeSupported is the footer size supported by this implementation.
|
// FooterSizeSupported is the footer size supported by this implementation.
|
||||||
// Newer versions of the image format might increase this value, so reject
|
// Newer versions of the image format might increase this value, so reject
|
||||||
// any version that is not supported.
|
// any version that is not supported.
|
||||||
FooterSizeSupported = 56
|
FooterSizeSupported = 64
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@ -108,7 +109,7 @@ var (
|
|||||||
// https://tools.ietf.org/html/rfc8478#section-3.1.2
|
// https://tools.ietf.org/html/rfc8478#section-3.1.2
|
||||||
skippableFrameMagic = []byte{0x50, 0x2a, 0x4d, 0x18}
|
skippableFrameMagic = []byte{0x50, 0x2a, 0x4d, 0x18}
|
||||||
|
|
||||||
ZstdChunkedFrameMagic = []byte{0x47, 0x6e, 0x55, 0x6c, 0x49, 0x6e, 0x55, 0x78}
|
ZstdChunkedFrameMagic = []byte{0x47, 0x4e, 0x55, 0x6c, 0x49, 0x6e, 0x55, 0x78}
|
||||||
)
|
)
|
||||||
|
|
||||||
func appendZstdSkippableFrame(dest io.Writer, data []byte) error {
|
func appendZstdSkippableFrame(dest io.Writer, data []byte) error {
|
||||||
@ -183,13 +184,19 @@ func WriteZstdChunkedManifest(dest io.Writer, outMetadata map[string]string, off
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
// Store the offset to the manifest and its size in LE order
|
footer := ZstdChunkedFooterData{
|
||||||
manifestDataLE := make([]byte, FooterSizeSupported)
|
ManifestType: uint64(ManifestTypeCRFS),
|
||||||
binary.LittleEndian.PutUint64(manifestDataLE, manifestOffset)
|
Offset: manifestOffset,
|
||||||
binary.LittleEndian.PutUint64(manifestDataLE[8*1:], uint64(len(compressedManifest)))
|
LengthCompressed: uint64(len(compressedManifest)),
|
||||||
binary.LittleEndian.PutUint64(manifestDataLE[8*2:], uint64(len(manifest)))
|
LengthUncompressed: uint64(len(manifest)),
|
||||||
binary.LittleEndian.PutUint64(manifestDataLE[8*3:], uint64(ManifestTypeCRFS))
|
ChecksumAnnotation: "", // unused
|
||||||
copy(manifestDataLE[8*4:], ZstdChunkedFrameMagic)
|
OffsetTarSplit: uint64(tarSplitOffset),
|
||||||
|
LengthCompressedTarSplit: uint64(len(tarSplitData.Data)),
|
||||||
|
LengthUncompressedTarSplit: uint64(tarSplitData.UncompressedSize),
|
||||||
|
ChecksumAnnotationTarSplit: "", // unused
|
||||||
|
}
|
||||||
|
|
||||||
|
manifestDataLE := footerDataToBlob(footer)
|
||||||
|
|
||||||
return appendZstdSkippableFrame(dest, manifestDataLE)
|
return appendZstdSkippableFrame(dest, manifestDataLE)
|
||||||
}
|
}
|
||||||
@ -198,3 +205,79 @@ func ZstdWriterWithLevel(dest io.Writer, level int) (*zstd.Encoder, error) {
|
|||||||
el := zstd.EncoderLevelFromZstd(level)
|
el := zstd.EncoderLevelFromZstd(level)
|
||||||
return zstd.NewWriter(dest, zstd.WithEncoderLevel(el))
|
return zstd.NewWriter(dest, zstd.WithEncoderLevel(el))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ZstdChunkedFooterData contains all the data stored in the zstd:chunked footer.
|
||||||
|
type ZstdChunkedFooterData struct {
|
||||||
|
ManifestType uint64
|
||||||
|
|
||||||
|
Offset uint64
|
||||||
|
LengthCompressed uint64
|
||||||
|
LengthUncompressed uint64
|
||||||
|
ChecksumAnnotation string // Only used when reading a layer, not when creating it
|
||||||
|
|
||||||
|
OffsetTarSplit uint64
|
||||||
|
LengthCompressedTarSplit uint64
|
||||||
|
LengthUncompressedTarSplit uint64
|
||||||
|
ChecksumAnnotationTarSplit string // Only used when reading a layer, not when creating it
|
||||||
|
}
|
||||||
|
|
||||||
|
func footerDataToBlob(footer ZstdChunkedFooterData) []byte {
|
||||||
|
// Store the offset to the manifest and its size in LE order
|
||||||
|
manifestDataLE := make([]byte, FooterSizeSupported)
|
||||||
|
binary.LittleEndian.PutUint64(manifestDataLE[8*0:], footer.Offset)
|
||||||
|
binary.LittleEndian.PutUint64(manifestDataLE[8*1:], footer.LengthCompressed)
|
||||||
|
binary.LittleEndian.PutUint64(manifestDataLE[8*2:], footer.LengthUncompressed)
|
||||||
|
binary.LittleEndian.PutUint64(manifestDataLE[8*3:], footer.ManifestType)
|
||||||
|
binary.LittleEndian.PutUint64(manifestDataLE[8*4:], footer.OffsetTarSplit)
|
||||||
|
binary.LittleEndian.PutUint64(manifestDataLE[8*5:], footer.LengthCompressedTarSplit)
|
||||||
|
binary.LittleEndian.PutUint64(manifestDataLE[8*6:], footer.LengthUncompressedTarSplit)
|
||||||
|
copy(manifestDataLE[8*7:], ZstdChunkedFrameMagic)
|
||||||
|
|
||||||
|
return manifestDataLE
|
||||||
|
}
|
||||||
|
|
||||||
|
// ReadFooterDataFromAnnotations reads the zstd:chunked footer data from the given annotations.
|
||||||
|
func ReadFooterDataFromAnnotations(annotations map[string]string) (ZstdChunkedFooterData, error) {
|
||||||
|
var footerData ZstdChunkedFooterData
|
||||||
|
|
||||||
|
footerData.ChecksumAnnotation = annotations[ManifestChecksumKey]
|
||||||
|
if footerData.ChecksumAnnotation == "" {
|
||||||
|
return footerData, fmt.Errorf("manifest checksum annotation %q not found", ManifestChecksumKey)
|
||||||
|
}
|
||||||
|
|
||||||
|
offsetMetadata := annotations[ManifestInfoKey]
|
||||||
|
|
||||||
|
if _, err := fmt.Sscanf(offsetMetadata, "%d:%d:%d:%d", &footerData.Offset, &footerData.LengthCompressed, &footerData.LengthUncompressed, &footerData.ManifestType); err != nil {
|
||||||
|
return footerData, err
|
||||||
|
}
|
||||||
|
|
||||||
|
if tarSplitInfoKeyAnnotation, found := annotations[TarSplitInfoKey]; found {
|
||||||
|
if _, err := fmt.Sscanf(tarSplitInfoKeyAnnotation, "%d:%d:%d", &footerData.OffsetTarSplit, &footerData.LengthCompressedTarSplit, &footerData.LengthUncompressedTarSplit); err != nil {
|
||||||
|
return footerData, err
|
||||||
|
}
|
||||||
|
footerData.ChecksumAnnotationTarSplit = annotations[TarSplitChecksumKey]
|
||||||
|
}
|
||||||
|
return footerData, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// ReadFooterDataFromBlob reads the zstd:chunked footer from the binary buffer.
|
||||||
|
func ReadFooterDataFromBlob(footer []byte) (ZstdChunkedFooterData, error) {
|
||||||
|
var footerData ZstdChunkedFooterData
|
||||||
|
|
||||||
|
if len(footer) < FooterSizeSupported {
|
||||||
|
return footerData, errors.New("blob too small")
|
||||||
|
}
|
||||||
|
footerData.Offset = binary.LittleEndian.Uint64(footer[0:8])
|
||||||
|
footerData.LengthCompressed = binary.LittleEndian.Uint64(footer[8:16])
|
||||||
|
footerData.LengthUncompressed = binary.LittleEndian.Uint64(footer[16:24])
|
||||||
|
footerData.ManifestType = binary.LittleEndian.Uint64(footer[24:32])
|
||||||
|
footerData.OffsetTarSplit = binary.LittleEndian.Uint64(footer[32:40])
|
||||||
|
footerData.LengthCompressedTarSplit = binary.LittleEndian.Uint64(footer[40:48])
|
||||||
|
footerData.LengthUncompressedTarSplit = binary.LittleEndian.Uint64(footer[48:56])
|
||||||
|
|
||||||
|
// the magic number is stored in the last 8 bytes
|
||||||
|
if !bytes.Equal(ZstdChunkedFrameMagic, footer[len(footer)-len(ZstdChunkedFrameMagic):]) {
|
||||||
|
return footerData, errors.New("invalid magic number")
|
||||||
|
}
|
||||||
|
return footerData, nil
|
||||||
|
}
|
||||||
|
5
vendor/github.com/containers/storage/storage.conf
generated
vendored
5
vendor/github.com/containers/storage/storage.conf
generated
vendored
@ -27,6 +27,11 @@ runroot = "/run/containers/storage"
|
|||||||
# restorecon -R -v /NEWSTORAGEPATH
|
# restorecon -R -v /NEWSTORAGEPATH
|
||||||
graphroot = "/var/lib/containers/storage"
|
graphroot = "/var/lib/containers/storage"
|
||||||
|
|
||||||
|
# Optional value for image storage location
|
||||||
|
# If set, it must be different than graphroot.
|
||||||
|
|
||||||
|
# imagestore = ""
|
||||||
|
|
||||||
|
|
||||||
# Storage path for rootless users
|
# Storage path for rootless users
|
||||||
#
|
#
|
||||||
|
4
vendor/github.com/containers/storage/storage.conf-freebsd
generated
vendored
4
vendor/github.com/containers/storage/storage.conf-freebsd
generated
vendored
@ -22,6 +22,10 @@ runroot = "/var/run/containers/storage"
|
|||||||
# Primary Read/Write location of container storage
|
# Primary Read/Write location of container storage
|
||||||
graphroot = "/var/db/containers/storage"
|
graphroot = "/var/db/containers/storage"
|
||||||
|
|
||||||
|
# Optional value for image storage location
|
||||||
|
# If set, it must be different than graphroot.
|
||||||
|
|
||||||
|
# imagestore = ""
|
||||||
|
|
||||||
# Storage path for rootless users
|
# Storage path for rootless users
|
||||||
#
|
#
|
||||||
|
5
vendor/github.com/containers/storage/store.go
generated
vendored
5
vendor/github.com/containers/storage/store.go
generated
vendored
@ -142,6 +142,7 @@ type Store interface {
|
|||||||
// settings that were passed to GetStore() when the object was created.
|
// settings that were passed to GetStore() when the object was created.
|
||||||
RunRoot() string
|
RunRoot() string
|
||||||
GraphRoot() string
|
GraphRoot() string
|
||||||
|
ImageStore() string
|
||||||
TransientStore() bool
|
TransientStore() bool
|
||||||
GraphDriverName() string
|
GraphDriverName() string
|
||||||
GraphOptions() []string
|
GraphOptions() []string
|
||||||
@ -862,6 +863,10 @@ func (s *store) GraphRoot() string {
|
|||||||
return s.graphRoot
|
return s.graphRoot
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (s *store) ImageStore() string {
|
||||||
|
return s.imageStoreDir
|
||||||
|
}
|
||||||
|
|
||||||
func (s *store) TransientStore() bool {
|
func (s *store) TransientStore() bool {
|
||||||
return s.transientStore
|
return s.transientStore
|
||||||
}
|
}
|
||||||
|
4
vendor/github.com/containers/storage/types/options.go
generated
vendored
4
vendor/github.com/containers/storage/types/options.go
generated
vendored
@ -179,6 +179,10 @@ func defaultStoreOptionsIsolated(rootless bool, rootlessUID int, storageConf str
|
|||||||
storageOpts.RootlessStoragePath = storagePath
|
storageOpts.RootlessStoragePath = storagePath
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if storageOpts.ImageStore != "" && storageOpts.ImageStore == storageOpts.GraphRoot {
|
||||||
|
return storageOpts, fmt.Errorf("imagestore %s must either be not set or be a different than graphroot", storageOpts.ImageStore)
|
||||||
|
}
|
||||||
|
|
||||||
return storageOpts, nil
|
return storageOpts, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
21
vendor/github.com/cyphar/filepath-securejoin/.travis.yml
generated
vendored
21
vendor/github.com/cyphar/filepath-securejoin/.travis.yml
generated
vendored
@ -1,21 +0,0 @@
|
|||||||
# Copyright (C) 2017 SUSE LLC. All rights reserved.
|
|
||||||
# Use of this source code is governed by a BSD-style
|
|
||||||
# license that can be found in the LICENSE file.
|
|
||||||
|
|
||||||
language: go
|
|
||||||
go:
|
|
||||||
- 1.13.x
|
|
||||||
- 1.16.x
|
|
||||||
- tip
|
|
||||||
arch:
|
|
||||||
- AMD64
|
|
||||||
- ppc64le
|
|
||||||
os:
|
|
||||||
- linux
|
|
||||||
- osx
|
|
||||||
|
|
||||||
script:
|
|
||||||
- go test -cover -v ./...
|
|
||||||
|
|
||||||
notifications:
|
|
||||||
email: false
|
|
2
vendor/github.com/cyphar/filepath-securejoin/README.md
generated
vendored
2
vendor/github.com/cyphar/filepath-securejoin/README.md
generated
vendored
@ -1,6 +1,6 @@
|
|||||||
## `filepath-securejoin` ##
|
## `filepath-securejoin` ##
|
||||||
|
|
||||||
[](https://travis-ci.org/cyphar/filepath-securejoin)
|
[](https://github.com/cyphar/filepath-securejoin/actions/workflows/ci.yml)
|
||||||
|
|
||||||
An implementation of `SecureJoin`, a [candidate for inclusion in the Go
|
An implementation of `SecureJoin`, a [candidate for inclusion in the Go
|
||||||
standard library][go#20126]. The purpose of this function is to be a "secure"
|
standard library][go#20126]. The purpose of this function is to be a "secure"
|
||||||
|
2
vendor/github.com/cyphar/filepath-securejoin/VERSION
generated
vendored
2
vendor/github.com/cyphar/filepath-securejoin/VERSION
generated
vendored
@ -1 +1 @@
|
|||||||
0.2.3
|
0.2.4
|
||||||
|
12
vendor/github.com/cyphar/filepath-securejoin/join.go
generated
vendored
12
vendor/github.com/cyphar/filepath-securejoin/join.go
generated
vendored
@ -39,17 +39,27 @@ func IsNotExist(err error) bool {
|
|||||||
// components in the returned string are not modified (in other words are not
|
// components in the returned string are not modified (in other words are not
|
||||||
// replaced with symlinks on the filesystem) after this function has returned.
|
// replaced with symlinks on the filesystem) after this function has returned.
|
||||||
// Such a symlink race is necessarily out-of-scope of SecureJoin.
|
// Such a symlink race is necessarily out-of-scope of SecureJoin.
|
||||||
|
//
|
||||||
|
// Volume names in unsafePath are always discarded, regardless if they are
|
||||||
|
// provided via direct input or when evaluating symlinks. Therefore:
|
||||||
|
//
|
||||||
|
// "C:\Temp" + "D:\path\to\file.txt" results in "C:\Temp\path\to\file.txt"
|
||||||
func SecureJoinVFS(root, unsafePath string, vfs VFS) (string, error) {
|
func SecureJoinVFS(root, unsafePath string, vfs VFS) (string, error) {
|
||||||
// Use the os.* VFS implementation if none was specified.
|
// Use the os.* VFS implementation if none was specified.
|
||||||
if vfs == nil {
|
if vfs == nil {
|
||||||
vfs = osVFS{}
|
vfs = osVFS{}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
unsafePath = filepath.FromSlash(unsafePath)
|
||||||
var path bytes.Buffer
|
var path bytes.Buffer
|
||||||
n := 0
|
n := 0
|
||||||
for unsafePath != "" {
|
for unsafePath != "" {
|
||||||
if n > 255 {
|
if n > 255 {
|
||||||
return "", &os.PathError{Op: "SecureJoin", Path: root + "/" + unsafePath, Err: syscall.ELOOP}
|
return "", &os.PathError{Op: "SecureJoin", Path: root + string(filepath.Separator) + unsafePath, Err: syscall.ELOOP}
|
||||||
|
}
|
||||||
|
|
||||||
|
if v := filepath.VolumeName(unsafePath); v != "" {
|
||||||
|
unsafePath = unsafePath[len(v):]
|
||||||
}
|
}
|
||||||
|
|
||||||
// Next path component, p.
|
// Next path component, p.
|
||||||
|
28
vendor/google.golang.org/grpc/attributes/attributes.go
generated
vendored
28
vendor/google.golang.org/grpc/attributes/attributes.go
generated
vendored
@ -112,19 +112,31 @@ func (a *Attributes) String() string {
|
|||||||
sb.WriteString("{")
|
sb.WriteString("{")
|
||||||
first := true
|
first := true
|
||||||
for k, v := range a.m {
|
for k, v := range a.m {
|
||||||
var key, val string
|
|
||||||
if str, ok := k.(interface{ String() string }); ok {
|
|
||||||
key = str.String()
|
|
||||||
}
|
|
||||||
if str, ok := v.(interface{ String() string }); ok {
|
|
||||||
val = str.String()
|
|
||||||
}
|
|
||||||
if !first {
|
if !first {
|
||||||
sb.WriteString(", ")
|
sb.WriteString(", ")
|
||||||
}
|
}
|
||||||
sb.WriteString(fmt.Sprintf("%q: %q, ", key, val))
|
sb.WriteString(fmt.Sprintf("%q: %q ", str(k), str(v)))
|
||||||
first = false
|
first = false
|
||||||
}
|
}
|
||||||
sb.WriteString("}")
|
sb.WriteString("}")
|
||||||
return sb.String()
|
return sb.String()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func str(x interface{}) string {
|
||||||
|
if v, ok := x.(fmt.Stringer); ok {
|
||||||
|
return v.String()
|
||||||
|
} else if v, ok := x.(string); ok {
|
||||||
|
return v
|
||||||
|
}
|
||||||
|
return fmt.Sprintf("<%p>", x)
|
||||||
|
}
|
||||||
|
|
||||||
|
// MarshalJSON helps implement the json.Marshaler interface, thereby rendering
|
||||||
|
// the Attributes correctly when printing (via pretty.JSON) structs containing
|
||||||
|
// Attributes as fields.
|
||||||
|
//
|
||||||
|
// Is it impossible to unmarshal attributes from a JSON representation and this
|
||||||
|
// method is meant only for debugging purposes.
|
||||||
|
func (a *Attributes) MarshalJSON() ([]byte, error) {
|
||||||
|
return []byte(a.String()), nil
|
||||||
|
}
|
||||||
|
91
vendor/google.golang.org/grpc/clientconn.go
generated
vendored
91
vendor/google.golang.org/grpc/clientconn.go
generated
vendored
@ -37,6 +37,7 @@ import (
|
|||||||
"google.golang.org/grpc/internal/backoff"
|
"google.golang.org/grpc/internal/backoff"
|
||||||
"google.golang.org/grpc/internal/channelz"
|
"google.golang.org/grpc/internal/channelz"
|
||||||
"google.golang.org/grpc/internal/grpcsync"
|
"google.golang.org/grpc/internal/grpcsync"
|
||||||
|
"google.golang.org/grpc/internal/pretty"
|
||||||
iresolver "google.golang.org/grpc/internal/resolver"
|
iresolver "google.golang.org/grpc/internal/resolver"
|
||||||
"google.golang.org/grpc/internal/transport"
|
"google.golang.org/grpc/internal/transport"
|
||||||
"google.golang.org/grpc/keepalive"
|
"google.golang.org/grpc/keepalive"
|
||||||
@ -867,6 +868,20 @@ func (cc *ClientConn) handleSubConnStateChange(sc balancer.SubConn, s connectivi
|
|||||||
cc.balancerWrapper.updateSubConnState(sc, s, err)
|
cc.balancerWrapper.updateSubConnState(sc, s, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Makes a copy of the input addresses slice and clears out the balancer
|
||||||
|
// attributes field. Addresses are passed during subconn creation and address
|
||||||
|
// update operations. In both cases, we will clear the balancer attributes by
|
||||||
|
// calling this function, and therefore we will be able to use the Equal method
|
||||||
|
// provided by the resolver.Address type for comparison.
|
||||||
|
func copyAddressesWithoutBalancerAttributes(in []resolver.Address) []resolver.Address {
|
||||||
|
out := make([]resolver.Address, len(in))
|
||||||
|
for i := range in {
|
||||||
|
out[i] = in[i]
|
||||||
|
out[i].BalancerAttributes = nil
|
||||||
|
}
|
||||||
|
return out
|
||||||
|
}
|
||||||
|
|
||||||
// newAddrConn creates an addrConn for addrs and adds it to cc.conns.
|
// newAddrConn creates an addrConn for addrs and adds it to cc.conns.
|
||||||
//
|
//
|
||||||
// Caller needs to make sure len(addrs) > 0.
|
// Caller needs to make sure len(addrs) > 0.
|
||||||
@ -874,7 +889,7 @@ func (cc *ClientConn) newAddrConn(addrs []resolver.Address, opts balancer.NewSub
|
|||||||
ac := &addrConn{
|
ac := &addrConn{
|
||||||
state: connectivity.Idle,
|
state: connectivity.Idle,
|
||||||
cc: cc,
|
cc: cc,
|
||||||
addrs: addrs,
|
addrs: copyAddressesWithoutBalancerAttributes(addrs),
|
||||||
scopts: opts,
|
scopts: opts,
|
||||||
dopts: cc.dopts,
|
dopts: cc.dopts,
|
||||||
czData: new(channelzData),
|
czData: new(channelzData),
|
||||||
@ -995,8 +1010,9 @@ func equalAddresses(a, b []resolver.Address) bool {
|
|||||||
// connections or connection attempts.
|
// connections or connection attempts.
|
||||||
func (ac *addrConn) updateAddrs(addrs []resolver.Address) {
|
func (ac *addrConn) updateAddrs(addrs []resolver.Address) {
|
||||||
ac.mu.Lock()
|
ac.mu.Lock()
|
||||||
channelz.Infof(logger, ac.channelzID, "addrConn: updateAddrs curAddr: %v, addrs: %v", ac.curAddr, addrs)
|
channelz.Infof(logger, ac.channelzID, "addrConn: updateAddrs curAddr: %v, addrs: %v", pretty.ToJSON(ac.curAddr), pretty.ToJSON(addrs))
|
||||||
|
|
||||||
|
addrs = copyAddressesWithoutBalancerAttributes(addrs)
|
||||||
if equalAddresses(ac.addrs, addrs) {
|
if equalAddresses(ac.addrs, addrs) {
|
||||||
ac.mu.Unlock()
|
ac.mu.Unlock()
|
||||||
return
|
return
|
||||||
@ -1807,19 +1823,70 @@ func (cc *ClientConn) parseTargetAndFindResolver() error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// parseTarget uses RFC 3986 semantics to parse the given target into a
|
// parseTarget uses RFC 3986 semantics to parse the given target into a
|
||||||
// resolver.Target struct containing scheme, authority and url. Query
|
// resolver.Target struct containing url. Query params are stripped from the
|
||||||
// params are stripped from the endpoint.
|
// endpoint.
|
||||||
func parseTarget(target string) (resolver.Target, error) {
|
func parseTarget(target string) (resolver.Target, error) {
|
||||||
u, err := url.Parse(target)
|
u, err := url.Parse(target)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return resolver.Target{}, err
|
return resolver.Target{}, err
|
||||||
}
|
}
|
||||||
|
|
||||||
return resolver.Target{
|
return resolver.Target{URL: *u}, nil
|
||||||
Scheme: u.Scheme,
|
}
|
||||||
Authority: u.Host,
|
|
||||||
URL: *u,
|
func encodeAuthority(authority string) string {
|
||||||
}, nil
|
const upperhex = "0123456789ABCDEF"
|
||||||
|
|
||||||
|
// Return for characters that must be escaped as per
|
||||||
|
// Valid chars are mentioned here:
|
||||||
|
// https://datatracker.ietf.org/doc/html/rfc3986#section-3.2
|
||||||
|
shouldEscape := func(c byte) bool {
|
||||||
|
// Alphanum are always allowed.
|
||||||
|
if 'a' <= c && c <= 'z' || 'A' <= c && c <= 'Z' || '0' <= c && c <= '9' {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
switch c {
|
||||||
|
case '-', '_', '.', '~': // Unreserved characters
|
||||||
|
return false
|
||||||
|
case '!', '$', '&', '\'', '(', ')', '*', '+', ',', ';', '=': // Subdelim characters
|
||||||
|
return false
|
||||||
|
case ':', '[', ']', '@': // Authority related delimeters
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
// Everything else must be escaped.
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
hexCount := 0
|
||||||
|
for i := 0; i < len(authority); i++ {
|
||||||
|
c := authority[i]
|
||||||
|
if shouldEscape(c) {
|
||||||
|
hexCount++
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if hexCount == 0 {
|
||||||
|
return authority
|
||||||
|
}
|
||||||
|
|
||||||
|
required := len(authority) + 2*hexCount
|
||||||
|
t := make([]byte, required)
|
||||||
|
|
||||||
|
j := 0
|
||||||
|
// This logic is a barebones version of escape in the go net/url library.
|
||||||
|
for i := 0; i < len(authority); i++ {
|
||||||
|
switch c := authority[i]; {
|
||||||
|
case shouldEscape(c):
|
||||||
|
t[j] = '%'
|
||||||
|
t[j+1] = upperhex[c>>4]
|
||||||
|
t[j+2] = upperhex[c&15]
|
||||||
|
j += 3
|
||||||
|
default:
|
||||||
|
t[j] = authority[i]
|
||||||
|
j++
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return string(t)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Determine channel authority. The order of precedence is as follows:
|
// Determine channel authority. The order of precedence is as follows:
|
||||||
@ -1872,7 +1939,11 @@ func (cc *ClientConn) determineAuthority() error {
|
|||||||
// the channel authority given the user's dial target. For resolvers
|
// the channel authority given the user's dial target. For resolvers
|
||||||
// which don't implement this interface, we will use the endpoint from
|
// which don't implement this interface, we will use the endpoint from
|
||||||
// "scheme://authority/endpoint" as the default authority.
|
// "scheme://authority/endpoint" as the default authority.
|
||||||
cc.authority = endpoint
|
// Escape the endpoint to handle use cases where the endpoint
|
||||||
|
// might not be a valid authority by default.
|
||||||
|
// For example an endpoint which has multiple paths like
|
||||||
|
// 'a/b/c', which is not a valid authority by default.
|
||||||
|
cc.authority = encodeAuthority(endpoint)
|
||||||
}
|
}
|
||||||
channelz.Infof(logger, cc.channelzID, "Channel authority set to %q", cc.authority)
|
channelz.Infof(logger, cc.channelzID, "Channel authority set to %q", cc.authority)
|
||||||
return nil
|
return nil
|
||||||
|
23
vendor/google.golang.org/grpc/dialoptions.go
generated
vendored
23
vendor/google.golang.org/grpc/dialoptions.go
generated
vendored
@ -78,6 +78,7 @@ type dialOptions struct {
|
|||||||
defaultServiceConfigRawJSON *string
|
defaultServiceConfigRawJSON *string
|
||||||
resolvers []resolver.Builder
|
resolvers []resolver.Builder
|
||||||
idleTimeout time.Duration
|
idleTimeout time.Duration
|
||||||
|
recvBufferPool SharedBufferPool
|
||||||
}
|
}
|
||||||
|
|
||||||
// DialOption configures how we set up the connection.
|
// DialOption configures how we set up the connection.
|
||||||
@ -628,6 +629,7 @@ func defaultDialOptions() dialOptions {
|
|||||||
ReadBufferSize: defaultReadBufSize,
|
ReadBufferSize: defaultReadBufSize,
|
||||||
UseProxy: true,
|
UseProxy: true,
|
||||||
},
|
},
|
||||||
|
recvBufferPool: nopBufferPool{},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -676,3 +678,24 @@ func WithIdleTimeout(d time.Duration) DialOption {
|
|||||||
o.idleTimeout = d
|
o.idleTimeout = d
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// WithRecvBufferPool returns a DialOption that configures the ClientConn
|
||||||
|
// to use the provided shared buffer pool for parsing incoming messages. Depending
|
||||||
|
// on the application's workload, this could result in reduced memory allocation.
|
||||||
|
//
|
||||||
|
// If you are unsure about how to implement a memory pool but want to utilize one,
|
||||||
|
// begin with grpc.NewSharedBufferPool.
|
||||||
|
//
|
||||||
|
// Note: The shared buffer pool feature will not be active if any of the following
|
||||||
|
// options are used: WithStatsHandler, EnableTracing, or binary logging. In such
|
||||||
|
// cases, the shared buffer pool will be ignored.
|
||||||
|
//
|
||||||
|
// # Experimental
|
||||||
|
//
|
||||||
|
// Notice: This API is EXPERIMENTAL and may be changed or removed in a
|
||||||
|
// later release.
|
||||||
|
func WithRecvBufferPool(bufferPool SharedBufferPool) DialOption {
|
||||||
|
return newFuncDialOption(func(o *dialOptions) {
|
||||||
|
o.recvBufferPool = bufferPool
|
||||||
|
})
|
||||||
|
}
|
||||||
|
3
vendor/google.golang.org/grpc/internal/envconfig/envconfig.go
generated
vendored
3
vendor/google.golang.org/grpc/internal/envconfig/envconfig.go
generated
vendored
@ -40,6 +40,9 @@ var (
|
|||||||
// pick_first LB policy, which can be enabled by setting the environment
|
// pick_first LB policy, which can be enabled by setting the environment
|
||||||
// variable "GRPC_EXPERIMENTAL_PICKFIRST_LB_CONFIG" to "true".
|
// variable "GRPC_EXPERIMENTAL_PICKFIRST_LB_CONFIG" to "true".
|
||||||
PickFirstLBConfig = boolFromEnv("GRPC_EXPERIMENTAL_PICKFIRST_LB_CONFIG", false)
|
PickFirstLBConfig = boolFromEnv("GRPC_EXPERIMENTAL_PICKFIRST_LB_CONFIG", false)
|
||||||
|
// ALTSMaxConcurrentHandshakes is the maximum number of concurrent ALTS
|
||||||
|
// handshakes that can be performed.
|
||||||
|
ALTSMaxConcurrentHandshakes = uint64FromEnv("GRPC_ALTS_MAX_CONCURRENT_HANDSHAKES", 100, 1, 100)
|
||||||
)
|
)
|
||||||
|
|
||||||
func boolFromEnv(envVar string, def bool) bool {
|
func boolFromEnv(envVar string, def bool) bool {
|
||||||
|
7
vendor/google.golang.org/grpc/internal/grpcrand/grpcrand.go
generated
vendored
7
vendor/google.golang.org/grpc/internal/grpcrand/grpcrand.go
generated
vendored
@ -80,6 +80,13 @@ func Uint32() uint32 {
|
|||||||
return r.Uint32()
|
return r.Uint32()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ExpFloat64 implements rand.ExpFloat64 on the grpcrand global source.
|
||||||
|
func ExpFloat64() float64 {
|
||||||
|
mu.Lock()
|
||||||
|
defer mu.Unlock()
|
||||||
|
return r.ExpFloat64()
|
||||||
|
}
|
||||||
|
|
||||||
// Shuffle implements rand.Shuffle on the grpcrand global source.
|
// Shuffle implements rand.Shuffle on the grpcrand global source.
|
||||||
var Shuffle = func(n int, f func(int, int)) {
|
var Shuffle = func(n int, f func(int, int)) {
|
||||||
mu.Lock()
|
mu.Lock()
|
||||||
|
136
vendor/google.golang.org/grpc/internal/grpcsync/pubsub.go
generated
vendored
Normal file
136
vendor/google.golang.org/grpc/internal/grpcsync/pubsub.go
generated
vendored
Normal file
@ -0,0 +1,136 @@
|
|||||||
|
/*
|
||||||
|
*
|
||||||
|
* Copyright 2023 gRPC 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.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
package grpcsync
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"sync"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Subscriber represents an entity that is subscribed to messages published on
|
||||||
|
// a PubSub. It wraps the callback to be invoked by the PubSub when a new
|
||||||
|
// message is published.
|
||||||
|
type Subscriber interface {
|
||||||
|
// OnMessage is invoked when a new message is published. Implementations
|
||||||
|
// must not block in this method.
|
||||||
|
OnMessage(msg interface{})
|
||||||
|
}
|
||||||
|
|
||||||
|
// PubSub is a simple one-to-many publish-subscribe system that supports
|
||||||
|
// messages of arbitrary type. It guarantees that messages are delivered in
|
||||||
|
// the same order in which they were published.
|
||||||
|
//
|
||||||
|
// Publisher invokes the Publish() method to publish new messages, while
|
||||||
|
// subscribers interested in receiving these messages register a callback
|
||||||
|
// via the Subscribe() method.
|
||||||
|
//
|
||||||
|
// Once a PubSub is stopped, no more messages can be published, and
|
||||||
|
// it is guaranteed that no more subscriber callback will be invoked.
|
||||||
|
type PubSub struct {
|
||||||
|
cs *CallbackSerializer
|
||||||
|
cancel context.CancelFunc
|
||||||
|
|
||||||
|
// Access to the below fields are guarded by this mutex.
|
||||||
|
mu sync.Mutex
|
||||||
|
msg interface{}
|
||||||
|
subscribers map[Subscriber]bool
|
||||||
|
stopped bool
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewPubSub returns a new PubSub instance.
|
||||||
|
func NewPubSub() *PubSub {
|
||||||
|
ctx, cancel := context.WithCancel(context.Background())
|
||||||
|
return &PubSub{
|
||||||
|
cs: NewCallbackSerializer(ctx),
|
||||||
|
cancel: cancel,
|
||||||
|
subscribers: map[Subscriber]bool{},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Subscribe registers the provided Subscriber to the PubSub.
|
||||||
|
//
|
||||||
|
// If the PubSub contains a previously published message, the Subscriber's
|
||||||
|
// OnMessage() callback will be invoked asynchronously with the existing
|
||||||
|
// message to begin with, and subsequently for every newly published message.
|
||||||
|
//
|
||||||
|
// The caller is responsible for invoking the returned cancel function to
|
||||||
|
// unsubscribe itself from the PubSub.
|
||||||
|
func (ps *PubSub) Subscribe(sub Subscriber) (cancel func()) {
|
||||||
|
ps.mu.Lock()
|
||||||
|
defer ps.mu.Unlock()
|
||||||
|
|
||||||
|
if ps.stopped {
|
||||||
|
return func() {}
|
||||||
|
}
|
||||||
|
|
||||||
|
ps.subscribers[sub] = true
|
||||||
|
|
||||||
|
if ps.msg != nil {
|
||||||
|
msg := ps.msg
|
||||||
|
ps.cs.Schedule(func(context.Context) {
|
||||||
|
ps.mu.Lock()
|
||||||
|
defer ps.mu.Unlock()
|
||||||
|
if !ps.subscribers[sub] {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
sub.OnMessage(msg)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
return func() {
|
||||||
|
ps.mu.Lock()
|
||||||
|
defer ps.mu.Unlock()
|
||||||
|
delete(ps.subscribers, sub)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Publish publishes the provided message to the PubSub, and invokes
|
||||||
|
// callbacks registered by subscribers asynchronously.
|
||||||
|
func (ps *PubSub) Publish(msg interface{}) {
|
||||||
|
ps.mu.Lock()
|
||||||
|
defer ps.mu.Unlock()
|
||||||
|
|
||||||
|
if ps.stopped {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
ps.msg = msg
|
||||||
|
for sub := range ps.subscribers {
|
||||||
|
s := sub
|
||||||
|
ps.cs.Schedule(func(context.Context) {
|
||||||
|
ps.mu.Lock()
|
||||||
|
defer ps.mu.Unlock()
|
||||||
|
if !ps.subscribers[s] {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
s.OnMessage(msg)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Stop shuts down the PubSub and releases any resources allocated by it.
|
||||||
|
// It is guaranteed that no subscriber callbacks would be invoked once this
|
||||||
|
// method returns.
|
||||||
|
func (ps *PubSub) Stop() {
|
||||||
|
ps.mu.Lock()
|
||||||
|
defer ps.mu.Unlock()
|
||||||
|
ps.stopped = true
|
||||||
|
|
||||||
|
ps.cancel()
|
||||||
|
}
|
74
vendor/google.golang.org/grpc/internal/resolver/dns/dns_resolver.go
generated
vendored
74
vendor/google.golang.org/grpc/internal/resolver/dns/dns_resolver.go
generated
vendored
@ -62,7 +62,8 @@ const (
|
|||||||
defaultPort = "443"
|
defaultPort = "443"
|
||||||
defaultDNSSvrPort = "53"
|
defaultDNSSvrPort = "53"
|
||||||
golang = "GO"
|
golang = "GO"
|
||||||
// txtPrefix is the prefix string to be prepended to the host name for txt record lookup.
|
// txtPrefix is the prefix string to be prepended to the host name for txt
|
||||||
|
// record lookup.
|
||||||
txtPrefix = "_grpc_config."
|
txtPrefix = "_grpc_config."
|
||||||
// In DNS, service config is encoded in a TXT record via the mechanism
|
// In DNS, service config is encoded in a TXT record via the mechanism
|
||||||
// described in RFC-1464 using the attribute name grpc_config.
|
// described in RFC-1464 using the attribute name grpc_config.
|
||||||
@ -86,14 +87,14 @@ var (
|
|||||||
minDNSResRate = 30 * time.Second
|
minDNSResRate = 30 * time.Second
|
||||||
)
|
)
|
||||||
|
|
||||||
var customAuthorityDialler = func(authority string) func(ctx context.Context, network, address string) (net.Conn, error) {
|
var addressDialer = func(address string) func(context.Context, string, string) (net.Conn, error) {
|
||||||
return func(ctx context.Context, network, address string) (net.Conn, error) {
|
return func(ctx context.Context, network, _ string) (net.Conn, error) {
|
||||||
var dialer net.Dialer
|
var dialer net.Dialer
|
||||||
return dialer.DialContext(ctx, network, authority)
|
return dialer.DialContext(ctx, network, address)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var customAuthorityResolver = func(authority string) (netResolver, error) {
|
var newNetResolver = func(authority string) (netResolver, error) {
|
||||||
host, port, err := parseTarget(authority, defaultDNSSvrPort)
|
host, port, err := parseTarget(authority, defaultDNSSvrPort)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -103,7 +104,7 @@ var customAuthorityResolver = func(authority string) (netResolver, error) {
|
|||||||
|
|
||||||
return &net.Resolver{
|
return &net.Resolver{
|
||||||
PreferGo: true,
|
PreferGo: true,
|
||||||
Dial: customAuthorityDialler(authorityWithPort),
|
Dial: addressDialer(authorityWithPort),
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -114,7 +115,8 @@ func NewBuilder() resolver.Builder {
|
|||||||
|
|
||||||
type dnsBuilder struct{}
|
type dnsBuilder struct{}
|
||||||
|
|
||||||
// Build creates and starts a DNS resolver that watches the name resolution of the target.
|
// Build creates and starts a DNS resolver that watches the name resolution of
|
||||||
|
// the target.
|
||||||
func (b *dnsBuilder) Build(target resolver.Target, cc resolver.ClientConn, opts resolver.BuildOptions) (resolver.Resolver, error) {
|
func (b *dnsBuilder) Build(target resolver.Target, cc resolver.ClientConn, opts resolver.BuildOptions) (resolver.Resolver, error) {
|
||||||
host, port, err := parseTarget(target.Endpoint(), defaultPort)
|
host, port, err := parseTarget(target.Endpoint(), defaultPort)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -143,7 +145,7 @@ func (b *dnsBuilder) Build(target resolver.Target, cc resolver.ClientConn, opts
|
|||||||
if target.URL.Host == "" {
|
if target.URL.Host == "" {
|
||||||
d.resolver = defaultResolver
|
d.resolver = defaultResolver
|
||||||
} else {
|
} else {
|
||||||
d.resolver, err = customAuthorityResolver(target.URL.Host)
|
d.resolver, err = newNetResolver(target.URL.Host)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -180,19 +182,22 @@ type dnsResolver struct {
|
|||||||
ctx context.Context
|
ctx context.Context
|
||||||
cancel context.CancelFunc
|
cancel context.CancelFunc
|
||||||
cc resolver.ClientConn
|
cc resolver.ClientConn
|
||||||
// rn channel is used by ResolveNow() to force an immediate resolution of the target.
|
// rn channel is used by ResolveNow() to force an immediate resolution of the
|
||||||
|
// target.
|
||||||
rn chan struct{}
|
rn chan struct{}
|
||||||
// wg is used to enforce Close() to return after the watcher() goroutine has finished.
|
// wg is used to enforce Close() to return after the watcher() goroutine has
|
||||||
// Otherwise, data race will be possible. [Race Example] in dns_resolver_test we
|
// finished. Otherwise, data race will be possible. [Race Example] in
|
||||||
// replace the real lookup functions with mocked ones to facilitate testing.
|
// dns_resolver_test we replace the real lookup functions with mocked ones to
|
||||||
// If Close() doesn't wait for watcher() goroutine finishes, race detector sometimes
|
// facilitate testing. If Close() doesn't wait for watcher() goroutine
|
||||||
// will warns lookup (READ the lookup function pointers) inside watcher() goroutine
|
// finishes, race detector sometimes will warns lookup (READ the lookup
|
||||||
// has data race with replaceNetFunc (WRITE the lookup function pointers).
|
// function pointers) inside watcher() goroutine has data race with
|
||||||
|
// replaceNetFunc (WRITE the lookup function pointers).
|
||||||
wg sync.WaitGroup
|
wg sync.WaitGroup
|
||||||
disableServiceConfig bool
|
disableServiceConfig bool
|
||||||
}
|
}
|
||||||
|
|
||||||
// ResolveNow invoke an immediate resolution of the target that this dnsResolver watches.
|
// ResolveNow invoke an immediate resolution of the target that this
|
||||||
|
// dnsResolver watches.
|
||||||
func (d *dnsResolver) ResolveNow(resolver.ResolveNowOptions) {
|
func (d *dnsResolver) ResolveNow(resolver.ResolveNowOptions) {
|
||||||
select {
|
select {
|
||||||
case d.rn <- struct{}{}:
|
case d.rn <- struct{}{}:
|
||||||
@ -220,8 +225,8 @@ func (d *dnsResolver) watcher() {
|
|||||||
|
|
||||||
var timer *time.Timer
|
var timer *time.Timer
|
||||||
if err == nil {
|
if err == nil {
|
||||||
// Success resolving, wait for the next ResolveNow. However, also wait 30 seconds at the very least
|
// Success resolving, wait for the next ResolveNow. However, also wait 30
|
||||||
// to prevent constantly re-resolving.
|
// seconds at the very least to prevent constantly re-resolving.
|
||||||
backoffIndex = 1
|
backoffIndex = 1
|
||||||
timer = newTimerDNSResRate(minDNSResRate)
|
timer = newTimerDNSResRate(minDNSResRate)
|
||||||
select {
|
select {
|
||||||
@ -231,7 +236,8 @@ func (d *dnsResolver) watcher() {
|
|||||||
case <-d.rn:
|
case <-d.rn:
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Poll on an error found in DNS Resolver or an error received from ClientConn.
|
// Poll on an error found in DNS Resolver or an error received from
|
||||||
|
// ClientConn.
|
||||||
timer = newTimer(backoff.DefaultExponential.Backoff(backoffIndex))
|
timer = newTimer(backoff.DefaultExponential.Backoff(backoffIndex))
|
||||||
backoffIndex++
|
backoffIndex++
|
||||||
}
|
}
|
||||||
@ -278,7 +284,8 @@ func (d *dnsResolver) lookupSRV() ([]resolver.Address, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func handleDNSError(err error, lookupType string) error {
|
func handleDNSError(err error, lookupType string) error {
|
||||||
if dnsErr, ok := err.(*net.DNSError); ok && !dnsErr.IsTimeout && !dnsErr.IsTemporary {
|
dnsErr, ok := err.(*net.DNSError)
|
||||||
|
if ok && !dnsErr.IsTimeout && !dnsErr.IsTemporary {
|
||||||
// Timeouts and temporary errors should be communicated to gRPC to
|
// Timeouts and temporary errors should be communicated to gRPC to
|
||||||
// attempt another DNS query (with backoff). Other errors should be
|
// attempt another DNS query (with backoff). Other errors should be
|
||||||
// suppressed (they may represent the absence of a TXT record).
|
// suppressed (they may represent the absence of a TXT record).
|
||||||
@ -307,10 +314,12 @@ func (d *dnsResolver) lookupTXT() *serviceconfig.ParseResult {
|
|||||||
res += s
|
res += s
|
||||||
}
|
}
|
||||||
|
|
||||||
// TXT record must have "grpc_config=" attribute in order to be used as service config.
|
// TXT record must have "grpc_config=" attribute in order to be used as
|
||||||
|
// service config.
|
||||||
if !strings.HasPrefix(res, txtAttribute) {
|
if !strings.HasPrefix(res, txtAttribute) {
|
||||||
logger.Warningf("dns: TXT record %v missing %v attribute", res, txtAttribute)
|
logger.Warningf("dns: TXT record %v missing %v attribute", res, txtAttribute)
|
||||||
// This is not an error; it is the equivalent of not having a service config.
|
// This is not an error; it is the equivalent of not having a service
|
||||||
|
// config.
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
sc := canaryingSC(strings.TrimPrefix(res, txtAttribute))
|
sc := canaryingSC(strings.TrimPrefix(res, txtAttribute))
|
||||||
@ -352,9 +361,10 @@ func (d *dnsResolver) lookup() (*resolver.State, error) {
|
|||||||
return &state, nil
|
return &state, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// formatIP returns ok = false if addr is not a valid textual representation of an IP address.
|
// formatIP returns ok = false if addr is not a valid textual representation of
|
||||||
// If addr is an IPv4 address, return the addr and ok = true.
|
// an IP address. If addr is an IPv4 address, return the addr and ok = true.
|
||||||
// If addr is an IPv6 address, return the addr enclosed in square brackets and ok = true.
|
// If addr is an IPv6 address, return the addr enclosed in square brackets and
|
||||||
|
// ok = true.
|
||||||
func formatIP(addr string) (addrIP string, ok bool) {
|
func formatIP(addr string) (addrIP string, ok bool) {
|
||||||
ip := net.ParseIP(addr)
|
ip := net.ParseIP(addr)
|
||||||
if ip == nil {
|
if ip == nil {
|
||||||
@ -366,10 +376,10 @@ func formatIP(addr string) (addrIP string, ok bool) {
|
|||||||
return "[" + addr + "]", true
|
return "[" + addr + "]", true
|
||||||
}
|
}
|
||||||
|
|
||||||
// parseTarget takes the user input target string and default port, returns formatted host and port info.
|
// parseTarget takes the user input target string and default port, returns
|
||||||
// If target doesn't specify a port, set the port to be the defaultPort.
|
// formatted host and port info. If target doesn't specify a port, set the port
|
||||||
// If target is in IPv6 format and host-name is enclosed in square brackets, brackets
|
// to be the defaultPort. If target is in IPv6 format and host-name is enclosed
|
||||||
// are stripped when setting the host.
|
// in square brackets, brackets are stripped when setting the host.
|
||||||
// examples:
|
// examples:
|
||||||
// target: "www.google.com" defaultPort: "443" returns host: "www.google.com", port: "443"
|
// target: "www.google.com" defaultPort: "443" returns host: "www.google.com", port: "443"
|
||||||
// target: "ipv4-host:80" defaultPort: "443" returns host: "ipv4-host", port: "80"
|
// target: "ipv4-host:80" defaultPort: "443" returns host: "ipv4-host", port: "80"
|
||||||
@ -385,12 +395,14 @@ func parseTarget(target, defaultPort string) (host, port string, err error) {
|
|||||||
}
|
}
|
||||||
if host, port, err = net.SplitHostPort(target); err == nil {
|
if host, port, err = net.SplitHostPort(target); err == nil {
|
||||||
if port == "" {
|
if port == "" {
|
||||||
// If the port field is empty (target ends with colon), e.g. "[::1]:", this is an error.
|
// If the port field is empty (target ends with colon), e.g. "[::1]:",
|
||||||
|
// this is an error.
|
||||||
return "", "", errEndsWithColon
|
return "", "", errEndsWithColon
|
||||||
}
|
}
|
||||||
// target has port, i.e ipv4-host:port, [ipv6-host]:port, host-name:port
|
// target has port, i.e ipv4-host:port, [ipv6-host]:port, host-name:port
|
||||||
if host == "" {
|
if host == "" {
|
||||||
// Keep consistent with net.Dial(): If the host is empty, as in ":80", the local system is assumed.
|
// Keep consistent with net.Dial(): If the host is empty, as in ":80",
|
||||||
|
// the local system is assumed.
|
||||||
host = "localhost"
|
host = "localhost"
|
||||||
}
|
}
|
||||||
return host, port, nil
|
return host, port, nil
|
||||||
|
2
vendor/google.golang.org/grpc/internal/transport/http2_server.go
generated
vendored
2
vendor/google.golang.org/grpc/internal/transport/http2_server.go
generated
vendored
@ -238,7 +238,7 @@ func NewServerTransport(conn net.Conn, config *ServerConfig) (_ ServerTransport,
|
|||||||
kp.Timeout = defaultServerKeepaliveTimeout
|
kp.Timeout = defaultServerKeepaliveTimeout
|
||||||
}
|
}
|
||||||
if kp.Time != infinity {
|
if kp.Time != infinity {
|
||||||
if err = syscall.SetTCPUserTimeout(conn, kp.Timeout); err != nil {
|
if err = syscall.SetTCPUserTimeout(rawConn, kp.Timeout); err != nil {
|
||||||
return nil, connectionErrorf(false, err, "transport: failed to set TCP_USER_TIMEOUT: %v", err)
|
return nil, connectionErrorf(false, err, "transport: failed to set TCP_USER_TIMEOUT: %v", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
8
vendor/google.golang.org/grpc/resolver/resolver.go
generated
vendored
8
vendor/google.golang.org/grpc/resolver/resolver.go
generated
vendored
@ -142,6 +142,10 @@ type Address struct {
|
|||||||
|
|
||||||
// Equal returns whether a and o are identical. Metadata is compared directly,
|
// Equal returns whether a and o are identical. Metadata is compared directly,
|
||||||
// not with any recursive introspection.
|
// not with any recursive introspection.
|
||||||
|
//
|
||||||
|
// This method compares all fields of the address. When used to tell apart
|
||||||
|
// addresses during subchannel creation or connection establishment, it might be
|
||||||
|
// more appropriate for the caller to implement custom equality logic.
|
||||||
func (a Address) Equal(o Address) bool {
|
func (a Address) Equal(o Address) bool {
|
||||||
return a.Addr == o.Addr && a.ServerName == o.ServerName &&
|
return a.Addr == o.Addr && a.ServerName == o.ServerName &&
|
||||||
a.Attributes.Equal(o.Attributes) &&
|
a.Attributes.Equal(o.Attributes) &&
|
||||||
@ -264,10 +268,6 @@ type ClientConn interface {
|
|||||||
// - "unknown_scheme://authority/endpoint"
|
// - "unknown_scheme://authority/endpoint"
|
||||||
// Target{Scheme: resolver.GetDefaultScheme(), Endpoint: "unknown_scheme://authority/endpoint"}
|
// Target{Scheme: resolver.GetDefaultScheme(), Endpoint: "unknown_scheme://authority/endpoint"}
|
||||||
type Target struct {
|
type Target struct {
|
||||||
// Deprecated: use URL.Scheme instead.
|
|
||||||
Scheme string
|
|
||||||
// Deprecated: use URL.Host instead.
|
|
||||||
Authority string
|
|
||||||
// URL contains the parsed dial target with an optional default scheme added
|
// URL contains the parsed dial target with an optional default scheme added
|
||||||
// to it if the original dial target contained no scheme or contained an
|
// to it if the original dial target contained no scheme or contained an
|
||||||
// unregistered scheme. Any query params specified in the original dial
|
// unregistered scheme. Any query params specified in the original dial
|
||||||
|
27
vendor/google.golang.org/grpc/rpc_util.go
generated
vendored
27
vendor/google.golang.org/grpc/rpc_util.go
generated
vendored
@ -577,6 +577,9 @@ type parser struct {
|
|||||||
// The header of a gRPC message. Find more detail at
|
// The header of a gRPC message. Find more detail at
|
||||||
// https://github.com/grpc/grpc/blob/master/doc/PROTOCOL-HTTP2.md
|
// https://github.com/grpc/grpc/blob/master/doc/PROTOCOL-HTTP2.md
|
||||||
header [5]byte
|
header [5]byte
|
||||||
|
|
||||||
|
// recvBufferPool is the pool of shared receive buffers.
|
||||||
|
recvBufferPool SharedBufferPool
|
||||||
}
|
}
|
||||||
|
|
||||||
// recvMsg reads a complete gRPC message from the stream.
|
// recvMsg reads a complete gRPC message from the stream.
|
||||||
@ -610,9 +613,7 @@ func (p *parser) recvMsg(maxReceiveMessageSize int) (pf payloadFormat, msg []byt
|
|||||||
if int(length) > maxReceiveMessageSize {
|
if int(length) > maxReceiveMessageSize {
|
||||||
return 0, nil, status.Errorf(codes.ResourceExhausted, "grpc: received message larger than max (%d vs. %d)", length, maxReceiveMessageSize)
|
return 0, nil, status.Errorf(codes.ResourceExhausted, "grpc: received message larger than max (%d vs. %d)", length, maxReceiveMessageSize)
|
||||||
}
|
}
|
||||||
// TODO(bradfitz,zhaoq): garbage. reuse buffer after proto decoding instead
|
msg = p.recvBufferPool.Get(int(length))
|
||||||
// of making it for each message:
|
|
||||||
msg = make([]byte, int(length))
|
|
||||||
if _, err := p.r.Read(msg); err != nil {
|
if _, err := p.r.Read(msg); err != nil {
|
||||||
if err == io.EOF {
|
if err == io.EOF {
|
||||||
err = io.ErrUnexpectedEOF
|
err = io.ErrUnexpectedEOF
|
||||||
@ -726,12 +727,12 @@ type payloadInfo struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func recvAndDecompress(p *parser, s *transport.Stream, dc Decompressor, maxReceiveMessageSize int, payInfo *payloadInfo, compressor encoding.Compressor) ([]byte, error) {
|
func recvAndDecompress(p *parser, s *transport.Stream, dc Decompressor, maxReceiveMessageSize int, payInfo *payloadInfo, compressor encoding.Compressor) ([]byte, error) {
|
||||||
pf, d, err := p.recvMsg(maxReceiveMessageSize)
|
pf, buf, err := p.recvMsg(maxReceiveMessageSize)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
if payInfo != nil {
|
if payInfo != nil {
|
||||||
payInfo.compressedLength = len(d)
|
payInfo.compressedLength = len(buf)
|
||||||
}
|
}
|
||||||
|
|
||||||
if st := checkRecvPayload(pf, s.RecvCompress(), compressor != nil || dc != nil); st != nil {
|
if st := checkRecvPayload(pf, s.RecvCompress(), compressor != nil || dc != nil); st != nil {
|
||||||
@ -743,10 +744,10 @@ func recvAndDecompress(p *parser, s *transport.Stream, dc Decompressor, maxRecei
|
|||||||
// To match legacy behavior, if the decompressor is set by WithDecompressor or RPCDecompressor,
|
// To match legacy behavior, if the decompressor is set by WithDecompressor or RPCDecompressor,
|
||||||
// use this decompressor as the default.
|
// use this decompressor as the default.
|
||||||
if dc != nil {
|
if dc != nil {
|
||||||
d, err = dc.Do(bytes.NewReader(d))
|
buf, err = dc.Do(bytes.NewReader(buf))
|
||||||
size = len(d)
|
size = len(buf)
|
||||||
} else {
|
} else {
|
||||||
d, size, err = decompress(compressor, d, maxReceiveMessageSize)
|
buf, size, err = decompress(compressor, buf, maxReceiveMessageSize)
|
||||||
}
|
}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, status.Errorf(codes.Internal, "grpc: failed to decompress the received message: %v", err)
|
return nil, status.Errorf(codes.Internal, "grpc: failed to decompress the received message: %v", err)
|
||||||
@ -757,7 +758,7 @@ func recvAndDecompress(p *parser, s *transport.Stream, dc Decompressor, maxRecei
|
|||||||
return nil, status.Errorf(codes.ResourceExhausted, "grpc: received message after decompression larger than max (%d vs. %d)", size, maxReceiveMessageSize)
|
return nil, status.Errorf(codes.ResourceExhausted, "grpc: received message after decompression larger than max (%d vs. %d)", size, maxReceiveMessageSize)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return d, nil
|
return buf, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Using compressor, decompress d, returning data and size.
|
// Using compressor, decompress d, returning data and size.
|
||||||
@ -792,15 +793,17 @@ func decompress(compressor encoding.Compressor, d []byte, maxReceiveMessageSize
|
|||||||
// dc takes precedence over compressor.
|
// dc takes precedence over compressor.
|
||||||
// TODO(dfawley): wrap the old compressor/decompressor using the new API?
|
// TODO(dfawley): wrap the old compressor/decompressor using the new API?
|
||||||
func recv(p *parser, c baseCodec, s *transport.Stream, dc Decompressor, m interface{}, maxReceiveMessageSize int, payInfo *payloadInfo, compressor encoding.Compressor) error {
|
func recv(p *parser, c baseCodec, s *transport.Stream, dc Decompressor, m interface{}, maxReceiveMessageSize int, payInfo *payloadInfo, compressor encoding.Compressor) error {
|
||||||
d, err := recvAndDecompress(p, s, dc, maxReceiveMessageSize, payInfo, compressor)
|
buf, err := recvAndDecompress(p, s, dc, maxReceiveMessageSize, payInfo, compressor)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if err := c.Unmarshal(d, m); err != nil {
|
if err := c.Unmarshal(buf, m); err != nil {
|
||||||
return status.Errorf(codes.Internal, "grpc: failed to unmarshal the received message: %v", err)
|
return status.Errorf(codes.Internal, "grpc: failed to unmarshal the received message: %v", err)
|
||||||
}
|
}
|
||||||
if payInfo != nil {
|
if payInfo != nil {
|
||||||
payInfo.uncompressedBytes = d
|
payInfo.uncompressedBytes = buf
|
||||||
|
} else {
|
||||||
|
p.recvBufferPool.Put(&buf)
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
27
vendor/google.golang.org/grpc/server.go
generated
vendored
27
vendor/google.golang.org/grpc/server.go
generated
vendored
@ -174,6 +174,7 @@ type serverOptions struct {
|
|||||||
maxHeaderListSize *uint32
|
maxHeaderListSize *uint32
|
||||||
headerTableSize *uint32
|
headerTableSize *uint32
|
||||||
numServerWorkers uint32
|
numServerWorkers uint32
|
||||||
|
recvBufferPool SharedBufferPool
|
||||||
}
|
}
|
||||||
|
|
||||||
var defaultServerOptions = serverOptions{
|
var defaultServerOptions = serverOptions{
|
||||||
@ -182,6 +183,7 @@ var defaultServerOptions = serverOptions{
|
|||||||
connectionTimeout: 120 * time.Second,
|
connectionTimeout: 120 * time.Second,
|
||||||
writeBufferSize: defaultWriteBufSize,
|
writeBufferSize: defaultWriteBufSize,
|
||||||
readBufferSize: defaultReadBufSize,
|
readBufferSize: defaultReadBufSize,
|
||||||
|
recvBufferPool: nopBufferPool{},
|
||||||
}
|
}
|
||||||
var globalServerOptions []ServerOption
|
var globalServerOptions []ServerOption
|
||||||
|
|
||||||
@ -552,6 +554,27 @@ func NumStreamWorkers(numServerWorkers uint32) ServerOption {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// RecvBufferPool returns a ServerOption that configures the server
|
||||||
|
// to use the provided shared buffer pool for parsing incoming messages. Depending
|
||||||
|
// on the application's workload, this could result in reduced memory allocation.
|
||||||
|
//
|
||||||
|
// If you are unsure about how to implement a memory pool but want to utilize one,
|
||||||
|
// begin with grpc.NewSharedBufferPool.
|
||||||
|
//
|
||||||
|
// Note: The shared buffer pool feature will not be active if any of the following
|
||||||
|
// options are used: StatsHandler, EnableTracing, or binary logging. In such
|
||||||
|
// cases, the shared buffer pool will be ignored.
|
||||||
|
//
|
||||||
|
// # Experimental
|
||||||
|
//
|
||||||
|
// Notice: This API is EXPERIMENTAL and may be changed or removed in a
|
||||||
|
// later release.
|
||||||
|
func RecvBufferPool(bufferPool SharedBufferPool) ServerOption {
|
||||||
|
return newFuncServerOption(func(o *serverOptions) {
|
||||||
|
o.recvBufferPool = bufferPool
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
// serverWorkerResetThreshold defines how often the stack must be reset. Every
|
// serverWorkerResetThreshold defines how often the stack must be reset. Every
|
||||||
// N requests, by spawning a new goroutine in its place, a worker can reset its
|
// N requests, by spawning a new goroutine in its place, a worker can reset its
|
||||||
// stack so that large stacks don't live in memory forever. 2^16 should allow
|
// stack so that large stacks don't live in memory forever. 2^16 should allow
|
||||||
@ -1296,7 +1319,7 @@ func (s *Server) processUnaryRPC(t transport.ServerTransport, stream *transport.
|
|||||||
if len(shs) != 0 || len(binlogs) != 0 {
|
if len(shs) != 0 || len(binlogs) != 0 {
|
||||||
payInfo = &payloadInfo{}
|
payInfo = &payloadInfo{}
|
||||||
}
|
}
|
||||||
d, err := recvAndDecompress(&parser{r: stream}, stream, dc, s.opts.maxReceiveMessageSize, payInfo, decomp)
|
d, err := recvAndDecompress(&parser{r: stream, recvBufferPool: s.opts.recvBufferPool}, stream, dc, s.opts.maxReceiveMessageSize, payInfo, decomp)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if e := t.WriteStatus(stream, status.Convert(err)); e != nil {
|
if e := t.WriteStatus(stream, status.Convert(err)); e != nil {
|
||||||
channelz.Warningf(logger, s.channelzID, "grpc: Server.processUnaryRPC failed to write status: %v", e)
|
channelz.Warningf(logger, s.channelzID, "grpc: Server.processUnaryRPC failed to write status: %v", e)
|
||||||
@ -1506,7 +1529,7 @@ func (s *Server) processStreamingRPC(t transport.ServerTransport, stream *transp
|
|||||||
ctx: ctx,
|
ctx: ctx,
|
||||||
t: t,
|
t: t,
|
||||||
s: stream,
|
s: stream,
|
||||||
p: &parser{r: stream},
|
p: &parser{r: stream, recvBufferPool: s.opts.recvBufferPool},
|
||||||
codec: s.getCodec(stream.ContentSubtype()),
|
codec: s.getCodec(stream.ContentSubtype()),
|
||||||
maxReceiveMessageSize: s.opts.maxReceiveMessageSize,
|
maxReceiveMessageSize: s.opts.maxReceiveMessageSize,
|
||||||
maxSendMessageSize: s.opts.maxSendMessageSize,
|
maxSendMessageSize: s.opts.maxSendMessageSize,
|
||||||
|
154
vendor/google.golang.org/grpc/shared_buffer_pool.go
generated
vendored
Normal file
154
vendor/google.golang.org/grpc/shared_buffer_pool.go
generated
vendored
Normal file
@ -0,0 +1,154 @@
|
|||||||
|
/*
|
||||||
|
*
|
||||||
|
* Copyright 2023 gRPC 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.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
package grpc
|
||||||
|
|
||||||
|
import "sync"
|
||||||
|
|
||||||
|
// SharedBufferPool is a pool of buffers that can be shared, resulting in
|
||||||
|
// decreased memory allocation. Currently, in gRPC-go, it is only utilized
|
||||||
|
// for parsing incoming messages.
|
||||||
|
//
|
||||||
|
// # Experimental
|
||||||
|
//
|
||||||
|
// Notice: This API is EXPERIMENTAL and may be changed or removed in a
|
||||||
|
// later release.
|
||||||
|
type SharedBufferPool interface {
|
||||||
|
// Get returns a buffer with specified length from the pool.
|
||||||
|
//
|
||||||
|
// The returned byte slice may be not zero initialized.
|
||||||
|
Get(length int) []byte
|
||||||
|
|
||||||
|
// Put returns a buffer to the pool.
|
||||||
|
Put(*[]byte)
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewSharedBufferPool creates a simple SharedBufferPool with buckets
|
||||||
|
// of different sizes to optimize memory usage. This prevents the pool from
|
||||||
|
// wasting large amounts of memory, even when handling messages of varying sizes.
|
||||||
|
//
|
||||||
|
// # Experimental
|
||||||
|
//
|
||||||
|
// Notice: This API is EXPERIMENTAL and may be changed or removed in a
|
||||||
|
// later release.
|
||||||
|
func NewSharedBufferPool() SharedBufferPool {
|
||||||
|
return &simpleSharedBufferPool{
|
||||||
|
pools: [poolArraySize]simpleSharedBufferChildPool{
|
||||||
|
newBytesPool(level0PoolMaxSize),
|
||||||
|
newBytesPool(level1PoolMaxSize),
|
||||||
|
newBytesPool(level2PoolMaxSize),
|
||||||
|
newBytesPool(level3PoolMaxSize),
|
||||||
|
newBytesPool(level4PoolMaxSize),
|
||||||
|
newBytesPool(0),
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// simpleSharedBufferPool is a simple implementation of SharedBufferPool.
|
||||||
|
type simpleSharedBufferPool struct {
|
||||||
|
pools [poolArraySize]simpleSharedBufferChildPool
|
||||||
|
}
|
||||||
|
|
||||||
|
func (p *simpleSharedBufferPool) Get(size int) []byte {
|
||||||
|
return p.pools[p.poolIdx(size)].Get(size)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (p *simpleSharedBufferPool) Put(bs *[]byte) {
|
||||||
|
p.pools[p.poolIdx(cap(*bs))].Put(bs)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (p *simpleSharedBufferPool) poolIdx(size int) int {
|
||||||
|
switch {
|
||||||
|
case size <= level0PoolMaxSize:
|
||||||
|
return level0PoolIdx
|
||||||
|
case size <= level1PoolMaxSize:
|
||||||
|
return level1PoolIdx
|
||||||
|
case size <= level2PoolMaxSize:
|
||||||
|
return level2PoolIdx
|
||||||
|
case size <= level3PoolMaxSize:
|
||||||
|
return level3PoolIdx
|
||||||
|
case size <= level4PoolMaxSize:
|
||||||
|
return level4PoolIdx
|
||||||
|
default:
|
||||||
|
return levelMaxPoolIdx
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const (
|
||||||
|
level0PoolMaxSize = 16 // 16 B
|
||||||
|
level1PoolMaxSize = level0PoolMaxSize * 16 // 256 B
|
||||||
|
level2PoolMaxSize = level1PoolMaxSize * 16 // 4 KB
|
||||||
|
level3PoolMaxSize = level2PoolMaxSize * 16 // 64 KB
|
||||||
|
level4PoolMaxSize = level3PoolMaxSize * 16 // 1 MB
|
||||||
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
level0PoolIdx = iota
|
||||||
|
level1PoolIdx
|
||||||
|
level2PoolIdx
|
||||||
|
level3PoolIdx
|
||||||
|
level4PoolIdx
|
||||||
|
levelMaxPoolIdx
|
||||||
|
poolArraySize
|
||||||
|
)
|
||||||
|
|
||||||
|
type simpleSharedBufferChildPool interface {
|
||||||
|
Get(size int) []byte
|
||||||
|
Put(interface{})
|
||||||
|
}
|
||||||
|
|
||||||
|
type bufferPool struct {
|
||||||
|
sync.Pool
|
||||||
|
|
||||||
|
defaultSize int
|
||||||
|
}
|
||||||
|
|
||||||
|
func (p *bufferPool) Get(size int) []byte {
|
||||||
|
bs := p.Pool.Get().(*[]byte)
|
||||||
|
|
||||||
|
if cap(*bs) < size {
|
||||||
|
p.Pool.Put(bs)
|
||||||
|
|
||||||
|
return make([]byte, size)
|
||||||
|
}
|
||||||
|
|
||||||
|
return (*bs)[:size]
|
||||||
|
}
|
||||||
|
|
||||||
|
func newBytesPool(size int) simpleSharedBufferChildPool {
|
||||||
|
return &bufferPool{
|
||||||
|
Pool: sync.Pool{
|
||||||
|
New: func() interface{} {
|
||||||
|
bs := make([]byte, size)
|
||||||
|
return &bs
|
||||||
|
},
|
||||||
|
},
|
||||||
|
defaultSize: size,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// nopBufferPool is a buffer pool just makes new buffer without pooling.
|
||||||
|
type nopBufferPool struct {
|
||||||
|
}
|
||||||
|
|
||||||
|
func (nopBufferPool) Get(length int) []byte {
|
||||||
|
return make([]byte, length)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (nopBufferPool) Put(*[]byte) {
|
||||||
|
}
|
4
vendor/google.golang.org/grpc/stream.go
generated
vendored
4
vendor/google.golang.org/grpc/stream.go
generated
vendored
@ -507,7 +507,7 @@ func (a *csAttempt) newStream() error {
|
|||||||
return toRPCErr(nse.Err)
|
return toRPCErr(nse.Err)
|
||||||
}
|
}
|
||||||
a.s = s
|
a.s = s
|
||||||
a.p = &parser{r: s}
|
a.p = &parser{r: s, recvBufferPool: a.cs.cc.dopts.recvBufferPool}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1270,7 +1270,7 @@ func newNonRetryClientStream(ctx context.Context, desc *StreamDesc, method strin
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
as.s = s
|
as.s = s
|
||||||
as.p = &parser{r: s}
|
as.p = &parser{r: s, recvBufferPool: ac.dopts.recvBufferPool}
|
||||||
ac.incrCallsStarted()
|
ac.incrCallsStarted()
|
||||||
if desc != unaryStreamDesc {
|
if desc != unaryStreamDesc {
|
||||||
// Listen on stream context to cleanup when the stream context is
|
// Listen on stream context to cleanup when the stream context is
|
||||||
|
2
vendor/google.golang.org/grpc/version.go
generated
vendored
2
vendor/google.golang.org/grpc/version.go
generated
vendored
@ -19,4 +19,4 @@
|
|||||||
package grpc
|
package grpc
|
||||||
|
|
||||||
// Version is the current grpc version.
|
// Version is the current grpc version.
|
||||||
const Version = "1.56.2"
|
const Version = "1.57.0"
|
||||||
|
8
vendor/modules.txt
vendored
8
vendor/modules.txt
vendored
@ -14,7 +14,7 @@ github.com/Microsoft/go-winio/internal/socket
|
|||||||
github.com/Microsoft/go-winio/internal/stringbuffer
|
github.com/Microsoft/go-winio/internal/stringbuffer
|
||||||
github.com/Microsoft/go-winio/pkg/guid
|
github.com/Microsoft/go-winio/pkg/guid
|
||||||
github.com/Microsoft/go-winio/vhd
|
github.com/Microsoft/go-winio/vhd
|
||||||
# github.com/Microsoft/hcsshim v0.10.0
|
# github.com/Microsoft/hcsshim v0.12.0-rc.0
|
||||||
## explicit; go 1.18
|
## explicit; go 1.18
|
||||||
github.com/Microsoft/hcsshim
|
github.com/Microsoft/hcsshim
|
||||||
github.com/Microsoft/hcsshim/computestorage
|
github.com/Microsoft/hcsshim/computestorage
|
||||||
@ -161,7 +161,7 @@ github.com/containers/ocicrypt/keywrap/pkcs7
|
|||||||
github.com/containers/ocicrypt/spec
|
github.com/containers/ocicrypt/spec
|
||||||
github.com/containers/ocicrypt/utils
|
github.com/containers/ocicrypt/utils
|
||||||
github.com/containers/ocicrypt/utils/keyprovider
|
github.com/containers/ocicrypt/utils/keyprovider
|
||||||
# github.com/containers/storage v1.49.0
|
# github.com/containers/storage v1.50.1
|
||||||
## explicit; go 1.19
|
## explicit; go 1.19
|
||||||
github.com/containers/storage
|
github.com/containers/storage
|
||||||
github.com/containers/storage/drivers
|
github.com/containers/storage/drivers
|
||||||
@ -215,7 +215,7 @@ github.com/coreos/go-oidc/v3/oidc
|
|||||||
# github.com/cyberphone/json-canonicalization v0.0.0-20230710064741-aa7fe85c7dbd
|
# github.com/cyberphone/json-canonicalization v0.0.0-20230710064741-aa7fe85c7dbd
|
||||||
## explicit
|
## explicit
|
||||||
github.com/cyberphone/json-canonicalization/go/src/webpki.org/jsoncanonicalizer
|
github.com/cyberphone/json-canonicalization/go/src/webpki.org/jsoncanonicalizer
|
||||||
# github.com/cyphar/filepath-securejoin v0.2.3
|
# github.com/cyphar/filepath-securejoin v0.2.4
|
||||||
## explicit; go 1.13
|
## explicit; go 1.13
|
||||||
github.com/cyphar/filepath-securejoin
|
github.com/cyphar/filepath-securejoin
|
||||||
# github.com/davecgh/go-spew v1.1.1
|
# github.com/davecgh/go-spew v1.1.1
|
||||||
@ -693,7 +693,7 @@ google.golang.org/appengine/urlfetch
|
|||||||
# google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98
|
# google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98
|
||||||
## explicit; go 1.19
|
## explicit; go 1.19
|
||||||
google.golang.org/genproto/googleapis/rpc/status
|
google.golang.org/genproto/googleapis/rpc/status
|
||||||
# google.golang.org/grpc v1.56.2
|
# google.golang.org/grpc v1.57.0
|
||||||
## explicit; go 1.17
|
## explicit; go 1.17
|
||||||
google.golang.org/grpc
|
google.golang.org/grpc
|
||||||
google.golang.org/grpc/attributes
|
google.golang.org/grpc/attributes
|
||||||
|
Loading…
Reference in New Issue
Block a user