mirror of
https://github.com/containers/skopeo.git
synced 2025-07-12 14:08:37 +00:00
Vendor after merging https://github.com/novas0x2a/image:context-everywhere
This commit is contained in:
parent
28080c8d5f
commit
e8dea9e770
102
vendor/github.com/containers/image/copy/copy.go
generated
vendored
102
vendor/github.com/containers/image/copy/copy.go
generated
vendored
@ -104,7 +104,7 @@ type Options struct {
|
|||||||
|
|
||||||
// Image copies image from srcRef to destRef, using policyContext to validate
|
// Image copies image from srcRef to destRef, using policyContext to validate
|
||||||
// source image admissibility.
|
// source image admissibility.
|
||||||
func Image(policyContext *signature.PolicyContext, destRef, srcRef types.ImageReference, options *Options) (retErr error) {
|
func Image(ctx context.Context, policyContext *signature.PolicyContext, destRef, srcRef types.ImageReference, options *Options) (retErr error) {
|
||||||
// NOTE this function uses an output parameter for the error return value.
|
// NOTE this function uses an output parameter for the error return value.
|
||||||
// Setting this and returning is the ideal way to return an error.
|
// Setting this and returning is the ideal way to return an error.
|
||||||
//
|
//
|
||||||
@ -120,7 +120,7 @@ func Image(policyContext *signature.PolicyContext, destRef, srcRef types.ImageRe
|
|||||||
reportWriter = options.ReportWriter
|
reportWriter = options.ReportWriter
|
||||||
}
|
}
|
||||||
|
|
||||||
dest, err := destRef.NewImageDestination(options.DestinationCtx)
|
dest, err := destRef.NewImageDestination(ctx, options.DestinationCtx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return errors.Wrapf(err, "Error initializing destination %s", transports.ImageName(destRef))
|
return errors.Wrapf(err, "Error initializing destination %s", transports.ImageName(destRef))
|
||||||
}
|
}
|
||||||
@ -130,7 +130,7 @@ func Image(policyContext *signature.PolicyContext, destRef, srcRef types.ImageRe
|
|||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
||||||
rawSource, err := srcRef.NewImageSource(options.SourceCtx)
|
rawSource, err := srcRef.NewImageSource(ctx, options.SourceCtx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return errors.Wrapf(err, "Error initializing source %s", transports.ImageName(srcRef))
|
return errors.Wrapf(err, "Error initializing source %s", transports.ImageName(srcRef))
|
||||||
}
|
}
|
||||||
@ -151,32 +151,32 @@ func Image(policyContext *signature.PolicyContext, destRef, srcRef types.ImageRe
|
|||||||
}
|
}
|
||||||
|
|
||||||
unparsedToplevel := image.UnparsedInstance(rawSource, nil)
|
unparsedToplevel := image.UnparsedInstance(rawSource, nil)
|
||||||
multiImage, err := isMultiImage(unparsedToplevel)
|
multiImage, err := isMultiImage(ctx, unparsedToplevel)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return errors.Wrapf(err, "Error determining manifest MIME type for %s", transports.ImageName(srcRef))
|
return errors.Wrapf(err, "Error determining manifest MIME type for %s", transports.ImageName(srcRef))
|
||||||
}
|
}
|
||||||
|
|
||||||
if !multiImage {
|
if !multiImage {
|
||||||
// The simple case: Just copy a single image.
|
// The simple case: Just copy a single image.
|
||||||
if err := c.copyOneImage(policyContext, options, unparsedToplevel); err != nil {
|
if err := c.copyOneImage(ctx, policyContext, options, unparsedToplevel); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// This is a manifest list. Choose a single image and copy it.
|
// This is a manifest list. Choose a single image and copy it.
|
||||||
// FIXME: Copy to destinations which support manifest lists, one image at a time.
|
// FIXME: Copy to destinations which support manifest lists, one image at a time.
|
||||||
instanceDigest, err := image.ChooseManifestInstanceFromManifestList(options.SourceCtx, unparsedToplevel)
|
instanceDigest, err := image.ChooseManifestInstanceFromManifestList(ctx, options.SourceCtx, unparsedToplevel)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return errors.Wrapf(err, "Error choosing an image from manifest list %s", transports.ImageName(srcRef))
|
return errors.Wrapf(err, "Error choosing an image from manifest list %s", transports.ImageName(srcRef))
|
||||||
}
|
}
|
||||||
logrus.Debugf("Source is a manifest list; copying (only) instance %s", instanceDigest)
|
logrus.Debugf("Source is a manifest list; copying (only) instance %s", instanceDigest)
|
||||||
unparsedInstance := image.UnparsedInstance(rawSource, &instanceDigest)
|
unparsedInstance := image.UnparsedInstance(rawSource, &instanceDigest)
|
||||||
|
|
||||||
if err := c.copyOneImage(policyContext, options, unparsedInstance); err != nil {
|
if err := c.copyOneImage(ctx, policyContext, options, unparsedInstance); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := c.dest.Commit(); err != nil {
|
if err := c.dest.Commit(ctx); err != nil {
|
||||||
return errors.Wrap(err, "Error committing the finished image")
|
return errors.Wrap(err, "Error committing the finished image")
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -185,10 +185,10 @@ func Image(policyContext *signature.PolicyContext, destRef, srcRef types.ImageRe
|
|||||||
|
|
||||||
// Image copies a single (on-manifest-list) image unparsedImage, using policyContext to validate
|
// Image copies a single (on-manifest-list) image unparsedImage, using policyContext to validate
|
||||||
// source image admissibility.
|
// source image admissibility.
|
||||||
func (c *copier) copyOneImage(policyContext *signature.PolicyContext, options *Options, unparsedImage *image.UnparsedImage) (retErr error) {
|
func (c *copier) copyOneImage(ctx context.Context, policyContext *signature.PolicyContext, options *Options, unparsedImage *image.UnparsedImage) (retErr error) {
|
||||||
// The caller is handling manifest lists; this could happen only if a manifest list contains a manifest list.
|
// The caller is handling manifest lists; this could happen only if a manifest list contains a manifest list.
|
||||||
// Make sure we fail cleanly in such cases.
|
// Make sure we fail cleanly in such cases.
|
||||||
multiImage, err := isMultiImage(unparsedImage)
|
multiImage, err := isMultiImage(ctx, unparsedImage)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// FIXME FIXME: How to name a reference for the sub-image?
|
// FIXME FIXME: How to name a reference for the sub-image?
|
||||||
return errors.Wrapf(err, "Error determining manifest MIME type for %s", transports.ImageName(unparsedImage.Reference()))
|
return errors.Wrapf(err, "Error determining manifest MIME type for %s", transports.ImageName(unparsedImage.Reference()))
|
||||||
@ -200,15 +200,15 @@ func (c *copier) copyOneImage(policyContext *signature.PolicyContext, options *O
|
|||||||
// Please keep this policy check BEFORE reading any other information about the image.
|
// Please keep this policy check BEFORE reading any other information about the image.
|
||||||
// (the multiImage check above only matches the MIME type, which we have received anyway.
|
// (the multiImage check above only matches the MIME type, which we have received anyway.
|
||||||
// Actual parsing of anything should be deferred.)
|
// Actual parsing of anything should be deferred.)
|
||||||
if allowed, err := policyContext.IsRunningImageAllowed(unparsedImage); !allowed || err != nil { // Be paranoid and fail if either return value indicates so.
|
if allowed, err := policyContext.IsRunningImageAllowed(ctx, unparsedImage); !allowed || err != nil { // Be paranoid and fail if either return value indicates so.
|
||||||
return errors.Wrap(err, "Source image rejected")
|
return errors.Wrap(err, "Source image rejected")
|
||||||
}
|
}
|
||||||
src, err := image.FromUnparsedImage(options.SourceCtx, unparsedImage)
|
src, err := image.FromUnparsedImage(ctx, options.SourceCtx, unparsedImage)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return errors.Wrapf(err, "Error initializing image from source %s", transports.ImageName(c.rawSource.Reference()))
|
return errors.Wrapf(err, "Error initializing image from source %s", transports.ImageName(c.rawSource.Reference()))
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := checkImageDestinationForCurrentRuntimeOS(options.DestinationCtx, src, c.dest); err != nil {
|
if err := checkImageDestinationForCurrentRuntimeOS(ctx, options.DestinationCtx, src, c.dest); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -217,7 +217,7 @@ func (c *copier) copyOneImage(policyContext *signature.PolicyContext, options *O
|
|||||||
sigs = [][]byte{}
|
sigs = [][]byte{}
|
||||||
} else {
|
} else {
|
||||||
c.Printf("Getting image source signatures\n")
|
c.Printf("Getting image source signatures\n")
|
||||||
s, err := src.Signatures(context.TODO())
|
s, err := src.Signatures(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return errors.Wrap(err, "Error reading signatures")
|
return errors.Wrap(err, "Error reading signatures")
|
||||||
}
|
}
|
||||||
@ -225,7 +225,7 @@ func (c *copier) copyOneImage(policyContext *signature.PolicyContext, options *O
|
|||||||
}
|
}
|
||||||
if len(sigs) != 0 {
|
if len(sigs) != 0 {
|
||||||
c.Printf("Checking if image destination supports signatures\n")
|
c.Printf("Checking if image destination supports signatures\n")
|
||||||
if err := c.dest.SupportsSignatures(); err != nil {
|
if err := c.dest.SupportsSignatures(ctx); err != nil {
|
||||||
return errors.Wrap(err, "Can not copy signatures")
|
return errors.Wrap(err, "Can not copy signatures")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -244,7 +244,7 @@ func (c *copier) copyOneImage(policyContext *signature.PolicyContext, options *O
|
|||||||
|
|
||||||
// We compute preferredManifestMIMEType only to show it in error messages.
|
// We compute preferredManifestMIMEType only to show it in error messages.
|
||||||
// Without having to add this context in an error message, we would be happy enough to know only that no conversion is needed.
|
// Without having to add this context in an error message, we would be happy enough to know only that no conversion is needed.
|
||||||
preferredManifestMIMEType, otherManifestMIMETypeCandidates, err := ic.determineManifestConversion(c.dest.SupportedManifestMIMETypes(), options.ForceManifestMIMEType)
|
preferredManifestMIMEType, otherManifestMIMETypeCandidates, err := ic.determineManifestConversion(ctx, c.dest.SupportedManifestMIMETypes(), options.ForceManifestMIMEType)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -252,7 +252,7 @@ func (c *copier) copyOneImage(policyContext *signature.PolicyContext, options *O
|
|||||||
// If src.UpdatedImageNeedsLayerDiffIDs(ic.manifestUpdates) will be true, it needs to be true by the time we get here.
|
// If src.UpdatedImageNeedsLayerDiffIDs(ic.manifestUpdates) will be true, it needs to be true by the time we get here.
|
||||||
ic.diffIDsAreNeeded = src.UpdatedImageNeedsLayerDiffIDs(*ic.manifestUpdates)
|
ic.diffIDsAreNeeded = src.UpdatedImageNeedsLayerDiffIDs(*ic.manifestUpdates)
|
||||||
|
|
||||||
if err := ic.copyLayers(); err != nil {
|
if err := ic.copyLayers(ctx); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -260,7 +260,7 @@ func (c *copier) copyOneImage(policyContext *signature.PolicyContext, options *O
|
|||||||
// and at least with the OpenShift registry "acceptschema2" option, there is no way to detect the support
|
// and at least with the OpenShift registry "acceptschema2" option, there is no way to detect the support
|
||||||
// without actually trying to upload something and getting a types.ManifestTypeRejectedError.
|
// without actually trying to upload something and getting a types.ManifestTypeRejectedError.
|
||||||
// So, try the preferred manifest MIME type. If the process succeeds, fine…
|
// So, try the preferred manifest MIME type. If the process succeeds, fine…
|
||||||
manifest, err := ic.copyUpdatedConfigAndManifest()
|
manifest, err := ic.copyUpdatedConfigAndManifest(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logrus.Debugf("Writing manifest using preferred type %s failed: %v", preferredManifestMIMEType, err)
|
logrus.Debugf("Writing manifest using preferred type %s failed: %v", preferredManifestMIMEType, err)
|
||||||
// … if it fails, _and_ the failure is because the manifest is rejected, we may have other options.
|
// … if it fails, _and_ the failure is because the manifest is rejected, we may have other options.
|
||||||
@ -283,7 +283,7 @@ func (c *copier) copyOneImage(policyContext *signature.PolicyContext, options *O
|
|||||||
for _, manifestMIMEType := range otherManifestMIMETypeCandidates {
|
for _, manifestMIMEType := range otherManifestMIMETypeCandidates {
|
||||||
logrus.Debugf("Trying to use manifest type %s…", manifestMIMEType)
|
logrus.Debugf("Trying to use manifest type %s…", manifestMIMEType)
|
||||||
ic.manifestUpdates.ManifestMIMEType = manifestMIMEType
|
ic.manifestUpdates.ManifestMIMEType = manifestMIMEType
|
||||||
attemptedManifest, err := ic.copyUpdatedConfigAndManifest()
|
attemptedManifest, err := ic.copyUpdatedConfigAndManifest(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logrus.Debugf("Upload of manifest type %s failed: %v", manifestMIMEType, err)
|
logrus.Debugf("Upload of manifest type %s failed: %v", manifestMIMEType, err)
|
||||||
errs = append(errs, fmt.Sprintf("%s(%v)", manifestMIMEType, err))
|
errs = append(errs, fmt.Sprintf("%s(%v)", manifestMIMEType, err))
|
||||||
@ -309,7 +309,7 @@ func (c *copier) copyOneImage(policyContext *signature.PolicyContext, options *O
|
|||||||
}
|
}
|
||||||
|
|
||||||
c.Printf("Storing signatures\n")
|
c.Printf("Storing signatures\n")
|
||||||
if err := c.dest.PutSignatures(sigs); err != nil {
|
if err := c.dest.PutSignatures(ctx, sigs); err != nil {
|
||||||
return errors.Wrap(err, "Error writing signatures")
|
return errors.Wrap(err, "Error writing signatures")
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -325,13 +325,13 @@ func (c *copier) Printf(format string, a ...interface{}) {
|
|||||||
fmt.Fprintf(c.reportWriter, format, a...)
|
fmt.Fprintf(c.reportWriter, format, a...)
|
||||||
}
|
}
|
||||||
|
|
||||||
func checkImageDestinationForCurrentRuntimeOS(ctx *types.SystemContext, src types.Image, dest types.ImageDestination) error {
|
func checkImageDestinationForCurrentRuntimeOS(ctx context.Context, sys *types.SystemContext, src types.Image, dest types.ImageDestination) error {
|
||||||
if dest.MustMatchRuntimeOS() {
|
if dest.MustMatchRuntimeOS() {
|
||||||
wantedOS := runtime.GOOS
|
wantedOS := runtime.GOOS
|
||||||
if ctx != nil && ctx.OSChoice != "" {
|
if sys != nil && sys.OSChoice != "" {
|
||||||
wantedOS = ctx.OSChoice
|
wantedOS = sys.OSChoice
|
||||||
}
|
}
|
||||||
c, err := src.OCIConfig()
|
c, err := src.OCIConfig(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return errors.Wrapf(err, "Error parsing image configuration")
|
return errors.Wrapf(err, "Error parsing image configuration")
|
||||||
}
|
}
|
||||||
@ -364,11 +364,11 @@ func (ic *imageCopier) updateEmbeddedDockerReference() error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// copyLayers copies layers from ic.src/ic.c.rawSource to dest, using and updating ic.manifestUpdates if necessary and ic.canModifyManifest.
|
// copyLayers copies layers from ic.src/ic.c.rawSource to dest, using and updating ic.manifestUpdates if necessary and ic.canModifyManifest.
|
||||||
func (ic *imageCopier) copyLayers() error {
|
func (ic *imageCopier) copyLayers(ctx context.Context) error {
|
||||||
srcInfos := ic.src.LayerInfos()
|
srcInfos := ic.src.LayerInfos()
|
||||||
destInfos := []types.BlobInfo{}
|
destInfos := []types.BlobInfo{}
|
||||||
diffIDs := []digest.Digest{}
|
diffIDs := []digest.Digest{}
|
||||||
updatedSrcInfos, err := ic.src.LayerInfosForCopy()
|
updatedSrcInfos, err := ic.src.LayerInfosForCopy(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -396,7 +396,7 @@ func (ic *imageCopier) copyLayers() error {
|
|||||||
destInfo = srcLayer
|
destInfo = srcLayer
|
||||||
ic.c.Printf("Skipping foreign layer %q copy to %s\n", destInfo.Digest, ic.c.dest.Reference().Transport().Name())
|
ic.c.Printf("Skipping foreign layer %q copy to %s\n", destInfo.Digest, ic.c.dest.Reference().Transport().Name())
|
||||||
} else {
|
} else {
|
||||||
destInfo, diffID, err = ic.copyLayer(srcLayer)
|
destInfo, diffID, err = ic.copyLayer(ctx, srcLayer)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -429,7 +429,7 @@ func layerDigestsDiffer(a, b []types.BlobInfo) bool {
|
|||||||
|
|
||||||
// copyUpdatedConfigAndManifest updates the image per ic.manifestUpdates, if necessary,
|
// copyUpdatedConfigAndManifest updates the image per ic.manifestUpdates, if necessary,
|
||||||
// stores the resulting config and manifest to the destination, and returns the stored manifest.
|
// stores the resulting config and manifest to the destination, and returns the stored manifest.
|
||||||
func (ic *imageCopier) copyUpdatedConfigAndManifest() ([]byte, error) {
|
func (ic *imageCopier) copyUpdatedConfigAndManifest(ctx context.Context) ([]byte, error) {
|
||||||
pendingImage := ic.src
|
pendingImage := ic.src
|
||||||
if !reflect.DeepEqual(*ic.manifestUpdates, types.ManifestUpdateOptions{InformationOnly: ic.manifestUpdates.InformationOnly}) {
|
if !reflect.DeepEqual(*ic.manifestUpdates, types.ManifestUpdateOptions{InformationOnly: ic.manifestUpdates.InformationOnly}) {
|
||||||
if !ic.canModifyManifest {
|
if !ic.canModifyManifest {
|
||||||
@ -444,38 +444,38 @@ func (ic *imageCopier) copyUpdatedConfigAndManifest() ([]byte, error) {
|
|||||||
// If handling such registries turns out to be necessary, we could compute ic.diffIDsAreNeeded based on the full list of manifest MIME type candidates.
|
// If handling such registries turns out to be necessary, we could compute ic.diffIDsAreNeeded based on the full list of manifest MIME type candidates.
|
||||||
return nil, errors.Errorf("Can not convert image to %s, preparing DiffIDs for this case is not supported", ic.manifestUpdates.ManifestMIMEType)
|
return nil, errors.Errorf("Can not convert image to %s, preparing DiffIDs for this case is not supported", ic.manifestUpdates.ManifestMIMEType)
|
||||||
}
|
}
|
||||||
pi, err := ic.src.UpdatedImage(*ic.manifestUpdates)
|
pi, err := ic.src.UpdatedImage(ctx, *ic.manifestUpdates)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, errors.Wrap(err, "Error creating an updated image manifest")
|
return nil, errors.Wrap(err, "Error creating an updated image manifest")
|
||||||
}
|
}
|
||||||
pendingImage = pi
|
pendingImage = pi
|
||||||
}
|
}
|
||||||
manifest, _, err := pendingImage.Manifest()
|
manifest, _, err := pendingImage.Manifest(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, errors.Wrap(err, "Error reading manifest")
|
return nil, errors.Wrap(err, "Error reading manifest")
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := ic.c.copyConfig(pendingImage); err != nil {
|
if err := ic.c.copyConfig(ctx, pendingImage); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
ic.c.Printf("Writing manifest to image destination\n")
|
ic.c.Printf("Writing manifest to image destination\n")
|
||||||
if err := ic.c.dest.PutManifest(manifest); err != nil {
|
if err := ic.c.dest.PutManifest(ctx, manifest); err != nil {
|
||||||
return nil, errors.Wrap(err, "Error writing manifest")
|
return nil, errors.Wrap(err, "Error writing manifest")
|
||||||
}
|
}
|
||||||
return manifest, nil
|
return manifest, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// copyConfig copies config.json, if any, from src to dest.
|
// copyConfig copies config.json, if any, from src to dest.
|
||||||
func (c *copier) copyConfig(src types.Image) error {
|
func (c *copier) copyConfig(ctx context.Context, src types.Image) error {
|
||||||
srcInfo := src.ConfigInfo()
|
srcInfo := src.ConfigInfo()
|
||||||
if srcInfo.Digest != "" {
|
if srcInfo.Digest != "" {
|
||||||
c.Printf("Copying config %s\n", srcInfo.Digest)
|
c.Printf("Copying config %s\n", srcInfo.Digest)
|
||||||
configBlob, err := src.ConfigBlob()
|
configBlob, err := src.ConfigBlob(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return errors.Wrapf(err, "Error reading config blob %s", srcInfo.Digest)
|
return errors.Wrapf(err, "Error reading config blob %s", srcInfo.Digest)
|
||||||
}
|
}
|
||||||
destInfo, err := c.copyBlobFromStream(bytes.NewReader(configBlob), srcInfo, nil, false, true)
|
destInfo, err := c.copyBlobFromStream(ctx, bytes.NewReader(configBlob), srcInfo, nil, false, true)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -495,9 +495,9 @@ type diffIDResult struct {
|
|||||||
|
|
||||||
// copyLayer copies a layer with srcInfo (with known Digest and possibly known Size) in src to dest, perhaps compressing it if canCompress,
|
// copyLayer copies a layer with srcInfo (with known Digest and possibly known Size) in src to dest, perhaps compressing it if canCompress,
|
||||||
// and returns a complete blobInfo of the copied layer, and a value for LayerDiffIDs if diffIDIsNeeded
|
// and returns a complete blobInfo of the copied layer, and a value for LayerDiffIDs if diffIDIsNeeded
|
||||||
func (ic *imageCopier) copyLayer(srcInfo types.BlobInfo) (types.BlobInfo, digest.Digest, error) {
|
func (ic *imageCopier) copyLayer(ctx context.Context, srcInfo types.BlobInfo) (types.BlobInfo, digest.Digest, error) {
|
||||||
// Check if we already have a blob with this digest
|
// Check if we already have a blob with this digest
|
||||||
haveBlob, extantBlobSize, err := ic.c.dest.HasBlob(srcInfo)
|
haveBlob, extantBlobSize, err := ic.c.dest.HasBlob(ctx, srcInfo)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return types.BlobInfo{}, "", errors.Wrapf(err, "Error checking for blob %s at destination", srcInfo.Digest)
|
return types.BlobInfo{}, "", errors.Wrapf(err, "Error checking for blob %s at destination", srcInfo.Digest)
|
||||||
}
|
}
|
||||||
@ -511,7 +511,7 @@ func (ic *imageCopier) copyLayer(srcInfo types.BlobInfo) (types.BlobInfo, digest
|
|||||||
}
|
}
|
||||||
srcInfo.Size = extantBlobSize
|
srcInfo.Size = extantBlobSize
|
||||||
// Tell the image destination that this blob's delta is being applied again. For some image destinations, this can be faster than using GetBlob/PutBlob
|
// Tell the image destination that this blob's delta is being applied again. For some image destinations, this can be faster than using GetBlob/PutBlob
|
||||||
blobinfo, err := ic.c.dest.ReapplyBlob(srcInfo)
|
blobinfo, err := ic.c.dest.ReapplyBlob(ctx, srcInfo)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return types.BlobInfo{}, "", errors.Wrapf(err, "Error reapplying blob %s at destination", srcInfo.Digest)
|
return types.BlobInfo{}, "", errors.Wrapf(err, "Error reapplying blob %s at destination", srcInfo.Digest)
|
||||||
}
|
}
|
||||||
@ -521,25 +521,29 @@ func (ic *imageCopier) copyLayer(srcInfo types.BlobInfo) (types.BlobInfo, digest
|
|||||||
|
|
||||||
// Fallback: copy the layer, computing the diffID if we need to do so
|
// Fallback: copy the layer, computing the diffID if we need to do so
|
||||||
ic.c.Printf("Copying blob %s\n", srcInfo.Digest)
|
ic.c.Printf("Copying blob %s\n", srcInfo.Digest)
|
||||||
srcStream, srcBlobSize, err := ic.c.rawSource.GetBlob(srcInfo)
|
srcStream, srcBlobSize, err := ic.c.rawSource.GetBlob(ctx, srcInfo)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return types.BlobInfo{}, "", errors.Wrapf(err, "Error reading blob %s", srcInfo.Digest)
|
return types.BlobInfo{}, "", errors.Wrapf(err, "Error reading blob %s", srcInfo.Digest)
|
||||||
}
|
}
|
||||||
defer srcStream.Close()
|
defer srcStream.Close()
|
||||||
|
|
||||||
blobInfo, diffIDChan, err := ic.copyLayerFromStream(srcStream, types.BlobInfo{Digest: srcInfo.Digest, Size: srcBlobSize},
|
blobInfo, diffIDChan, err := ic.copyLayerFromStream(ctx, srcStream, types.BlobInfo{Digest: srcInfo.Digest, Size: srcBlobSize},
|
||||||
diffIDIsNeeded)
|
diffIDIsNeeded)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return types.BlobInfo{}, "", err
|
return types.BlobInfo{}, "", err
|
||||||
}
|
}
|
||||||
var diffIDResult diffIDResult // = {digest:""}
|
var diffIDResult diffIDResult // = {digest:""}
|
||||||
if diffIDIsNeeded {
|
if diffIDIsNeeded {
|
||||||
diffIDResult = <-diffIDChan
|
select {
|
||||||
if diffIDResult.err != nil {
|
case <-ctx.Done():
|
||||||
return types.BlobInfo{}, "", errors.Wrap(diffIDResult.err, "Error computing layer DiffID")
|
return types.BlobInfo{}, "", ctx.Err()
|
||||||
|
case diffIDResult = <-diffIDChan:
|
||||||
|
if diffIDResult.err != nil {
|
||||||
|
return types.BlobInfo{}, "", errors.Wrap(diffIDResult.err, "Error computing layer DiffID")
|
||||||
|
}
|
||||||
|
logrus.Debugf("Computed DiffID %s for layer %s", diffIDResult.digest, srcInfo.Digest)
|
||||||
|
ic.c.cachedDiffIDs[srcInfo.Digest] = diffIDResult.digest
|
||||||
}
|
}
|
||||||
logrus.Debugf("Computed DiffID %s for layer %s", diffIDResult.digest, srcInfo.Digest)
|
|
||||||
ic.c.cachedDiffIDs[srcInfo.Digest] = diffIDResult.digest
|
|
||||||
}
|
}
|
||||||
return blobInfo, diffIDResult.digest, nil
|
return blobInfo, diffIDResult.digest, nil
|
||||||
}
|
}
|
||||||
@ -548,7 +552,7 @@ func (ic *imageCopier) copyLayer(srcInfo types.BlobInfo) (types.BlobInfo, digest
|
|||||||
// it copies a blob with srcInfo (with known Digest and possibly known Size) from srcStream to dest,
|
// it copies a blob with srcInfo (with known Digest and possibly known Size) from srcStream to dest,
|
||||||
// perhaps compressing the stream if canCompress,
|
// perhaps compressing the stream if canCompress,
|
||||||
// and returns a complete blobInfo of the copied blob and perhaps a <-chan diffIDResult if diffIDIsNeeded, to be read by the caller.
|
// and returns a complete blobInfo of the copied blob and perhaps a <-chan diffIDResult if diffIDIsNeeded, to be read by the caller.
|
||||||
func (ic *imageCopier) copyLayerFromStream(srcStream io.Reader, srcInfo types.BlobInfo,
|
func (ic *imageCopier) copyLayerFromStream(ctx context.Context, srcStream io.Reader, srcInfo types.BlobInfo,
|
||||||
diffIDIsNeeded bool) (types.BlobInfo, <-chan diffIDResult, error) {
|
diffIDIsNeeded bool) (types.BlobInfo, <-chan diffIDResult, error) {
|
||||||
var getDiffIDRecorder func(compression.DecompressorFunc) io.Writer // = nil
|
var getDiffIDRecorder func(compression.DecompressorFunc) io.Writer // = nil
|
||||||
var diffIDChan chan diffIDResult
|
var diffIDChan chan diffIDResult
|
||||||
@ -573,7 +577,7 @@ func (ic *imageCopier) copyLayerFromStream(srcStream io.Reader, srcInfo types.Bl
|
|||||||
return pipeWriter
|
return pipeWriter
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
blobInfo, err := ic.c.copyBlobFromStream(srcStream, srcInfo, getDiffIDRecorder, ic.canModifyManifest, false) // Sets err to nil on success
|
blobInfo, err := ic.c.copyBlobFromStream(ctx, srcStream, srcInfo, getDiffIDRecorder, ic.canModifyManifest, false) // Sets err to nil on success
|
||||||
return blobInfo, diffIDChan, err
|
return blobInfo, diffIDChan, err
|
||||||
// We need the defer … pipeWriter.CloseWithError() to happen HERE so that the caller can block on reading from diffIDChan
|
// We need the defer … pipeWriter.CloseWithError() to happen HERE so that the caller can block on reading from diffIDChan
|
||||||
}
|
}
|
||||||
@ -607,7 +611,7 @@ func computeDiffID(stream io.Reader, decompressor compression.DecompressorFunc)
|
|||||||
// perhaps sending a copy to an io.Writer if getOriginalLayerCopyWriter != nil,
|
// perhaps sending a copy to an io.Writer if getOriginalLayerCopyWriter != nil,
|
||||||
// perhaps compressing it if canCompress,
|
// perhaps compressing it if canCompress,
|
||||||
// and returns a complete blobInfo of the copied blob.
|
// and returns a complete blobInfo of the copied blob.
|
||||||
func (c *copier) copyBlobFromStream(srcStream io.Reader, srcInfo types.BlobInfo,
|
func (c *copier) copyBlobFromStream(ctx context.Context, srcStream io.Reader, srcInfo types.BlobInfo,
|
||||||
getOriginalLayerCopyWriter func(decompressor compression.DecompressorFunc) io.Writer,
|
getOriginalLayerCopyWriter func(decompressor compression.DecompressorFunc) io.Writer,
|
||||||
canModifyBlob bool, isConfig bool) (types.BlobInfo, error) {
|
canModifyBlob bool, isConfig bool) (types.BlobInfo, error) {
|
||||||
// The copying happens through a pipeline of connected io.Readers.
|
// The copying happens through a pipeline of connected io.Readers.
|
||||||
@ -689,7 +693,7 @@ func (c *copier) copyBlobFromStream(srcStream io.Reader, srcInfo types.BlobInfo,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// === Finally, send the layer stream to dest.
|
// === Finally, send the layer stream to dest.
|
||||||
uploadedInfo, err := c.dest.PutBlob(destStream, inputInfo, isConfig)
|
uploadedInfo, err := c.dest.PutBlob(ctx, destStream, inputInfo, isConfig)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return types.BlobInfo{}, errors.Wrap(err, "Error writing blob")
|
return types.BlobInfo{}, errors.Wrap(err, "Error writing blob")
|
||||||
}
|
}
|
||||||
|
9
vendor/github.com/containers/image/copy/manifest.go
generated
vendored
9
vendor/github.com/containers/image/copy/manifest.go
generated
vendored
@ -1,6 +1,7 @@
|
|||||||
package copy
|
package copy
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"context"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/containers/image/manifest"
|
"github.com/containers/image/manifest"
|
||||||
@ -41,8 +42,8 @@ func (os *orderedSet) append(s string) {
|
|||||||
// Note that the conversion will only happen later, through ic.src.UpdatedImage
|
// Note that the conversion will only happen later, through ic.src.UpdatedImage
|
||||||
// Returns the preferred manifest MIME type (whether we are converting to it or using it unmodified),
|
// Returns the preferred manifest MIME type (whether we are converting to it or using it unmodified),
|
||||||
// and a list of other possible alternatives, in order.
|
// and a list of other possible alternatives, in order.
|
||||||
func (ic *imageCopier) determineManifestConversion(destSupportedManifestMIMETypes []string, forceManifestMIMEType string) (string, []string, error) {
|
func (ic *imageCopier) determineManifestConversion(ctx context.Context, destSupportedManifestMIMETypes []string, forceManifestMIMEType string) (string, []string, error) {
|
||||||
_, srcType, err := ic.src.Manifest()
|
_, srcType, err := ic.src.Manifest(ctx)
|
||||||
if err != nil { // This should have been cached?!
|
if err != nil { // This should have been cached?!
|
||||||
return "", nil, errors.Wrap(err, "Error reading manifest")
|
return "", nil, errors.Wrap(err, "Error reading manifest")
|
||||||
}
|
}
|
||||||
@ -111,8 +112,8 @@ func (ic *imageCopier) determineManifestConversion(destSupportedManifestMIMEType
|
|||||||
}
|
}
|
||||||
|
|
||||||
// isMultiImage returns true if img is a list of images
|
// isMultiImage returns true if img is a list of images
|
||||||
func isMultiImage(img types.UnparsedImage) (bool, error) {
|
func isMultiImage(ctx context.Context, img types.UnparsedImage) (bool, error) {
|
||||||
_, mt, err := img.Manifest()
|
_, mt, err := img.Manifest(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return false, err
|
return false, err
|
||||||
}
|
}
|
||||||
|
15
vendor/github.com/containers/image/directory/directory_dest.go
generated
vendored
15
vendor/github.com/containers/image/directory/directory_dest.go
generated
vendored
@ -1,6 +1,7 @@
|
|||||||
package directory
|
package directory
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"context"
|
||||||
"io"
|
"io"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"os"
|
"os"
|
||||||
@ -94,7 +95,7 @@ func (d *dirImageDestination) SupportedManifestMIMETypes() []string {
|
|||||||
|
|
||||||
// SupportsSignatures returns an error (to be displayed to the user) if the destination certainly can't store signatures.
|
// SupportsSignatures returns an error (to be displayed to the user) if the destination certainly can't store signatures.
|
||||||
// Note: It is still possible for PutSignatures to fail if SupportsSignatures returns nil.
|
// Note: It is still possible for PutSignatures to fail if SupportsSignatures returns nil.
|
||||||
func (d *dirImageDestination) SupportsSignatures() error {
|
func (d *dirImageDestination) SupportsSignatures(ctx context.Context) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -122,7 +123,7 @@ func (d *dirImageDestination) MustMatchRuntimeOS() bool {
|
|||||||
// WARNING: The contents of stream are being verified on the fly. Until stream.Read() returns io.EOF, the contents of the data SHOULD NOT be available
|
// WARNING: The contents of stream are being verified on the fly. Until stream.Read() returns io.EOF, the contents of the data SHOULD NOT be available
|
||||||
// to any other readers for download using the supplied digest.
|
// to any other readers for download using the supplied digest.
|
||||||
// If stream.Read() at any time, ESPECIALLY at end of input, returns an error, PutBlob MUST 1) fail, and 2) delete any data stored so far.
|
// If stream.Read() at any time, ESPECIALLY at end of input, returns an error, PutBlob MUST 1) fail, and 2) delete any data stored so far.
|
||||||
func (d *dirImageDestination) PutBlob(stream io.Reader, inputInfo types.BlobInfo, isConfig bool) (types.BlobInfo, error) {
|
func (d *dirImageDestination) PutBlob(ctx context.Context, stream io.Reader, inputInfo types.BlobInfo, isConfig bool) (types.BlobInfo, error) {
|
||||||
blobFile, err := ioutil.TempFile(d.ref.path, "dir-put-blob")
|
blobFile, err := ioutil.TempFile(d.ref.path, "dir-put-blob")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return types.BlobInfo{}, err
|
return types.BlobInfo{}, err
|
||||||
@ -164,7 +165,7 @@ func (d *dirImageDestination) PutBlob(stream io.Reader, inputInfo types.BlobInfo
|
|||||||
// Unlike PutBlob, the digest can not be empty. If HasBlob returns true, the size of the blob must also be returned.
|
// Unlike PutBlob, the digest can not be empty. If HasBlob returns true, the size of the blob must also be returned.
|
||||||
// If the destination does not contain the blob, or it is unknown, HasBlob ordinarily returns (false, -1, nil);
|
// If the destination does not contain the blob, or it is unknown, HasBlob ordinarily returns (false, -1, nil);
|
||||||
// it returns a non-nil error only on an unexpected failure.
|
// it returns a non-nil error only on an unexpected failure.
|
||||||
func (d *dirImageDestination) HasBlob(info types.BlobInfo) (bool, int64, error) {
|
func (d *dirImageDestination) HasBlob(ctx context.Context, info types.BlobInfo) (bool, int64, error) {
|
||||||
if info.Digest == "" {
|
if info.Digest == "" {
|
||||||
return false, -1, errors.Errorf(`"Can not check for a blob with unknown digest`)
|
return false, -1, errors.Errorf(`"Can not check for a blob with unknown digest`)
|
||||||
}
|
}
|
||||||
@ -179,7 +180,7 @@ func (d *dirImageDestination) HasBlob(info types.BlobInfo) (bool, int64, error)
|
|||||||
return true, finfo.Size(), nil
|
return true, finfo.Size(), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d *dirImageDestination) ReapplyBlob(info types.BlobInfo) (types.BlobInfo, error) {
|
func (d *dirImageDestination) ReapplyBlob(ctx context.Context, info types.BlobInfo) (types.BlobInfo, error) {
|
||||||
return info, nil
|
return info, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -187,11 +188,11 @@ func (d *dirImageDestination) ReapplyBlob(info types.BlobInfo) (types.BlobInfo,
|
|||||||
// FIXME? This should also receive a MIME type if known, to differentiate between schema versions.
|
// FIXME? This should also receive a MIME type if known, to differentiate between schema versions.
|
||||||
// If the destination is in principle available, refuses this manifest type (e.g. it does not recognize the schema),
|
// If the destination is in principle available, refuses this manifest type (e.g. it does not recognize the schema),
|
||||||
// but may accept a different manifest type, the returned error must be an ManifestTypeRejectedError.
|
// but may accept a different manifest type, the returned error must be an ManifestTypeRejectedError.
|
||||||
func (d *dirImageDestination) PutManifest(manifest []byte) error {
|
func (d *dirImageDestination) PutManifest(ctx context.Context, manifest []byte) error {
|
||||||
return ioutil.WriteFile(d.ref.manifestPath(), manifest, 0644)
|
return ioutil.WriteFile(d.ref.manifestPath(), manifest, 0644)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d *dirImageDestination) PutSignatures(signatures [][]byte) error {
|
func (d *dirImageDestination) PutSignatures(ctx context.Context, signatures [][]byte) error {
|
||||||
for i, sig := range signatures {
|
for i, sig := range signatures {
|
||||||
if err := ioutil.WriteFile(d.ref.signaturePath(i), sig, 0644); err != nil {
|
if err := ioutil.WriteFile(d.ref.signaturePath(i), sig, 0644); err != nil {
|
||||||
return err
|
return err
|
||||||
@ -204,7 +205,7 @@ func (d *dirImageDestination) PutSignatures(signatures [][]byte) error {
|
|||||||
// WARNING: This does not have any transactional semantics:
|
// WARNING: This does not have any transactional semantics:
|
||||||
// - Uploaded data MAY be visible to others before Commit() is called
|
// - Uploaded data MAY be visible to others before Commit() is called
|
||||||
// - Uploaded data MAY be removed or MAY remain around if Close() is called without Commit() (i.e. rollback is allowed but not guaranteed)
|
// - Uploaded data MAY be removed or MAY remain around if Close() is called without Commit() (i.e. rollback is allowed but not guaranteed)
|
||||||
func (d *dirImageDestination) Commit() error {
|
func (d *dirImageDestination) Commit(ctx context.Context) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
6
vendor/github.com/containers/image/directory/directory_src.go
generated
vendored
6
vendor/github.com/containers/image/directory/directory_src.go
generated
vendored
@ -37,7 +37,7 @@ func (s *dirImageSource) Close() error {
|
|||||||
// It may use a remote (= slow) service.
|
// It may use a remote (= slow) service.
|
||||||
// If instanceDigest is not nil, it contains a digest of the specific manifest instance to retrieve (when the primary manifest is a manifest list);
|
// If instanceDigest is not nil, it contains a digest of the specific manifest instance to retrieve (when the primary manifest is a manifest list);
|
||||||
// this never happens if the primary manifest is not a manifest list (e.g. if the source never returns manifest lists).
|
// this never happens if the primary manifest is not a manifest list (e.g. if the source never returns manifest lists).
|
||||||
func (s *dirImageSource) GetManifest(instanceDigest *digest.Digest) ([]byte, string, error) {
|
func (s *dirImageSource) GetManifest(ctx context.Context, instanceDigest *digest.Digest) ([]byte, string, error) {
|
||||||
if instanceDigest != nil {
|
if instanceDigest != nil {
|
||||||
return nil, "", errors.Errorf(`Getting target manifest not supported by "dir:"`)
|
return nil, "", errors.Errorf(`Getting target manifest not supported by "dir:"`)
|
||||||
}
|
}
|
||||||
@ -49,7 +49,7 @@ func (s *dirImageSource) GetManifest(instanceDigest *digest.Digest) ([]byte, str
|
|||||||
}
|
}
|
||||||
|
|
||||||
// GetBlob returns a stream for the specified blob, and the blob’s size (or -1 if unknown).
|
// GetBlob returns a stream for the specified blob, and the blob’s size (or -1 if unknown).
|
||||||
func (s *dirImageSource) GetBlob(info types.BlobInfo) (io.ReadCloser, int64, error) {
|
func (s *dirImageSource) GetBlob(ctx context.Context, info types.BlobInfo) (io.ReadCloser, int64, error) {
|
||||||
r, err := os.Open(s.ref.layerPath(info.Digest))
|
r, err := os.Open(s.ref.layerPath(info.Digest))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, -1, err
|
return nil, -1, err
|
||||||
@ -84,6 +84,6 @@ func (s *dirImageSource) GetSignatures(ctx context.Context, instanceDigest *dige
|
|||||||
}
|
}
|
||||||
|
|
||||||
// LayerInfosForCopy() returns updated layer info that should be used when copying, in preference to values in the manifest, if specified.
|
// LayerInfosForCopy() returns updated layer info that should be used when copying, in preference to values in the manifest, if specified.
|
||||||
func (s *dirImageSource) LayerInfosForCopy() ([]types.BlobInfo, error) {
|
func (s *dirImageSource) LayerInfosForCopy(ctx context.Context) ([]types.BlobInfo, error) {
|
||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
15
vendor/github.com/containers/image/directory/directory_transport.go
generated
vendored
15
vendor/github.com/containers/image/directory/directory_transport.go
generated
vendored
@ -1,6 +1,7 @@
|
|||||||
package directory
|
package directory
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"strings"
|
"strings"
|
||||||
@ -138,29 +139,29 @@ func (ref dirReference) PolicyConfigurationNamespaces() []string {
|
|||||||
// NOTE: If any kind of signature verification should happen, build an UnparsedImage from the value returned by NewImageSource,
|
// NOTE: If any kind of signature verification should happen, build an UnparsedImage from the value returned by NewImageSource,
|
||||||
// verify that UnparsedImage, and convert it into a real Image via image.FromUnparsedImage.
|
// verify that UnparsedImage, and convert it into a real Image via image.FromUnparsedImage.
|
||||||
// WARNING: This may not do the right thing for a manifest list, see image.FromSource for details.
|
// WARNING: This may not do the right thing for a manifest list, see image.FromSource for details.
|
||||||
func (ref dirReference) NewImage(ctx *types.SystemContext) (types.ImageCloser, error) {
|
func (ref dirReference) NewImage(ctx context.Context, sys *types.SystemContext) (types.ImageCloser, error) {
|
||||||
src := newImageSource(ref)
|
src := newImageSource(ref)
|
||||||
return image.FromSource(ctx, src)
|
return image.FromSource(ctx, sys, src)
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewImageSource returns a types.ImageSource for this reference.
|
// NewImageSource returns a types.ImageSource for this reference.
|
||||||
// The caller must call .Close() on the returned ImageSource.
|
// The caller must call .Close() on the returned ImageSource.
|
||||||
func (ref dirReference) NewImageSource(ctx *types.SystemContext) (types.ImageSource, error) {
|
func (ref dirReference) NewImageSource(ctx context.Context, sys *types.SystemContext) (types.ImageSource, error) {
|
||||||
return newImageSource(ref), nil
|
return newImageSource(ref), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewImageDestination returns a types.ImageDestination for this reference.
|
// NewImageDestination returns a types.ImageDestination for this reference.
|
||||||
// The caller must call .Close() on the returned ImageDestination.
|
// The caller must call .Close() on the returned ImageDestination.
|
||||||
func (ref dirReference) NewImageDestination(ctx *types.SystemContext) (types.ImageDestination, error) {
|
func (ref dirReference) NewImageDestination(ctx context.Context, sys *types.SystemContext) (types.ImageDestination, error) {
|
||||||
compress := false
|
compress := false
|
||||||
if ctx != nil {
|
if sys != nil {
|
||||||
compress = ctx.DirForceCompress
|
compress = sys.DirForceCompress
|
||||||
}
|
}
|
||||||
return newImageDestination(ref, compress)
|
return newImageDestination(ref, compress)
|
||||||
}
|
}
|
||||||
|
|
||||||
// DeleteImage deletes the named image from the registry, if supported.
|
// DeleteImage deletes the named image from the registry, if supported.
|
||||||
func (ref dirReference) DeleteImage(ctx *types.SystemContext) error {
|
func (ref dirReference) DeleteImage(ctx context.Context, sys *types.SystemContext) error {
|
||||||
return errors.Errorf("Deleting images not implemented for dir: images")
|
return errors.Errorf("Deleting images not implemented for dir: images")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
7
vendor/github.com/containers/image/docker/archive/dest.go
generated
vendored
7
vendor/github.com/containers/image/docker/archive/dest.go
generated
vendored
@ -1,6 +1,7 @@
|
|||||||
package archive
|
package archive
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"context"
|
||||||
"io"
|
"io"
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
@ -15,7 +16,7 @@ type archiveImageDestination struct {
|
|||||||
writer io.Closer
|
writer io.Closer
|
||||||
}
|
}
|
||||||
|
|
||||||
func newImageDestination(ctx *types.SystemContext, ref archiveReference) (types.ImageDestination, error) {
|
func newImageDestination(ctx context.Context, ref archiveReference) (types.ImageDestination, error) {
|
||||||
if ref.destinationRef == nil {
|
if ref.destinationRef == nil {
|
||||||
return nil, errors.Errorf("docker-archive: destination reference not supplied (must be of form <path>:<reference:tag>)")
|
return nil, errors.Errorf("docker-archive: destination reference not supplied (must be of form <path>:<reference:tag>)")
|
||||||
}
|
}
|
||||||
@ -66,6 +67,6 @@ func (d *archiveImageDestination) Close() error {
|
|||||||
// WARNING: This does not have any transactional semantics:
|
// WARNING: This does not have any transactional semantics:
|
||||||
// - Uploaded data MAY be visible to others before Commit() is called
|
// - Uploaded data MAY be visible to others before Commit() is called
|
||||||
// - Uploaded data MAY be removed or MAY remain around if Close() is called without Commit() (i.e. rollback is allowed but not guaranteed)
|
// - Uploaded data MAY be removed or MAY remain around if Close() is called without Commit() (i.e. rollback is allowed but not guaranteed)
|
||||||
func (d *archiveImageDestination) Commit() error {
|
func (d *archiveImageDestination) Commit(ctx context.Context) error {
|
||||||
return d.Destination.Commit()
|
return d.Destination.Commit(ctx)
|
||||||
}
|
}
|
||||||
|
5
vendor/github.com/containers/image/docker/archive/src.go
generated
vendored
5
vendor/github.com/containers/image/docker/archive/src.go
generated
vendored
@ -1,6 +1,7 @@
|
|||||||
package archive
|
package archive
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"context"
|
||||||
"github.com/containers/image/docker/tarfile"
|
"github.com/containers/image/docker/tarfile"
|
||||||
"github.com/containers/image/types"
|
"github.com/containers/image/types"
|
||||||
"github.com/sirupsen/logrus"
|
"github.com/sirupsen/logrus"
|
||||||
@ -13,7 +14,7 @@ type archiveImageSource struct {
|
|||||||
|
|
||||||
// newImageSource returns a types.ImageSource for the specified image reference.
|
// newImageSource returns a types.ImageSource for the specified image reference.
|
||||||
// The caller must call .Close() on the returned ImageSource.
|
// The caller must call .Close() on the returned ImageSource.
|
||||||
func newImageSource(ctx *types.SystemContext, ref archiveReference) (types.ImageSource, error) {
|
func newImageSource(ctx context.Context, ref archiveReference) (types.ImageSource, error) {
|
||||||
if ref.destinationRef != nil {
|
if ref.destinationRef != nil {
|
||||||
logrus.Warnf("docker-archive: references are not supported for sources (ignoring)")
|
logrus.Warnf("docker-archive: references are not supported for sources (ignoring)")
|
||||||
}
|
}
|
||||||
@ -34,6 +35,6 @@ func (s *archiveImageSource) Reference() types.ImageReference {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// LayerInfosForCopy() returns updated layer info that should be used when reading, in preference to values in the manifest, if specified.
|
// LayerInfosForCopy() returns updated layer info that should be used when reading, in preference to values in the manifest, if specified.
|
||||||
func (s *archiveImageSource) LayerInfosForCopy() ([]types.BlobInfo, error) {
|
func (s *archiveImageSource) LayerInfosForCopy(ctx context.Context) ([]types.BlobInfo, error) {
|
||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
11
vendor/github.com/containers/image/docker/archive/transport.go
generated
vendored
11
vendor/github.com/containers/image/docker/archive/transport.go
generated
vendored
@ -1,6 +1,7 @@
|
|||||||
package archive
|
package archive
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
@ -130,28 +131,28 @@ func (ref archiveReference) PolicyConfigurationNamespaces() []string {
|
|||||||
// NOTE: If any kind of signature verification should happen, build an UnparsedImage from the value returned by NewImageSource,
|
// NOTE: If any kind of signature verification should happen, build an UnparsedImage from the value returned by NewImageSource,
|
||||||
// verify that UnparsedImage, and convert it into a real Image via image.FromUnparsedImage.
|
// verify that UnparsedImage, and convert it into a real Image via image.FromUnparsedImage.
|
||||||
// WARNING: This may not do the right thing for a manifest list, see image.FromSource for details.
|
// WARNING: This may not do the right thing for a manifest list, see image.FromSource for details.
|
||||||
func (ref archiveReference) NewImage(ctx *types.SystemContext) (types.ImageCloser, error) {
|
func (ref archiveReference) NewImage(ctx context.Context, sys *types.SystemContext) (types.ImageCloser, error) {
|
||||||
src, err := newImageSource(ctx, ref)
|
src, err := newImageSource(ctx, ref)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
return ctrImage.FromSource(ctx, src)
|
return ctrImage.FromSource(ctx, sys, src)
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewImageSource returns a types.ImageSource for this reference.
|
// NewImageSource returns a types.ImageSource for this reference.
|
||||||
// The caller must call .Close() on the returned ImageSource.
|
// The caller must call .Close() on the returned ImageSource.
|
||||||
func (ref archiveReference) NewImageSource(ctx *types.SystemContext) (types.ImageSource, error) {
|
func (ref archiveReference) NewImageSource(ctx context.Context, sys *types.SystemContext) (types.ImageSource, error) {
|
||||||
return newImageSource(ctx, ref)
|
return newImageSource(ctx, ref)
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewImageDestination returns a types.ImageDestination for this reference.
|
// NewImageDestination returns a types.ImageDestination for this reference.
|
||||||
// The caller must call .Close() on the returned ImageDestination.
|
// The caller must call .Close() on the returned ImageDestination.
|
||||||
func (ref archiveReference) NewImageDestination(ctx *types.SystemContext) (types.ImageDestination, error) {
|
func (ref archiveReference) NewImageDestination(ctx context.Context, sys *types.SystemContext) (types.ImageDestination, error) {
|
||||||
return newImageDestination(ctx, ref)
|
return newImageDestination(ctx, ref)
|
||||||
}
|
}
|
||||||
|
|
||||||
// DeleteImage deletes the named image from the registry, if supported.
|
// DeleteImage deletes the named image from the registry, if supported.
|
||||||
func (ref archiveReference) DeleteImage(ctx *types.SystemContext) error {
|
func (ref archiveReference) DeleteImage(ctx context.Context, sys *types.SystemContext) error {
|
||||||
// Not really supported, for safety reasons.
|
// Not really supported, for safety reasons.
|
||||||
return errors.New("Deleting images not implemented for docker-archive: images")
|
return errors.New("Deleting images not implemented for docker-archive: images")
|
||||||
}
|
}
|
||||||
|
20
vendor/github.com/containers/image/docker/daemon/client.go
generated
vendored
20
vendor/github.com/containers/image/docker/daemon/client.go
generated
vendored
@ -15,10 +15,10 @@ const (
|
|||||||
)
|
)
|
||||||
|
|
||||||
// NewDockerClient initializes a new API client based on the passed SystemContext.
|
// NewDockerClient initializes a new API client based on the passed SystemContext.
|
||||||
func newDockerClient(ctx *types.SystemContext) (*dockerclient.Client, error) {
|
func newDockerClient(sys *types.SystemContext) (*dockerclient.Client, error) {
|
||||||
host := dockerclient.DefaultDockerHost
|
host := dockerclient.DefaultDockerHost
|
||||||
if ctx != nil && ctx.DockerDaemonHost != "" {
|
if sys != nil && sys.DockerDaemonHost != "" {
|
||||||
host = ctx.DockerDaemonHost
|
host = sys.DockerDaemonHost
|
||||||
}
|
}
|
||||||
|
|
||||||
// Sadly, unix:// sockets don't work transparently with dockerclient.NewClient.
|
// Sadly, unix:// sockets don't work transparently with dockerclient.NewClient.
|
||||||
@ -39,7 +39,7 @@ func newDockerClient(ctx *types.SystemContext) (*dockerclient.Client, error) {
|
|||||||
if proto == "http" {
|
if proto == "http" {
|
||||||
httpClient = httpConfig()
|
httpClient = httpConfig()
|
||||||
} else {
|
} else {
|
||||||
hc, err := tlsConfig(ctx)
|
hc, err := tlsConfig(sys)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -50,16 +50,16 @@ func newDockerClient(ctx *types.SystemContext) (*dockerclient.Client, error) {
|
|||||||
return dockerclient.NewClient(host, defaultAPIVersion, httpClient, nil)
|
return dockerclient.NewClient(host, defaultAPIVersion, httpClient, nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
func tlsConfig(ctx *types.SystemContext) (*http.Client, error) {
|
func tlsConfig(sys *types.SystemContext) (*http.Client, error) {
|
||||||
options := tlsconfig.Options{}
|
options := tlsconfig.Options{}
|
||||||
if ctx != nil && ctx.DockerDaemonInsecureSkipTLSVerify {
|
if sys != nil && sys.DockerDaemonInsecureSkipTLSVerify {
|
||||||
options.InsecureSkipVerify = true
|
options.InsecureSkipVerify = true
|
||||||
}
|
}
|
||||||
|
|
||||||
if ctx != nil && ctx.DockerDaemonCertPath != "" {
|
if sys != nil && sys.DockerDaemonCertPath != "" {
|
||||||
options.CAFile = filepath.Join(ctx.DockerDaemonCertPath, "ca.pem")
|
options.CAFile = filepath.Join(sys.DockerDaemonCertPath, "ca.pem")
|
||||||
options.CertFile = filepath.Join(ctx.DockerDaemonCertPath, "cert.pem")
|
options.CertFile = filepath.Join(sys.DockerDaemonCertPath, "cert.pem")
|
||||||
options.KeyFile = filepath.Join(ctx.DockerDaemonCertPath, "key.pem")
|
options.KeyFile = filepath.Join(sys.DockerDaemonCertPath, "key.pem")
|
||||||
}
|
}
|
||||||
|
|
||||||
tlsc, err := tlsconfig.Client(options)
|
tlsc, err := tlsconfig.Client(options)
|
||||||
|
22
vendor/github.com/containers/image/docker/daemon/daemon_dest.go
generated
vendored
22
vendor/github.com/containers/image/docker/daemon/daemon_dest.go
generated
vendored
@ -1,6 +1,7 @@
|
|||||||
package daemon
|
package daemon
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"context"
|
||||||
"io"
|
"io"
|
||||||
|
|
||||||
"github.com/containers/image/docker/reference"
|
"github.com/containers/image/docker/reference"
|
||||||
@ -9,7 +10,6 @@ import (
|
|||||||
"github.com/docker/docker/client"
|
"github.com/docker/docker/client"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
"github.com/sirupsen/logrus"
|
"github.com/sirupsen/logrus"
|
||||||
"golang.org/x/net/context"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type daemonImageDestination struct {
|
type daemonImageDestination struct {
|
||||||
@ -25,7 +25,7 @@ type daemonImageDestination struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// newImageDestination returns a types.ImageDestination for the specified image reference.
|
// newImageDestination returns a types.ImageDestination for the specified image reference.
|
||||||
func newImageDestination(ctx *types.SystemContext, ref daemonReference) (types.ImageDestination, error) {
|
func newImageDestination(ctx context.Context, sys *types.SystemContext, ref daemonReference) (types.ImageDestination, error) {
|
||||||
if ref.ref == nil {
|
if ref.ref == nil {
|
||||||
return nil, errors.Errorf("Invalid destination docker-daemon:%s: a destination must be a name:tag", ref.StringWithinTransport())
|
return nil, errors.Errorf("Invalid destination docker-daemon:%s: a destination must be a name:tag", ref.StringWithinTransport())
|
||||||
}
|
}
|
||||||
@ -35,11 +35,11 @@ func newImageDestination(ctx *types.SystemContext, ref daemonReference) (types.I
|
|||||||
}
|
}
|
||||||
|
|
||||||
var mustMatchRuntimeOS = true
|
var mustMatchRuntimeOS = true
|
||||||
if ctx != nil && ctx.DockerDaemonHost != client.DefaultDockerHost {
|
if sys != nil && sys.DockerDaemonHost != client.DefaultDockerHost {
|
||||||
mustMatchRuntimeOS = false
|
mustMatchRuntimeOS = false
|
||||||
}
|
}
|
||||||
|
|
||||||
c, err := newDockerClient(ctx)
|
c, err := newDockerClient(sys)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, errors.Wrap(err, "Error initializing docker engine client")
|
return nil, errors.Wrap(err, "Error initializing docker engine client")
|
||||||
}
|
}
|
||||||
@ -48,7 +48,7 @@ func newImageDestination(ctx *types.SystemContext, ref daemonReference) (types.I
|
|||||||
// Commit() may never be called, so we may never read from this channel; so, make this buffered to allow imageLoadGoroutine to write status and terminate even if we never read it.
|
// Commit() may never be called, so we may never read from this channel; so, make this buffered to allow imageLoadGoroutine to write status and terminate even if we never read it.
|
||||||
statusChannel := make(chan error, 1)
|
statusChannel := make(chan error, 1)
|
||||||
|
|
||||||
goroutineContext, goroutineCancel := context.WithCancel(context.Background())
|
goroutineContext, goroutineCancel := context.WithCancel(ctx)
|
||||||
go imageLoadGoroutine(goroutineContext, c, reader, statusChannel)
|
go imageLoadGoroutine(goroutineContext, c, reader, statusChannel)
|
||||||
|
|
||||||
return &daemonImageDestination{
|
return &daemonImageDestination{
|
||||||
@ -124,9 +124,9 @@ func (d *daemonImageDestination) Reference() types.ImageReference {
|
|||||||
// WARNING: This does not have any transactional semantics:
|
// WARNING: This does not have any transactional semantics:
|
||||||
// - Uploaded data MAY be visible to others before Commit() is called
|
// - Uploaded data MAY be visible to others before Commit() is called
|
||||||
// - Uploaded data MAY be removed or MAY remain around if Close() is called without Commit() (i.e. rollback is allowed but not guaranteed)
|
// - Uploaded data MAY be removed or MAY remain around if Close() is called without Commit() (i.e. rollback is allowed but not guaranteed)
|
||||||
func (d *daemonImageDestination) Commit() error {
|
func (d *daemonImageDestination) Commit(ctx context.Context) error {
|
||||||
logrus.Debugf("docker-daemon: Closing tar stream")
|
logrus.Debugf("docker-daemon: Closing tar stream")
|
||||||
if err := d.Destination.Commit(); err != nil {
|
if err := d.Destination.Commit(ctx); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if err := d.writer.Close(); err != nil {
|
if err := d.writer.Close(); err != nil {
|
||||||
@ -135,6 +135,10 @@ func (d *daemonImageDestination) Commit() error {
|
|||||||
d.committed = true // We may still fail, but we are done sending to imageLoadGoroutine.
|
d.committed = true // We may still fail, but we are done sending to imageLoadGoroutine.
|
||||||
|
|
||||||
logrus.Debugf("docker-daemon: Waiting for status")
|
logrus.Debugf("docker-daemon: Waiting for status")
|
||||||
err := <-d.statusChannel
|
select {
|
||||||
return err
|
case <-ctx.Done():
|
||||||
|
return ctx.Err()
|
||||||
|
case err := <-d.statusChannel:
|
||||||
|
return err
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
11
vendor/github.com/containers/image/docker/daemon/daemon_src.go
generated
vendored
11
vendor/github.com/containers/image/docker/daemon/daemon_src.go
generated
vendored
@ -1,10 +1,11 @@
|
|||||||
package daemon
|
package daemon
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"context"
|
||||||
|
|
||||||
"github.com/containers/image/docker/tarfile"
|
"github.com/containers/image/docker/tarfile"
|
||||||
"github.com/containers/image/types"
|
"github.com/containers/image/types"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
"golang.org/x/net/context"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type daemonImageSource struct {
|
type daemonImageSource struct {
|
||||||
@ -26,14 +27,14 @@ type layerInfo struct {
|
|||||||
// (We could, perhaps, expect an exact sequence, assume that the first plaintext file
|
// (We could, perhaps, expect an exact sequence, assume that the first plaintext file
|
||||||
// is the config, and that the following len(RootFS) files are the layers, but that feels
|
// is the config, and that the following len(RootFS) files are the layers, but that feels
|
||||||
// way too brittle.)
|
// way too brittle.)
|
||||||
func newImageSource(ctx *types.SystemContext, ref daemonReference) (types.ImageSource, error) {
|
func newImageSource(ctx context.Context, sys *types.SystemContext, ref daemonReference) (types.ImageSource, error) {
|
||||||
c, err := newDockerClient(ctx)
|
c, err := newDockerClient(sys)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, errors.Wrap(err, "Error initializing docker engine client")
|
return nil, errors.Wrap(err, "Error initializing docker engine client")
|
||||||
}
|
}
|
||||||
// Per NewReference(), ref.StringWithinTransport() is either an image ID (config digest), or a !reference.NameOnly() reference.
|
// Per NewReference(), ref.StringWithinTransport() is either an image ID (config digest), or a !reference.NameOnly() reference.
|
||||||
// Either way ImageSave should create a tarball with exactly one image.
|
// Either way ImageSave should create a tarball with exactly one image.
|
||||||
inputStream, err := c.ImageSave(context.TODO(), []string{ref.StringWithinTransport()})
|
inputStream, err := c.ImageSave(ctx, []string{ref.StringWithinTransport()})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, errors.Wrap(err, "Error loading image from docker engine")
|
return nil, errors.Wrap(err, "Error loading image from docker engine")
|
||||||
}
|
}
|
||||||
@ -56,6 +57,6 @@ func (s *daemonImageSource) Reference() types.ImageReference {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// LayerInfosForCopy() returns updated layer info that should be used when reading, in preference to values in the manifest, if specified.
|
// LayerInfosForCopy() returns updated layer info that should be used when reading, in preference to values in the manifest, if specified.
|
||||||
func (s *daemonImageSource) LayerInfosForCopy() ([]types.BlobInfo, error) {
|
func (s *daemonImageSource) LayerInfosForCopy(ctx context.Context) ([]types.BlobInfo, error) {
|
||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
17
vendor/github.com/containers/image/docker/daemon/daemon_transport.go
generated
vendored
17
vendor/github.com/containers/image/docker/daemon/daemon_transport.go
generated
vendored
@ -1,6 +1,7 @@
|
|||||||
package daemon
|
package daemon
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"context"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
|
|
||||||
"github.com/containers/image/docker/reference"
|
"github.com/containers/image/docker/reference"
|
||||||
@ -156,28 +157,28 @@ func (ref daemonReference) PolicyConfigurationNamespaces() []string {
|
|||||||
// NOTE: If any kind of signature verification should happen, build an UnparsedImage from the value returned by NewImageSource,
|
// NOTE: If any kind of signature verification should happen, build an UnparsedImage from the value returned by NewImageSource,
|
||||||
// verify that UnparsedImage, and convert it into a real Image via image.FromUnparsedImage.
|
// verify that UnparsedImage, and convert it into a real Image via image.FromUnparsedImage.
|
||||||
// WARNING: This may not do the right thing for a manifest list, see image.FromSource for details.
|
// WARNING: This may not do the right thing for a manifest list, see image.FromSource for details.
|
||||||
func (ref daemonReference) NewImage(ctx *types.SystemContext) (types.ImageCloser, error) {
|
func (ref daemonReference) NewImage(ctx context.Context, sys *types.SystemContext) (types.ImageCloser, error) {
|
||||||
src, err := newImageSource(ctx, ref)
|
src, err := newImageSource(ctx, sys, ref)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
return image.FromSource(ctx, src)
|
return image.FromSource(ctx, sys, src)
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewImageSource returns a types.ImageSource for this reference.
|
// NewImageSource returns a types.ImageSource for this reference.
|
||||||
// The caller must call .Close() on the returned ImageSource.
|
// The caller must call .Close() on the returned ImageSource.
|
||||||
func (ref daemonReference) NewImageSource(ctx *types.SystemContext) (types.ImageSource, error) {
|
func (ref daemonReference) NewImageSource(ctx context.Context, sys *types.SystemContext) (types.ImageSource, error) {
|
||||||
return newImageSource(ctx, ref)
|
return newImageSource(ctx, sys, ref)
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewImageDestination returns a types.ImageDestination for this reference.
|
// NewImageDestination returns a types.ImageDestination for this reference.
|
||||||
// The caller must call .Close() on the returned ImageDestination.
|
// The caller must call .Close() on the returned ImageDestination.
|
||||||
func (ref daemonReference) NewImageDestination(ctx *types.SystemContext) (types.ImageDestination, error) {
|
func (ref daemonReference) NewImageDestination(ctx context.Context, sys *types.SystemContext) (types.ImageDestination, error) {
|
||||||
return newImageDestination(ctx, ref)
|
return newImageDestination(ctx, sys, ref)
|
||||||
}
|
}
|
||||||
|
|
||||||
// DeleteImage deletes the named image from the registry, if supported.
|
// DeleteImage deletes the named image from the registry, if supported.
|
||||||
func (ref daemonReference) DeleteImage(ctx *types.SystemContext) error {
|
func (ref daemonReference) DeleteImage(ctx context.Context, sys *types.SystemContext) error {
|
||||||
// Should this just untag the image? Should this stop running containers?
|
// Should this just untag the image? Should this stop running containers?
|
||||||
// The semantics is not quite as clear as for remote repositories.
|
// The semantics is not quite as clear as for remote repositories.
|
||||||
// The user can run (docker rmi) directly anyway, so, for now(?), punt instead of trying to guess what the user meant.
|
// The user can run (docker rmi) directly anyway, so, for now(?), punt instead of trying to guess what the user meant.
|
||||||
|
50
vendor/github.com/containers/image/docker/docker_client.go
generated
vendored
50
vendor/github.com/containers/image/docker/docker_client.go
generated
vendored
@ -78,7 +78,7 @@ type bearerToken struct {
|
|||||||
// dockerClient is configuration for dealing with a single Docker registry.
|
// dockerClient is configuration for dealing with a single Docker registry.
|
||||||
type dockerClient struct {
|
type dockerClient struct {
|
||||||
// The following members are set by newDockerClient and do not change afterwards.
|
// The following members are set by newDockerClient and do not change afterwards.
|
||||||
ctx *types.SystemContext
|
sys *types.SystemContext
|
||||||
registry string
|
registry string
|
||||||
username string
|
username string
|
||||||
password string
|
password string
|
||||||
@ -131,12 +131,12 @@ func serverDefault() *tls.Config {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// dockerCertDir returns a path to a directory to be consumed by tlsclientconfig.SetupCertificates() depending on ctx and hostPort.
|
// dockerCertDir returns a path to a directory to be consumed by tlsclientconfig.SetupCertificates() depending on ctx and hostPort.
|
||||||
func dockerCertDir(ctx *types.SystemContext, hostPort string) (string, error) {
|
func dockerCertDir(sys *types.SystemContext, hostPort string) (string, error) {
|
||||||
if ctx != nil && ctx.DockerCertPath != "" {
|
if sys != nil && sys.DockerCertPath != "" {
|
||||||
return ctx.DockerCertPath, nil
|
return sys.DockerCertPath, nil
|
||||||
}
|
}
|
||||||
if ctx != nil && ctx.DockerPerHostCertDirPath != "" {
|
if sys != nil && sys.DockerPerHostCertDirPath != "" {
|
||||||
return filepath.Join(ctx.DockerPerHostCertDirPath, hostPort), nil
|
return filepath.Join(sys.DockerPerHostCertDirPath, hostPort), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@ -144,8 +144,8 @@ func dockerCertDir(ctx *types.SystemContext, hostPort string) (string, error) {
|
|||||||
fullCertDirPath string
|
fullCertDirPath string
|
||||||
)
|
)
|
||||||
for _, systemPerHostCertDirPath := range systemPerHostCertDirPaths {
|
for _, systemPerHostCertDirPath := range systemPerHostCertDirPaths {
|
||||||
if ctx != nil && ctx.RootForImplicitAbsolutePaths != "" {
|
if sys != nil && sys.RootForImplicitAbsolutePaths != "" {
|
||||||
hostCertDir = filepath.Join(ctx.RootForImplicitAbsolutePaths, systemPerHostCertDirPath)
|
hostCertDir = filepath.Join(sys.RootForImplicitAbsolutePaths, systemPerHostCertDirPath)
|
||||||
} else {
|
} else {
|
||||||
hostCertDir = systemPerHostCertDirPath
|
hostCertDir = systemPerHostCertDirPath
|
||||||
}
|
}
|
||||||
@ -171,23 +171,23 @@ func dockerCertDir(ctx *types.SystemContext, hostPort string) (string, error) {
|
|||||||
|
|
||||||
// newDockerClientFromRef returns a new dockerClient instance for refHostname (a host a specified in the Docker image reference, not canonicalized to dockerRegistry)
|
// newDockerClientFromRef returns a new dockerClient instance for refHostname (a host a specified in the Docker image reference, not canonicalized to dockerRegistry)
|
||||||
// “write” specifies whether the client will be used for "write" access (in particular passed to lookaside.go:toplevelFromSection)
|
// “write” specifies whether the client will be used for "write" access (in particular passed to lookaside.go:toplevelFromSection)
|
||||||
func newDockerClientFromRef(ctx *types.SystemContext, ref dockerReference, write bool, actions string) (*dockerClient, error) {
|
func newDockerClientFromRef(ctx context.Context, sys *types.SystemContext, ref dockerReference, write bool, actions string) (*dockerClient, error) {
|
||||||
registry := reference.Domain(ref.ref)
|
registry := reference.Domain(ref.ref)
|
||||||
username, password, err := config.GetAuthentication(ctx, reference.Domain(ref.ref))
|
username, password, err := config.GetAuthentication(sys, reference.Domain(ref.ref))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, errors.Wrapf(err, "error getting username and password")
|
return nil, errors.Wrapf(err, "error getting username and password")
|
||||||
}
|
}
|
||||||
sigBase, err := configuredSignatureStorageBase(ctx, ref, write)
|
sigBase, err := configuredSignatureStorageBase(sys, ref, write)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
remoteName := reference.Path(ref.ref)
|
remoteName := reference.Path(ref.ref)
|
||||||
|
|
||||||
return newDockerClientWithDetails(ctx, registry, username, password, actions, sigBase, remoteName)
|
return newDockerClientWithDetails(sys, registry, username, password, actions, sigBase, remoteName)
|
||||||
}
|
}
|
||||||
|
|
||||||
// newDockerClientWithDetails returns a new dockerClient instance for the given parameters
|
// newDockerClientWithDetails returns a new dockerClient instance for the given parameters
|
||||||
func newDockerClientWithDetails(ctx *types.SystemContext, registry, username, password, actions string, sigBase signatureStorageBase, remoteName string) (*dockerClient, error) {
|
func newDockerClientWithDetails(sys *types.SystemContext, registry, username, password, actions string, sigBase signatureStorageBase, remoteName string) (*dockerClient, error) {
|
||||||
hostName := registry
|
hostName := registry
|
||||||
if registry == dockerHostname {
|
if registry == dockerHostname {
|
||||||
registry = dockerRegistry
|
registry = dockerRegistry
|
||||||
@ -200,7 +200,7 @@ func newDockerClientWithDetails(ctx *types.SystemContext, registry, username, pa
|
|||||||
// dockerHostname here, because it is more symmetrical to read the configuration in that case as well, and because
|
// dockerHostname here, because it is more symmetrical to read the configuration in that case as well, and because
|
||||||
// generally the UI hides the existence of the different dockerRegistry. But note that this behavior is
|
// generally the UI hides the existence of the different dockerRegistry. But note that this behavior is
|
||||||
// undocumented and may change if docker/docker changes.
|
// undocumented and may change if docker/docker changes.
|
||||||
certDir, err := dockerCertDir(ctx, hostName)
|
certDir, err := dockerCertDir(sys, hostName)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -208,12 +208,12 @@ func newDockerClientWithDetails(ctx *types.SystemContext, registry, username, pa
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
if ctx != nil && ctx.DockerInsecureSkipTLSVerify {
|
if sys != nil && sys.DockerInsecureSkipTLSVerify {
|
||||||
tr.TLSClientConfig.InsecureSkipVerify = true
|
tr.TLSClientConfig.InsecureSkipVerify = true
|
||||||
}
|
}
|
||||||
|
|
||||||
return &dockerClient{
|
return &dockerClient{
|
||||||
ctx: ctx,
|
sys: sys,
|
||||||
registry: registry,
|
registry: registry,
|
||||||
username: username,
|
username: username,
|
||||||
password: password,
|
password: password,
|
||||||
@ -228,8 +228,8 @@ func newDockerClientWithDetails(ctx *types.SystemContext, registry, username, pa
|
|||||||
|
|
||||||
// CheckAuth validates the credentials by attempting to log into the registry
|
// CheckAuth validates the credentials by attempting to log into the registry
|
||||||
// returns an error if an error occcured while making the http request or the status code received was 401
|
// returns an error if an error occcured while making the http request or the status code received was 401
|
||||||
func CheckAuth(ctx context.Context, sCtx *types.SystemContext, username, password, registry string) error {
|
func CheckAuth(ctx context.Context, sys *types.SystemContext, username, password, registry string) error {
|
||||||
newLoginClient, err := newDockerClientWithDetails(sCtx, registry, username, password, "", nil, "")
|
newLoginClient, err := newDockerClientWithDetails(sys, registry, username, password, "", nil, "")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return errors.Wrapf(err, "error creating new docker client")
|
return errors.Wrapf(err, "error creating new docker client")
|
||||||
}
|
}
|
||||||
@ -268,7 +268,7 @@ type SearchResult struct {
|
|||||||
// The limit is the max number of results desired
|
// The limit is the max number of results desired
|
||||||
// Note: The limit value doesn't work with all registries
|
// Note: The limit value doesn't work with all registries
|
||||||
// for example registry.access.redhat.com returns all the results without limiting it to the limit value
|
// for example registry.access.redhat.com returns all the results without limiting it to the limit value
|
||||||
func SearchRegistry(ctx context.Context, sCtx *types.SystemContext, registry, image string, limit int) ([]SearchResult, error) {
|
func SearchRegistry(ctx context.Context, sys *types.SystemContext, registry, image string, limit int) ([]SearchResult, error) {
|
||||||
type V2Results struct {
|
type V2Results struct {
|
||||||
// Repositories holds the results returned by the /v2/_catalog endpoint
|
// Repositories holds the results returned by the /v2/_catalog endpoint
|
||||||
Repositories []string `json:"repositories"`
|
Repositories []string `json:"repositories"`
|
||||||
@ -286,7 +286,7 @@ func SearchRegistry(ctx context.Context, sCtx *types.SystemContext, registry, im
|
|||||||
registry = dockerV1Hostname
|
registry = dockerV1Hostname
|
||||||
}
|
}
|
||||||
|
|
||||||
client, err := newDockerClientWithDetails(sCtx, registry, "", "", "", nil, "")
|
client, err := newDockerClientWithDetails(sys, registry, "", "", "", nil, "")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, errors.Wrapf(err, "error creating new docker client")
|
return nil, errors.Wrapf(err, "error creating new docker client")
|
||||||
}
|
}
|
||||||
@ -374,8 +374,8 @@ func (c *dockerClient) makeRequestToResolvedURL(ctx context.Context, method, url
|
|||||||
req.Header.Add(n, hh)
|
req.Header.Add(n, hh)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if c.ctx != nil && c.ctx.DockerRegistryUserAgent != "" {
|
if c.sys != nil && c.sys.DockerRegistryUserAgent != "" {
|
||||||
req.Header.Add("User-Agent", c.ctx.DockerRegistryUserAgent)
|
req.Header.Add("User-Agent", c.sys.DockerRegistryUserAgent)
|
||||||
}
|
}
|
||||||
if sendAuth {
|
if sendAuth {
|
||||||
if err := c.setupRequestAuth(req); err != nil {
|
if err := c.setupRequestAuth(req); err != nil {
|
||||||
@ -503,12 +503,12 @@ func (c *dockerClient) detectProperties(ctx context.Context) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
err := ping("https")
|
err := ping("https")
|
||||||
if err != nil && c.ctx != nil && c.ctx.DockerInsecureSkipTLSVerify {
|
if err != nil && c.sys != nil && c.sys.DockerInsecureSkipTLSVerify {
|
||||||
err = ping("http")
|
err = ping("http")
|
||||||
}
|
}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
err = errors.Wrap(err, "pinging docker registry returned")
|
err = errors.Wrap(err, "pinging docker registry returned")
|
||||||
if c.ctx != nil && c.ctx.DockerDisableV1Ping {
|
if c.sys != nil && c.sys.DockerDisableV1Ping {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
// best effort to understand if we're talking to a V1 registry
|
// best effort to understand if we're talking to a V1 registry
|
||||||
@ -527,7 +527,7 @@ func (c *dockerClient) detectProperties(ctx context.Context) error {
|
|||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
isV1 := pingV1("https")
|
isV1 := pingV1("https")
|
||||||
if !isV1 && c.ctx != nil && c.ctx.DockerInsecureSkipTLSVerify {
|
if !isV1 && c.sys != nil && c.sys.DockerInsecureSkipTLSVerify {
|
||||||
isV1 = pingV1("http")
|
isV1 = pingV1("http")
|
||||||
}
|
}
|
||||||
if isV1 {
|
if isV1 {
|
||||||
|
10
vendor/github.com/containers/image/docker/docker_image.go
generated
vendored
10
vendor/github.com/containers/image/docker/docker_image.go
generated
vendored
@ -22,12 +22,12 @@ type Image struct {
|
|||||||
// newImage returns a new Image interface type after setting up
|
// newImage returns a new Image interface type after setting up
|
||||||
// a client to the registry hosting the given image.
|
// a client to the registry hosting the given image.
|
||||||
// The caller must call .Close() on the returned Image.
|
// The caller must call .Close() on the returned Image.
|
||||||
func newImage(ctx *types.SystemContext, ref dockerReference) (types.ImageCloser, error) {
|
func newImage(ctx context.Context, sys *types.SystemContext, ref dockerReference) (types.ImageCloser, error) {
|
||||||
s, err := newImageSource(ctx, ref)
|
s, err := newImageSource(ctx, sys, ref)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
img, err := image.FromSource(ctx, s)
|
img, err := image.FromSource(ctx, sys, s)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -40,10 +40,10 @@ func (i *Image) SourceRefFullName() string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// GetRepositoryTags list all tags available in the repository. Note that this has no connection with the tag(s) used for this specific image, if any.
|
// GetRepositoryTags list all tags available in the repository. Note that this has no connection with the tag(s) used for this specific image, if any.
|
||||||
func (i *Image) GetRepositoryTags() ([]string, error) {
|
func (i *Image) GetRepositoryTags(ctx context.Context) ([]string, error) {
|
||||||
path := fmt.Sprintf(tagsPath, reference.Path(i.src.ref.ref))
|
path := fmt.Sprintf(tagsPath, reference.Path(i.src.ref.ref))
|
||||||
// FIXME: Pass the context.Context
|
// FIXME: Pass the context.Context
|
||||||
res, err := i.src.c.makeRequest(context.TODO(), "GET", path, nil, nil)
|
res, err := i.src.c.makeRequest(ctx, "GET", path, nil, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
42
vendor/github.com/containers/image/docker/docker_image_dest.go
generated
vendored
42
vendor/github.com/containers/image/docker/docker_image_dest.go
generated
vendored
@ -33,8 +33,8 @@ type dockerImageDestination struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// newImageDestination creates a new ImageDestination for the specified image reference.
|
// newImageDestination creates a new ImageDestination for the specified image reference.
|
||||||
func newImageDestination(ctx *types.SystemContext, ref dockerReference) (types.ImageDestination, error) {
|
func newImageDestination(ctx context.Context, sys *types.SystemContext, ref dockerReference) (types.ImageDestination, error) {
|
||||||
c, err := newDockerClientFromRef(ctx, ref, true, "pull,push")
|
c, err := newDockerClientFromRef(ctx, sys, ref, true, "pull,push")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -66,8 +66,8 @@ func (d *dockerImageDestination) SupportedManifestMIMETypes() []string {
|
|||||||
|
|
||||||
// SupportsSignatures returns an error (to be displayed to the user) if the destination certainly can't store signatures.
|
// SupportsSignatures returns an error (to be displayed to the user) if the destination certainly can't store signatures.
|
||||||
// Note: It is still possible for PutSignatures to fail if SupportsSignatures returns nil.
|
// Note: It is still possible for PutSignatures to fail if SupportsSignatures returns nil.
|
||||||
func (d *dockerImageDestination) SupportsSignatures() error {
|
func (d *dockerImageDestination) SupportsSignatures(ctx context.Context) error {
|
||||||
if err := d.c.detectProperties(context.TODO()); err != nil {
|
if err := d.c.detectProperties(ctx); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
switch {
|
switch {
|
||||||
@ -109,9 +109,9 @@ func (c *sizeCounter) Write(p []byte) (n int, err error) {
|
|||||||
// WARNING: The contents of stream are being verified on the fly. Until stream.Read() returns io.EOF, the contents of the data SHOULD NOT be available
|
// WARNING: The contents of stream are being verified on the fly. Until stream.Read() returns io.EOF, the contents of the data SHOULD NOT be available
|
||||||
// to any other readers for download using the supplied digest.
|
// to any other readers for download using the supplied digest.
|
||||||
// If stream.Read() at any time, ESPECIALLY at end of input, returns an error, PutBlob MUST 1) fail, and 2) delete any data stored so far.
|
// If stream.Read() at any time, ESPECIALLY at end of input, returns an error, PutBlob MUST 1) fail, and 2) delete any data stored so far.
|
||||||
func (d *dockerImageDestination) PutBlob(stream io.Reader, inputInfo types.BlobInfo, isConfig bool) (types.BlobInfo, error) {
|
func (d *dockerImageDestination) PutBlob(ctx context.Context, stream io.Reader, inputInfo types.BlobInfo, isConfig bool) (types.BlobInfo, error) {
|
||||||
if inputInfo.Digest.String() != "" {
|
if inputInfo.Digest.String() != "" {
|
||||||
haveBlob, size, err := d.HasBlob(inputInfo)
|
haveBlob, size, err := d.HasBlob(ctx, inputInfo)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return types.BlobInfo{}, err
|
return types.BlobInfo{}, err
|
||||||
}
|
}
|
||||||
@ -123,7 +123,7 @@ func (d *dockerImageDestination) PutBlob(stream io.Reader, inputInfo types.BlobI
|
|||||||
// FIXME? Chunked upload, progress reporting, etc.
|
// FIXME? Chunked upload, progress reporting, etc.
|
||||||
uploadPath := fmt.Sprintf(blobUploadPath, reference.Path(d.ref.ref))
|
uploadPath := fmt.Sprintf(blobUploadPath, reference.Path(d.ref.ref))
|
||||||
logrus.Debugf("Uploading %s", uploadPath)
|
logrus.Debugf("Uploading %s", uploadPath)
|
||||||
res, err := d.c.makeRequest(context.TODO(), "POST", uploadPath, nil, nil)
|
res, err := d.c.makeRequest(ctx, "POST", uploadPath, nil, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return types.BlobInfo{}, err
|
return types.BlobInfo{}, err
|
||||||
}
|
}
|
||||||
@ -140,7 +140,7 @@ func (d *dockerImageDestination) PutBlob(stream io.Reader, inputInfo types.BlobI
|
|||||||
digester := digest.Canonical.Digester()
|
digester := digest.Canonical.Digester()
|
||||||
sizeCounter := &sizeCounter{}
|
sizeCounter := &sizeCounter{}
|
||||||
tee := io.TeeReader(stream, io.MultiWriter(digester.Hash(), sizeCounter))
|
tee := io.TeeReader(stream, io.MultiWriter(digester.Hash(), sizeCounter))
|
||||||
res, err = d.c.makeRequestToResolvedURL(context.TODO(), "PATCH", uploadLocation.String(), map[string][]string{"Content-Type": {"application/octet-stream"}}, tee, inputInfo.Size, true)
|
res, err = d.c.makeRequestToResolvedURL(ctx, "PATCH", uploadLocation.String(), map[string][]string{"Content-Type": {"application/octet-stream"}}, tee, inputInfo.Size, true)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logrus.Debugf("Error uploading layer chunked, response %#v", res)
|
logrus.Debugf("Error uploading layer chunked, response %#v", res)
|
||||||
return types.BlobInfo{}, err
|
return types.BlobInfo{}, err
|
||||||
@ -159,7 +159,7 @@ func (d *dockerImageDestination) PutBlob(stream io.Reader, inputInfo types.BlobI
|
|||||||
// TODO: check inputInfo.Digest == computedDigest https://github.com/containers/image/pull/70#discussion_r77646717
|
// TODO: check inputInfo.Digest == computedDigest https://github.com/containers/image/pull/70#discussion_r77646717
|
||||||
locationQuery.Set("digest", computedDigest.String())
|
locationQuery.Set("digest", computedDigest.String())
|
||||||
uploadLocation.RawQuery = locationQuery.Encode()
|
uploadLocation.RawQuery = locationQuery.Encode()
|
||||||
res, err = d.c.makeRequestToResolvedURL(context.TODO(), "PUT", uploadLocation.String(), map[string][]string{"Content-Type": {"application/octet-stream"}}, nil, -1, true)
|
res, err = d.c.makeRequestToResolvedURL(ctx, "PUT", uploadLocation.String(), map[string][]string{"Content-Type": {"application/octet-stream"}}, nil, -1, true)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return types.BlobInfo{}, err
|
return types.BlobInfo{}, err
|
||||||
}
|
}
|
||||||
@ -177,14 +177,14 @@ func (d *dockerImageDestination) PutBlob(stream io.Reader, inputInfo types.BlobI
|
|||||||
// Unlike PutBlob, the digest can not be empty. If HasBlob returns true, the size of the blob must also be returned.
|
// Unlike PutBlob, the digest can not be empty. If HasBlob returns true, the size of the blob must also be returned.
|
||||||
// If the destination does not contain the blob, or it is unknown, HasBlob ordinarily returns (false, -1, nil);
|
// If the destination does not contain the blob, or it is unknown, HasBlob ordinarily returns (false, -1, nil);
|
||||||
// it returns a non-nil error only on an unexpected failure.
|
// it returns a non-nil error only on an unexpected failure.
|
||||||
func (d *dockerImageDestination) HasBlob(info types.BlobInfo) (bool, int64, error) {
|
func (d *dockerImageDestination) HasBlob(ctx context.Context, info types.BlobInfo) (bool, int64, error) {
|
||||||
if info.Digest == "" {
|
if info.Digest == "" {
|
||||||
return false, -1, errors.Errorf(`"Can not check for a blob with unknown digest`)
|
return false, -1, errors.Errorf(`"Can not check for a blob with unknown digest`)
|
||||||
}
|
}
|
||||||
checkPath := fmt.Sprintf(blobsPath, reference.Path(d.ref.ref), info.Digest.String())
|
checkPath := fmt.Sprintf(blobsPath, reference.Path(d.ref.ref), info.Digest.String())
|
||||||
|
|
||||||
logrus.Debugf("Checking %s", checkPath)
|
logrus.Debugf("Checking %s", checkPath)
|
||||||
res, err := d.c.makeRequest(context.TODO(), "HEAD", checkPath, nil, nil)
|
res, err := d.c.makeRequest(ctx, "HEAD", checkPath, nil, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return false, -1, err
|
return false, -1, err
|
||||||
}
|
}
|
||||||
@ -204,7 +204,7 @@ func (d *dockerImageDestination) HasBlob(info types.BlobInfo) (bool, int64, erro
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d *dockerImageDestination) ReapplyBlob(info types.BlobInfo) (types.BlobInfo, error) {
|
func (d *dockerImageDestination) ReapplyBlob(ctx context.Context, info types.BlobInfo) (types.BlobInfo, error) {
|
||||||
return info, nil
|
return info, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -212,7 +212,7 @@ func (d *dockerImageDestination) ReapplyBlob(info types.BlobInfo) (types.BlobInf
|
|||||||
// FIXME? This should also receive a MIME type if known, to differentiate between schema versions.
|
// FIXME? This should also receive a MIME type if known, to differentiate between schema versions.
|
||||||
// If the destination is in principle available, refuses this manifest type (e.g. it does not recognize the schema),
|
// If the destination is in principle available, refuses this manifest type (e.g. it does not recognize the schema),
|
||||||
// but may accept a different manifest type, the returned error must be an ManifestTypeRejectedError.
|
// but may accept a different manifest type, the returned error must be an ManifestTypeRejectedError.
|
||||||
func (d *dockerImageDestination) PutManifest(m []byte) error {
|
func (d *dockerImageDestination) PutManifest(ctx context.Context, m []byte) error {
|
||||||
digest, err := manifest.Digest(m)
|
digest, err := manifest.Digest(m)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
@ -230,7 +230,7 @@ func (d *dockerImageDestination) PutManifest(m []byte) error {
|
|||||||
if mimeType != "" {
|
if mimeType != "" {
|
||||||
headers["Content-Type"] = []string{mimeType}
|
headers["Content-Type"] = []string{mimeType}
|
||||||
}
|
}
|
||||||
res, err := d.c.makeRequest(context.TODO(), "PUT", path, headers, bytes.NewReader(m))
|
res, err := d.c.makeRequest(ctx, "PUT", path, headers, bytes.NewReader(m))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -267,19 +267,19 @@ func isManifestInvalidError(err error) bool {
|
|||||||
return ec.ErrorCode() == v2.ErrorCodeManifestInvalid || ec.ErrorCode() == v2.ErrorCodeTagInvalid
|
return ec.ErrorCode() == v2.ErrorCodeManifestInvalid || ec.ErrorCode() == v2.ErrorCodeTagInvalid
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d *dockerImageDestination) PutSignatures(signatures [][]byte) error {
|
func (d *dockerImageDestination) PutSignatures(ctx context.Context, signatures [][]byte) error {
|
||||||
// Do not fail if we don’t really need to support signatures.
|
// Do not fail if we don’t really need to support signatures.
|
||||||
if len(signatures) == 0 {
|
if len(signatures) == 0 {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
if err := d.c.detectProperties(context.TODO()); err != nil {
|
if err := d.c.detectProperties(ctx); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
switch {
|
switch {
|
||||||
case d.c.signatureBase != nil:
|
case d.c.signatureBase != nil:
|
||||||
return d.putSignaturesToLookaside(signatures)
|
return d.putSignaturesToLookaside(signatures)
|
||||||
case d.c.supportsSignatures:
|
case d.c.supportsSignatures:
|
||||||
return d.putSignaturesToAPIExtension(signatures)
|
return d.putSignaturesToAPIExtension(ctx, signatures)
|
||||||
default:
|
default:
|
||||||
return errors.Errorf("X-Registry-Supports-Signatures extension not supported, and lookaside is not configured")
|
return errors.Errorf("X-Registry-Supports-Signatures extension not supported, and lookaside is not configured")
|
||||||
}
|
}
|
||||||
@ -378,7 +378,7 @@ func (c *dockerClient) deleteOneSignature(url *url.URL) (missing bool, err error
|
|||||||
}
|
}
|
||||||
|
|
||||||
// putSignaturesToAPIExtension implements PutSignatures() using the X-Registry-Supports-Signatures API extension.
|
// putSignaturesToAPIExtension implements PutSignatures() using the X-Registry-Supports-Signatures API extension.
|
||||||
func (d *dockerImageDestination) putSignaturesToAPIExtension(signatures [][]byte) error {
|
func (d *dockerImageDestination) putSignaturesToAPIExtension(ctx context.Context, signatures [][]byte) error {
|
||||||
// Skip dealing with the manifest digest, or reading the old state, if not necessary.
|
// Skip dealing with the manifest digest, or reading the old state, if not necessary.
|
||||||
if len(signatures) == 0 {
|
if len(signatures) == 0 {
|
||||||
return nil
|
return nil
|
||||||
@ -393,7 +393,7 @@ func (d *dockerImageDestination) putSignaturesToAPIExtension(signatures [][]byte
|
|||||||
// always adds signatures. Eventually we should also allow removing signatures,
|
// always adds signatures. Eventually we should also allow removing signatures,
|
||||||
// but the X-Registry-Supports-Signatures API extension does not support that yet.
|
// but the X-Registry-Supports-Signatures API extension does not support that yet.
|
||||||
|
|
||||||
existingSignatures, err := d.c.getExtensionsSignatures(context.TODO(), d.ref, d.manifestDigest)
|
existingSignatures, err := d.c.getExtensionsSignatures(ctx, d.ref, d.manifestDigest)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -435,7 +435,7 @@ sigExists:
|
|||||||
}
|
}
|
||||||
|
|
||||||
path := fmt.Sprintf(extensionsSignaturePath, reference.Path(d.ref.ref), d.manifestDigest.String())
|
path := fmt.Sprintf(extensionsSignaturePath, reference.Path(d.ref.ref), d.manifestDigest.String())
|
||||||
res, err := d.c.makeRequest(context.TODO(), "PUT", path, nil, bytes.NewReader(body))
|
res, err := d.c.makeRequest(ctx, "PUT", path, nil, bytes.NewReader(body))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -457,6 +457,6 @@ sigExists:
|
|||||||
// WARNING: This does not have any transactional semantics:
|
// WARNING: This does not have any transactional semantics:
|
||||||
// - Uploaded data MAY be visible to others before Commit() is called
|
// - Uploaded data MAY be visible to others before Commit() is called
|
||||||
// - Uploaded data MAY be removed or MAY remain around if Close() is called without Commit() (i.e. rollback is allowed but not guaranteed)
|
// - Uploaded data MAY be removed or MAY remain around if Close() is called without Commit() (i.e. rollback is allowed but not guaranteed)
|
||||||
func (d *dockerImageDestination) Commit() error {
|
func (d *dockerImageDestination) Commit(ctx context.Context) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
32
vendor/github.com/containers/image/docker/docker_image_src.go
generated
vendored
32
vendor/github.com/containers/image/docker/docker_image_src.go
generated
vendored
@ -30,8 +30,8 @@ type dockerImageSource struct {
|
|||||||
|
|
||||||
// newImageSource creates a new ImageSource for the specified image reference.
|
// newImageSource creates a new ImageSource for the specified image reference.
|
||||||
// The caller must call .Close() on the returned ImageSource.
|
// The caller must call .Close() on the returned ImageSource.
|
||||||
func newImageSource(ctx *types.SystemContext, ref dockerReference) (*dockerImageSource, error) {
|
func newImageSource(ctx context.Context, sys *types.SystemContext, ref dockerReference) (*dockerImageSource, error) {
|
||||||
c, err := newDockerClientFromRef(ctx, ref, false, "pull")
|
c, err := newDockerClientFromRef(ctx, sys, ref, false, "pull")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -53,7 +53,7 @@ func (s *dockerImageSource) Close() error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// LayerInfosForCopy() returns updated layer info that should be used when reading, in preference to values in the manifest, if specified.
|
// LayerInfosForCopy() returns updated layer info that should be used when reading, in preference to values in the manifest, if specified.
|
||||||
func (s *dockerImageSource) LayerInfosForCopy() ([]types.BlobInfo, error) {
|
func (s *dockerImageSource) LayerInfosForCopy(ctx context.Context) ([]types.BlobInfo, error) {
|
||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -74,11 +74,11 @@ func simplifyContentType(contentType string) string {
|
|||||||
// It may use a remote (= slow) service.
|
// It may use a remote (= slow) service.
|
||||||
// If instanceDigest is not nil, it contains a digest of the specific manifest instance to retrieve (when the primary manifest is a manifest list);
|
// If instanceDigest is not nil, it contains a digest of the specific manifest instance to retrieve (when the primary manifest is a manifest list);
|
||||||
// this never happens if the primary manifest is not a manifest list (e.g. if the source never returns manifest lists).
|
// this never happens if the primary manifest is not a manifest list (e.g. if the source never returns manifest lists).
|
||||||
func (s *dockerImageSource) GetManifest(instanceDigest *digest.Digest) ([]byte, string, error) {
|
func (s *dockerImageSource) GetManifest(ctx context.Context, instanceDigest *digest.Digest) ([]byte, string, error) {
|
||||||
if instanceDigest != nil {
|
if instanceDigest != nil {
|
||||||
return s.fetchManifest(context.TODO(), instanceDigest.String())
|
return s.fetchManifest(ctx, instanceDigest.String())
|
||||||
}
|
}
|
||||||
err := s.ensureManifestIsLoaded(context.TODO())
|
err := s.ensureManifestIsLoaded(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, "", err
|
return nil, "", err
|
||||||
}
|
}
|
||||||
@ -108,7 +108,7 @@ func (s *dockerImageSource) fetchManifest(ctx context.Context, tagOrDigest strin
|
|||||||
//
|
//
|
||||||
// ImageSource implementations are not required or expected to do any caching,
|
// ImageSource implementations are not required or expected to do any caching,
|
||||||
// but because our signatures are “attached” to the manifest digest,
|
// but because our signatures are “attached” to the manifest digest,
|
||||||
// we need to ensure that the digest of the manifest returned by GetManifest(nil)
|
// we need to ensure that the digest of the manifest returned by GetManifest(ctx, nil)
|
||||||
// and used by GetSignatures(ctx, nil) are consistent, otherwise we would get spurious
|
// and used by GetSignatures(ctx, nil) are consistent, otherwise we would get spurious
|
||||||
// signature verification failures when pulling while a tag is being updated.
|
// signature verification failures when pulling while a tag is being updated.
|
||||||
func (s *dockerImageSource) ensureManifestIsLoaded(ctx context.Context) error {
|
func (s *dockerImageSource) ensureManifestIsLoaded(ctx context.Context) error {
|
||||||
@ -131,13 +131,13 @@ func (s *dockerImageSource) ensureManifestIsLoaded(ctx context.Context) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *dockerImageSource) getExternalBlob(urls []string) (io.ReadCloser, int64, error) {
|
func (s *dockerImageSource) getExternalBlob(ctx context.Context, urls []string) (io.ReadCloser, int64, error) {
|
||||||
var (
|
var (
|
||||||
resp *http.Response
|
resp *http.Response
|
||||||
err error
|
err error
|
||||||
)
|
)
|
||||||
for _, url := range urls {
|
for _, url := range urls {
|
||||||
resp, err = s.c.makeRequestToResolvedURL(context.TODO(), "GET", url, nil, nil, -1, false)
|
resp, err = s.c.makeRequestToResolvedURL(ctx, "GET", url, nil, nil, -1, false)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
if resp.StatusCode != http.StatusOK {
|
if resp.StatusCode != http.StatusOK {
|
||||||
err = errors.Errorf("error fetching external blob from %q: %d", url, resp.StatusCode)
|
err = errors.Errorf("error fetching external blob from %q: %d", url, resp.StatusCode)
|
||||||
@ -162,14 +162,14 @@ func getBlobSize(resp *http.Response) int64 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// GetBlob returns a stream for the specified blob, and the blob’s size (or -1 if unknown).
|
// GetBlob returns a stream for the specified blob, and the blob’s size (or -1 if unknown).
|
||||||
func (s *dockerImageSource) GetBlob(info types.BlobInfo) (io.ReadCloser, int64, error) {
|
func (s *dockerImageSource) GetBlob(ctx context.Context, info types.BlobInfo) (io.ReadCloser, int64, error) {
|
||||||
if len(info.URLs) != 0 {
|
if len(info.URLs) != 0 {
|
||||||
return s.getExternalBlob(info.URLs)
|
return s.getExternalBlob(ctx, info.URLs)
|
||||||
}
|
}
|
||||||
|
|
||||||
path := fmt.Sprintf(blobsPath, reference.Path(s.ref.ref), info.Digest.String())
|
path := fmt.Sprintf(blobsPath, reference.Path(s.ref.ref), info.Digest.String())
|
||||||
logrus.Debugf("Downloading %s", path)
|
logrus.Debugf("Downloading %s", path)
|
||||||
res, err := s.c.makeRequest(context.TODO(), "GET", path, nil, nil)
|
res, err := s.c.makeRequest(ctx, "GET", path, nil, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, 0, err
|
return nil, 0, err
|
||||||
}
|
}
|
||||||
@ -309,8 +309,8 @@ func (s *dockerImageSource) getSignaturesFromAPIExtension(ctx context.Context, i
|
|||||||
}
|
}
|
||||||
|
|
||||||
// deleteImage deletes the named image from the registry, if supported.
|
// deleteImage deletes the named image from the registry, if supported.
|
||||||
func deleteImage(ctx *types.SystemContext, ref dockerReference) error {
|
func deleteImage(ctx context.Context, sys *types.SystemContext, ref dockerReference) error {
|
||||||
c, err := newDockerClientFromRef(ctx, ref, true, "push")
|
c, err := newDockerClientFromRef(ctx, sys, ref, true, "push")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -325,7 +325,7 @@ func deleteImage(ctx *types.SystemContext, ref dockerReference) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
getPath := fmt.Sprintf(manifestPath, reference.Path(ref.ref), refTail)
|
getPath := fmt.Sprintf(manifestPath, reference.Path(ref.ref), refTail)
|
||||||
get, err := c.makeRequest(context.TODO(), "GET", getPath, headers, nil)
|
get, err := c.makeRequest(ctx, "GET", getPath, headers, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -347,7 +347,7 @@ func deleteImage(ctx *types.SystemContext, ref dockerReference) error {
|
|||||||
|
|
||||||
// When retrieving the digest from a registry >= 2.3 use the following header:
|
// When retrieving the digest from a registry >= 2.3 use the following header:
|
||||||
// "Accept": "application/vnd.docker.distribution.manifest.v2+json"
|
// "Accept": "application/vnd.docker.distribution.manifest.v2+json"
|
||||||
delete, err := c.makeRequest(context.TODO(), "DELETE", deletePath, headers, nil)
|
delete, err := c.makeRequest(ctx, "DELETE", deletePath, headers, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
17
vendor/github.com/containers/image/docker/docker_transport.go
generated
vendored
17
vendor/github.com/containers/image/docker/docker_transport.go
generated
vendored
@ -1,6 +1,7 @@
|
|||||||
package docker
|
package docker
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
@ -127,25 +128,25 @@ func (ref dockerReference) PolicyConfigurationNamespaces() []string {
|
|||||||
// NOTE: If any kind of signature verification should happen, build an UnparsedImage from the value returned by NewImageSource,
|
// NOTE: If any kind of signature verification should happen, build an UnparsedImage from the value returned by NewImageSource,
|
||||||
// verify that UnparsedImage, and convert it into a real Image via image.FromUnparsedImage.
|
// verify that UnparsedImage, and convert it into a real Image via image.FromUnparsedImage.
|
||||||
// WARNING: This may not do the right thing for a manifest list, see image.FromSource for details.
|
// WARNING: This may not do the right thing for a manifest list, see image.FromSource for details.
|
||||||
func (ref dockerReference) NewImage(ctx *types.SystemContext) (types.ImageCloser, error) {
|
func (ref dockerReference) NewImage(ctx context.Context, sys *types.SystemContext) (types.ImageCloser, error) {
|
||||||
return newImage(ctx, ref)
|
return newImage(ctx, sys, ref)
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewImageSource returns a types.ImageSource for this reference.
|
// NewImageSource returns a types.ImageSource for this reference.
|
||||||
// The caller must call .Close() on the returned ImageSource.
|
// The caller must call .Close() on the returned ImageSource.
|
||||||
func (ref dockerReference) NewImageSource(ctx *types.SystemContext) (types.ImageSource, error) {
|
func (ref dockerReference) NewImageSource(ctx context.Context, sys *types.SystemContext) (types.ImageSource, error) {
|
||||||
return newImageSource(ctx, ref)
|
return newImageSource(ctx, sys, ref)
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewImageDestination returns a types.ImageDestination for this reference.
|
// NewImageDestination returns a types.ImageDestination for this reference.
|
||||||
// The caller must call .Close() on the returned ImageDestination.
|
// The caller must call .Close() on the returned ImageDestination.
|
||||||
func (ref dockerReference) NewImageDestination(ctx *types.SystemContext) (types.ImageDestination, error) {
|
func (ref dockerReference) NewImageDestination(ctx context.Context, sys *types.SystemContext) (types.ImageDestination, error) {
|
||||||
return newImageDestination(ctx, ref)
|
return newImageDestination(ctx, sys, ref)
|
||||||
}
|
}
|
||||||
|
|
||||||
// DeleteImage deletes the named image from the registry, if supported.
|
// DeleteImage deletes the named image from the registry, if supported.
|
||||||
func (ref dockerReference) DeleteImage(ctx *types.SystemContext) error {
|
func (ref dockerReference) DeleteImage(ctx context.Context, sys *types.SystemContext) error {
|
||||||
return deleteImage(ctx, ref)
|
return deleteImage(ctx, sys, ref)
|
||||||
}
|
}
|
||||||
|
|
||||||
// tagOrDigest returns a tag or digest from the reference.
|
// tagOrDigest returns a tag or digest from the reference.
|
||||||
|
16
vendor/github.com/containers/image/docker/lookaside.go
generated
vendored
16
vendor/github.com/containers/image/docker/lookaside.go
generated
vendored
@ -45,9 +45,9 @@ type registryNamespace struct {
|
|||||||
type signatureStorageBase *url.URL // The only documented value is nil, meaning storage is not supported.
|
type signatureStorageBase *url.URL // The only documented value is nil, meaning storage is not supported.
|
||||||
|
|
||||||
// configuredSignatureStorageBase reads configuration to find an appropriate signature storage URL for ref, for write access if “write”.
|
// configuredSignatureStorageBase reads configuration to find an appropriate signature storage URL for ref, for write access if “write”.
|
||||||
func configuredSignatureStorageBase(ctx *types.SystemContext, ref dockerReference, write bool) (signatureStorageBase, error) {
|
func configuredSignatureStorageBase(sys *types.SystemContext, ref dockerReference, write bool) (signatureStorageBase, error) {
|
||||||
// FIXME? Loading and parsing the config could be cached across calls.
|
// FIXME? Loading and parsing the config could be cached across calls.
|
||||||
dirPath := registriesDirPath(ctx)
|
dirPath := registriesDirPath(sys)
|
||||||
logrus.Debugf(`Using registries.d directory %s for sigstore configuration`, dirPath)
|
logrus.Debugf(`Using registries.d directory %s for sigstore configuration`, dirPath)
|
||||||
config, err := loadAndMergeConfig(dirPath)
|
config, err := loadAndMergeConfig(dirPath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -74,13 +74,13 @@ func configuredSignatureStorageBase(ctx *types.SystemContext, ref dockerReferenc
|
|||||||
}
|
}
|
||||||
|
|
||||||
// registriesDirPath returns a path to registries.d
|
// registriesDirPath returns a path to registries.d
|
||||||
func registriesDirPath(ctx *types.SystemContext) string {
|
func registriesDirPath(sys *types.SystemContext) string {
|
||||||
if ctx != nil {
|
if sys != nil {
|
||||||
if ctx.RegistriesDirPath != "" {
|
if sys.RegistriesDirPath != "" {
|
||||||
return ctx.RegistriesDirPath
|
return sys.RegistriesDirPath
|
||||||
}
|
}
|
||||||
if ctx.RootForImplicitAbsolutePaths != "" {
|
if sys.RootForImplicitAbsolutePaths != "" {
|
||||||
return filepath.Join(ctx.RootForImplicitAbsolutePaths, systemRegistriesDirPath)
|
return filepath.Join(sys.RootForImplicitAbsolutePaths, systemRegistriesDirPath)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return systemRegistriesDirPath
|
return systemRegistriesDirPath
|
||||||
|
17
vendor/github.com/containers/image/docker/tarfile/dest.go
generated
vendored
17
vendor/github.com/containers/image/docker/tarfile/dest.go
generated
vendored
@ -3,6 +3,7 @@ package tarfile
|
|||||||
import (
|
import (
|
||||||
"archive/tar"
|
"archive/tar"
|
||||||
"bytes"
|
"bytes"
|
||||||
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
@ -50,7 +51,7 @@ func (d *Destination) SupportedManifestMIMETypes() []string {
|
|||||||
|
|
||||||
// SupportsSignatures returns an error (to be displayed to the user) if the destination certainly can't store signatures.
|
// SupportsSignatures returns an error (to be displayed to the user) if the destination certainly can't store signatures.
|
||||||
// Note: It is still possible for PutSignatures to fail if SupportsSignatures returns nil.
|
// Note: It is still possible for PutSignatures to fail if SupportsSignatures returns nil.
|
||||||
func (d *Destination) SupportsSignatures() error {
|
func (d *Destination) SupportsSignatures(ctx context.Context) error {
|
||||||
return errors.Errorf("Storing signatures for docker tar files is not supported")
|
return errors.Errorf("Storing signatures for docker tar files is not supported")
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -71,7 +72,7 @@ func (d *Destination) MustMatchRuntimeOS() bool {
|
|||||||
// WARNING: The contents of stream are being verified on the fly. Until stream.Read() returns io.EOF, the contents of the data SHOULD NOT be available
|
// WARNING: The contents of stream are being verified on the fly. Until stream.Read() returns io.EOF, the contents of the data SHOULD NOT be available
|
||||||
// to any other readers for download using the supplied digest.
|
// to any other readers for download using the supplied digest.
|
||||||
// If stream.Read() at any time, ESPECIALLY at end of input, returns an error, PutBlob MUST 1) fail, and 2) delete any data stored so far.
|
// If stream.Read() at any time, ESPECIALLY at end of input, returns an error, PutBlob MUST 1) fail, and 2) delete any data stored so far.
|
||||||
func (d *Destination) PutBlob(stream io.Reader, inputInfo types.BlobInfo, isConfig bool) (types.BlobInfo, error) {
|
func (d *Destination) PutBlob(ctx context.Context, stream io.Reader, inputInfo types.BlobInfo, isConfig bool) (types.BlobInfo, error) {
|
||||||
// Ouch, we need to stream the blob into a temporary file just to determine the size.
|
// Ouch, we need to stream the blob into a temporary file just to determine the size.
|
||||||
// When the layer is decompressed, we also have to generate the digest on uncompressed datas.
|
// When the layer is decompressed, we also have to generate the digest on uncompressed datas.
|
||||||
if inputInfo.Size == -1 || inputInfo.Digest.String() == "" {
|
if inputInfo.Size == -1 || inputInfo.Digest.String() == "" {
|
||||||
@ -102,7 +103,7 @@ func (d *Destination) PutBlob(stream io.Reader, inputInfo types.BlobInfo, isConf
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Maybe the blob has been already sent
|
// Maybe the blob has been already sent
|
||||||
ok, size, err := d.HasBlob(inputInfo)
|
ok, size, err := d.HasBlob(ctx, inputInfo)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return types.BlobInfo{}, err
|
return types.BlobInfo{}, err
|
||||||
}
|
}
|
||||||
@ -139,7 +140,7 @@ func (d *Destination) PutBlob(stream io.Reader, inputInfo types.BlobInfo, isConf
|
|||||||
// the blob must also be returned. If the destination does not contain the
|
// the blob must also be returned. If the destination does not contain the
|
||||||
// blob, or it is unknown, HasBlob ordinarily returns (false, -1, nil); it
|
// blob, or it is unknown, HasBlob ordinarily returns (false, -1, nil); it
|
||||||
// returns a non-nil error only on an unexpected failure.
|
// returns a non-nil error only on an unexpected failure.
|
||||||
func (d *Destination) HasBlob(info types.BlobInfo) (bool, int64, error) {
|
func (d *Destination) HasBlob(ctx context.Context, info types.BlobInfo) (bool, int64, error) {
|
||||||
if info.Digest == "" {
|
if info.Digest == "" {
|
||||||
return false, -1, errors.Errorf("Can not check for a blob with unknown digest")
|
return false, -1, errors.Errorf("Can not check for a blob with unknown digest")
|
||||||
}
|
}
|
||||||
@ -154,7 +155,7 @@ func (d *Destination) HasBlob(info types.BlobInfo) (bool, int64, error) {
|
|||||||
// returned false. Like HasBlob and unlike PutBlob, the digest can not be
|
// returned false. Like HasBlob and unlike PutBlob, the digest can not be
|
||||||
// empty. If the blob is a filesystem layer, this signifies that the changes
|
// empty. If the blob is a filesystem layer, this signifies that the changes
|
||||||
// it describes need to be applied again when composing a filesystem tree.
|
// it describes need to be applied again when composing a filesystem tree.
|
||||||
func (d *Destination) ReapplyBlob(info types.BlobInfo) (types.BlobInfo, error) {
|
func (d *Destination) ReapplyBlob(ctx context.Context, info types.BlobInfo) (types.BlobInfo, error) {
|
||||||
return info, nil
|
return info, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -175,7 +176,7 @@ func (d *Destination) createRepositoriesFile(rootLayerID string) error {
|
|||||||
// FIXME? This should also receive a MIME type if known, to differentiate between schema versions.
|
// FIXME? This should also receive a MIME type if known, to differentiate between schema versions.
|
||||||
// If the destination is in principle available, refuses this manifest type (e.g. it does not recognize the schema),
|
// If the destination is in principle available, refuses this manifest type (e.g. it does not recognize the schema),
|
||||||
// but may accept a different manifest type, the returned error must be an ManifestTypeRejectedError.
|
// but may accept a different manifest type, the returned error must be an ManifestTypeRejectedError.
|
||||||
func (d *Destination) PutManifest(m []byte) error {
|
func (d *Destination) PutManifest(ctx context.Context, m []byte) error {
|
||||||
// We do not bother with types.ManifestTypeRejectedError; our .SupportedManifestMIMETypes() above is already providing only one alternative,
|
// We do not bother with types.ManifestTypeRejectedError; our .SupportedManifestMIMETypes() above is already providing only one alternative,
|
||||||
// so the caller trying a different manifest kind would be pointless.
|
// so the caller trying a different manifest kind would be pointless.
|
||||||
var man manifest.Schema2
|
var man manifest.Schema2
|
||||||
@ -364,7 +365,7 @@ func (d *Destination) sendFile(path string, expectedSize int64, stream io.Reader
|
|||||||
// PutSignatures adds the given signatures to the docker tarfile (currently not
|
// PutSignatures adds the given signatures to the docker tarfile (currently not
|
||||||
// supported). MUST be called after PutManifest (signatures reference manifest
|
// supported). MUST be called after PutManifest (signatures reference manifest
|
||||||
// contents)
|
// contents)
|
||||||
func (d *Destination) PutSignatures(signatures [][]byte) error {
|
func (d *Destination) PutSignatures(ctx context.Context, signatures [][]byte) error {
|
||||||
if len(signatures) != 0 {
|
if len(signatures) != 0 {
|
||||||
return errors.Errorf("Storing signatures for docker tar files is not supported")
|
return errors.Errorf("Storing signatures for docker tar files is not supported")
|
||||||
}
|
}
|
||||||
@ -373,6 +374,6 @@ func (d *Destination) PutSignatures(signatures [][]byte) error {
|
|||||||
|
|
||||||
// Commit finishes writing data to the underlying io.Writer.
|
// Commit finishes writing data to the underlying io.Writer.
|
||||||
// It is the caller's responsibility to close it, if necessary.
|
// It is the caller's responsibility to close it, if necessary.
|
||||||
func (d *Destination) Commit() error {
|
func (d *Destination) Commit(ctx context.Context) error {
|
||||||
return d.tar.Close()
|
return d.tar.Close()
|
||||||
}
|
}
|
||||||
|
8
vendor/github.com/containers/image/docker/tarfile/src.go
generated
vendored
8
vendor/github.com/containers/image/docker/tarfile/src.go
generated
vendored
@ -306,9 +306,9 @@ func (s *Source) prepareLayerData(tarManifest *ManifestItem, parsedConfig *manif
|
|||||||
// It may use a remote (= slow) service.
|
// It may use a remote (= slow) service.
|
||||||
// If instanceDigest is not nil, it contains a digest of the specific manifest instance to retrieve (when the primary manifest is a manifest list);
|
// If instanceDigest is not nil, it contains a digest of the specific manifest instance to retrieve (when the primary manifest is a manifest list);
|
||||||
// this never happens if the primary manifest is not a manifest list (e.g. if the source never returns manifest lists).
|
// this never happens if the primary manifest is not a manifest list (e.g. if the source never returns manifest lists).
|
||||||
func (s *Source) GetManifest(instanceDigest *digest.Digest) ([]byte, string, error) {
|
func (s *Source) GetManifest(ctx context.Context, instanceDigest *digest.Digest) ([]byte, string, error) {
|
||||||
if instanceDigest != nil {
|
if instanceDigest != nil {
|
||||||
// How did we even get here? GetManifest(nil) has returned a manifest.DockerV2Schema2MediaType.
|
// How did we even get here? GetManifest(ctx, nil) has returned a manifest.DockerV2Schema2MediaType.
|
||||||
return nil, "", errors.Errorf(`Manifest lists are not supported by "docker-daemon:"`)
|
return nil, "", errors.Errorf(`Manifest lists are not supported by "docker-daemon:"`)
|
||||||
}
|
}
|
||||||
if s.generatedManifest == nil {
|
if s.generatedManifest == nil {
|
||||||
@ -358,7 +358,7 @@ func (r readCloseWrapper) Close() error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// GetBlob returns a stream for the specified blob, and the blob’s size (or -1 if unknown).
|
// GetBlob returns a stream for the specified blob, and the blob’s size (or -1 if unknown).
|
||||||
func (s *Source) GetBlob(info types.BlobInfo) (io.ReadCloser, int64, error) {
|
func (s *Source) GetBlob(ctx context.Context, info types.BlobInfo) (io.ReadCloser, int64, error) {
|
||||||
if err := s.ensureCachedDataIsPresent(); err != nil {
|
if err := s.ensureCachedDataIsPresent(); err != nil {
|
||||||
return nil, 0, err
|
return nil, 0, err
|
||||||
}
|
}
|
||||||
@ -414,7 +414,7 @@ func (s *Source) GetBlob(info types.BlobInfo) (io.ReadCloser, int64, error) {
|
|||||||
// (e.g. if the source never returns manifest lists).
|
// (e.g. if the source never returns manifest lists).
|
||||||
func (s *Source) GetSignatures(ctx context.Context, instanceDigest *digest.Digest) ([][]byte, error) {
|
func (s *Source) GetSignatures(ctx context.Context, instanceDigest *digest.Digest) ([][]byte, error) {
|
||||||
if instanceDigest != nil {
|
if instanceDigest != nil {
|
||||||
// How did we even get here? GetManifest(nil) has returned a manifest.DockerV2Schema2MediaType.
|
// How did we even get here? GetManifest(ctx, nil) has returned a manifest.DockerV2Schema2MediaType.
|
||||||
return nil, errors.Errorf(`Manifest lists are not supported by "docker-daemon:"`)
|
return nil, errors.Errorf(`Manifest lists are not supported by "docker-daemon:"`)
|
||||||
}
|
}
|
||||||
return [][]byte{}, nil
|
return [][]byte{}, nil
|
||||||
|
25
vendor/github.com/containers/image/image/docker_list.go
generated
vendored
25
vendor/github.com/containers/image/image/docker_list.go
generated
vendored
@ -1,6 +1,7 @@
|
|||||||
package image
|
package image
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"runtime"
|
"runtime"
|
||||||
@ -34,14 +35,14 @@ type manifestList struct {
|
|||||||
|
|
||||||
// chooseDigestFromManifestList parses blob as a schema2 manifest list,
|
// chooseDigestFromManifestList parses blob as a schema2 manifest list,
|
||||||
// and returns the digest of the image appropriate for the current environment.
|
// and returns the digest of the image appropriate for the current environment.
|
||||||
func chooseDigestFromManifestList(ctx *types.SystemContext, blob []byte) (digest.Digest, error) {
|
func chooseDigestFromManifestList(sys *types.SystemContext, blob []byte) (digest.Digest, error) {
|
||||||
wantedArch := runtime.GOARCH
|
wantedArch := runtime.GOARCH
|
||||||
if ctx != nil && ctx.ArchitectureChoice != "" {
|
if sys != nil && sys.ArchitectureChoice != "" {
|
||||||
wantedArch = ctx.ArchitectureChoice
|
wantedArch = sys.ArchitectureChoice
|
||||||
}
|
}
|
||||||
wantedOS := runtime.GOOS
|
wantedOS := runtime.GOOS
|
||||||
if ctx != nil && ctx.OSChoice != "" {
|
if sys != nil && sys.OSChoice != "" {
|
||||||
wantedOS = ctx.OSChoice
|
wantedOS = sys.OSChoice
|
||||||
}
|
}
|
||||||
|
|
||||||
list := manifestList{}
|
list := manifestList{}
|
||||||
@ -56,12 +57,12 @@ func chooseDigestFromManifestList(ctx *types.SystemContext, blob []byte) (digest
|
|||||||
return "", fmt.Errorf("no image found in manifest list for architecture %s, OS %s", wantedArch, wantedOS)
|
return "", fmt.Errorf("no image found in manifest list for architecture %s, OS %s", wantedArch, wantedOS)
|
||||||
}
|
}
|
||||||
|
|
||||||
func manifestSchema2FromManifestList(ctx *types.SystemContext, src types.ImageSource, manblob []byte) (genericManifest, error) {
|
func manifestSchema2FromManifestList(ctx context.Context, sys *types.SystemContext, src types.ImageSource, manblob []byte) (genericManifest, error) {
|
||||||
targetManifestDigest, err := chooseDigestFromManifestList(ctx, manblob)
|
targetManifestDigest, err := chooseDigestFromManifestList(sys, manblob)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
manblob, mt, err := src.GetManifest(&targetManifestDigest)
|
manblob, mt, err := src.GetManifest(ctx, &targetManifestDigest)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -74,20 +75,20 @@ func manifestSchema2FromManifestList(ctx *types.SystemContext, src types.ImageSo
|
|||||||
return nil, errors.Errorf("Manifest image does not match selected manifest digest %s", targetManifestDigest)
|
return nil, errors.Errorf("Manifest image does not match selected manifest digest %s", targetManifestDigest)
|
||||||
}
|
}
|
||||||
|
|
||||||
return manifestInstanceFromBlob(ctx, src, manblob, mt)
|
return manifestInstanceFromBlob(ctx, sys, src, manblob, mt)
|
||||||
}
|
}
|
||||||
|
|
||||||
// ChooseManifestInstanceFromManifestList returns a digest of a manifest appropriate
|
// ChooseManifestInstanceFromManifestList returns a digest of a manifest appropriate
|
||||||
// for the current system from the manifest available from src.
|
// for the current system from the manifest available from src.
|
||||||
func ChooseManifestInstanceFromManifestList(ctx *types.SystemContext, src types.UnparsedImage) (digest.Digest, error) {
|
func ChooseManifestInstanceFromManifestList(ctx context.Context, sys *types.SystemContext, src types.UnparsedImage) (digest.Digest, error) {
|
||||||
// For now this only handles manifest.DockerV2ListMediaType; we can generalize it later,
|
// For now this only handles manifest.DockerV2ListMediaType; we can generalize it later,
|
||||||
// probably along with manifest list editing.
|
// probably along with manifest list editing.
|
||||||
blob, mt, err := src.Manifest()
|
blob, mt, err := src.Manifest(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
if mt != manifest.DockerV2ListMediaType {
|
if mt != manifest.DockerV2ListMediaType {
|
||||||
return "", fmt.Errorf("Internal error: Trying to select an image from a non-manifest-list manifest type %s", mt)
|
return "", fmt.Errorf("Internal error: Trying to select an image from a non-manifest-list manifest type %s", mt)
|
||||||
}
|
}
|
||||||
return chooseDigestFromManifestList(ctx, blob)
|
return chooseDigestFromManifestList(sys, blob)
|
||||||
}
|
}
|
||||||
|
13
vendor/github.com/containers/image/image/docker_schema1.go
generated
vendored
13
vendor/github.com/containers/image/image/docker_schema1.go
generated
vendored
@ -1,6 +1,7 @@
|
|||||||
package image
|
package image
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
|
||||||
"github.com/containers/image/docker/reference"
|
"github.com/containers/image/docker/reference"
|
||||||
@ -44,19 +45,19 @@ func (m *manifestSchema1) ConfigInfo() types.BlobInfo {
|
|||||||
|
|
||||||
// ConfigBlob returns the blob described by ConfigInfo, iff ConfigInfo().Digest != ""; nil otherwise.
|
// ConfigBlob returns the blob described by ConfigInfo, iff ConfigInfo().Digest != ""; nil otherwise.
|
||||||
// The result is cached; it is OK to call this however often you need.
|
// The result is cached; it is OK to call this however often you need.
|
||||||
func (m *manifestSchema1) ConfigBlob() ([]byte, error) {
|
func (m *manifestSchema1) ConfigBlob(context.Context) ([]byte, error) {
|
||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// OCIConfig returns the image configuration as per OCI v1 image-spec. Information about
|
// OCIConfig returns the image configuration as per OCI v1 image-spec. Information about
|
||||||
// layers in the resulting configuration isn't guaranteed to be returned to due how
|
// layers in the resulting configuration isn't guaranteed to be returned to due how
|
||||||
// old image manifests work (docker v2s1 especially).
|
// old image manifests work (docker v2s1 especially).
|
||||||
func (m *manifestSchema1) OCIConfig() (*imgspecv1.Image, error) {
|
func (m *manifestSchema1) OCIConfig(ctx context.Context) (*imgspecv1.Image, error) {
|
||||||
v2s2, err := m.convertToManifestSchema2(nil, nil)
|
v2s2, err := m.convertToManifestSchema2(nil, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
return v2s2.OCIConfig()
|
return v2s2.OCIConfig(ctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
// LayerInfos returns a list of BlobInfos of layers referenced by this image, in order (the root layer first, and then successive layered layers).
|
// LayerInfos returns a list of BlobInfos of layers referenced by this image, in order (the root layer first, and then successive layered layers).
|
||||||
@ -88,7 +89,7 @@ func (m *manifestSchema1) EmbeddedDockerReferenceConflicts(ref reference.Named)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Inspect returns various information for (skopeo inspect) parsed from the manifest and configuration.
|
// Inspect returns various information for (skopeo inspect) parsed from the manifest and configuration.
|
||||||
func (m *manifestSchema1) Inspect() (*types.ImageInspectInfo, error) {
|
func (m *manifestSchema1) Inspect(context.Context) (*types.ImageInspectInfo, error) {
|
||||||
return m.m.Inspect(nil)
|
return m.m.Inspect(nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -101,7 +102,7 @@ func (m *manifestSchema1) UpdatedImageNeedsLayerDiffIDs(options types.ManifestUp
|
|||||||
|
|
||||||
// UpdatedImage returns a types.Image modified according to options.
|
// UpdatedImage returns a types.Image modified according to options.
|
||||||
// This does not change the state of the original Image object.
|
// This does not change the state of the original Image object.
|
||||||
func (m *manifestSchema1) UpdatedImage(options types.ManifestUpdateOptions) (types.Image, error) {
|
func (m *manifestSchema1) UpdatedImage(ctx context.Context, options types.ManifestUpdateOptions) (types.Image, error) {
|
||||||
copy := manifestSchema1{m: manifest.Schema1Clone(m.m)}
|
copy := manifestSchema1{m: manifest.Schema1Clone(m.m)}
|
||||||
if options.LayerInfos != nil {
|
if options.LayerInfos != nil {
|
||||||
if err := copy.m.UpdateLayerInfos(options.LayerInfos); err != nil {
|
if err := copy.m.UpdateLayerInfos(options.LayerInfos); err != nil {
|
||||||
@ -134,7 +135,7 @@ func (m *manifestSchema1) UpdatedImage(options types.ManifestUpdateOptions) (typ
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
return m2.UpdatedImage(types.ManifestUpdateOptions{
|
return m2.UpdatedImage(ctx, types.ManifestUpdateOptions{
|
||||||
ManifestMIMEType: imgspecv1.MediaTypeImageManifest,
|
ManifestMIMEType: imgspecv1.MediaTypeImageManifest,
|
||||||
InformationOnly: options.InformationOnly,
|
InformationOnly: options.InformationOnly,
|
||||||
})
|
})
|
||||||
|
29
vendor/github.com/containers/image/image/docker_schema2.go
generated
vendored
29
vendor/github.com/containers/image/image/docker_schema2.go
generated
vendored
@ -2,6 +2,7 @@ package image
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
|
"context"
|
||||||
"crypto/sha256"
|
"crypto/sha256"
|
||||||
"encoding/hex"
|
"encoding/hex"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
@ -72,8 +73,8 @@ func (m *manifestSchema2) ConfigInfo() types.BlobInfo {
|
|||||||
// OCIConfig returns the image configuration as per OCI v1 image-spec. Information about
|
// OCIConfig returns the image configuration as per OCI v1 image-spec. Information about
|
||||||
// layers in the resulting configuration isn't guaranteed to be returned to due how
|
// layers in the resulting configuration isn't guaranteed to be returned to due how
|
||||||
// old image manifests work (docker v2s1 especially).
|
// old image manifests work (docker v2s1 especially).
|
||||||
func (m *manifestSchema2) OCIConfig() (*imgspecv1.Image, error) {
|
func (m *manifestSchema2) OCIConfig(ctx context.Context) (*imgspecv1.Image, error) {
|
||||||
configBlob, err := m.ConfigBlob()
|
configBlob, err := m.ConfigBlob(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -89,12 +90,12 @@ func (m *manifestSchema2) OCIConfig() (*imgspecv1.Image, error) {
|
|||||||
|
|
||||||
// ConfigBlob returns the blob described by ConfigInfo, iff ConfigInfo().Digest != ""; nil otherwise.
|
// ConfigBlob returns the blob described by ConfigInfo, iff ConfigInfo().Digest != ""; nil otherwise.
|
||||||
// The result is cached; it is OK to call this however often you need.
|
// The result is cached; it is OK to call this however often you need.
|
||||||
func (m *manifestSchema2) ConfigBlob() ([]byte, error) {
|
func (m *manifestSchema2) ConfigBlob(ctx context.Context) ([]byte, error) {
|
||||||
if m.configBlob == nil {
|
if m.configBlob == nil {
|
||||||
if m.src == nil {
|
if m.src == nil {
|
||||||
return nil, errors.Errorf("Internal error: neither src nor configBlob set in manifestSchema2")
|
return nil, errors.Errorf("Internal error: neither src nor configBlob set in manifestSchema2")
|
||||||
}
|
}
|
||||||
stream, _, err := m.src.GetBlob(types.BlobInfo{
|
stream, _, err := m.src.GetBlob(ctx, types.BlobInfo{
|
||||||
Digest: m.m.ConfigDescriptor.Digest,
|
Digest: m.m.ConfigDescriptor.Digest,
|
||||||
Size: m.m.ConfigDescriptor.Size,
|
Size: m.m.ConfigDescriptor.Size,
|
||||||
URLs: m.m.ConfigDescriptor.URLs,
|
URLs: m.m.ConfigDescriptor.URLs,
|
||||||
@ -131,13 +132,13 @@ func (m *manifestSchema2) EmbeddedDockerReferenceConflicts(ref reference.Named)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Inspect returns various information for (skopeo inspect) parsed from the manifest and configuration.
|
// Inspect returns various information for (skopeo inspect) parsed from the manifest and configuration.
|
||||||
func (m *manifestSchema2) Inspect() (*types.ImageInspectInfo, error) {
|
func (m *manifestSchema2) Inspect(ctx context.Context) (*types.ImageInspectInfo, error) {
|
||||||
getter := func(info types.BlobInfo) ([]byte, error) {
|
getter := func(info types.BlobInfo) ([]byte, error) {
|
||||||
if info.Digest != m.ConfigInfo().Digest {
|
if info.Digest != m.ConfigInfo().Digest {
|
||||||
// Shouldn't ever happen
|
// Shouldn't ever happen
|
||||||
return nil, errors.New("asked for a different config blob")
|
return nil, errors.New("asked for a different config blob")
|
||||||
}
|
}
|
||||||
config, err := m.ConfigBlob()
|
config, err := m.ConfigBlob(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -155,7 +156,7 @@ func (m *manifestSchema2) UpdatedImageNeedsLayerDiffIDs(options types.ManifestUp
|
|||||||
|
|
||||||
// UpdatedImage returns a types.Image modified according to options.
|
// UpdatedImage returns a types.Image modified according to options.
|
||||||
// This does not change the state of the original Image object.
|
// This does not change the state of the original Image object.
|
||||||
func (m *manifestSchema2) UpdatedImage(options types.ManifestUpdateOptions) (types.Image, error) {
|
func (m *manifestSchema2) UpdatedImage(ctx context.Context, options types.ManifestUpdateOptions) (types.Image, error) {
|
||||||
copy := manifestSchema2{ // NOTE: This is not a deep copy, it still shares slices etc.
|
copy := manifestSchema2{ // NOTE: This is not a deep copy, it still shares slices etc.
|
||||||
src: m.src,
|
src: m.src,
|
||||||
configBlob: m.configBlob,
|
configBlob: m.configBlob,
|
||||||
@ -171,9 +172,9 @@ func (m *manifestSchema2) UpdatedImage(options types.ManifestUpdateOptions) (typ
|
|||||||
switch options.ManifestMIMEType {
|
switch options.ManifestMIMEType {
|
||||||
case "": // No conversion, OK
|
case "": // No conversion, OK
|
||||||
case manifest.DockerV2Schema1SignedMediaType, manifest.DockerV2Schema1MediaType:
|
case manifest.DockerV2Schema1SignedMediaType, manifest.DockerV2Schema1MediaType:
|
||||||
return copy.convertToManifestSchema1(options.InformationOnly.Destination)
|
return copy.convertToManifestSchema1(ctx, options.InformationOnly.Destination)
|
||||||
case imgspecv1.MediaTypeImageManifest:
|
case imgspecv1.MediaTypeImageManifest:
|
||||||
return copy.convertToManifestOCI1()
|
return copy.convertToManifestOCI1(ctx)
|
||||||
default:
|
default:
|
||||||
return nil, errors.Errorf("Conversion of image manifest from %s to %s is not implemented", manifest.DockerV2Schema2MediaType, options.ManifestMIMEType)
|
return nil, errors.Errorf("Conversion of image manifest from %s to %s is not implemented", manifest.DockerV2Schema2MediaType, options.ManifestMIMEType)
|
||||||
}
|
}
|
||||||
@ -190,8 +191,8 @@ func oci1DescriptorFromSchema2Descriptor(d manifest.Schema2Descriptor) imgspecv1
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *manifestSchema2) convertToManifestOCI1() (types.Image, error) {
|
func (m *manifestSchema2) convertToManifestOCI1(ctx context.Context) (types.Image, error) {
|
||||||
configOCI, err := m.OCIConfig()
|
configOCI, err := m.OCIConfig(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -223,8 +224,8 @@ func (m *manifestSchema2) convertToManifestOCI1() (types.Image, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Based on docker/distribution/manifest/schema1/config_builder.go
|
// Based on docker/distribution/manifest/schema1/config_builder.go
|
||||||
func (m *manifestSchema2) convertToManifestSchema1(dest types.ImageDestination) (types.Image, error) {
|
func (m *manifestSchema2) convertToManifestSchema1(ctx context.Context, dest types.ImageDestination) (types.Image, error) {
|
||||||
configBytes, err := m.ConfigBlob()
|
configBytes, err := m.ConfigBlob(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -252,7 +253,7 @@ func (m *manifestSchema2) convertToManifestSchema1(dest types.ImageDestination)
|
|||||||
if historyEntry.EmptyLayer {
|
if historyEntry.EmptyLayer {
|
||||||
if !haveGzippedEmptyLayer {
|
if !haveGzippedEmptyLayer {
|
||||||
logrus.Debugf("Uploading empty layer during conversion to schema 1")
|
logrus.Debugf("Uploading empty layer during conversion to schema 1")
|
||||||
info, err := dest.PutBlob(bytes.NewReader(gzippedEmptyLayer), types.BlobInfo{Digest: gzippedEmptyLayerDigest, Size: int64(len(gzippedEmptyLayer))}, false)
|
info, err := dest.PutBlob(ctx, bytes.NewReader(gzippedEmptyLayer), types.BlobInfo{Digest: gzippedEmptyLayerDigest, Size: int64(len(gzippedEmptyLayer))}, false)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, errors.Wrap(err, "Error uploading empty layer")
|
return nil, errors.Wrap(err, "Error uploading empty layer")
|
||||||
}
|
}
|
||||||
|
13
vendor/github.com/containers/image/image/manifest.go
generated
vendored
13
vendor/github.com/containers/image/image/manifest.go
generated
vendored
@ -1,6 +1,7 @@
|
|||||||
package image
|
package image
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/containers/image/docker/reference"
|
"github.com/containers/image/docker/reference"
|
||||||
@ -21,11 +22,11 @@ type genericManifest interface {
|
|||||||
ConfigInfo() types.BlobInfo
|
ConfigInfo() types.BlobInfo
|
||||||
// ConfigBlob returns the blob described by ConfigInfo, iff ConfigInfo().Digest != ""; nil otherwise.
|
// ConfigBlob returns the blob described by ConfigInfo, iff ConfigInfo().Digest != ""; nil otherwise.
|
||||||
// The result is cached; it is OK to call this however often you need.
|
// The result is cached; it is OK to call this however often you need.
|
||||||
ConfigBlob() ([]byte, error)
|
ConfigBlob(context.Context) ([]byte, error)
|
||||||
// OCIConfig returns the image configuration as per OCI v1 image-spec. Information about
|
// OCIConfig returns the image configuration as per OCI v1 image-spec. Information about
|
||||||
// layers in the resulting configuration isn't guaranteed to be returned to due how
|
// layers in the resulting configuration isn't guaranteed to be returned to due how
|
||||||
// old image manifests work (docker v2s1 especially).
|
// old image manifests work (docker v2s1 especially).
|
||||||
OCIConfig() (*imgspecv1.Image, error)
|
OCIConfig(context.Context) (*imgspecv1.Image, error)
|
||||||
// LayerInfos returns a list of BlobInfos of layers referenced by this image, in order (the root layer first, and then successive layered layers).
|
// LayerInfos returns a list of BlobInfos of layers referenced by this image, in order (the root layer first, and then successive layered layers).
|
||||||
// The Digest field is guaranteed to be provided; Size may be -1.
|
// The Digest field is guaranteed to be provided; Size may be -1.
|
||||||
// WARNING: The list may contain duplicates, and they are semantically relevant.
|
// WARNING: The list may contain duplicates, and they are semantically relevant.
|
||||||
@ -35,19 +36,19 @@ type genericManifest interface {
|
|||||||
// (This embedding unfortunately happens for Docker schema1, please do not add support for this in any new formats.)
|
// (This embedding unfortunately happens for Docker schema1, please do not add support for this in any new formats.)
|
||||||
EmbeddedDockerReferenceConflicts(ref reference.Named) bool
|
EmbeddedDockerReferenceConflicts(ref reference.Named) bool
|
||||||
// Inspect returns various information for (skopeo inspect) parsed from the manifest and configuration.
|
// Inspect returns various information for (skopeo inspect) parsed from the manifest and configuration.
|
||||||
Inspect() (*types.ImageInspectInfo, error)
|
Inspect(context.Context) (*types.ImageInspectInfo, error)
|
||||||
// UpdatedImageNeedsLayerDiffIDs returns true iff UpdatedImage(options) needs InformationOnly.LayerDiffIDs.
|
// UpdatedImageNeedsLayerDiffIDs returns true iff UpdatedImage(options) needs InformationOnly.LayerDiffIDs.
|
||||||
// This is a horribly specific interface, but computing InformationOnly.LayerDiffIDs can be very expensive to compute
|
// This is a horribly specific interface, but computing InformationOnly.LayerDiffIDs can be very expensive to compute
|
||||||
// (most importantly it forces us to download the full layers even if they are already present at the destination).
|
// (most importantly it forces us to download the full layers even if they are already present at the destination).
|
||||||
UpdatedImageNeedsLayerDiffIDs(options types.ManifestUpdateOptions) bool
|
UpdatedImageNeedsLayerDiffIDs(options types.ManifestUpdateOptions) bool
|
||||||
// UpdatedImage returns a types.Image modified according to options.
|
// UpdatedImage returns a types.Image modified according to options.
|
||||||
// This does not change the state of the original Image object.
|
// This does not change the state of the original Image object.
|
||||||
UpdatedImage(options types.ManifestUpdateOptions) (types.Image, error)
|
UpdatedImage(ctx context.Context, options types.ManifestUpdateOptions) (types.Image, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
// manifestInstanceFromBlob returns a genericManifest implementation for (manblob, mt) in src.
|
// manifestInstanceFromBlob returns a genericManifest implementation for (manblob, mt) in src.
|
||||||
// If manblob is a manifest list, it implicitly chooses an appropriate image from the list.
|
// If manblob is a manifest list, it implicitly chooses an appropriate image from the list.
|
||||||
func manifestInstanceFromBlob(ctx *types.SystemContext, src types.ImageSource, manblob []byte, mt string) (genericManifest, error) {
|
func manifestInstanceFromBlob(ctx context.Context, sys *types.SystemContext, src types.ImageSource, manblob []byte, mt string) (genericManifest, error) {
|
||||||
switch manifest.NormalizedMIMEType(mt) {
|
switch manifest.NormalizedMIMEType(mt) {
|
||||||
case manifest.DockerV2Schema1MediaType, manifest.DockerV2Schema1SignedMediaType:
|
case manifest.DockerV2Schema1MediaType, manifest.DockerV2Schema1SignedMediaType:
|
||||||
return manifestSchema1FromManifest(manblob)
|
return manifestSchema1FromManifest(manblob)
|
||||||
@ -56,7 +57,7 @@ func manifestInstanceFromBlob(ctx *types.SystemContext, src types.ImageSource, m
|
|||||||
case manifest.DockerV2Schema2MediaType:
|
case manifest.DockerV2Schema2MediaType:
|
||||||
return manifestSchema2FromManifest(src, manblob)
|
return manifestSchema2FromManifest(src, manblob)
|
||||||
case manifest.DockerV2ListMediaType:
|
case manifest.DockerV2ListMediaType:
|
||||||
return manifestSchema2FromManifestList(ctx, src, manblob)
|
return manifestSchema2FromManifestList(ctx, sys, src, manblob)
|
||||||
default: // Note that this may not be reachable, manifest.NormalizedMIMEType has a default for unknown values.
|
default: // Note that this may not be reachable, manifest.NormalizedMIMEType has a default for unknown values.
|
||||||
return nil, fmt.Errorf("Unimplemented manifest MIME type %s", mt)
|
return nil, fmt.Errorf("Unimplemented manifest MIME type %s", mt)
|
||||||
}
|
}
|
||||||
|
4
vendor/github.com/containers/image/image/memory.go
generated
vendored
4
vendor/github.com/containers/image/image/memory.go
generated
vendored
@ -39,7 +39,7 @@ func (i *memoryImage) Size() (int64, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Manifest is like ImageSource.GetManifest, but the result is cached; it is OK to call this however often you need.
|
// Manifest is like ImageSource.GetManifest, but the result is cached; it is OK to call this however often you need.
|
||||||
func (i *memoryImage) Manifest() ([]byte, string, error) {
|
func (i *memoryImage) Manifest(ctx context.Context) ([]byte, string, error) {
|
||||||
if i.serializedManifest == nil {
|
if i.serializedManifest == nil {
|
||||||
m, err := i.genericManifest.serialize()
|
m, err := i.genericManifest.serialize()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -60,6 +60,6 @@ func (i *memoryImage) Signatures(ctx context.Context) ([][]byte, error) {
|
|||||||
// LayerInfosForCopy returns an updated set of layer blob information which may not match the manifest.
|
// LayerInfosForCopy returns an updated set of layer blob information which may not match the manifest.
|
||||||
// The Digest field is guaranteed to be provided; Size may be -1.
|
// The Digest field is guaranteed to be provided; Size may be -1.
|
||||||
// WARNING: The list may contain duplicates, and they are semantically relevant.
|
// WARNING: The list may contain duplicates, and they are semantically relevant.
|
||||||
func (i *memoryImage) LayerInfosForCopy() ([]types.BlobInfo, error) {
|
func (i *memoryImage) LayerInfosForCopy(ctx context.Context) ([]types.BlobInfo, error) {
|
||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
17
vendor/github.com/containers/image/image/oci.go
generated
vendored
17
vendor/github.com/containers/image/image/oci.go
generated
vendored
@ -1,6 +1,7 @@
|
|||||||
package image
|
package image
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
|
|
||||||
@ -54,12 +55,12 @@ func (m *manifestOCI1) ConfigInfo() types.BlobInfo {
|
|||||||
|
|
||||||
// ConfigBlob returns the blob described by ConfigInfo, iff ConfigInfo().Digest != ""; nil otherwise.
|
// ConfigBlob returns the blob described by ConfigInfo, iff ConfigInfo().Digest != ""; nil otherwise.
|
||||||
// The result is cached; it is OK to call this however often you need.
|
// The result is cached; it is OK to call this however often you need.
|
||||||
func (m *manifestOCI1) ConfigBlob() ([]byte, error) {
|
func (m *manifestOCI1) ConfigBlob(ctx context.Context) ([]byte, error) {
|
||||||
if m.configBlob == nil {
|
if m.configBlob == nil {
|
||||||
if m.src == nil {
|
if m.src == nil {
|
||||||
return nil, errors.Errorf("Internal error: neither src nor configBlob set in manifestOCI1")
|
return nil, errors.Errorf("Internal error: neither src nor configBlob set in manifestOCI1")
|
||||||
}
|
}
|
||||||
stream, _, err := m.src.GetBlob(types.BlobInfo{
|
stream, _, err := m.src.GetBlob(ctx, types.BlobInfo{
|
||||||
Digest: m.m.Config.Digest,
|
Digest: m.m.Config.Digest,
|
||||||
Size: m.m.Config.Size,
|
Size: m.m.Config.Size,
|
||||||
URLs: m.m.Config.URLs,
|
URLs: m.m.Config.URLs,
|
||||||
@ -84,8 +85,8 @@ func (m *manifestOCI1) ConfigBlob() ([]byte, error) {
|
|||||||
// OCIConfig returns the image configuration as per OCI v1 image-spec. Information about
|
// OCIConfig returns the image configuration as per OCI v1 image-spec. Information about
|
||||||
// layers in the resulting configuration isn't guaranteed to be returned to due how
|
// layers in the resulting configuration isn't guaranteed to be returned to due how
|
||||||
// old image manifests work (docker v2s1 especially).
|
// old image manifests work (docker v2s1 especially).
|
||||||
func (m *manifestOCI1) OCIConfig() (*imgspecv1.Image, error) {
|
func (m *manifestOCI1) OCIConfig(ctx context.Context) (*imgspecv1.Image, error) {
|
||||||
cb, err := m.ConfigBlob()
|
cb, err := m.ConfigBlob(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -111,13 +112,13 @@ func (m *manifestOCI1) EmbeddedDockerReferenceConflicts(ref reference.Named) boo
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Inspect returns various information for (skopeo inspect) parsed from the manifest and configuration.
|
// Inspect returns various information for (skopeo inspect) parsed from the manifest and configuration.
|
||||||
func (m *manifestOCI1) Inspect() (*types.ImageInspectInfo, error) {
|
func (m *manifestOCI1) Inspect(ctx context.Context) (*types.ImageInspectInfo, error) {
|
||||||
getter := func(info types.BlobInfo) ([]byte, error) {
|
getter := func(info types.BlobInfo) ([]byte, error) {
|
||||||
if info.Digest != m.ConfigInfo().Digest {
|
if info.Digest != m.ConfigInfo().Digest {
|
||||||
// Shouldn't ever happen
|
// Shouldn't ever happen
|
||||||
return nil, errors.New("asked for a different config blob")
|
return nil, errors.New("asked for a different config blob")
|
||||||
}
|
}
|
||||||
config, err := m.ConfigBlob()
|
config, err := m.ConfigBlob(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -135,7 +136,7 @@ func (m *manifestOCI1) UpdatedImageNeedsLayerDiffIDs(options types.ManifestUpdat
|
|||||||
|
|
||||||
// UpdatedImage returns a types.Image modified according to options.
|
// UpdatedImage returns a types.Image modified according to options.
|
||||||
// This does not change the state of the original Image object.
|
// This does not change the state of the original Image object.
|
||||||
func (m *manifestOCI1) UpdatedImage(options types.ManifestUpdateOptions) (types.Image, error) {
|
func (m *manifestOCI1) UpdatedImage(ctx context.Context, options types.ManifestUpdateOptions) (types.Image, error) {
|
||||||
copy := manifestOCI1{ // NOTE: This is not a deep copy, it still shares slices etc.
|
copy := manifestOCI1{ // NOTE: This is not a deep copy, it still shares slices etc.
|
||||||
src: m.src,
|
src: m.src,
|
||||||
configBlob: m.configBlob,
|
configBlob: m.configBlob,
|
||||||
@ -156,7 +157,7 @@ func (m *manifestOCI1) UpdatedImage(options types.ManifestUpdateOptions) (types.
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
return m2.UpdatedImage(types.ManifestUpdateOptions{
|
return m2.UpdatedImage(ctx, types.ManifestUpdateOptions{
|
||||||
ManifestMIMEType: options.ManifestMIMEType,
|
ManifestMIMEType: options.ManifestMIMEType,
|
||||||
InformationOnly: options.InformationOnly,
|
InformationOnly: options.InformationOnly,
|
||||||
})
|
})
|
||||||
|
17
vendor/github.com/containers/image/image/sourced.go
generated
vendored
17
vendor/github.com/containers/image/image/sourced.go
generated
vendored
@ -4,6 +4,7 @@
|
|||||||
package image
|
package image
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"context"
|
||||||
"github.com/containers/image/types"
|
"github.com/containers/image/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -28,8 +29,8 @@ type imageCloser struct {
|
|||||||
//
|
//
|
||||||
// NOTE: If any kind of signature verification should happen, build an UnparsedImage from the value returned by NewImageSource,
|
// NOTE: If any kind of signature verification should happen, build an UnparsedImage from the value returned by NewImageSource,
|
||||||
// verify that UnparsedImage, and convert it into a real Image via image.FromUnparsedImage instead of calling this function.
|
// verify that UnparsedImage, and convert it into a real Image via image.FromUnparsedImage instead of calling this function.
|
||||||
func FromSource(ctx *types.SystemContext, src types.ImageSource) (types.ImageCloser, error) {
|
func FromSource(ctx context.Context, sys *types.SystemContext, src types.ImageSource) (types.ImageCloser, error) {
|
||||||
img, err := FromUnparsedImage(ctx, UnparsedInstance(src, nil))
|
img, err := FromUnparsedImage(ctx, sys, UnparsedInstance(src, nil))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -63,18 +64,18 @@ type sourcedImage struct {
|
|||||||
// but other methods transparently return data from an appropriate single image.
|
// but other methods transparently return data from an appropriate single image.
|
||||||
//
|
//
|
||||||
// The Image must not be used after the underlying ImageSource is Close()d.
|
// The Image must not be used after the underlying ImageSource is Close()d.
|
||||||
func FromUnparsedImage(ctx *types.SystemContext, unparsed *UnparsedImage) (types.Image, error) {
|
func FromUnparsedImage(ctx context.Context, sys *types.SystemContext, unparsed *UnparsedImage) (types.Image, error) {
|
||||||
// Note that the input parameter above is specifically *image.UnparsedImage, not types.UnparsedImage:
|
// Note that the input parameter above is specifically *image.UnparsedImage, not types.UnparsedImage:
|
||||||
// we want to be able to use unparsed.src. We could make that an explicit interface, but, well,
|
// we want to be able to use unparsed.src. We could make that an explicit interface, but, well,
|
||||||
// this is the only UnparsedImage implementation around, anyway.
|
// this is the only UnparsedImage implementation around, anyway.
|
||||||
|
|
||||||
// NOTE: It is essential for signature verification that all parsing done in this object happens on the same manifest which is returned by unparsed.Manifest().
|
// NOTE: It is essential for signature verification that all parsing done in this object happens on the same manifest which is returned by unparsed.Manifest().
|
||||||
manifestBlob, manifestMIMEType, err := unparsed.Manifest()
|
manifestBlob, manifestMIMEType, err := unparsed.Manifest(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
parsedManifest, err := manifestInstanceFromBlob(ctx, unparsed.src, manifestBlob, manifestMIMEType)
|
parsedManifest, err := manifestInstanceFromBlob(ctx, sys, unparsed.src, manifestBlob, manifestMIMEType)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -93,10 +94,10 @@ func (i *sourcedImage) Size() (int64, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Manifest overrides the UnparsedImage.Manifest to always use the fields which we have already fetched.
|
// Manifest overrides the UnparsedImage.Manifest to always use the fields which we have already fetched.
|
||||||
func (i *sourcedImage) Manifest() ([]byte, string, error) {
|
func (i *sourcedImage) Manifest(ctx context.Context) ([]byte, string, error) {
|
||||||
return i.manifestBlob, i.manifestMIMEType, nil
|
return i.manifestBlob, i.manifestMIMEType, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (i *sourcedImage) LayerInfosForCopy() ([]types.BlobInfo, error) {
|
func (i *sourcedImage) LayerInfosForCopy(ctx context.Context) ([]types.BlobInfo, error) {
|
||||||
return i.UnparsedImage.src.LayerInfosForCopy()
|
return i.UnparsedImage.src.LayerInfosForCopy(ctx)
|
||||||
}
|
}
|
||||||
|
4
vendor/github.com/containers/image/image/unparsed.go
generated
vendored
4
vendor/github.com/containers/image/image/unparsed.go
generated
vendored
@ -41,9 +41,9 @@ func (i *UnparsedImage) Reference() types.ImageReference {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Manifest is like ImageSource.GetManifest, but the result is cached; it is OK to call this however often you need.
|
// Manifest is like ImageSource.GetManifest, but the result is cached; it is OK to call this however often you need.
|
||||||
func (i *UnparsedImage) Manifest() ([]byte, string, error) {
|
func (i *UnparsedImage) Manifest(ctx context.Context) ([]byte, string, error) {
|
||||||
if i.cachedManifest == nil {
|
if i.cachedManifest == nil {
|
||||||
m, mt, err := i.src.GetManifest(i.instanceDigest)
|
m, mt, err := i.src.GetManifest(ctx, i.instanceDigest)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, "", err
|
return nil, "", err
|
||||||
}
|
}
|
||||||
|
33
vendor/github.com/containers/image/oci/archive/oci_dest.go
generated
vendored
33
vendor/github.com/containers/image/oci/archive/oci_dest.go
generated
vendored
@ -1,6 +1,7 @@
|
|||||||
package archive
|
package archive
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"context"
|
||||||
"io"
|
"io"
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
@ -16,12 +17,12 @@ type ociArchiveImageDestination struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// newImageDestination returns an ImageDestination for writing to an existing directory.
|
// newImageDestination returns an ImageDestination for writing to an existing directory.
|
||||||
func newImageDestination(ctx *types.SystemContext, ref ociArchiveReference) (types.ImageDestination, error) {
|
func newImageDestination(ctx context.Context, sys *types.SystemContext, ref ociArchiveReference) (types.ImageDestination, error) {
|
||||||
tempDirRef, err := createOCIRef(ref.image)
|
tempDirRef, err := createOCIRef(ref.image)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, errors.Wrapf(err, "error creating oci reference")
|
return nil, errors.Wrapf(err, "error creating oci reference")
|
||||||
}
|
}
|
||||||
unpackedDest, err := tempDirRef.ociRefExtracted.NewImageDestination(ctx)
|
unpackedDest, err := tempDirRef.ociRefExtracted.NewImageDestination(ctx, sys)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if err := tempDirRef.deleteTempDir(); err != nil {
|
if err := tempDirRef.deleteTempDir(); err != nil {
|
||||||
return nil, errors.Wrapf(err, "error deleting temp directory", tempDirRef.tempDirectory)
|
return nil, errors.Wrapf(err, "error deleting temp directory", tempDirRef.tempDirectory)
|
||||||
@ -50,8 +51,8 @@ func (d *ociArchiveImageDestination) SupportedManifestMIMETypes() []string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// SupportsSignatures returns an error (to be displayed to the user) if the destination certainly can't store signatures
|
// SupportsSignatures returns an error (to be displayed to the user) if the destination certainly can't store signatures
|
||||||
func (d *ociArchiveImageDestination) SupportsSignatures() error {
|
func (d *ociArchiveImageDestination) SupportsSignatures(ctx context.Context) error {
|
||||||
return d.unpackedDest.SupportsSignatures()
|
return d.unpackedDest.SupportsSignatures(ctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d *ociArchiveImageDestination) DesiredLayerCompression() types.LayerCompression {
|
func (d *ociArchiveImageDestination) DesiredLayerCompression() types.LayerCompression {
|
||||||
@ -72,32 +73,32 @@ func (d *ociArchiveImageDestination) MustMatchRuntimeOS() bool {
|
|||||||
// PutBlob writes contents of stream and returns data representing the result (with all data filled in).
|
// PutBlob writes contents of stream and returns data representing the result (with all data filled in).
|
||||||
// inputInfo.Digest can be optionally provided if known; it is not mandatory for the implementation to verify it.
|
// inputInfo.Digest can be optionally provided if known; it is not mandatory for the implementation to verify it.
|
||||||
// inputInfo.Size is the expected length of stream, if known.
|
// inputInfo.Size is the expected length of stream, if known.
|
||||||
func (d *ociArchiveImageDestination) PutBlob(stream io.Reader, inputInfo types.BlobInfo, isConfig bool) (types.BlobInfo, error) {
|
func (d *ociArchiveImageDestination) PutBlob(ctx context.Context, stream io.Reader, inputInfo types.BlobInfo, isConfig bool) (types.BlobInfo, error) {
|
||||||
return d.unpackedDest.PutBlob(stream, inputInfo, isConfig)
|
return d.unpackedDest.PutBlob(ctx, stream, inputInfo, isConfig)
|
||||||
}
|
}
|
||||||
|
|
||||||
// HasBlob returns true iff the image destination already contains a blob with the matching digest which can be reapplied using ReapplyBlob
|
// HasBlob returns true iff the image destination already contains a blob with the matching digest which can be reapplied using ReapplyBlob
|
||||||
func (d *ociArchiveImageDestination) HasBlob(info types.BlobInfo) (bool, int64, error) {
|
func (d *ociArchiveImageDestination) HasBlob(ctx context.Context, info types.BlobInfo) (bool, int64, error) {
|
||||||
return d.unpackedDest.HasBlob(info)
|
return d.unpackedDest.HasBlob(ctx, info)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d *ociArchiveImageDestination) ReapplyBlob(info types.BlobInfo) (types.BlobInfo, error) {
|
func (d *ociArchiveImageDestination) ReapplyBlob(ctx context.Context, info types.BlobInfo) (types.BlobInfo, error) {
|
||||||
return d.unpackedDest.ReapplyBlob(info)
|
return d.unpackedDest.ReapplyBlob(ctx, info)
|
||||||
}
|
}
|
||||||
|
|
||||||
// PutManifest writes manifest to the destination
|
// PutManifest writes manifest to the destination
|
||||||
func (d *ociArchiveImageDestination) PutManifest(m []byte) error {
|
func (d *ociArchiveImageDestination) PutManifest(ctx context.Context, m []byte) error {
|
||||||
return d.unpackedDest.PutManifest(m)
|
return d.unpackedDest.PutManifest(ctx, m)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d *ociArchiveImageDestination) PutSignatures(signatures [][]byte) error {
|
func (d *ociArchiveImageDestination) PutSignatures(ctx context.Context, signatures [][]byte) error {
|
||||||
return d.unpackedDest.PutSignatures(signatures)
|
return d.unpackedDest.PutSignatures(ctx, signatures)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Commit marks the process of storing the image as successful and asks for the image to be persisted
|
// Commit marks the process of storing the image as successful and asks for the image to be persisted
|
||||||
// after the directory is made, it is tarred up into a file and the directory is deleted
|
// after the directory is made, it is tarred up into a file and the directory is deleted
|
||||||
func (d *ociArchiveImageDestination) Commit() error {
|
func (d *ociArchiveImageDestination) Commit(ctx context.Context) error {
|
||||||
if err := d.unpackedDest.Commit(); err != nil {
|
if err := d.unpackedDest.Commit(ctx); err != nil {
|
||||||
return errors.Wrapf(err, "error storing image %q", d.ref.image)
|
return errors.Wrapf(err, "error storing image %q", d.ref.image)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
14
vendor/github.com/containers/image/oci/archive/oci_src.go
generated
vendored
14
vendor/github.com/containers/image/oci/archive/oci_src.go
generated
vendored
@ -19,13 +19,13 @@ type ociArchiveImageSource struct {
|
|||||||
|
|
||||||
// newImageSource returns an ImageSource for reading from an existing directory.
|
// newImageSource returns an ImageSource for reading from an existing directory.
|
||||||
// newImageSource untars the file and saves it in a temp directory
|
// newImageSource untars the file and saves it in a temp directory
|
||||||
func newImageSource(ctx *types.SystemContext, ref ociArchiveReference) (types.ImageSource, error) {
|
func newImageSource(ctx context.Context, sys *types.SystemContext, ref ociArchiveReference) (types.ImageSource, error) {
|
||||||
tempDirRef, err := createUntarTempDir(ref)
|
tempDirRef, err := createUntarTempDir(ref)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, errors.Wrap(err, "error creating temp directory")
|
return nil, errors.Wrap(err, "error creating temp directory")
|
||||||
}
|
}
|
||||||
|
|
||||||
unpackedSrc, err := tempDirRef.ociRefExtracted.NewImageSource(ctx)
|
unpackedSrc, err := tempDirRef.ociRefExtracted.NewImageSource(ctx, sys)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if err := tempDirRef.deleteTempDir(); err != nil {
|
if err := tempDirRef.deleteTempDir(); err != nil {
|
||||||
return nil, errors.Wrapf(err, "error deleting temp directory", tempDirRef.tempDirectory)
|
return nil, errors.Wrapf(err, "error deleting temp directory", tempDirRef.tempDirectory)
|
||||||
@ -72,13 +72,13 @@ func (s *ociArchiveImageSource) Close() error {
|
|||||||
// It may use a remote (= slow) service.
|
// It may use a remote (= slow) service.
|
||||||
// If instanceDigest is not nil, it contains a digest of the specific manifest instance to retrieve (when the primary manifest is a manifest list);
|
// If instanceDigest is not nil, it contains a digest of the specific manifest instance to retrieve (when the primary manifest is a manifest list);
|
||||||
// this never happens if the primary manifest is not a manifest list (e.g. if the source never returns manifest lists).
|
// this never happens if the primary manifest is not a manifest list (e.g. if the source never returns manifest lists).
|
||||||
func (s *ociArchiveImageSource) GetManifest(instanceDigest *digest.Digest) ([]byte, string, error) {
|
func (s *ociArchiveImageSource) GetManifest(ctx context.Context, instanceDigest *digest.Digest) ([]byte, string, error) {
|
||||||
return s.unpackedSrc.GetManifest(instanceDigest)
|
return s.unpackedSrc.GetManifest(ctx, instanceDigest)
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetBlob returns a stream for the specified blob, and the blob's size.
|
// GetBlob returns a stream for the specified blob, and the blob's size.
|
||||||
func (s *ociArchiveImageSource) GetBlob(info types.BlobInfo) (io.ReadCloser, int64, error) {
|
func (s *ociArchiveImageSource) GetBlob(ctx context.Context, info types.BlobInfo) (io.ReadCloser, int64, error) {
|
||||||
return s.unpackedSrc.GetBlob(info)
|
return s.unpackedSrc.GetBlob(ctx, info)
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetSignatures returns the image's signatures. It may use a remote (= slow) service.
|
// GetSignatures returns the image's signatures. It may use a remote (= slow) service.
|
||||||
@ -90,6 +90,6 @@ func (s *ociArchiveImageSource) GetSignatures(ctx context.Context, instanceDiges
|
|||||||
}
|
}
|
||||||
|
|
||||||
// LayerInfosForCopy() returns updated layer info that should be used when reading, in preference to values in the manifest, if specified.
|
// LayerInfosForCopy() returns updated layer info that should be used when reading, in preference to values in the manifest, if specified.
|
||||||
func (s *ociArchiveImageSource) LayerInfosForCopy() ([]types.BlobInfo, error) {
|
func (s *ociArchiveImageSource) LayerInfosForCopy(ctx context.Context) ([]types.BlobInfo, error) {
|
||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
17
vendor/github.com/containers/image/oci/archive/oci_transport.go
generated
vendored
17
vendor/github.com/containers/image/oci/archive/oci_transport.go
generated
vendored
@ -1,6 +1,7 @@
|
|||||||
package archive
|
package archive
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"os"
|
"os"
|
||||||
@ -121,28 +122,28 @@ func (ref ociArchiveReference) PolicyConfigurationNamespaces() []string {
|
|||||||
// NOTE: If any kind of signature verification should happen, build an UnparsedImage from the value returned by NewImageSource,
|
// NOTE: If any kind of signature verification should happen, build an UnparsedImage from the value returned by NewImageSource,
|
||||||
// verify that UnparsedImage, and convert it into a real Image via image.FromUnparsedImage.
|
// verify that UnparsedImage, and convert it into a real Image via image.FromUnparsedImage.
|
||||||
// WARNING: This may not do the right thing for a manifest list, see image.FromSource for details.
|
// WARNING: This may not do the right thing for a manifest list, see image.FromSource for details.
|
||||||
func (ref ociArchiveReference) NewImage(ctx *types.SystemContext) (types.ImageCloser, error) {
|
func (ref ociArchiveReference) NewImage(ctx context.Context, sys *types.SystemContext) (types.ImageCloser, error) {
|
||||||
src, err := newImageSource(ctx, ref)
|
src, err := newImageSource(ctx, sys, ref)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
return image.FromSource(ctx, src)
|
return image.FromSource(ctx, sys, src)
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewImageSource returns a types.ImageSource for this reference.
|
// NewImageSource returns a types.ImageSource for this reference.
|
||||||
// The caller must call .Close() on the returned ImageSource.
|
// The caller must call .Close() on the returned ImageSource.
|
||||||
func (ref ociArchiveReference) NewImageSource(ctx *types.SystemContext) (types.ImageSource, error) {
|
func (ref ociArchiveReference) NewImageSource(ctx context.Context, sys *types.SystemContext) (types.ImageSource, error) {
|
||||||
return newImageSource(ctx, ref)
|
return newImageSource(ctx, sys, ref)
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewImageDestination returns a types.ImageDestination for this reference.
|
// NewImageDestination returns a types.ImageDestination for this reference.
|
||||||
// The caller must call .Close() on the returned ImageDestination.
|
// The caller must call .Close() on the returned ImageDestination.
|
||||||
func (ref ociArchiveReference) NewImageDestination(ctx *types.SystemContext) (types.ImageDestination, error) {
|
func (ref ociArchiveReference) NewImageDestination(ctx context.Context, sys *types.SystemContext) (types.ImageDestination, error) {
|
||||||
return newImageDestination(ctx, ref)
|
return newImageDestination(ctx, sys, ref)
|
||||||
}
|
}
|
||||||
|
|
||||||
// DeleteImage deletes the named image from the registry, if supported.
|
// DeleteImage deletes the named image from the registry, if supported.
|
||||||
func (ref ociArchiveReference) DeleteImage(ctx *types.SystemContext) error {
|
func (ref ociArchiveReference) DeleteImage(ctx context.Context, sys *types.SystemContext) error {
|
||||||
return errors.Errorf("Deleting images not implemented for oci: images")
|
return errors.Errorf("Deleting images not implemented for oci: images")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
21
vendor/github.com/containers/image/oci/layout/oci_dest.go
generated
vendored
21
vendor/github.com/containers/image/oci/layout/oci_dest.go
generated
vendored
@ -1,6 +1,7 @@
|
|||||||
package layout
|
package layout
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"io"
|
"io"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
@ -24,7 +25,7 @@ type ociImageDestination struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// newImageDestination returns an ImageDestination for writing to an existing directory.
|
// newImageDestination returns an ImageDestination for writing to an existing directory.
|
||||||
func newImageDestination(ctx *types.SystemContext, ref ociReference) (types.ImageDestination, error) {
|
func newImageDestination(ctx context.Context, sys *types.SystemContext, ref ociReference) (types.ImageDestination, error) {
|
||||||
if ref.image == "" {
|
if ref.image == "" {
|
||||||
return nil, errors.Errorf("cannot save image with empty image.ref.name")
|
return nil, errors.Errorf("cannot save image with empty image.ref.name")
|
||||||
}
|
}
|
||||||
@ -45,8 +46,8 @@ func newImageDestination(ctx *types.SystemContext, ref ociReference) (types.Imag
|
|||||||
}
|
}
|
||||||
|
|
||||||
d := &ociImageDestination{ref: ref, index: *index}
|
d := &ociImageDestination{ref: ref, index: *index}
|
||||||
if ctx != nil {
|
if sys != nil {
|
||||||
d.sharedBlobDir = ctx.OCISharedBlobDirPath
|
d.sharedBlobDir = sys.OCISharedBlobDirPath
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := ensureDirectoryExists(d.ref.dir); err != nil {
|
if err := ensureDirectoryExists(d.ref.dir); err != nil {
|
||||||
@ -80,7 +81,7 @@ func (d *ociImageDestination) SupportedManifestMIMETypes() []string {
|
|||||||
|
|
||||||
// SupportsSignatures returns an error (to be displayed to the user) if the destination certainly can't store signatures.
|
// SupportsSignatures returns an error (to be displayed to the user) if the destination certainly can't store signatures.
|
||||||
// Note: It is still possible for PutSignatures to fail if SupportsSignatures returns nil.
|
// Note: It is still possible for PutSignatures to fail if SupportsSignatures returns nil.
|
||||||
func (d *ociImageDestination) SupportsSignatures() error {
|
func (d *ociImageDestination) SupportsSignatures(ctx context.Context) error {
|
||||||
return errors.Errorf("Pushing signatures for OCI images is not supported")
|
return errors.Errorf("Pushing signatures for OCI images is not supported")
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -105,7 +106,7 @@ func (d *ociImageDestination) MustMatchRuntimeOS() bool {
|
|||||||
// WARNING: The contents of stream are being verified on the fly. Until stream.Read() returns io.EOF, the contents of the data SHOULD NOT be available
|
// WARNING: The contents of stream are being verified on the fly. Until stream.Read() returns io.EOF, the contents of the data SHOULD NOT be available
|
||||||
// to any other readers for download using the supplied digest.
|
// to any other readers for download using the supplied digest.
|
||||||
// If stream.Read() at any time, ESPECIALLY at end of input, returns an error, PutBlob MUST 1) fail, and 2) delete any data stored so far.
|
// If stream.Read() at any time, ESPECIALLY at end of input, returns an error, PutBlob MUST 1) fail, and 2) delete any data stored so far.
|
||||||
func (d *ociImageDestination) PutBlob(stream io.Reader, inputInfo types.BlobInfo, isConfig bool) (types.BlobInfo, error) {
|
func (d *ociImageDestination) PutBlob(ctx context.Context, stream io.Reader, inputInfo types.BlobInfo, isConfig bool) (types.BlobInfo, error) {
|
||||||
blobFile, err := ioutil.TempFile(d.ref.dir, "oci-put-blob")
|
blobFile, err := ioutil.TempFile(d.ref.dir, "oci-put-blob")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return types.BlobInfo{}, err
|
return types.BlobInfo{}, err
|
||||||
@ -168,7 +169,7 @@ func (d *ociImageDestination) PutBlob(stream io.Reader, inputInfo types.BlobInfo
|
|||||||
// Unlike PutBlob, the digest can not be empty. If HasBlob returns true, the size of the blob must also be returned.
|
// Unlike PutBlob, the digest can not be empty. If HasBlob returns true, the size of the blob must also be returned.
|
||||||
// If the destination does not contain the blob, or it is unknown, HasBlob ordinarily returns (false, -1, nil);
|
// If the destination does not contain the blob, or it is unknown, HasBlob ordinarily returns (false, -1, nil);
|
||||||
// it returns a non-nil error only on an unexpected failure.
|
// it returns a non-nil error only on an unexpected failure.
|
||||||
func (d *ociImageDestination) HasBlob(info types.BlobInfo) (bool, int64, error) {
|
func (d *ociImageDestination) HasBlob(ctx context.Context, info types.BlobInfo) (bool, int64, error) {
|
||||||
if info.Digest == "" {
|
if info.Digest == "" {
|
||||||
return false, -1, errors.Errorf(`"Can not check for a blob with unknown digest`)
|
return false, -1, errors.Errorf(`"Can not check for a blob with unknown digest`)
|
||||||
}
|
}
|
||||||
@ -186,7 +187,7 @@ func (d *ociImageDestination) HasBlob(info types.BlobInfo) (bool, int64, error)
|
|||||||
return true, finfo.Size(), nil
|
return true, finfo.Size(), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d *ociImageDestination) ReapplyBlob(info types.BlobInfo) (types.BlobInfo, error) {
|
func (d *ociImageDestination) ReapplyBlob(ctx context.Context, info types.BlobInfo) (types.BlobInfo, error) {
|
||||||
return info, nil
|
return info, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -194,7 +195,7 @@ func (d *ociImageDestination) ReapplyBlob(info types.BlobInfo) (types.BlobInfo,
|
|||||||
// FIXME? This should also receive a MIME type if known, to differentiate between schema versions.
|
// FIXME? This should also receive a MIME type if known, to differentiate between schema versions.
|
||||||
// If the destination is in principle available, refuses this manifest type (e.g. it does not recognize the schema),
|
// If the destination is in principle available, refuses this manifest type (e.g. it does not recognize the schema),
|
||||||
// but may accept a different manifest type, the returned error must be an ManifestTypeRejectedError.
|
// but may accept a different manifest type, the returned error must be an ManifestTypeRejectedError.
|
||||||
func (d *ociImageDestination) PutManifest(m []byte) error {
|
func (d *ociImageDestination) PutManifest(ctx context.Context, m []byte) error {
|
||||||
digest, err := manifest.Digest(m)
|
digest, err := manifest.Digest(m)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
@ -243,7 +244,7 @@ func (d *ociImageDestination) addManifest(desc *imgspecv1.Descriptor) {
|
|||||||
d.index.Manifests = append(d.index.Manifests, *desc)
|
d.index.Manifests = append(d.index.Manifests, *desc)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d *ociImageDestination) PutSignatures(signatures [][]byte) error {
|
func (d *ociImageDestination) PutSignatures(ctx context.Context, signatures [][]byte) error {
|
||||||
if len(signatures) != 0 {
|
if len(signatures) != 0 {
|
||||||
return errors.Errorf("Pushing signatures for OCI images is not supported")
|
return errors.Errorf("Pushing signatures for OCI images is not supported")
|
||||||
}
|
}
|
||||||
@ -254,7 +255,7 @@ func (d *ociImageDestination) PutSignatures(signatures [][]byte) error {
|
|||||||
// WARNING: This does not have any transactional semantics:
|
// WARNING: This does not have any transactional semantics:
|
||||||
// - Uploaded data MAY be visible to others before Commit() is called
|
// - Uploaded data MAY be visible to others before Commit() is called
|
||||||
// - Uploaded data MAY be removed or MAY remain around if Close() is called without Commit() (i.e. rollback is allowed but not guaranteed)
|
// - Uploaded data MAY be removed or MAY remain around if Close() is called without Commit() (i.e. rollback is allowed but not guaranteed)
|
||||||
func (d *ociImageDestination) Commit() error {
|
func (d *ociImageDestination) Commit(ctx context.Context) error {
|
||||||
if err := ioutil.WriteFile(d.ref.ociLayoutPath(), []byte(`{"imageLayoutVersion": "1.0.0"}`), 0644); err != nil {
|
if err := ioutil.WriteFile(d.ref.ociLayoutPath(), []byte(`{"imageLayoutVersion": "1.0.0"}`), 0644); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
31
vendor/github.com/containers/image/oci/layout/oci_src.go
generated
vendored
31
vendor/github.com/containers/image/oci/layout/oci_src.go
generated
vendored
@ -24,15 +24,15 @@ type ociImageSource struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// newImageSource returns an ImageSource for reading from an existing directory.
|
// newImageSource returns an ImageSource for reading from an existing directory.
|
||||||
func newImageSource(ctx *types.SystemContext, ref ociReference) (types.ImageSource, error) {
|
func newImageSource(ctx context.Context, sys *types.SystemContext, ref ociReference) (types.ImageSource, error) {
|
||||||
tr := tlsclientconfig.NewTransport()
|
tr := tlsclientconfig.NewTransport()
|
||||||
tr.TLSClientConfig = tlsconfig.ServerDefault()
|
tr.TLSClientConfig = tlsconfig.ServerDefault()
|
||||||
|
|
||||||
if ctx != nil && ctx.OCICertPath != "" {
|
if sys != nil && sys.OCICertPath != "" {
|
||||||
if err := tlsclientconfig.SetupCertificates(ctx.OCICertPath, tr.TLSClientConfig); err != nil {
|
if err := tlsclientconfig.SetupCertificates(sys.OCICertPath, tr.TLSClientConfig); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
tr.TLSClientConfig.InsecureSkipVerify = ctx.OCIInsecureSkipTLSVerify
|
tr.TLSClientConfig.InsecureSkipVerify = sys.OCIInsecureSkipTLSVerify
|
||||||
}
|
}
|
||||||
|
|
||||||
client := &http.Client{}
|
client := &http.Client{}
|
||||||
@ -42,9 +42,9 @@ func newImageSource(ctx *types.SystemContext, ref ociReference) (types.ImageSour
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
d := &ociImageSource{ref: ref, descriptor: descriptor, client: client}
|
d := &ociImageSource{ref: ref, descriptor: descriptor, client: client}
|
||||||
if ctx != nil {
|
if sys != nil {
|
||||||
// TODO(jonboulle): check dir existence?
|
// TODO(jonboulle): check dir existence?
|
||||||
d.sharedBlobDir = ctx.OCISharedBlobDirPath
|
d.sharedBlobDir = sys.OCISharedBlobDirPath
|
||||||
}
|
}
|
||||||
return d, nil
|
return d, nil
|
||||||
}
|
}
|
||||||
@ -63,7 +63,7 @@ func (s *ociImageSource) Close() error {
|
|||||||
// It may use a remote (= slow) service.
|
// It may use a remote (= slow) service.
|
||||||
// If instanceDigest is not nil, it contains a digest of the specific manifest instance to retrieve (when the primary manifest is a manifest list);
|
// If instanceDigest is not nil, it contains a digest of the specific manifest instance to retrieve (when the primary manifest is a manifest list);
|
||||||
// this never happens if the primary manifest is not a manifest list (e.g. if the source never returns manifest lists).
|
// this never happens if the primary manifest is not a manifest list (e.g. if the source never returns manifest lists).
|
||||||
func (s *ociImageSource) GetManifest(instanceDigest *digest.Digest) ([]byte, string, error) {
|
func (s *ociImageSource) GetManifest(ctx context.Context, instanceDigest *digest.Digest) ([]byte, string, error) {
|
||||||
var dig digest.Digest
|
var dig digest.Digest
|
||||||
var mimeType string
|
var mimeType string
|
||||||
if instanceDigest == nil {
|
if instanceDigest == nil {
|
||||||
@ -93,9 +93,9 @@ func (s *ociImageSource) GetManifest(instanceDigest *digest.Digest) ([]byte, str
|
|||||||
}
|
}
|
||||||
|
|
||||||
// GetBlob returns a stream for the specified blob, and the blob's size.
|
// GetBlob returns a stream for the specified blob, and the blob's size.
|
||||||
func (s *ociImageSource) GetBlob(info types.BlobInfo) (io.ReadCloser, int64, error) {
|
func (s *ociImageSource) GetBlob(ctx context.Context, info types.BlobInfo) (io.ReadCloser, int64, error) {
|
||||||
if len(info.URLs) != 0 {
|
if len(info.URLs) != 0 {
|
||||||
return s.getExternalBlob(info.URLs)
|
return s.getExternalBlob(ctx, info.URLs)
|
||||||
}
|
}
|
||||||
|
|
||||||
path, err := s.ref.blobPath(info.Digest, s.sharedBlobDir)
|
path, err := s.ref.blobPath(info.Digest, s.sharedBlobDir)
|
||||||
@ -122,10 +122,17 @@ func (s *ociImageSource) GetSignatures(ctx context.Context, instanceDigest *dige
|
|||||||
return [][]byte{}, nil
|
return [][]byte{}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *ociImageSource) getExternalBlob(urls []string) (io.ReadCloser, int64, error) {
|
func (s *ociImageSource) getExternalBlob(ctx context.Context, urls []string) (io.ReadCloser, int64, error) {
|
||||||
errWrap := errors.New("failed fetching external blob from all urls")
|
errWrap := errors.New("failed fetching external blob from all urls")
|
||||||
for _, url := range urls {
|
for _, url := range urls {
|
||||||
resp, err := s.client.Get(url)
|
|
||||||
|
req, err := http.NewRequest("GET", url, nil)
|
||||||
|
if err != nil {
|
||||||
|
errWrap = errors.Wrapf(errWrap, "fetching %s failed %s", url, err.Error())
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
resp, err := s.client.Do(req.WithContext(ctx))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
errWrap = errors.Wrapf(errWrap, "fetching %s failed %s", url, err.Error())
|
errWrap = errors.Wrapf(errWrap, "fetching %s failed %s", url, err.Error())
|
||||||
continue
|
continue
|
||||||
@ -144,7 +151,7 @@ func (s *ociImageSource) getExternalBlob(urls []string) (io.ReadCloser, int64, e
|
|||||||
}
|
}
|
||||||
|
|
||||||
// LayerInfosForCopy() returns updated layer info that should be used when reading, in preference to values in the manifest, if specified.
|
// LayerInfosForCopy() returns updated layer info that should be used when reading, in preference to values in the manifest, if specified.
|
||||||
func (s *ociImageSource) LayerInfosForCopy() ([]types.BlobInfo, error) {
|
func (s *ociImageSource) LayerInfosForCopy(ctx context.Context) ([]types.BlobInfo, error) {
|
||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
17
vendor/github.com/containers/image/oci/layout/oci_transport.go
generated
vendored
17
vendor/github.com/containers/image/oci/layout/oci_transport.go
generated
vendored
@ -1,6 +1,7 @@
|
|||||||
package layout
|
package layout
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
@ -144,12 +145,12 @@ func (ref ociReference) PolicyConfigurationNamespaces() []string {
|
|||||||
// NOTE: If any kind of signature verification should happen, build an UnparsedImage from the value returned by NewImageSource,
|
// NOTE: If any kind of signature verification should happen, build an UnparsedImage from the value returned by NewImageSource,
|
||||||
// verify that UnparsedImage, and convert it into a real Image via image.FromUnparsedImage.
|
// verify that UnparsedImage, and convert it into a real Image via image.FromUnparsedImage.
|
||||||
// WARNING: This may not do the right thing for a manifest list, see image.FromSource for details.
|
// WARNING: This may not do the right thing for a manifest list, see image.FromSource for details.
|
||||||
func (ref ociReference) NewImage(ctx *types.SystemContext) (types.ImageCloser, error) {
|
func (ref ociReference) NewImage(ctx context.Context, sys *types.SystemContext) (types.ImageCloser, error) {
|
||||||
src, err := newImageSource(ctx, ref)
|
src, err := newImageSource(ctx, sys, ref)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
return image.FromSource(ctx, src)
|
return image.FromSource(ctx, sys, src)
|
||||||
}
|
}
|
||||||
|
|
||||||
// getIndex returns a pointer to the index references by this ociReference. If an error occurs opening an index nil is returned together
|
// getIndex returns a pointer to the index references by this ociReference. If an error occurs opening an index nil is returned together
|
||||||
@ -217,18 +218,18 @@ func LoadManifestDescriptor(imgRef types.ImageReference) (imgspecv1.Descriptor,
|
|||||||
|
|
||||||
// NewImageSource returns a types.ImageSource for this reference.
|
// NewImageSource returns a types.ImageSource for this reference.
|
||||||
// The caller must call .Close() on the returned ImageSource.
|
// The caller must call .Close() on the returned ImageSource.
|
||||||
func (ref ociReference) NewImageSource(ctx *types.SystemContext) (types.ImageSource, error) {
|
func (ref ociReference) NewImageSource(ctx context.Context, sys *types.SystemContext) (types.ImageSource, error) {
|
||||||
return newImageSource(ctx, ref)
|
return newImageSource(ctx, sys, ref)
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewImageDestination returns a types.ImageDestination for this reference.
|
// NewImageDestination returns a types.ImageDestination for this reference.
|
||||||
// The caller must call .Close() on the returned ImageDestination.
|
// The caller must call .Close() on the returned ImageDestination.
|
||||||
func (ref ociReference) NewImageDestination(ctx *types.SystemContext) (types.ImageDestination, error) {
|
func (ref ociReference) NewImageDestination(ctx context.Context, sys *types.SystemContext) (types.ImageDestination, error) {
|
||||||
return newImageDestination(ctx, ref)
|
return newImageDestination(ctx, sys, ref)
|
||||||
}
|
}
|
||||||
|
|
||||||
// DeleteImage deletes the named image from the registry, if supported.
|
// DeleteImage deletes the named image from the registry, if supported.
|
||||||
func (ref ociReference) DeleteImage(ctx *types.SystemContext) error {
|
func (ref ociReference) DeleteImage(ctx context.Context, sys *types.SystemContext) error {
|
||||||
return errors.Errorf("Deleting images not implemented for oci: images")
|
return errors.Errorf("Deleting images not implemented for oci: images")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
54
vendor/github.com/containers/image/openshift/openshift.go
generated
vendored
54
vendor/github.com/containers/image/openshift/openshift.go
generated
vendored
@ -162,7 +162,7 @@ func (c *openshiftClient) convertDockerImageReference(ref string) (string, error
|
|||||||
type openshiftImageSource struct {
|
type openshiftImageSource struct {
|
||||||
client *openshiftClient
|
client *openshiftClient
|
||||||
// Values specific to this image
|
// Values specific to this image
|
||||||
ctx *types.SystemContext
|
sys *types.SystemContext
|
||||||
// State
|
// State
|
||||||
docker types.ImageSource // The Docker Registry endpoint, or nil if not resolved yet
|
docker types.ImageSource // The Docker Registry endpoint, or nil if not resolved yet
|
||||||
imageStreamImageName string // Resolved image identifier, or "" if not known yet
|
imageStreamImageName string // Resolved image identifier, or "" if not known yet
|
||||||
@ -170,7 +170,7 @@ type openshiftImageSource struct {
|
|||||||
|
|
||||||
// newImageSource creates a new ImageSource for the specified reference.
|
// newImageSource creates a new ImageSource for the specified reference.
|
||||||
// The caller must call .Close() on the returned ImageSource.
|
// The caller must call .Close() on the returned ImageSource.
|
||||||
func newImageSource(ctx *types.SystemContext, ref openshiftReference) (types.ImageSource, error) {
|
func newImageSource(ctx context.Context, sys *types.SystemContext, ref openshiftReference) (types.ImageSource, error) {
|
||||||
client, err := newOpenshiftClient(ref)
|
client, err := newOpenshiftClient(ref)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -178,7 +178,7 @@ func newImageSource(ctx *types.SystemContext, ref openshiftReference) (types.Ima
|
|||||||
|
|
||||||
return &openshiftImageSource{
|
return &openshiftImageSource{
|
||||||
client: client,
|
client: client,
|
||||||
ctx: ctx,
|
sys: sys,
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -204,19 +204,19 @@ func (s *openshiftImageSource) Close() error {
|
|||||||
// It may use a remote (= slow) service.
|
// It may use a remote (= slow) service.
|
||||||
// If instanceDigest is not nil, it contains a digest of the specific manifest instance to retrieve (when the primary manifest is a manifest list);
|
// If instanceDigest is not nil, it contains a digest of the specific manifest instance to retrieve (when the primary manifest is a manifest list);
|
||||||
// this never happens if the primary manifest is not a manifest list (e.g. if the source never returns manifest lists).
|
// this never happens if the primary manifest is not a manifest list (e.g. if the source never returns manifest lists).
|
||||||
func (s *openshiftImageSource) GetManifest(instanceDigest *digest.Digest) ([]byte, string, error) {
|
func (s *openshiftImageSource) GetManifest(ctx context.Context, instanceDigest *digest.Digest) ([]byte, string, error) {
|
||||||
if err := s.ensureImageIsResolved(context.TODO()); err != nil {
|
if err := s.ensureImageIsResolved(ctx); err != nil {
|
||||||
return nil, "", err
|
return nil, "", err
|
||||||
}
|
}
|
||||||
return s.docker.GetManifest(instanceDigest)
|
return s.docker.GetManifest(ctx, instanceDigest)
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetBlob returns a stream for the specified blob, and the blob’s size (or -1 if unknown).
|
// GetBlob returns a stream for the specified blob, and the blob’s size (or -1 if unknown).
|
||||||
func (s *openshiftImageSource) GetBlob(info types.BlobInfo) (io.ReadCloser, int64, error) {
|
func (s *openshiftImageSource) GetBlob(ctx context.Context, info types.BlobInfo) (io.ReadCloser, int64, error) {
|
||||||
if err := s.ensureImageIsResolved(context.TODO()); err != nil {
|
if err := s.ensureImageIsResolved(ctx); err != nil {
|
||||||
return nil, 0, err
|
return nil, 0, err
|
||||||
}
|
}
|
||||||
return s.docker.GetBlob(info)
|
return s.docker.GetBlob(ctx, info)
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetSignatures returns the image's signatures. It may use a remote (= slow) service.
|
// GetSignatures returns the image's signatures. It may use a remote (= slow) service.
|
||||||
@ -247,7 +247,7 @@ func (s *openshiftImageSource) GetSignatures(ctx context.Context, instanceDigest
|
|||||||
}
|
}
|
||||||
|
|
||||||
// LayerInfosForCopy() returns updated layer info that should be used when reading, in preference to values in the manifest, if specified.
|
// LayerInfosForCopy() returns updated layer info that should be used when reading, in preference to values in the manifest, if specified.
|
||||||
func (s *openshiftImageSource) LayerInfosForCopy() ([]types.BlobInfo, error) {
|
func (s *openshiftImageSource) LayerInfosForCopy(ctx context.Context) ([]types.BlobInfo, error) {
|
||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -291,7 +291,7 @@ func (s *openshiftImageSource) ensureImageIsResolved(ctx context.Context) error
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
d, err := dockerRef.NewImageSource(s.ctx)
|
d, err := dockerRef.NewImageSource(ctx, s.sys)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -308,7 +308,7 @@ type openshiftImageDestination struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// newImageDestination creates a new ImageDestination for the specified reference.
|
// newImageDestination creates a new ImageDestination for the specified reference.
|
||||||
func newImageDestination(ctx *types.SystemContext, ref openshiftReference) (types.ImageDestination, error) {
|
func newImageDestination(ctx context.Context, sys *types.SystemContext, ref openshiftReference) (types.ImageDestination, error) {
|
||||||
client, err := newOpenshiftClient(ref)
|
client, err := newOpenshiftClient(ref)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -322,7 +322,7 @@ func newImageDestination(ctx *types.SystemContext, ref openshiftReference) (type
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
docker, err := dockerRef.NewImageDestination(ctx)
|
docker, err := dockerRef.NewImageDestination(ctx, sys)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -350,7 +350,7 @@ func (d *openshiftImageDestination) SupportedManifestMIMETypes() []string {
|
|||||||
|
|
||||||
// SupportsSignatures returns an error (to be displayed to the user) if the destination certainly can't store signatures.
|
// SupportsSignatures returns an error (to be displayed to the user) if the destination certainly can't store signatures.
|
||||||
// Note: It is still possible for PutSignatures to fail if SupportsSignatures returns nil.
|
// Note: It is still possible for PutSignatures to fail if SupportsSignatures returns nil.
|
||||||
func (d *openshiftImageDestination) SupportsSignatures() error {
|
func (d *openshiftImageDestination) SupportsSignatures(ctx context.Context) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -375,37 +375,37 @@ func (d *openshiftImageDestination) MustMatchRuntimeOS() bool {
|
|||||||
// WARNING: The contents of stream are being verified on the fly. Until stream.Read() returns io.EOF, the contents of the data SHOULD NOT be available
|
// WARNING: The contents of stream are being verified on the fly. Until stream.Read() returns io.EOF, the contents of the data SHOULD NOT be available
|
||||||
// to any other readers for download using the supplied digest.
|
// to any other readers for download using the supplied digest.
|
||||||
// If stream.Read() at any time, ESPECIALLY at end of input, returns an error, PutBlob MUST 1) fail, and 2) delete any data stored so far.
|
// If stream.Read() at any time, ESPECIALLY at end of input, returns an error, PutBlob MUST 1) fail, and 2) delete any data stored so far.
|
||||||
func (d *openshiftImageDestination) PutBlob(stream io.Reader, inputInfo types.BlobInfo, isConfig bool) (types.BlobInfo, error) {
|
func (d *openshiftImageDestination) PutBlob(ctx context.Context, stream io.Reader, inputInfo types.BlobInfo, isConfig bool) (types.BlobInfo, error) {
|
||||||
return d.docker.PutBlob(stream, inputInfo, isConfig)
|
return d.docker.PutBlob(ctx, stream, inputInfo, isConfig)
|
||||||
}
|
}
|
||||||
|
|
||||||
// HasBlob returns true iff the image destination already contains a blob with the matching digest which can be reapplied using ReapplyBlob.
|
// HasBlob returns true iff the image destination already contains a blob with the matching digest which can be reapplied using ReapplyBlob.
|
||||||
// Unlike PutBlob, the digest can not be empty. If HasBlob returns true, the size of the blob must also be returned.
|
// Unlike PutBlob, the digest can not be empty. If HasBlob returns true, the size of the blob must also be returned.
|
||||||
// If the destination does not contain the blob, or it is unknown, HasBlob ordinarily returns (false, -1, nil);
|
// If the destination does not contain the blob, or it is unknown, HasBlob ordinarily returns (false, -1, nil);
|
||||||
// it returns a non-nil error only on an unexpected failure.
|
// it returns a non-nil error only on an unexpected failure.
|
||||||
func (d *openshiftImageDestination) HasBlob(info types.BlobInfo) (bool, int64, error) {
|
func (d *openshiftImageDestination) HasBlob(ctx context.Context, info types.BlobInfo) (bool, int64, error) {
|
||||||
return d.docker.HasBlob(info)
|
return d.docker.HasBlob(ctx, info)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d *openshiftImageDestination) ReapplyBlob(info types.BlobInfo) (types.BlobInfo, error) {
|
func (d *openshiftImageDestination) ReapplyBlob(ctx context.Context, info types.BlobInfo) (types.BlobInfo, error) {
|
||||||
return d.docker.ReapplyBlob(info)
|
return d.docker.ReapplyBlob(ctx, info)
|
||||||
}
|
}
|
||||||
|
|
||||||
// PutManifest writes manifest to the destination.
|
// PutManifest writes manifest to the destination.
|
||||||
// FIXME? This should also receive a MIME type if known, to differentiate between schema versions.
|
// FIXME? This should also receive a MIME type if known, to differentiate between schema versions.
|
||||||
// If the destination is in principle available, refuses this manifest type (e.g. it does not recognize the schema),
|
// If the destination is in principle available, refuses this manifest type (e.g. it does not recognize the schema),
|
||||||
// but may accept a different manifest type, the returned error must be an ManifestTypeRejectedError.
|
// but may accept a different manifest type, the returned error must be an ManifestTypeRejectedError.
|
||||||
func (d *openshiftImageDestination) PutManifest(m []byte) error {
|
func (d *openshiftImageDestination) PutManifest(ctx context.Context, m []byte) error {
|
||||||
manifestDigest, err := manifest.Digest(m)
|
manifestDigest, err := manifest.Digest(m)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
d.imageStreamImageName = manifestDigest.String()
|
d.imageStreamImageName = manifestDigest.String()
|
||||||
|
|
||||||
return d.docker.PutManifest(m)
|
return d.docker.PutManifest(ctx, m)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d *openshiftImageDestination) PutSignatures(signatures [][]byte) error {
|
func (d *openshiftImageDestination) PutSignatures(ctx context.Context, signatures [][]byte) error {
|
||||||
if d.imageStreamImageName == "" {
|
if d.imageStreamImageName == "" {
|
||||||
return errors.Errorf("Internal error: Unknown manifest digest, can't add signatures")
|
return errors.Errorf("Internal error: Unknown manifest digest, can't add signatures")
|
||||||
}
|
}
|
||||||
@ -416,7 +416,7 @@ func (d *openshiftImageDestination) PutSignatures(signatures [][]byte) error {
|
|||||||
return nil // No need to even read the old state.
|
return nil // No need to even read the old state.
|
||||||
}
|
}
|
||||||
|
|
||||||
image, err := d.client.getImage(context.TODO(), d.imageStreamImageName)
|
image, err := d.client.getImage(ctx, d.imageStreamImageName)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -457,7 +457,7 @@ sigExists:
|
|||||||
Content: newSig,
|
Content: newSig,
|
||||||
}
|
}
|
||||||
body, err := json.Marshal(sig)
|
body, err := json.Marshal(sig)
|
||||||
_, err = d.client.doRequest(context.TODO(), "POST", "/oapi/v1/imagesignatures", body)
|
_, err = d.client.doRequest(ctx, "POST", "/oapi/v1/imagesignatures", body)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -470,8 +470,8 @@ sigExists:
|
|||||||
// WARNING: This does not have any transactional semantics:
|
// WARNING: This does not have any transactional semantics:
|
||||||
// - Uploaded data MAY be visible to others before Commit() is called
|
// - Uploaded data MAY be visible to others before Commit() is called
|
||||||
// - Uploaded data MAY be removed or MAY remain around if Close() is called without Commit() (i.e. rollback is allowed but not guaranteed)
|
// - Uploaded data MAY be removed or MAY remain around if Close() is called without Commit() (i.e. rollback is allowed but not guaranteed)
|
||||||
func (d *openshiftImageDestination) Commit() error {
|
func (d *openshiftImageDestination) Commit(ctx context.Context) error {
|
||||||
return d.docker.Commit()
|
return d.docker.Commit(ctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
// These structs are subsets of github.com/openshift/origin/pkg/image/api/v1 and its dependencies.
|
// These structs are subsets of github.com/openshift/origin/pkg/image/api/v1 and its dependencies.
|
||||||
|
17
vendor/github.com/containers/image/openshift/openshift_transport.go
generated
vendored
17
vendor/github.com/containers/image/openshift/openshift_transport.go
generated
vendored
@ -1,6 +1,7 @@
|
|||||||
package openshift
|
package openshift
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"regexp"
|
"regexp"
|
||||||
"strings"
|
"strings"
|
||||||
@ -130,27 +131,27 @@ func (ref openshiftReference) PolicyConfigurationNamespaces() []string {
|
|||||||
// NOTE: If any kind of signature verification should happen, build an UnparsedImage from the value returned by NewImageSource,
|
// NOTE: If any kind of signature verification should happen, build an UnparsedImage from the value returned by NewImageSource,
|
||||||
// verify that UnparsedImage, and convert it into a real Image via image.FromUnparsedImage.
|
// verify that UnparsedImage, and convert it into a real Image via image.FromUnparsedImage.
|
||||||
// WARNING: This may not do the right thing for a manifest list, see image.FromSource for details.
|
// WARNING: This may not do the right thing for a manifest list, see image.FromSource for details.
|
||||||
func (ref openshiftReference) NewImage(ctx *types.SystemContext) (types.ImageCloser, error) {
|
func (ref openshiftReference) NewImage(ctx context.Context, sys *types.SystemContext) (types.ImageCloser, error) {
|
||||||
src, err := newImageSource(ctx, ref)
|
src, err := newImageSource(ctx, sys, ref)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
return genericImage.FromSource(ctx, src)
|
return genericImage.FromSource(ctx, sys, src)
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewImageSource returns a types.ImageSource for this reference.
|
// NewImageSource returns a types.ImageSource for this reference.
|
||||||
// The caller must call .Close() on the returned ImageSource.
|
// The caller must call .Close() on the returned ImageSource.
|
||||||
func (ref openshiftReference) NewImageSource(ctx *types.SystemContext) (types.ImageSource, error) {
|
func (ref openshiftReference) NewImageSource(ctx context.Context, sys *types.SystemContext) (types.ImageSource, error) {
|
||||||
return newImageSource(ctx, ref)
|
return newImageSource(ctx, sys, ref)
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewImageDestination returns a types.ImageDestination for this reference.
|
// NewImageDestination returns a types.ImageDestination for this reference.
|
||||||
// The caller must call .Close() on the returned ImageDestination.
|
// The caller must call .Close() on the returned ImageDestination.
|
||||||
func (ref openshiftReference) NewImageDestination(ctx *types.SystemContext) (types.ImageDestination, error) {
|
func (ref openshiftReference) NewImageDestination(ctx context.Context, sys *types.SystemContext) (types.ImageDestination, error) {
|
||||||
return newImageDestination(ctx, ref)
|
return newImageDestination(ctx, sys, ref)
|
||||||
}
|
}
|
||||||
|
|
||||||
// DeleteImage deletes the named image from the registry, if supported.
|
// DeleteImage deletes the named image from the registry, if supported.
|
||||||
func (ref openshiftReference) DeleteImage(ctx *types.SystemContext) error {
|
func (ref openshiftReference) DeleteImage(ctx context.Context, sys *types.SystemContext) error {
|
||||||
return errors.Errorf("Deleting images not implemented for atomic: images")
|
return errors.Errorf("Deleting images not implemented for atomic: images")
|
||||||
}
|
}
|
||||||
|
15
vendor/github.com/containers/image/ostree/ostree_dest.go
generated
vendored
15
vendor/github.com/containers/image/ostree/ostree_dest.go
generated
vendored
@ -5,6 +5,7 @@ package ostree
|
|||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"compress/gzip"
|
"compress/gzip"
|
||||||
|
"context"
|
||||||
"encoding/base64"
|
"encoding/base64"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
@ -103,7 +104,7 @@ func (d *ostreeImageDestination) SupportedManifestMIMETypes() []string {
|
|||||||
|
|
||||||
// SupportsSignatures returns an error (to be displayed to the user) if the destination certainly can't store signatures.
|
// SupportsSignatures returns an error (to be displayed to the user) if the destination certainly can't store signatures.
|
||||||
// Note: It is still possible for PutSignatures to fail if SupportsSignatures returns nil.
|
// Note: It is still possible for PutSignatures to fail if SupportsSignatures returns nil.
|
||||||
func (d *ostreeImageDestination) SupportsSignatures() error {
|
func (d *ostreeImageDestination) SupportsSignatures(ctx context.Context) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -123,7 +124,7 @@ func (d *ostreeImageDestination) MustMatchRuntimeOS() bool {
|
|||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d *ostreeImageDestination) PutBlob(stream io.Reader, inputInfo types.BlobInfo, isConfig bool) (types.BlobInfo, error) {
|
func (d *ostreeImageDestination) PutBlob(ctx context.Context, stream io.Reader, inputInfo types.BlobInfo, isConfig bool) (types.BlobInfo, error) {
|
||||||
tmpDir, err := ioutil.TempDir(d.tmpDirPath, "blob")
|
tmpDir, err := ioutil.TempDir(d.tmpDirPath, "blob")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return types.BlobInfo{}, err
|
return types.BlobInfo{}, err
|
||||||
@ -310,7 +311,7 @@ func (d *ostreeImageDestination) importConfig(repo *otbuiltin.Repo, blob *blobTo
|
|||||||
return d.ostreeCommit(repo, ostreeBranch, destinationPath, []string{fmt.Sprintf("docker.size=%d", blob.Size)})
|
return d.ostreeCommit(repo, ostreeBranch, destinationPath, []string{fmt.Sprintf("docker.size=%d", blob.Size)})
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d *ostreeImageDestination) HasBlob(info types.BlobInfo) (bool, int64, error) {
|
func (d *ostreeImageDestination) HasBlob(ctx context.Context, info types.BlobInfo) (bool, int64, error) {
|
||||||
|
|
||||||
if d.repo == nil {
|
if d.repo == nil {
|
||||||
repo, err := openRepo(d.ref.repo)
|
repo, err := openRepo(d.ref.repo)
|
||||||
@ -344,7 +345,7 @@ func (d *ostreeImageDestination) HasBlob(info types.BlobInfo) (bool, int64, erro
|
|||||||
return true, size, nil
|
return true, size, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d *ostreeImageDestination) ReapplyBlob(info types.BlobInfo) (types.BlobInfo, error) {
|
func (d *ostreeImageDestination) ReapplyBlob(ctx context.Context, info types.BlobInfo) (types.BlobInfo, error) {
|
||||||
return info, nil
|
return info, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -352,7 +353,7 @@ func (d *ostreeImageDestination) ReapplyBlob(info types.BlobInfo) (types.BlobInf
|
|||||||
// FIXME? This should also receive a MIME type if known, to differentiate between schema versions.
|
// FIXME? This should also receive a MIME type if known, to differentiate between schema versions.
|
||||||
// If the destination is in principle available, refuses this manifest type (e.g. it does not recognize the schema),
|
// If the destination is in principle available, refuses this manifest type (e.g. it does not recognize the schema),
|
||||||
// but may accept a different manifest type, the returned error must be an ManifestTypeRejectedError.
|
// but may accept a different manifest type, the returned error must be an ManifestTypeRejectedError.
|
||||||
func (d *ostreeImageDestination) PutManifest(manifestBlob []byte) error {
|
func (d *ostreeImageDestination) PutManifest(ctx context.Context, manifestBlob []byte) error {
|
||||||
d.manifest = string(manifestBlob)
|
d.manifest = string(manifestBlob)
|
||||||
|
|
||||||
if err := json.Unmarshal(manifestBlob, &d.schema); err != nil {
|
if err := json.Unmarshal(manifestBlob, &d.schema); err != nil {
|
||||||
@ -373,7 +374,7 @@ func (d *ostreeImageDestination) PutManifest(manifestBlob []byte) error {
|
|||||||
return ioutil.WriteFile(manifestPath, manifestBlob, 0644)
|
return ioutil.WriteFile(manifestPath, manifestBlob, 0644)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d *ostreeImageDestination) PutSignatures(signatures [][]byte) error {
|
func (d *ostreeImageDestination) PutSignatures(ctx context.Context, signatures [][]byte) error {
|
||||||
path := filepath.Join(d.tmpDirPath, d.ref.signaturePath(0))
|
path := filepath.Join(d.tmpDirPath, d.ref.signaturePath(0))
|
||||||
if err := ensureParentDirectoryExists(path); err != nil {
|
if err := ensureParentDirectoryExists(path); err != nil {
|
||||||
return err
|
return err
|
||||||
@ -389,7 +390,7 @@ func (d *ostreeImageDestination) PutSignatures(signatures [][]byte) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d *ostreeImageDestination) Commit() error {
|
func (d *ostreeImageDestination) Commit(ctx context.Context) error {
|
||||||
repo, err := otbuiltin.OpenRepo(d.ref.repo)
|
repo, err := otbuiltin.OpenRepo(d.ref.repo)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
12
vendor/github.com/containers/image/ostree/ostree_src.go
generated
vendored
12
vendor/github.com/containers/image/ostree/ostree_src.go
generated
vendored
@ -42,7 +42,7 @@ type ostreeImageSource struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// newImageSource returns an ImageSource for reading from an existing directory.
|
// newImageSource returns an ImageSource for reading from an existing directory.
|
||||||
func newImageSource(ctx *types.SystemContext, tmpDir string, ref ostreeReference) (types.ImageSource, error) {
|
func newImageSource(ctx context.Context, tmpDir string, ref ostreeReference) (types.ImageSource, error) {
|
||||||
return &ostreeImageSource{ref: ref, tmpDir: tmpDir, compressed: nil}, nil
|
return &ostreeImageSource{ref: ref, tmpDir: tmpDir, compressed: nil}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -92,7 +92,7 @@ func (s *ostreeImageSource) getTarSplitData(blob string) ([]byte, error) {
|
|||||||
|
|
||||||
// GetManifest returns the image's manifest along with its MIME type (which may be empty when it can't be determined but the manifest is available).
|
// GetManifest returns the image's manifest along with its MIME type (which may be empty when it can't be determined but the manifest is available).
|
||||||
// It may use a remote (= slow) service.
|
// It may use a remote (= slow) service.
|
||||||
func (s *ostreeImageSource) GetManifest(instanceDigest *digest.Digest) ([]byte, string, error) {
|
func (s *ostreeImageSource) GetManifest(ctx context.Context, instanceDigest *digest.Digest) ([]byte, string, error) {
|
||||||
if instanceDigest != nil {
|
if instanceDigest != nil {
|
||||||
return nil, "", errors.Errorf(`Manifest lists are not supported by "ostree:"`)
|
return nil, "", errors.Errorf(`Manifest lists are not supported by "ostree:"`)
|
||||||
}
|
}
|
||||||
@ -256,13 +256,13 @@ func (s *ostreeImageSource) readSingleFile(commit, path string) (io.ReadCloser,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// GetBlob returns a stream for the specified blob, and the blob's size.
|
// GetBlob returns a stream for the specified blob, and the blob's size.
|
||||||
func (s *ostreeImageSource) GetBlob(info types.BlobInfo) (io.ReadCloser, int64, error) {
|
func (s *ostreeImageSource) GetBlob(ctx context.Context, info types.BlobInfo) (io.ReadCloser, int64, error) {
|
||||||
|
|
||||||
blob := info.Digest.Hex()
|
blob := info.Digest.Hex()
|
||||||
|
|
||||||
// Ensure s.compressed is initialized. It is build by LayerInfosForCopy.
|
// Ensure s.compressed is initialized. It is build by LayerInfosForCopy.
|
||||||
if s.compressed == nil {
|
if s.compressed == nil {
|
||||||
_, err := s.LayerInfosForCopy()
|
_, err := s.LayerInfosForCopy(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, -1, err
|
return nil, -1, err
|
||||||
}
|
}
|
||||||
@ -366,9 +366,9 @@ func (s *ostreeImageSource) GetSignatures(ctx context.Context, instanceDigest *d
|
|||||||
|
|
||||||
// LayerInfosForCopy() returns the list of layer blobs that make up the root filesystem of
|
// LayerInfosForCopy() returns the list of layer blobs that make up the root filesystem of
|
||||||
// the image, after they've been decompressed.
|
// the image, after they've been decompressed.
|
||||||
func (s *ostreeImageSource) LayerInfosForCopy() ([]types.BlobInfo, error) {
|
func (s *ostreeImageSource) LayerInfosForCopy(ctx context.Context) ([]types.BlobInfo, error) {
|
||||||
updatedBlobInfos := []types.BlobInfo{}
|
updatedBlobInfos := []types.BlobInfo{}
|
||||||
manifestBlob, manifestType, err := s.GetManifest(nil)
|
manifestBlob, manifestType, err := s.GetManifest(ctx, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
23
vendor/github.com/containers/image/ostree/ostree_transport.go
generated
vendored
23
vendor/github.com/containers/image/ostree/ostree_transport.go
generated
vendored
@ -4,6 +4,7 @@ package ostree
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
@ -181,46 +182,46 @@ func (s *ostreeImageCloser) Size() (int64, error) {
|
|||||||
// The caller must call .Close() on the returned ImageCloser.
|
// The caller must call .Close() on the returned ImageCloser.
|
||||||
// NOTE: If any kind of signature verification should happen, build an UnparsedImage from the value returned by NewImageSource,
|
// NOTE: If any kind of signature verification should happen, build an UnparsedImage from the value returned by NewImageSource,
|
||||||
// verify that UnparsedImage, and convert it into a real Image via image.FromUnparsedImage.
|
// verify that UnparsedImage, and convert it into a real Image via image.FromUnparsedImage.
|
||||||
func (ref ostreeReference) NewImage(ctx *types.SystemContext) (types.ImageCloser, error) {
|
func (ref ostreeReference) NewImage(ctx context.Context, sys *types.SystemContext) (types.ImageCloser, error) {
|
||||||
var tmpDir string
|
var tmpDir string
|
||||||
if ctx == nil || ctx.OSTreeTmpDirPath == "" {
|
if sys == nil || sys.OSTreeTmpDirPath == "" {
|
||||||
tmpDir = os.TempDir()
|
tmpDir = os.TempDir()
|
||||||
} else {
|
} else {
|
||||||
tmpDir = ctx.OSTreeTmpDirPath
|
tmpDir = sys.OSTreeTmpDirPath
|
||||||
}
|
}
|
||||||
src, err := newImageSource(ctx, tmpDir, ref)
|
src, err := newImageSource(ctx, tmpDir, ref)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
return image.FromSource(ctx, src)
|
return image.FromSource(ctx, sys, src)
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewImageSource returns a types.ImageSource for this reference.
|
// NewImageSource returns a types.ImageSource for this reference.
|
||||||
// The caller must call .Close() on the returned ImageSource.
|
// The caller must call .Close() on the returned ImageSource.
|
||||||
func (ref ostreeReference) NewImageSource(ctx *types.SystemContext) (types.ImageSource, error) {
|
func (ref ostreeReference) NewImageSource(ctx context.Context, sys *types.SystemContext) (types.ImageSource, error) {
|
||||||
var tmpDir string
|
var tmpDir string
|
||||||
if ctx == nil || ctx.OSTreeTmpDirPath == "" {
|
if sys == nil || sys.OSTreeTmpDirPath == "" {
|
||||||
tmpDir = os.TempDir()
|
tmpDir = os.TempDir()
|
||||||
} else {
|
} else {
|
||||||
tmpDir = ctx.OSTreeTmpDirPath
|
tmpDir = sys.OSTreeTmpDirPath
|
||||||
}
|
}
|
||||||
return newImageSource(ctx, tmpDir, ref)
|
return newImageSource(ctx, tmpDir, ref)
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewImageDestination returns a types.ImageDestination for this reference.
|
// NewImageDestination returns a types.ImageDestination for this reference.
|
||||||
// The caller must call .Close() on the returned ImageDestination.
|
// The caller must call .Close() on the returned ImageDestination.
|
||||||
func (ref ostreeReference) NewImageDestination(ctx *types.SystemContext) (types.ImageDestination, error) {
|
func (ref ostreeReference) NewImageDestination(ctx context.Context, sys *types.SystemContext) (types.ImageDestination, error) {
|
||||||
var tmpDir string
|
var tmpDir string
|
||||||
if ctx == nil || ctx.OSTreeTmpDirPath == "" {
|
if sys == nil || sys.OSTreeTmpDirPath == "" {
|
||||||
tmpDir = os.TempDir()
|
tmpDir = os.TempDir()
|
||||||
} else {
|
} else {
|
||||||
tmpDir = ctx.OSTreeTmpDirPath
|
tmpDir = sys.OSTreeTmpDirPath
|
||||||
}
|
}
|
||||||
return newImageDestination(ref, tmpDir)
|
return newImageDestination(ref, tmpDir)
|
||||||
}
|
}
|
||||||
|
|
||||||
// DeleteImage deletes the named image from the registry, if supported.
|
// DeleteImage deletes the named image from the registry, if supported.
|
||||||
func (ref ostreeReference) DeleteImage(ctx *types.SystemContext) error {
|
func (ref ostreeReference) DeleteImage(ctx context.Context, sys *types.SystemContext) error {
|
||||||
return errors.Errorf("Deleting images not implemented for ostree: images")
|
return errors.Errorf("Deleting images not implemented for ostree: images")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
40
vendor/github.com/containers/image/pkg/docker/config/config.go
generated
vendored
40
vendor/github.com/containers/image/pkg/docker/config/config.go
generated
vendored
@ -42,8 +42,8 @@ var (
|
|||||||
)
|
)
|
||||||
|
|
||||||
// SetAuthentication stores the username and password in the auth.json file
|
// SetAuthentication stores the username and password in the auth.json file
|
||||||
func SetAuthentication(ctx *types.SystemContext, registry, username, password string) error {
|
func SetAuthentication(sys *types.SystemContext, registry, username, password string) error {
|
||||||
return modifyJSON(ctx, func(auths *dockerConfigFile) (bool, error) {
|
return modifyJSON(sys, func(auths *dockerConfigFile) (bool, error) {
|
||||||
if ch, exists := auths.CredHelpers[registry]; exists {
|
if ch, exists := auths.CredHelpers[registry]; exists {
|
||||||
return false, setAuthToCredHelper(ch, registry, username, password)
|
return false, setAuthToCredHelper(ch, registry, username, password)
|
||||||
}
|
}
|
||||||
@ -58,13 +58,13 @@ func SetAuthentication(ctx *types.SystemContext, registry, username, password st
|
|||||||
// GetAuthentication returns the registry credentials stored in
|
// GetAuthentication returns the registry credentials stored in
|
||||||
// either auth.json file or .docker/config.json
|
// either auth.json file or .docker/config.json
|
||||||
// If an entry is not found empty strings are returned for the username and password
|
// If an entry is not found empty strings are returned for the username and password
|
||||||
func GetAuthentication(ctx *types.SystemContext, registry string) (string, string, error) {
|
func GetAuthentication(sys *types.SystemContext, registry string) (string, string, error) {
|
||||||
if ctx != nil && ctx.DockerAuthConfig != nil {
|
if sys != nil && sys.DockerAuthConfig != nil {
|
||||||
return ctx.DockerAuthConfig.Username, ctx.DockerAuthConfig.Password, nil
|
return sys.DockerAuthConfig.Username, sys.DockerAuthConfig.Password, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
dockerLegacyPath := filepath.Join(homedir.Get(), dockerLegacyCfg)
|
dockerLegacyPath := filepath.Join(homedir.Get(), dockerLegacyCfg)
|
||||||
pathToAuth, err := getPathToAuth(ctx)
|
pathToAuth, err := getPathToAuth(sys)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", "", err
|
return "", "", err
|
||||||
}
|
}
|
||||||
@ -86,8 +86,8 @@ func GetAuthentication(ctx *types.SystemContext, registry string) (string, strin
|
|||||||
// GetUserLoggedIn returns the username logged in to registry from either
|
// GetUserLoggedIn returns the username logged in to registry from either
|
||||||
// auth.json or XDG_RUNTIME_DIR
|
// auth.json or XDG_RUNTIME_DIR
|
||||||
// Used to tell the user if someone is logged in to the registry when logging in
|
// Used to tell the user if someone is logged in to the registry when logging in
|
||||||
func GetUserLoggedIn(ctx *types.SystemContext, registry string) (string, error) {
|
func GetUserLoggedIn(sys *types.SystemContext, registry string) (string, error) {
|
||||||
path, err := getPathToAuth(ctx)
|
path, err := getPathToAuth(sys)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
@ -99,8 +99,8 @@ func GetUserLoggedIn(ctx *types.SystemContext, registry string) (string, error)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// RemoveAuthentication deletes the credentials stored in auth.json
|
// RemoveAuthentication deletes the credentials stored in auth.json
|
||||||
func RemoveAuthentication(ctx *types.SystemContext, registry string) error {
|
func RemoveAuthentication(sys *types.SystemContext, registry string) error {
|
||||||
return modifyJSON(ctx, func(auths *dockerConfigFile) (bool, error) {
|
return modifyJSON(sys, func(auths *dockerConfigFile) (bool, error) {
|
||||||
// First try cred helpers.
|
// First try cred helpers.
|
||||||
if ch, exists := auths.CredHelpers[registry]; exists {
|
if ch, exists := auths.CredHelpers[registry]; exists {
|
||||||
return false, deleteAuthFromCredHelper(ch, registry)
|
return false, deleteAuthFromCredHelper(ch, registry)
|
||||||
@ -118,8 +118,8 @@ func RemoveAuthentication(ctx *types.SystemContext, registry string) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// RemoveAllAuthentication deletes all the credentials stored in auth.json
|
// RemoveAllAuthentication deletes all the credentials stored in auth.json
|
||||||
func RemoveAllAuthentication(ctx *types.SystemContext) error {
|
func RemoveAllAuthentication(sys *types.SystemContext) error {
|
||||||
return modifyJSON(ctx, func(auths *dockerConfigFile) (bool, error) {
|
return modifyJSON(sys, func(auths *dockerConfigFile) (bool, error) {
|
||||||
auths.CredHelpers = make(map[string]string)
|
auths.CredHelpers = make(map[string]string)
|
||||||
auths.AuthConfigs = make(map[string]dockerAuthConfig)
|
auths.AuthConfigs = make(map[string]dockerAuthConfig)
|
||||||
return true, nil
|
return true, nil
|
||||||
@ -130,13 +130,13 @@ func RemoveAllAuthentication(ctx *types.SystemContext) error {
|
|||||||
// The path can be overriden by the user if the overwrite-path flag is set
|
// The path can be overriden by the user if the overwrite-path flag is set
|
||||||
// If the flag is not set and XDG_RUNTIME_DIR is ser, the auth.json file is saved in XDG_RUNTIME_DIR/containers
|
// If the flag is not set and XDG_RUNTIME_DIR is ser, the auth.json file is saved in XDG_RUNTIME_DIR/containers
|
||||||
// Otherwise, the auth.json file is stored in /run/user/UID/containers
|
// Otherwise, the auth.json file is stored in /run/user/UID/containers
|
||||||
func getPathToAuth(ctx *types.SystemContext) (string, error) {
|
func getPathToAuth(sys *types.SystemContext) (string, error) {
|
||||||
if ctx != nil {
|
if sys != nil {
|
||||||
if ctx.AuthFilePath != "" {
|
if sys.AuthFilePath != "" {
|
||||||
return ctx.AuthFilePath, nil
|
return sys.AuthFilePath, nil
|
||||||
}
|
}
|
||||||
if ctx.RootForImplicitAbsolutePaths != "" {
|
if sys.RootForImplicitAbsolutePaths != "" {
|
||||||
return filepath.Join(ctx.RootForImplicitAbsolutePaths, defaultPath, strconv.Itoa(os.Getuid()), authCfg, authCfgFileName), nil
|
return filepath.Join(sys.RootForImplicitAbsolutePaths, defaultPath, strconv.Itoa(os.Getuid()), authCfg, authCfgFileName), nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -183,8 +183,8 @@ func readJSONFile(path string, legacyFormat bool) (dockerConfigFile, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// modifyJSON writes to auth.json if the dockerConfigFile has been updated
|
// modifyJSON writes to auth.json if the dockerConfigFile has been updated
|
||||||
func modifyJSON(ctx *types.SystemContext, editor func(auths *dockerConfigFile) (bool, error)) error {
|
func modifyJSON(sys *types.SystemContext, editor func(auths *dockerConfigFile) (bool, error)) error {
|
||||||
path, err := getPathToAuth(ctx)
|
path, err := getPathToAuth(sys)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
18
vendor/github.com/containers/image/signature/policy_config.go
generated
vendored
18
vendor/github.com/containers/image/signature/policy_config.go
generated
vendored
@ -44,21 +44,21 @@ func (err InvalidPolicyFormatError) Error() string {
|
|||||||
// DefaultPolicy returns the default policy of the system.
|
// DefaultPolicy returns the default policy of the system.
|
||||||
// Most applications should be using this method to get the policy configured
|
// Most applications should be using this method to get the policy configured
|
||||||
// by the system administrator.
|
// by the system administrator.
|
||||||
// ctx should usually be nil, can be set to override the default.
|
// sys should usually be nil, can be set to override the default.
|
||||||
// NOTE: When this function returns an error, report it to the user and abort.
|
// NOTE: When this function returns an error, report it to the user and abort.
|
||||||
// DO NOT hard-code fallback policies in your application.
|
// DO NOT hard-code fallback policies in your application.
|
||||||
func DefaultPolicy(ctx *types.SystemContext) (*Policy, error) {
|
func DefaultPolicy(sys *types.SystemContext) (*Policy, error) {
|
||||||
return NewPolicyFromFile(defaultPolicyPath(ctx))
|
return NewPolicyFromFile(defaultPolicyPath(sys))
|
||||||
}
|
}
|
||||||
|
|
||||||
// defaultPolicyPath returns a path to the default policy of the system.
|
// defaultPolicyPath returns a path to the default policy of the system.
|
||||||
func defaultPolicyPath(ctx *types.SystemContext) string {
|
func defaultPolicyPath(sys *types.SystemContext) string {
|
||||||
if ctx != nil {
|
if sys != nil {
|
||||||
if ctx.SignaturePolicyPath != "" {
|
if sys.SignaturePolicyPath != "" {
|
||||||
return ctx.SignaturePolicyPath
|
return sys.SignaturePolicyPath
|
||||||
}
|
}
|
||||||
if ctx.RootForImplicitAbsolutePaths != "" {
|
if sys.RootForImplicitAbsolutePaths != "" {
|
||||||
return filepath.Join(ctx.RootForImplicitAbsolutePaths, systemDefaultPolicyPath)
|
return filepath.Join(sys.RootForImplicitAbsolutePaths, systemDefaultPolicyPath)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return systemDefaultPolicyPath
|
return systemDefaultPolicyPath
|
||||||
|
14
vendor/github.com/containers/image/signature/policy_eval.go
generated
vendored
14
vendor/github.com/containers/image/signature/policy_eval.go
generated
vendored
@ -55,14 +55,14 @@ type PolicyRequirement interface {
|
|||||||
// a container based on this image; use IsRunningImageAllowed instead.
|
// a container based on this image; use IsRunningImageAllowed instead.
|
||||||
// - Just because a signature is accepted does not automatically mean the contents of the
|
// - Just because a signature is accepted does not automatically mean the contents of the
|
||||||
// signature are authorized to run code as root, or to affect system or cluster configuration.
|
// signature are authorized to run code as root, or to affect system or cluster configuration.
|
||||||
isSignatureAuthorAccepted(image types.UnparsedImage, sig []byte) (signatureAcceptanceResult, *Signature, error)
|
isSignatureAuthorAccepted(ctx context.Context, image types.UnparsedImage, sig []byte) (signatureAcceptanceResult, *Signature, error)
|
||||||
|
|
||||||
// isRunningImageAllowed returns true if the requirement allows running an image.
|
// isRunningImageAllowed returns true if the requirement allows running an image.
|
||||||
// If it returns false, err must be non-nil, and should be an PolicyRequirementError if evaluation
|
// If it returns false, err must be non-nil, and should be an PolicyRequirementError if evaluation
|
||||||
// succeeded but the result was rejection.
|
// succeeded but the result was rejection.
|
||||||
// WARNING: This validates signatures and the manifest, but does not download or validate the
|
// WARNING: This validates signatures and the manifest, but does not download or validate the
|
||||||
// layers. Users must validate that the layers match their expected digests.
|
// layers. Users must validate that the layers match their expected digests.
|
||||||
isRunningImageAllowed(image types.UnparsedImage) (bool, error)
|
isRunningImageAllowed(ctx context.Context, image types.UnparsedImage) (bool, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
// PolicyReferenceMatch specifies a set of image identities accepted in PolicyRequirement.
|
// PolicyReferenceMatch specifies a set of image identities accepted in PolicyRequirement.
|
||||||
@ -175,7 +175,7 @@ func (pc *PolicyContext) requirementsForImageRef(ref types.ImageReference) Polic
|
|||||||
// a container based on this image; use IsRunningImageAllowed instead.
|
// a container based on this image; use IsRunningImageAllowed instead.
|
||||||
// - Just because a signature is accepted does not automatically mean the contents of the
|
// - Just because a signature is accepted does not automatically mean the contents of the
|
||||||
// signature are authorized to run code as root, or to affect system or cluster configuration.
|
// signature are authorized to run code as root, or to affect system or cluster configuration.
|
||||||
func (pc *PolicyContext) GetSignaturesWithAcceptedAuthor(image types.UnparsedImage) (sigs []*Signature, finalErr error) {
|
func (pc *PolicyContext) GetSignaturesWithAcceptedAuthor(ctx context.Context, image types.UnparsedImage) (sigs []*Signature, finalErr error) {
|
||||||
if err := pc.changeState(pcReady, pcInUse); err != nil {
|
if err := pc.changeState(pcReady, pcInUse); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -191,7 +191,7 @@ func (pc *PolicyContext) GetSignaturesWithAcceptedAuthor(image types.UnparsedIma
|
|||||||
|
|
||||||
// FIXME: rename Signatures to UnverifiedSignatures
|
// FIXME: rename Signatures to UnverifiedSignatures
|
||||||
// FIXME: pass context.Context
|
// FIXME: pass context.Context
|
||||||
unverifiedSignatures, err := image.Signatures(context.TODO())
|
unverifiedSignatures, err := image.Signatures(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -206,7 +206,7 @@ func (pc *PolicyContext) GetSignaturesWithAcceptedAuthor(image types.UnparsedIma
|
|||||||
for reqNumber, req := range reqs {
|
for reqNumber, req := range reqs {
|
||||||
// FIXME: Log the requirement itself? For now, we use just the number.
|
// FIXME: Log the requirement itself? For now, we use just the number.
|
||||||
// FIXME: supply state
|
// FIXME: supply state
|
||||||
switch res, as, err := req.isSignatureAuthorAccepted(image, sig); res {
|
switch res, as, err := req.isSignatureAuthorAccepted(ctx, image, sig); res {
|
||||||
case sarAccepted:
|
case sarAccepted:
|
||||||
if as == nil { // Coverage: this should never happen
|
if as == nil { // Coverage: this should never happen
|
||||||
logrus.Debugf(" Requirement %d: internal inconsistency: sarAccepted but no parsed contents", reqNumber)
|
logrus.Debugf(" Requirement %d: internal inconsistency: sarAccepted but no parsed contents", reqNumber)
|
||||||
@ -256,7 +256,7 @@ func (pc *PolicyContext) GetSignaturesWithAcceptedAuthor(image types.UnparsedIma
|
|||||||
// succeeded but the result was rejection.
|
// succeeded but the result was rejection.
|
||||||
// WARNING: This validates signatures and the manifest, but does not download or validate the
|
// WARNING: This validates signatures and the manifest, but does not download or validate the
|
||||||
// layers. Users must validate that the layers match their expected digests.
|
// layers. Users must validate that the layers match their expected digests.
|
||||||
func (pc *PolicyContext) IsRunningImageAllowed(image types.UnparsedImage) (res bool, finalErr error) {
|
func (pc *PolicyContext) IsRunningImageAllowed(ctx context.Context, image types.UnparsedImage) (res bool, finalErr error) {
|
||||||
if err := pc.changeState(pcReady, pcInUse); err != nil {
|
if err := pc.changeState(pcReady, pcInUse); err != nil {
|
||||||
return false, err
|
return false, err
|
||||||
}
|
}
|
||||||
@ -276,7 +276,7 @@ func (pc *PolicyContext) IsRunningImageAllowed(image types.UnparsedImage) (res b
|
|||||||
|
|
||||||
for reqNumber, req := range reqs {
|
for reqNumber, req := range reqs {
|
||||||
// FIXME: supply state
|
// FIXME: supply state
|
||||||
allowed, err := req.isRunningImageAllowed(image)
|
allowed, err := req.isRunningImageAllowed(ctx, image)
|
||||||
if !allowed {
|
if !allowed {
|
||||||
logrus.Debugf("Requirement %d: denied, done", reqNumber)
|
logrus.Debugf("Requirement %d: denied, done", reqNumber)
|
||||||
return false, err
|
return false, err
|
||||||
|
6
vendor/github.com/containers/image/signature/policy_eval_baselayer.go
generated
vendored
6
vendor/github.com/containers/image/signature/policy_eval_baselayer.go
generated
vendored
@ -3,15 +3,17 @@
|
|||||||
package signature
|
package signature
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"context"
|
||||||
|
|
||||||
"github.com/containers/image/types"
|
"github.com/containers/image/types"
|
||||||
"github.com/sirupsen/logrus"
|
"github.com/sirupsen/logrus"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (pr *prSignedBaseLayer) isSignatureAuthorAccepted(image types.UnparsedImage, sig []byte) (signatureAcceptanceResult, *Signature, error) {
|
func (pr *prSignedBaseLayer) isSignatureAuthorAccepted(ctx context.Context, image types.UnparsedImage, sig []byte) (signatureAcceptanceResult, *Signature, error) {
|
||||||
return sarUnknown, nil, nil
|
return sarUnknown, nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (pr *prSignedBaseLayer) isRunningImageAllowed(image types.UnparsedImage) (bool, error) {
|
func (pr *prSignedBaseLayer) isRunningImageAllowed(ctx context.Context, image types.UnparsedImage) (bool, error) {
|
||||||
// FIXME? Reject this at policy parsing time already?
|
// FIXME? Reject this at policy parsing time already?
|
||||||
logrus.Errorf("signedBaseLayer not implemented yet!")
|
logrus.Errorf("signedBaseLayer not implemented yet!")
|
||||||
return false, PolicyRequirementError("signedBaseLayer not implemented yet!")
|
return false, PolicyRequirementError("signedBaseLayer not implemented yet!")
|
||||||
|
10
vendor/github.com/containers/image/signature/policy_eval_signedby.go
generated
vendored
10
vendor/github.com/containers/image/signature/policy_eval_signedby.go
generated
vendored
@ -15,7 +15,7 @@ import (
|
|||||||
"github.com/opencontainers/go-digest"
|
"github.com/opencontainers/go-digest"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (pr *prSignedBy) isSignatureAuthorAccepted(image types.UnparsedImage, sig []byte) (signatureAcceptanceResult, *Signature, error) {
|
func (pr *prSignedBy) isSignatureAuthorAccepted(ctx context.Context, image types.UnparsedImage, sig []byte) (signatureAcceptanceResult, *Signature, error) {
|
||||||
switch pr.KeyType {
|
switch pr.KeyType {
|
||||||
case SBKeyTypeGPGKeys:
|
case SBKeyTypeGPGKeys:
|
||||||
case SBKeyTypeSignedByGPGKeys, SBKeyTypeX509Certificates, SBKeyTypeSignedByX509CAs:
|
case SBKeyTypeSignedByGPGKeys, SBKeyTypeX509Certificates, SBKeyTypeSignedByX509CAs:
|
||||||
@ -69,7 +69,7 @@ func (pr *prSignedBy) isSignatureAuthorAccepted(image types.UnparsedImage, sig [
|
|||||||
return nil
|
return nil
|
||||||
},
|
},
|
||||||
validateSignedDockerManifestDigest: func(digest digest.Digest) error {
|
validateSignedDockerManifestDigest: func(digest digest.Digest) error {
|
||||||
m, _, err := image.Manifest()
|
m, _, err := image.Manifest(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -90,16 +90,16 @@ func (pr *prSignedBy) isSignatureAuthorAccepted(image types.UnparsedImage, sig [
|
|||||||
return sarAccepted, signature, nil
|
return sarAccepted, signature, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (pr *prSignedBy) isRunningImageAllowed(image types.UnparsedImage) (bool, error) {
|
func (pr *prSignedBy) isRunningImageAllowed(ctx context.Context, image types.UnparsedImage) (bool, error) {
|
||||||
// FIXME: pass context.Context
|
// FIXME: pass context.Context
|
||||||
sigs, err := image.Signatures(context.TODO())
|
sigs, err := image.Signatures(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return false, err
|
return false, err
|
||||||
}
|
}
|
||||||
var rejections []error
|
var rejections []error
|
||||||
for _, s := range sigs {
|
for _, s := range sigs {
|
||||||
var reason error
|
var reason error
|
||||||
switch res, _, err := pr.isSignatureAuthorAccepted(image, s); res {
|
switch res, _, err := pr.isSignatureAuthorAccepted(ctx, image, s); res {
|
||||||
case sarAccepted:
|
case sarAccepted:
|
||||||
// One accepted signature is enough.
|
// One accepted signature is enough.
|
||||||
return true, nil
|
return true, nil
|
||||||
|
9
vendor/github.com/containers/image/signature/policy_eval_simple.go
generated
vendored
9
vendor/github.com/containers/image/signature/policy_eval_simple.go
generated
vendored
@ -3,26 +3,27 @@
|
|||||||
package signature
|
package signature
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/containers/image/transports"
|
"github.com/containers/image/transports"
|
||||||
"github.com/containers/image/types"
|
"github.com/containers/image/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (pr *prInsecureAcceptAnything) isSignatureAuthorAccepted(image types.UnparsedImage, sig []byte) (signatureAcceptanceResult, *Signature, error) {
|
func (pr *prInsecureAcceptAnything) isSignatureAuthorAccepted(ctx context.Context, image types.UnparsedImage, sig []byte) (signatureAcceptanceResult, *Signature, error) {
|
||||||
// prInsecureAcceptAnything semantics: Every image is allowed to run,
|
// prInsecureAcceptAnything semantics: Every image is allowed to run,
|
||||||
// but this does not consider the signature as verified.
|
// but this does not consider the signature as verified.
|
||||||
return sarUnknown, nil, nil
|
return sarUnknown, nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (pr *prInsecureAcceptAnything) isRunningImageAllowed(image types.UnparsedImage) (bool, error) {
|
func (pr *prInsecureAcceptAnything) isRunningImageAllowed(ctx context.Context, image types.UnparsedImage) (bool, error) {
|
||||||
return true, nil
|
return true, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (pr *prReject) isSignatureAuthorAccepted(image types.UnparsedImage, sig []byte) (signatureAcceptanceResult, *Signature, error) {
|
func (pr *prReject) isSignatureAuthorAccepted(ctx context.Context, image types.UnparsedImage, sig []byte) (signatureAcceptanceResult, *Signature, error) {
|
||||||
return sarRejected, nil, PolicyRequirementError(fmt.Sprintf("Any signatures for image %s are rejected by policy.", transports.ImageName(image.Reference())))
|
return sarRejected, nil, PolicyRequirementError(fmt.Sprintf("Any signatures for image %s are rejected by policy.", transports.ImageName(image.Reference())))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (pr *prReject) isRunningImageAllowed(image types.UnparsedImage) (bool, error) {
|
func (pr *prReject) isRunningImageAllowed(ctx context.Context, image types.UnparsedImage) (bool, error) {
|
||||||
return false, PolicyRequirementError(fmt.Sprintf("Running image %s is rejected by policy.", transports.ImageName(image.Reference())))
|
return false, PolicyRequirementError(fmt.Sprintf("Running image %s is rejected by policy.", transports.ImageName(image.Reference())))
|
||||||
}
|
}
|
||||||
|
32
vendor/github.com/containers/image/storage/storage_image.go
generated
vendored
32
vendor/github.com/containers/image/storage/storage_image.go
generated
vendored
@ -102,7 +102,7 @@ func (s storageImageSource) Close() error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// GetBlob reads the data blob or filesystem layer which matches the digest and size, if given.
|
// GetBlob reads the data blob or filesystem layer which matches the digest and size, if given.
|
||||||
func (s *storageImageSource) GetBlob(info types.BlobInfo) (rc io.ReadCloser, n int64, err error) {
|
func (s *storageImageSource) GetBlob(ctx context.Context, info types.BlobInfo) (rc io.ReadCloser, n int64, err error) {
|
||||||
rc, n, _, err = s.getBlobAndLayerID(info)
|
rc, n, _, err = s.getBlobAndLayerID(info)
|
||||||
return rc, n, err
|
return rc, n, err
|
||||||
}
|
}
|
||||||
@ -158,7 +158,7 @@ func (s *storageImageSource) getBlobAndLayerID(info types.BlobInfo) (rc io.ReadC
|
|||||||
}
|
}
|
||||||
|
|
||||||
// GetManifest() reads the image's manifest.
|
// GetManifest() reads the image's manifest.
|
||||||
func (s *storageImageSource) GetManifest(instanceDigest *digest.Digest) (manifestBlob []byte, MIMEType string, err error) {
|
func (s *storageImageSource) GetManifest(ctx context.Context, instanceDigest *digest.Digest) (manifestBlob []byte, MIMEType string, err error) {
|
||||||
if instanceDigest != nil {
|
if instanceDigest != nil {
|
||||||
return nil, "", ErrNoManifestLists
|
return nil, "", ErrNoManifestLists
|
||||||
}
|
}
|
||||||
@ -175,9 +175,9 @@ func (s *storageImageSource) GetManifest(instanceDigest *digest.Digest) (manifes
|
|||||||
|
|
||||||
// LayerInfosForCopy() returns the list of layer blobs that make up the root filesystem of
|
// LayerInfosForCopy() returns the list of layer blobs that make up the root filesystem of
|
||||||
// the image, after they've been decompressed.
|
// the image, after they've been decompressed.
|
||||||
func (s *storageImageSource) LayerInfosForCopy() ([]types.BlobInfo, error) {
|
func (s *storageImageSource) LayerInfosForCopy(ctx context.Context) ([]types.BlobInfo, error) {
|
||||||
updatedBlobInfos := []types.BlobInfo{}
|
updatedBlobInfos := []types.BlobInfo{}
|
||||||
_, manifestType, err := s.GetManifest(nil)
|
_, manifestType, err := s.GetManifest(ctx, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, errors.Wrapf(err, "error reading image manifest for %q", s.image.ID)
|
return nil, errors.Wrapf(err, "error reading image manifest for %q", s.image.ID)
|
||||||
}
|
}
|
||||||
@ -239,7 +239,7 @@ func (s *storageImageSource) GetSignatures(ctx context.Context, instanceDigest *
|
|||||||
|
|
||||||
// newImageDestination sets us up to write a new image, caching blobs in a temporary directory until
|
// newImageDestination sets us up to write a new image, caching blobs in a temporary directory until
|
||||||
// it's time to Commit() the image
|
// it's time to Commit() the image
|
||||||
func newImageDestination(ctx *types.SystemContext, imageRef storageReference) (*storageImageDestination, error) {
|
func newImageDestination(ctx context.Context, imageRef storageReference) (*storageImageDestination, error) {
|
||||||
directory, err := ioutil.TempDir(temporaryDirectoryForBigFiles, "storage")
|
directory, err := ioutil.TempDir(temporaryDirectoryForBigFiles, "storage")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, errors.Wrapf(err, "error creating a temporary directory")
|
return nil, errors.Wrapf(err, "error creating a temporary directory")
|
||||||
@ -283,7 +283,7 @@ func (s storageImageDestination) DesiredLayerCompression() types.LayerCompressio
|
|||||||
|
|
||||||
// PutBlob stores a layer or data blob in our temporary directory, checking that any information
|
// PutBlob stores a layer or data blob in our temporary directory, checking that any information
|
||||||
// in the blobinfo matches the incoming data.
|
// in the blobinfo matches the incoming data.
|
||||||
func (s *storageImageDestination) PutBlob(stream io.Reader, blobinfo types.BlobInfo, isConfig bool) (types.BlobInfo, error) {
|
func (s *storageImageDestination) PutBlob(ctx context.Context, stream io.Reader, blobinfo types.BlobInfo, isConfig bool) (types.BlobInfo, error) {
|
||||||
errorBlobInfo := types.BlobInfo{
|
errorBlobInfo := types.BlobInfo{
|
||||||
Digest: "",
|
Digest: "",
|
||||||
Size: -1,
|
Size: -1,
|
||||||
@ -346,7 +346,7 @@ func (s *storageImageDestination) PutBlob(stream io.Reader, blobinfo types.BlobI
|
|||||||
// Unlike PutBlob, the digest can not be empty. If HasBlob returns true, the size of the blob must also be returned.
|
// Unlike PutBlob, the digest can not be empty. If HasBlob returns true, the size of the blob must also be returned.
|
||||||
// If the destination does not contain the blob, or it is unknown, HasBlob ordinarily returns (false, -1, nil);
|
// If the destination does not contain the blob, or it is unknown, HasBlob ordinarily returns (false, -1, nil);
|
||||||
// it returns a non-nil error only on an unexpected failure.
|
// it returns a non-nil error only on an unexpected failure.
|
||||||
func (s *storageImageDestination) HasBlob(blobinfo types.BlobInfo) (bool, int64, error) {
|
func (s *storageImageDestination) HasBlob(ctx context.Context, blobinfo types.BlobInfo) (bool, int64, error) {
|
||||||
if blobinfo.Digest == "" {
|
if blobinfo.Digest == "" {
|
||||||
return false, -1, errors.Errorf(`Can not check for a blob with unknown digest`)
|
return false, -1, errors.Errorf(`Can not check for a blob with unknown digest`)
|
||||||
}
|
}
|
||||||
@ -383,8 +383,8 @@ func (s *storageImageDestination) HasBlob(blobinfo types.BlobInfo) (bool, int64,
|
|||||||
|
|
||||||
// ReapplyBlob is now a no-op, assuming HasBlob() says we already have it, since Commit() can just apply the
|
// ReapplyBlob is now a no-op, assuming HasBlob() says we already have it, since Commit() can just apply the
|
||||||
// same one when it walks the list in the manifest.
|
// same one when it walks the list in the manifest.
|
||||||
func (s *storageImageDestination) ReapplyBlob(blobinfo types.BlobInfo) (types.BlobInfo, error) {
|
func (s *storageImageDestination) ReapplyBlob(ctx context.Context, blobinfo types.BlobInfo) (types.BlobInfo, error) {
|
||||||
present, size, err := s.HasBlob(blobinfo)
|
present, size, err := s.HasBlob(ctx, blobinfo)
|
||||||
if !present {
|
if !present {
|
||||||
return types.BlobInfo{}, errors.Errorf("error reapplying blob %+v: blob was not previously applied", blobinfo)
|
return types.BlobInfo{}, errors.Errorf("error reapplying blob %+v: blob was not previously applied", blobinfo)
|
||||||
}
|
}
|
||||||
@ -459,7 +459,7 @@ func (s *storageImageDestination) getConfigBlob(info types.BlobInfo) ([]byte, er
|
|||||||
return nil, errors.New("blob not found")
|
return nil, errors.New("blob not found")
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *storageImageDestination) Commit() error {
|
func (s *storageImageDestination) Commit(ctx context.Context) error {
|
||||||
// Find the list of layer blobs.
|
// Find the list of layer blobs.
|
||||||
if len(s.manifest) == 0 {
|
if len(s.manifest) == 0 {
|
||||||
return errors.New("Internal error: storageImageDestination.Commit() called without PutManifest()")
|
return errors.New("Internal error: storageImageDestination.Commit() called without PutManifest()")
|
||||||
@ -481,7 +481,7 @@ func (s *storageImageDestination) Commit() error {
|
|||||||
// Check if it's elsewhere and the caller just forgot to pass it to us in a PutBlob(),
|
// Check if it's elsewhere and the caller just forgot to pass it to us in a PutBlob(),
|
||||||
// or to even check if we had it.
|
// or to even check if we had it.
|
||||||
logrus.Debugf("looking for diffID for blob %+v", blob.Digest)
|
logrus.Debugf("looking for diffID for blob %+v", blob.Digest)
|
||||||
has, _, err := s.HasBlob(blob)
|
has, _, err := s.HasBlob(ctx, blob)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return errors.Wrapf(err, "error checking for a layer based on blob %q", blob.Digest.String())
|
return errors.Wrapf(err, "error checking for a layer based on blob %q", blob.Digest.String())
|
||||||
}
|
}
|
||||||
@ -679,7 +679,7 @@ func (s *storageImageDestination) SupportedManifestMIMETypes() []string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// PutManifest writes the manifest to the destination.
|
// PutManifest writes the manifest to the destination.
|
||||||
func (s *storageImageDestination) PutManifest(manifest []byte) error {
|
func (s *storageImageDestination) PutManifest(ctx context.Context, manifest []byte) error {
|
||||||
s.manifest = make([]byte, len(manifest))
|
s.manifest = make([]byte, len(manifest))
|
||||||
copy(s.manifest, manifest)
|
copy(s.manifest, manifest)
|
||||||
return nil
|
return nil
|
||||||
@ -687,7 +687,7 @@ func (s *storageImageDestination) PutManifest(manifest []byte) error {
|
|||||||
|
|
||||||
// SupportsSignatures returns an error if we can't expect GetSignatures() to return data that was
|
// SupportsSignatures returns an error if we can't expect GetSignatures() to return data that was
|
||||||
// previously supplied to PutSignatures().
|
// previously supplied to PutSignatures().
|
||||||
func (s *storageImageDestination) SupportsSignatures() error {
|
func (s *storageImageDestination) SupportsSignatures(ctx context.Context) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -703,7 +703,7 @@ func (s *storageImageDestination) MustMatchRuntimeOS() bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// PutSignatures records the image's signatures for committing as a single data blob.
|
// PutSignatures records the image's signatures for committing as a single data blob.
|
||||||
func (s *storageImageDestination) PutSignatures(signatures [][]byte) error {
|
func (s *storageImageDestination) PutSignatures(ctx context.Context, signatures [][]byte) error {
|
||||||
sizes := []int{}
|
sizes := []int{}
|
||||||
sigblob := []byte{}
|
sigblob := []byte{}
|
||||||
for _, sig := range signatures {
|
for _, sig := range signatures {
|
||||||
@ -769,12 +769,12 @@ func (s *storageImageCloser) Size() (int64, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// newImage creates an image that also knows its size
|
// newImage creates an image that also knows its size
|
||||||
func newImage(ctx *types.SystemContext, s storageReference) (types.ImageCloser, error) {
|
func newImage(ctx context.Context, sys *types.SystemContext, s storageReference) (types.ImageCloser, error) {
|
||||||
src, err := newImageSource(s)
|
src, err := newImageSource(s)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
img, err := image.FromSource(ctx, src)
|
img, err := image.FromSource(ctx, sys, src)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
11
vendor/github.com/containers/image/storage/storage_reference.go
generated
vendored
11
vendor/github.com/containers/image/storage/storage_reference.go
generated
vendored
@ -3,6 +3,7 @@
|
|||||||
package storage
|
package storage
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"context"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/containers/image/docker/reference"
|
"github.com/containers/image/docker/reference"
|
||||||
@ -181,11 +182,11 @@ func (s storageReference) PolicyConfigurationNamespaces() []string {
|
|||||||
// NOTE: If any kind of signature verification should happen, build an UnparsedImage from the value returned by NewImageSource,
|
// NOTE: If any kind of signature verification should happen, build an UnparsedImage from the value returned by NewImageSource,
|
||||||
// verify that UnparsedImage, and convert it into a real Image via image.FromUnparsedImage.
|
// verify that UnparsedImage, and convert it into a real Image via image.FromUnparsedImage.
|
||||||
// WARNING: This may not do the right thing for a manifest list, see image.FromSource for details.
|
// WARNING: This may not do the right thing for a manifest list, see image.FromSource for details.
|
||||||
func (s storageReference) NewImage(ctx *types.SystemContext) (types.ImageCloser, error) {
|
func (s storageReference) NewImage(ctx context.Context, sys *types.SystemContext) (types.ImageCloser, error) {
|
||||||
return newImage(ctx, s)
|
return newImage(ctx, sys, s)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s storageReference) DeleteImage(ctx *types.SystemContext) error {
|
func (s storageReference) DeleteImage(ctx context.Context, sys *types.SystemContext) error {
|
||||||
img, err := s.resolveImage()
|
img, err := s.resolveImage()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
@ -200,10 +201,10 @@ func (s storageReference) DeleteImage(ctx *types.SystemContext) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s storageReference) NewImageSource(ctx *types.SystemContext) (types.ImageSource, error) {
|
func (s storageReference) NewImageSource(ctx context.Context, sys *types.SystemContext) (types.ImageSource, error) {
|
||||||
return newImageSource(s)
|
return newImageSource(s)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s storageReference) NewImageDestination(ctx *types.SystemContext) (types.ImageDestination, error) {
|
func (s storageReference) NewImageDestination(ctx context.Context, sys *types.SystemContext) (types.ImageDestination, error) {
|
||||||
return newImageDestination(ctx, s)
|
return newImageDestination(ctx, s)
|
||||||
}
|
}
|
||||||
|
11
vendor/github.com/containers/image/tarball/tarball_reference.go
generated
vendored
11
vendor/github.com/containers/image/tarball/tarball_reference.go
generated
vendored
@ -1,6 +1,7 @@
|
|||||||
package tarball
|
package tarball
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
"strings"
|
"strings"
|
||||||
@ -66,12 +67,12 @@ func (r *tarballReference) PolicyConfigurationNamespaces() []string {
|
|||||||
// NOTE: If any kind of signature verification should happen, build an UnparsedImage from the value returned by NewImageSource,
|
// NOTE: If any kind of signature verification should happen, build an UnparsedImage from the value returned by NewImageSource,
|
||||||
// verify that UnparsedImage, and convert it into a real Image via image.FromUnparsedImage.
|
// verify that UnparsedImage, and convert it into a real Image via image.FromUnparsedImage.
|
||||||
// WARNING: This may not do the right thing for a manifest list, see image.FromSource for details.
|
// WARNING: This may not do the right thing for a manifest list, see image.FromSource for details.
|
||||||
func (r *tarballReference) NewImage(ctx *types.SystemContext) (types.ImageCloser, error) {
|
func (r *tarballReference) NewImage(ctx context.Context, sys *types.SystemContext) (types.ImageCloser, error) {
|
||||||
src, err := r.NewImageSource(ctx)
|
src, err := r.NewImageSource(ctx, sys)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
img, err := image.FromSource(ctx, src)
|
img, err := image.FromSource(ctx, sys, src)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
src.Close()
|
src.Close()
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -79,7 +80,7 @@ func (r *tarballReference) NewImage(ctx *types.SystemContext) (types.ImageCloser
|
|||||||
return img, nil
|
return img, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *tarballReference) DeleteImage(ctx *types.SystemContext) error {
|
func (r *tarballReference) DeleteImage(ctx context.Context, sys *types.SystemContext) error {
|
||||||
for _, filename := range r.filenames {
|
for _, filename := range r.filenames {
|
||||||
if err := os.Remove(filename); err != nil && !os.IsNotExist(err) {
|
if err := os.Remove(filename); err != nil && !os.IsNotExist(err) {
|
||||||
return fmt.Errorf("error removing %q: %v", filename, err)
|
return fmt.Errorf("error removing %q: %v", filename, err)
|
||||||
@ -88,6 +89,6 @@ func (r *tarballReference) DeleteImage(ctx *types.SystemContext) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *tarballReference) NewImageDestination(ctx *types.SystemContext) (types.ImageDestination, error) {
|
func (r *tarballReference) NewImageDestination(ctx context.Context, sys *types.SystemContext) (types.ImageDestination, error) {
|
||||||
return nil, fmt.Errorf(`"tarball:" locations can only be read from, not written to`)
|
return nil, fmt.Errorf(`"tarball:" locations can only be read from, not written to`)
|
||||||
}
|
}
|
||||||
|
8
vendor/github.com/containers/image/tarball/tarball_src.go
generated
vendored
8
vendor/github.com/containers/image/tarball/tarball_src.go
generated
vendored
@ -34,7 +34,7 @@ type tarballImageSource struct {
|
|||||||
manifest []byte
|
manifest []byte
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *tarballReference) NewImageSource(ctx *types.SystemContext) (types.ImageSource, error) {
|
func (r *tarballReference) NewImageSource(ctx context.Context, sys *types.SystemContext) (types.ImageSource, error) {
|
||||||
// Gather up the digests, sizes, and date information for all of the files.
|
// Gather up the digests, sizes, and date information for all of the files.
|
||||||
filenames := []string{}
|
filenames := []string{}
|
||||||
diffIDs := []digest.Digest{}
|
diffIDs := []digest.Digest{}
|
||||||
@ -206,7 +206,7 @@ func (is *tarballImageSource) Close() error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (is *tarballImageSource) GetBlob(blobinfo types.BlobInfo) (io.ReadCloser, int64, error) {
|
func (is *tarballImageSource) GetBlob(ctx context.Context, blobinfo types.BlobInfo) (io.ReadCloser, int64, error) {
|
||||||
// We should only be asked about things in the manifest. Maybe the configuration blob.
|
// We should only be asked about things in the manifest. Maybe the configuration blob.
|
||||||
if blobinfo.Digest == is.configID {
|
if blobinfo.Digest == is.configID {
|
||||||
return ioutil.NopCloser(bytes.NewBuffer(is.config)), is.configSize, nil
|
return ioutil.NopCloser(bytes.NewBuffer(is.config)), is.configSize, nil
|
||||||
@ -232,7 +232,7 @@ func (is *tarballImageSource) GetBlob(blobinfo types.BlobInfo) (io.ReadCloser, i
|
|||||||
// It may use a remote (= slow) service.
|
// It may use a remote (= slow) service.
|
||||||
// If instanceDigest is not nil, it contains a digest of the specific manifest instance to retrieve (when the primary manifest is a manifest list);
|
// If instanceDigest is not nil, it contains a digest of the specific manifest instance to retrieve (when the primary manifest is a manifest list);
|
||||||
// this never happens if the primary manifest is not a manifest list (e.g. if the source never returns manifest lists).
|
// this never happens if the primary manifest is not a manifest list (e.g. if the source never returns manifest lists).
|
||||||
func (is *tarballImageSource) GetManifest(instanceDigest *digest.Digest) ([]byte, string, error) {
|
func (is *tarballImageSource) GetManifest(ctx context.Context, instanceDigest *digest.Digest) ([]byte, string, error) {
|
||||||
if instanceDigest != nil {
|
if instanceDigest != nil {
|
||||||
return nil, "", fmt.Errorf("manifest lists are not supported by the %q transport", transportName)
|
return nil, "", fmt.Errorf("manifest lists are not supported by the %q transport", transportName)
|
||||||
}
|
}
|
||||||
@ -255,6 +255,6 @@ func (is *tarballImageSource) Reference() types.ImageReference {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// LayerInfosForCopy() returns updated layer info that should be used when reading, in preference to values in the manifest, if specified.
|
// LayerInfosForCopy() returns updated layer info that should be used when reading, in preference to values in the manifest, if specified.
|
||||||
func (*tarballImageSource) LayerInfosForCopy() ([]types.BlobInfo, error) {
|
func (*tarballImageSource) LayerInfosForCopy(ctx context.Context) ([]types.BlobInfo, error) {
|
||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
40
vendor/github.com/containers/image/types/types.go
generated
vendored
40
vendor/github.com/containers/image/types/types.go
generated
vendored
@ -78,16 +78,16 @@ type ImageReference interface {
|
|||||||
// NOTE: If any kind of signature verification should happen, build an UnparsedImage from the value returned by NewImageSource,
|
// NOTE: If any kind of signature verification should happen, build an UnparsedImage from the value returned by NewImageSource,
|
||||||
// verify that UnparsedImage, and convert it into a real Image via image.FromUnparsedImage.
|
// verify that UnparsedImage, and convert it into a real Image via image.FromUnparsedImage.
|
||||||
// WARNING: This may not do the right thing for a manifest list, see image.FromSource for details.
|
// WARNING: This may not do the right thing for a manifest list, see image.FromSource for details.
|
||||||
NewImage(ctx *SystemContext) (ImageCloser, error)
|
NewImage(ctx context.Context, sys *SystemContext) (ImageCloser, error)
|
||||||
// NewImageSource returns a types.ImageSource for this reference.
|
// NewImageSource returns a types.ImageSource for this reference.
|
||||||
// The caller must call .Close() on the returned ImageSource.
|
// The caller must call .Close() on the returned ImageSource.
|
||||||
NewImageSource(ctx *SystemContext) (ImageSource, error)
|
NewImageSource(ctx context.Context, sys *SystemContext) (ImageSource, error)
|
||||||
// NewImageDestination returns a types.ImageDestination for this reference.
|
// NewImageDestination returns a types.ImageDestination for this reference.
|
||||||
// The caller must call .Close() on the returned ImageDestination.
|
// The caller must call .Close() on the returned ImageDestination.
|
||||||
NewImageDestination(ctx *SystemContext) (ImageDestination, error)
|
NewImageDestination(ctx context.Context, sys *SystemContext) (ImageDestination, error)
|
||||||
|
|
||||||
// DeleteImage deletes the named image from the registry, if supported.
|
// DeleteImage deletes the named image from the registry, if supported.
|
||||||
DeleteImage(ctx *SystemContext) error
|
DeleteImage(ctx context.Context, sys *SystemContext) error
|
||||||
}
|
}
|
||||||
|
|
||||||
// BlobInfo collects known information about a blob (layer/config).
|
// BlobInfo collects known information about a blob (layer/config).
|
||||||
@ -117,10 +117,10 @@ type ImageSource interface {
|
|||||||
// It may use a remote (= slow) service.
|
// It may use a remote (= slow) service.
|
||||||
// If instanceDigest is not nil, it contains a digest of the specific manifest instance to retrieve (when the primary manifest is a manifest list);
|
// If instanceDigest is not nil, it contains a digest of the specific manifest instance to retrieve (when the primary manifest is a manifest list);
|
||||||
// this never happens if the primary manifest is not a manifest list (e.g. if the source never returns manifest lists).
|
// this never happens if the primary manifest is not a manifest list (e.g. if the source never returns manifest lists).
|
||||||
GetManifest(instanceDigest *digest.Digest) ([]byte, string, error)
|
GetManifest(ctx context.Context, instanceDigest *digest.Digest) ([]byte, string, error)
|
||||||
// GetBlob returns a stream for the specified blob, and the blob’s size (or -1 if unknown).
|
// GetBlob returns a stream for the specified blob, and the blob’s size (or -1 if unknown).
|
||||||
// The Digest field in BlobInfo is guaranteed to be provided, Size may be -1 and MediaType may be optionally provided.
|
// The Digest field in BlobInfo is guaranteed to be provided, Size may be -1 and MediaType may be optionally provided.
|
||||||
GetBlob(BlobInfo) (io.ReadCloser, int64, error)
|
GetBlob(context.Context, BlobInfo) (io.ReadCloser, int64, error)
|
||||||
// GetSignatures returns the image's signatures. It may use a remote (= slow) service.
|
// GetSignatures returns the image's signatures. It may use a remote (= slow) service.
|
||||||
// If instanceDigest is not nil, it contains a digest of the specific manifest instance to retrieve signatures for
|
// If instanceDigest is not nil, it contains a digest of the specific manifest instance to retrieve signatures for
|
||||||
// (when the primary manifest is a manifest list); this never happens if the primary manifest is not a manifest list
|
// (when the primary manifest is a manifest list); this never happens if the primary manifest is not a manifest list
|
||||||
@ -129,7 +129,7 @@ type ImageSource interface {
|
|||||||
// LayerInfosForCopy returns either nil (meaning the values in the manifest are fine), or updated values for the layer blobsums that are listed in the image's manifest.
|
// LayerInfosForCopy returns either nil (meaning the values in the manifest are fine), or updated values for the layer blobsums that are listed in the image's manifest.
|
||||||
// The Digest field is guaranteed to be provided; Size may be -1.
|
// The Digest field is guaranteed to be provided; Size may be -1.
|
||||||
// WARNING: The list may contain duplicates, and they are semantically relevant.
|
// WARNING: The list may contain duplicates, and they are semantically relevant.
|
||||||
LayerInfosForCopy() ([]BlobInfo, error)
|
LayerInfosForCopy(ctx context.Context) ([]BlobInfo, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
// LayerCompression indicates if layers must be compressed, decompressed or preserved
|
// LayerCompression indicates if layers must be compressed, decompressed or preserved
|
||||||
@ -166,7 +166,7 @@ type ImageDestination interface {
|
|||||||
SupportedManifestMIMETypes() []string
|
SupportedManifestMIMETypes() []string
|
||||||
// SupportsSignatures returns an error (to be displayed to the user) if the destination certainly can't store signatures.
|
// SupportsSignatures returns an error (to be displayed to the user) if the destination certainly can't store signatures.
|
||||||
// Note: It is still possible for PutSignatures to fail if SupportsSignatures returns nil.
|
// Note: It is still possible for PutSignatures to fail if SupportsSignatures returns nil.
|
||||||
SupportsSignatures() error
|
SupportsSignatures(ctx context.Context) error
|
||||||
// DesiredLayerCompression indicates the kind of compression to apply on layers
|
// DesiredLayerCompression indicates the kind of compression to apply on layers
|
||||||
DesiredLayerCompression() LayerCompression
|
DesiredLayerCompression() LayerCompression
|
||||||
// AcceptsForeignLayerURLs returns false iff foreign layers in manifest should be actually
|
// AcceptsForeignLayerURLs returns false iff foreign layers in manifest should be actually
|
||||||
@ -181,25 +181,25 @@ type ImageDestination interface {
|
|||||||
// WARNING: The contents of stream are being verified on the fly. Until stream.Read() returns io.EOF, the contents of the data SHOULD NOT be available
|
// WARNING: The contents of stream are being verified on the fly. Until stream.Read() returns io.EOF, the contents of the data SHOULD NOT be available
|
||||||
// to any other readers for download using the supplied digest.
|
// to any other readers for download using the supplied digest.
|
||||||
// If stream.Read() at any time, ESPECIALLY at end of input, returns an error, PutBlob MUST 1) fail, and 2) delete any data stored so far.
|
// If stream.Read() at any time, ESPECIALLY at end of input, returns an error, PutBlob MUST 1) fail, and 2) delete any data stored so far.
|
||||||
PutBlob(stream io.Reader, inputInfo BlobInfo, isConfig bool) (BlobInfo, error)
|
PutBlob(ctx context.Context, stream io.Reader, inputInfo BlobInfo, isConfig bool) (BlobInfo, error)
|
||||||
// HasBlob returns true iff the image destination already contains a blob with the matching digest which can be reapplied using ReapplyBlob.
|
// HasBlob returns true iff the image destination already contains a blob with the matching digest which can be reapplied using ReapplyBlob.
|
||||||
// Unlike PutBlob, the digest can not be empty. If HasBlob returns true, the size of the blob must also be returned.
|
// Unlike PutBlob, the digest can not be empty. If HasBlob returns true, the size of the blob must also be returned.
|
||||||
// If the destination does not contain the blob, or it is unknown, HasBlob ordinarily returns (false, -1, nil);
|
// If the destination does not contain the blob, or it is unknown, HasBlob ordinarily returns (false, -1, nil);
|
||||||
// it returns a non-nil error only on an unexpected failure.
|
// it returns a non-nil error only on an unexpected failure.
|
||||||
HasBlob(info BlobInfo) (bool, int64, error)
|
HasBlob(ctx context.Context, info BlobInfo) (bool, int64, error)
|
||||||
// ReapplyBlob informs the image destination that a blob for which HasBlob previously returned true would have been passed to PutBlob if it had returned false. Like HasBlob and unlike PutBlob, the digest can not be empty. If the blob is a filesystem layer, this signifies that the changes it describes need to be applied again when composing a filesystem tree.
|
// ReapplyBlob informs the image destination that a blob for which HasBlob previously returned true would have been passed to PutBlob if it had returned false. Like HasBlob and unlike PutBlob, the digest can not be empty. If the blob is a filesystem layer, this signifies that the changes it describes need to be applied again when composing a filesystem tree.
|
||||||
ReapplyBlob(info BlobInfo) (BlobInfo, error)
|
ReapplyBlob(ctx context.Context, info BlobInfo) (BlobInfo, error)
|
||||||
// PutManifest writes manifest to the destination.
|
// PutManifest writes manifest to the destination.
|
||||||
// FIXME? This should also receive a MIME type if known, to differentiate between schema versions.
|
// FIXME? This should also receive a MIME type if known, to differentiate between schema versions.
|
||||||
// If the destination is in principle available, refuses this manifest type (e.g. it does not recognize the schema),
|
// If the destination is in principle available, refuses this manifest type (e.g. it does not recognize the schema),
|
||||||
// but may accept a different manifest type, the returned error must be an ManifestTypeRejectedError.
|
// but may accept a different manifest type, the returned error must be an ManifestTypeRejectedError.
|
||||||
PutManifest(manifest []byte) error
|
PutManifest(ctx context.Context, manifest []byte) error
|
||||||
PutSignatures(signatures [][]byte) error
|
PutSignatures(ctx context.Context, signatures [][]byte) error
|
||||||
// Commit marks the process of storing the image as successful and asks for the image to be persisted.
|
// Commit marks the process of storing the image as successful and asks for the image to be persisted.
|
||||||
// WARNING: This does not have any transactional semantics:
|
// WARNING: This does not have any transactional semantics:
|
||||||
// - Uploaded data MAY be visible to others before Commit() is called
|
// - Uploaded data MAY be visible to others before Commit() is called
|
||||||
// - Uploaded data MAY be removed or MAY remain around if Close() is called without Commit() (i.e. rollback is allowed but not guaranteed)
|
// - Uploaded data MAY be removed or MAY remain around if Close() is called without Commit() (i.e. rollback is allowed but not guaranteed)
|
||||||
Commit() error
|
Commit(ctx context.Context) error
|
||||||
}
|
}
|
||||||
|
|
||||||
// ManifestTypeRejectedError is returned by ImageDestination.PutManifest if the destination is in principle available,
|
// ManifestTypeRejectedError is returned by ImageDestination.PutManifest if the destination is in principle available,
|
||||||
@ -225,7 +225,7 @@ type UnparsedImage interface {
|
|||||||
// (not as the image itself, or its underlying storage, claims). This can be used e.g. to determine which public keys are trusted for this image.
|
// (not as the image itself, or its underlying storage, claims). This can be used e.g. to determine which public keys are trusted for this image.
|
||||||
Reference() ImageReference
|
Reference() ImageReference
|
||||||
// Manifest is like ImageSource.GetManifest, but the result is cached; it is OK to call this however often you need.
|
// Manifest is like ImageSource.GetManifest, but the result is cached; it is OK to call this however often you need.
|
||||||
Manifest() ([]byte, string, error)
|
Manifest(ctx context.Context) ([]byte, string, error)
|
||||||
// Signatures is like ImageSource.GetSignatures, but the result is cached; it is OK to call this however often you need.
|
// Signatures is like ImageSource.GetSignatures, but the result is cached; it is OK to call this however often you need.
|
||||||
Signatures(ctx context.Context) ([][]byte, error)
|
Signatures(ctx context.Context) ([][]byte, error)
|
||||||
}
|
}
|
||||||
@ -242,11 +242,11 @@ type Image interface {
|
|||||||
ConfigInfo() BlobInfo
|
ConfigInfo() BlobInfo
|
||||||
// ConfigBlob returns the blob described by ConfigInfo, if ConfigInfo().Digest != ""; nil otherwise.
|
// ConfigBlob returns the blob described by ConfigInfo, if ConfigInfo().Digest != ""; nil otherwise.
|
||||||
// The result is cached; it is OK to call this however often you need.
|
// The result is cached; it is OK to call this however often you need.
|
||||||
ConfigBlob() ([]byte, error)
|
ConfigBlob(context.Context) ([]byte, error)
|
||||||
// OCIConfig returns the image configuration as per OCI v1 image-spec. Information about
|
// OCIConfig returns the image configuration as per OCI v1 image-spec. Information about
|
||||||
// layers in the resulting configuration isn't guaranteed to be returned to due how
|
// layers in the resulting configuration isn't guaranteed to be returned to due how
|
||||||
// old image manifests work (docker v2s1 especially).
|
// old image manifests work (docker v2s1 especially).
|
||||||
OCIConfig() (*v1.Image, error)
|
OCIConfig(context.Context) (*v1.Image, error)
|
||||||
// LayerInfos returns a list of BlobInfos of layers referenced by this image, in order (the root layer first, and then successive layered layers).
|
// LayerInfos returns a list of BlobInfos of layers referenced by this image, in order (the root layer first, and then successive layered layers).
|
||||||
// The Digest field is guaranteed to be provided, Size may be -1 and MediaType may be optionally provided.
|
// The Digest field is guaranteed to be provided, Size may be -1 and MediaType may be optionally provided.
|
||||||
// WARNING: The list may contain duplicates, and they are semantically relevant.
|
// WARNING: The list may contain duplicates, and they are semantically relevant.
|
||||||
@ -254,13 +254,13 @@ type Image interface {
|
|||||||
// LayerInfosForCopy returns either nil (meaning the values in the manifest are fine), or updated values for the layer blobsums that are listed in the image's manifest.
|
// LayerInfosForCopy returns either nil (meaning the values in the manifest are fine), or updated values for the layer blobsums that are listed in the image's manifest.
|
||||||
// The Digest field is guaranteed to be provided, Size may be -1 and MediaType may be optionally provided.
|
// The Digest field is guaranteed to be provided, Size may be -1 and MediaType may be optionally provided.
|
||||||
// WARNING: The list may contain duplicates, and they are semantically relevant.
|
// WARNING: The list may contain duplicates, and they are semantically relevant.
|
||||||
LayerInfosForCopy() ([]BlobInfo, error)
|
LayerInfosForCopy(context.Context) ([]BlobInfo, error)
|
||||||
// EmbeddedDockerReferenceConflicts whether a Docker reference embedded in the manifest, if any, conflicts with destination ref.
|
// EmbeddedDockerReferenceConflicts whether a Docker reference embedded in the manifest, if any, conflicts with destination ref.
|
||||||
// It returns false if the manifest does not embed a Docker reference.
|
// It returns false if the manifest does not embed a Docker reference.
|
||||||
// (This embedding unfortunately happens for Docker schema1, please do not add support for this in any new formats.)
|
// (This embedding unfortunately happens for Docker schema1, please do not add support for this in any new formats.)
|
||||||
EmbeddedDockerReferenceConflicts(ref reference.Named) bool
|
EmbeddedDockerReferenceConflicts(ref reference.Named) bool
|
||||||
// Inspect returns various information for (skopeo inspect) parsed from the manifest and configuration.
|
// Inspect returns various information for (skopeo inspect) parsed from the manifest and configuration.
|
||||||
Inspect() (*ImageInspectInfo, error)
|
Inspect(context.Context) (*ImageInspectInfo, error)
|
||||||
// UpdatedImageNeedsLayerDiffIDs returns true iff UpdatedImage(options) needs InformationOnly.LayerDiffIDs.
|
// UpdatedImageNeedsLayerDiffIDs returns true iff UpdatedImage(options) needs InformationOnly.LayerDiffIDs.
|
||||||
// This is a horribly specific interface, but computing InformationOnly.LayerDiffIDs can be very expensive to compute
|
// This is a horribly specific interface, but computing InformationOnly.LayerDiffIDs can be very expensive to compute
|
||||||
// (most importantly it forces us to download the full layers even if they are already present at the destination).
|
// (most importantly it forces us to download the full layers even if they are already present at the destination).
|
||||||
@ -268,7 +268,7 @@ type Image interface {
|
|||||||
// UpdatedImage returns a types.Image modified according to options.
|
// UpdatedImage returns a types.Image modified according to options.
|
||||||
// Everything in options.InformationOnly should be provided, other fields should be set only if a modification is desired.
|
// Everything in options.InformationOnly should be provided, other fields should be set only if a modification is desired.
|
||||||
// This does not change the state of the original Image object.
|
// This does not change the state of the original Image object.
|
||||||
UpdatedImage(options ManifestUpdateOptions) (Image, error)
|
UpdatedImage(ctx context.Context, options ManifestUpdateOptions) (Image, error)
|
||||||
// Size returns an approximation of the amount of disk space which is consumed by the image in its current
|
// Size returns an approximation of the amount of disk space which is consumed by the image in its current
|
||||||
// location. If the size is not known, -1 will be returned.
|
// location. If the size is not known, -1 will be returned.
|
||||||
Size() (int64, error)
|
Size() (int64, error)
|
||||||
|
2
vendor/github.com/containers/image/vendor.conf
generated
vendored
2
vendor/github.com/containers/image/vendor.conf
generated
vendored
@ -1,3 +1,5 @@
|
|||||||
|
github.com/containers/image
|
||||||
|
|
||||||
github.com/sirupsen/logrus v1.0.0
|
github.com/sirupsen/logrus v1.0.0
|
||||||
github.com/containers/storage master
|
github.com/containers/storage master
|
||||||
github.com/davecgh/go-spew 346938d642f2ec3594ed81d874461961cd0faa76
|
github.com/davecgh/go-spew 346938d642f2ec3594ed81d874461961cd0faa76
|
||||||
|
11
vendor/github.com/xeipuuv/gojsonschema/README.md
generated
vendored
11
vendor/github.com/xeipuuv/gojsonschema/README.md
generated
vendored
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
## Description
|
## Description
|
||||||
|
|
||||||
An implementation of JSON Schema, based on IETF's draft v4 - Go language
|
An implementation of JSON Schema for the Go programming language. Supports draft-04, draft-06 and draft-07.
|
||||||
|
|
||||||
References :
|
References :
|
||||||
|
|
||||||
@ -156,7 +156,9 @@ The library handles string error codes which you can customize by creating your
|
|||||||
gojsonschema.Locale = YourCustomLocale{}
|
gojsonschema.Locale = YourCustomLocale{}
|
||||||
```
|
```
|
||||||
|
|
||||||
However, each error contains additional contextual information.
|
However, each error contains additional contextual information.
|
||||||
|
|
||||||
|
Newer versions of `gojsonschema` may have new additional errors, so code that uses a custom locale will need to be updated when this happens.
|
||||||
|
|
||||||
**err.Type()**: *string* Returns the "type" of error that occurred. Note you can also type check. See below
|
**err.Type()**: *string* Returns the "type" of error that occurred. Note you can also type check. See below
|
||||||
|
|
||||||
@ -170,15 +172,18 @@ Note: An error of RequiredType has an err.Type() return value of "required"
|
|||||||
"number_not": NumberNotError
|
"number_not": NumberNotError
|
||||||
"missing_dependency": MissingDependencyError
|
"missing_dependency": MissingDependencyError
|
||||||
"internal": InternalError
|
"internal": InternalError
|
||||||
|
"const": ConstEror
|
||||||
"enum": EnumError
|
"enum": EnumError
|
||||||
"array_no_additional_items": ArrayNoAdditionalItemsError
|
"array_no_additional_items": ArrayNoAdditionalItemsError
|
||||||
"array_min_items": ArrayMinItemsError
|
"array_min_items": ArrayMinItemsError
|
||||||
"array_max_items": ArrayMaxItemsError
|
"array_max_items": ArrayMaxItemsError
|
||||||
"unique": ItemsMustBeUniqueError
|
"unique": ItemsMustBeUniqueError
|
||||||
|
"contains" : ArrayContainsError
|
||||||
"array_min_properties": ArrayMinPropertiesError
|
"array_min_properties": ArrayMinPropertiesError
|
||||||
"array_max_properties": ArrayMaxPropertiesError
|
"array_max_properties": ArrayMaxPropertiesError
|
||||||
"additional_property_not_allowed": AdditionalPropertyNotAllowedError
|
"additional_property_not_allowed": AdditionalPropertyNotAllowedError
|
||||||
"invalid_property_pattern": InvalidPropertyPatternError
|
"invalid_property_pattern": InvalidPropertyPatternError
|
||||||
|
"invalid_property_name": InvalidPropertyNameError
|
||||||
"string_gte": StringLengthGTEError
|
"string_gte": StringLengthGTEError
|
||||||
"string_lte": StringLengthLTEError
|
"string_lte": StringLengthLTEError
|
||||||
"pattern": DoesNotMatchPatternError
|
"pattern": DoesNotMatchPatternError
|
||||||
@ -231,7 +236,7 @@ JSON Schema allows for optional "format" property to validate instances against
|
|||||||
````json
|
````json
|
||||||
{"type": "string", "format": "email"}
|
{"type": "string", "format": "email"}
|
||||||
````
|
````
|
||||||
Available formats: date-time, hostname, email, ipv4, ipv6, uri, uri-reference.
|
Available formats: date-time, hostname, email, ipv4, ipv6, uri, uri-reference, uuid, regex. Some of the new formats in draft-06 and draft-07 are not yet implemented.
|
||||||
|
|
||||||
For repetitive or more complex formats, you can create custom format checkers and add them to gojsonschema like this:
|
For repetitive or more complex formats, you can create custom format checkers and add them to gojsonschema like this:
|
||||||
|
|
||||||
|
24
vendor/github.com/xeipuuv/gojsonschema/errors.go
generated
vendored
24
vendor/github.com/xeipuuv/gojsonschema/errors.go
generated
vendored
@ -56,6 +56,11 @@ type (
|
|||||||
ResultErrorFields
|
ResultErrorFields
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ConstError. ErrorDetails: allowed
|
||||||
|
ConstError struct {
|
||||||
|
ResultErrorFields
|
||||||
|
}
|
||||||
|
|
||||||
// EnumError. ErrorDetails: allowed
|
// EnumError. ErrorDetails: allowed
|
||||||
EnumError struct {
|
EnumError struct {
|
||||||
ResultErrorFields
|
ResultErrorFields
|
||||||
@ -81,6 +86,11 @@ type (
|
|||||||
ResultErrorFields
|
ResultErrorFields
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ArrayContainsError. ErrorDetails:
|
||||||
|
ArrayContainsError struct {
|
||||||
|
ResultErrorFields
|
||||||
|
}
|
||||||
|
|
||||||
// ArrayMinPropertiesError. ErrorDetails: min
|
// ArrayMinPropertiesError. ErrorDetails: min
|
||||||
ArrayMinPropertiesError struct {
|
ArrayMinPropertiesError struct {
|
||||||
ResultErrorFields
|
ResultErrorFields
|
||||||
@ -101,6 +111,11 @@ type (
|
|||||||
ResultErrorFields
|
ResultErrorFields
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// InvalidPopertyNameError. ErrorDetails: property
|
||||||
|
InvalidPropertyNameError struct {
|
||||||
|
ResultErrorFields
|
||||||
|
}
|
||||||
|
|
||||||
// StringLengthGTEError. ErrorDetails: min
|
// StringLengthGTEError. ErrorDetails: min
|
||||||
StringLengthGTEError struct {
|
StringLengthGTEError struct {
|
||||||
ResultErrorFields
|
ResultErrorFields
|
||||||
@ -186,6 +201,9 @@ func newError(err ResultError, context *JsonContext, value interface{}, locale l
|
|||||||
case *InternalError:
|
case *InternalError:
|
||||||
t = "internal"
|
t = "internal"
|
||||||
d = locale.Internal()
|
d = locale.Internal()
|
||||||
|
case *ConstError:
|
||||||
|
t = "const"
|
||||||
|
d = locale.Const()
|
||||||
case *EnumError:
|
case *EnumError:
|
||||||
t = "enum"
|
t = "enum"
|
||||||
d = locale.Enum()
|
d = locale.Enum()
|
||||||
@ -201,6 +219,9 @@ func newError(err ResultError, context *JsonContext, value interface{}, locale l
|
|||||||
case *ItemsMustBeUniqueError:
|
case *ItemsMustBeUniqueError:
|
||||||
t = "unique"
|
t = "unique"
|
||||||
d = locale.Unique()
|
d = locale.Unique()
|
||||||
|
case *ArrayContainsError:
|
||||||
|
t = "contains"
|
||||||
|
d = locale.ArrayContains()
|
||||||
case *ArrayMinPropertiesError:
|
case *ArrayMinPropertiesError:
|
||||||
t = "array_min_properties"
|
t = "array_min_properties"
|
||||||
d = locale.ArrayMinProperties()
|
d = locale.ArrayMinProperties()
|
||||||
@ -213,6 +234,9 @@ func newError(err ResultError, context *JsonContext, value interface{}, locale l
|
|||||||
case *InvalidPropertyPatternError:
|
case *InvalidPropertyPatternError:
|
||||||
t = "invalid_property_pattern"
|
t = "invalid_property_pattern"
|
||||||
d = locale.InvalidPropertyPattern()
|
d = locale.InvalidPropertyPattern()
|
||||||
|
case *InvalidPropertyNameError:
|
||||||
|
t = "invalid_property_name"
|
||||||
|
d = locale.InvalidPropertyName()
|
||||||
case *StringLengthGTEError:
|
case *StringLengthGTEError:
|
||||||
t = "string_gte"
|
t = "string_gte"
|
||||||
d = locale.StringGTE()
|
d = locale.StringGTE()
|
||||||
|
27
vendor/github.com/xeipuuv/gojsonschema/jsonLoader.go
generated
vendored
27
vendor/github.com/xeipuuv/gojsonschema/jsonLoader.go
generated
vendored
@ -38,7 +38,6 @@ import (
|
|||||||
"runtime"
|
"runtime"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
|
||||||
"github.com/xeipuuv/gojsonreference"
|
"github.com/xeipuuv/gojsonreference"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -324,6 +323,30 @@ func (l *jsonIOLoader) LoaderFactory() JSONLoaderFactory {
|
|||||||
return &DefaultJSONLoaderFactory{}
|
return &DefaultJSONLoaderFactory{}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// JSON raw loader
|
||||||
|
// In case the JSON is already marshalled to interface{} use this loader
|
||||||
|
// This is used for testing as otherwise there is no guarantee the JSON is marshalled
|
||||||
|
// "properly" by using https://golang.org/pkg/encoding/json/#Decoder.UseNumber
|
||||||
|
type jsonRawLoader struct {
|
||||||
|
source interface{}
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewRawLoader(source interface{}) *jsonRawLoader {
|
||||||
|
return &jsonRawLoader{source: source}
|
||||||
|
}
|
||||||
|
func (l *jsonRawLoader) JsonSource() interface{} {
|
||||||
|
return l.source
|
||||||
|
}
|
||||||
|
func (l *jsonRawLoader) LoadJSON() (interface{}, error) {
|
||||||
|
return l.source, nil
|
||||||
|
}
|
||||||
|
func (l *jsonRawLoader) JsonReference() (gojsonreference.JsonReference, error) {
|
||||||
|
return gojsonreference.NewJsonReference("#")
|
||||||
|
}
|
||||||
|
func (l *jsonRawLoader) LoaderFactory() JSONLoaderFactory {
|
||||||
|
return &DefaultJSONLoaderFactory{}
|
||||||
|
}
|
||||||
|
|
||||||
func decodeJsonUsingNumber(r io.Reader) (interface{}, error) {
|
func decodeJsonUsingNumber(r io.Reader) (interface{}, error) {
|
||||||
|
|
||||||
var document interface{}
|
var document interface{}
|
||||||
@ -335,7 +358,7 @@ func decodeJsonUsingNumber(r io.Reader) (interface{}, error) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
return document, nil
|
return document, nil
|
||||||
|
|
||||||
}
|
}
|
||||||
|
15
vendor/github.com/xeipuuv/gojsonschema/locales.go
generated
vendored
15
vendor/github.com/xeipuuv/gojsonschema/locales.go
generated
vendored
@ -36,16 +36,19 @@ type (
|
|||||||
NumberNot() string
|
NumberNot() string
|
||||||
MissingDependency() string
|
MissingDependency() string
|
||||||
Internal() string
|
Internal() string
|
||||||
|
Const() string
|
||||||
Enum() string
|
Enum() string
|
||||||
ArrayNotEnoughItems() string
|
ArrayNotEnoughItems() string
|
||||||
ArrayNoAdditionalItems() string
|
ArrayNoAdditionalItems() string
|
||||||
ArrayMinItems() string
|
ArrayMinItems() string
|
||||||
ArrayMaxItems() string
|
ArrayMaxItems() string
|
||||||
Unique() string
|
Unique() string
|
||||||
|
ArrayContains() string
|
||||||
ArrayMinProperties() string
|
ArrayMinProperties() string
|
||||||
ArrayMaxProperties() string
|
ArrayMaxProperties() string
|
||||||
AdditionalPropertyNotAllowed() string
|
AdditionalPropertyNotAllowed() string
|
||||||
InvalidPropertyPattern() string
|
InvalidPropertyPattern() string
|
||||||
|
InvalidPropertyName() string
|
||||||
StringGTE() string
|
StringGTE() string
|
||||||
StringLTE() string
|
StringLTE() string
|
||||||
DoesNotMatchPattern() string
|
DoesNotMatchPattern() string
|
||||||
@ -119,6 +122,10 @@ func (l DefaultLocale) Internal() string {
|
|||||||
return `Internal Error {{.error}}`
|
return `Internal Error {{.error}}`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (l DefaultLocale) Const() string {
|
||||||
|
return `{{.field}} does not match: {{.allowed}}`
|
||||||
|
}
|
||||||
|
|
||||||
func (l DefaultLocale) Enum() string {
|
func (l DefaultLocale) Enum() string {
|
||||||
return `{{.field}} must be one of the following: {{.allowed}}`
|
return `{{.field}} must be one of the following: {{.allowed}}`
|
||||||
}
|
}
|
||||||
@ -143,6 +150,10 @@ func (l DefaultLocale) Unique() string {
|
|||||||
return `{{.type}} items must be unique`
|
return `{{.type}} items must be unique`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (l DefaultLocale) ArrayContains() string {
|
||||||
|
return `At least one of the items must match`
|
||||||
|
}
|
||||||
|
|
||||||
func (l DefaultLocale) ArrayMinProperties() string {
|
func (l DefaultLocale) ArrayMinProperties() string {
|
||||||
return `Must have at least {{.min}} properties`
|
return `Must have at least {{.min}} properties`
|
||||||
}
|
}
|
||||||
@ -159,6 +170,10 @@ func (l DefaultLocale) InvalidPropertyPattern() string {
|
|||||||
return `Property "{{.property}}" does not match pattern {{.pattern}}`
|
return `Property "{{.property}}" does not match pattern {{.pattern}}`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (l DefaultLocale) InvalidPropertyName() string {
|
||||||
|
return `Property name of "{{.property}}" does not match`
|
||||||
|
}
|
||||||
|
|
||||||
func (l DefaultLocale) StringGTE() string {
|
func (l DefaultLocale) StringGTE() string {
|
||||||
return `String length must be greater than or equal to {{.min}}`
|
return `String length must be greater than or equal to {{.min}}`
|
||||||
}
|
}
|
||||||
|
138
vendor/github.com/xeipuuv/gojsonschema/schema.go
generated
vendored
138
vendor/github.com/xeipuuv/gojsonschema/schema.go
generated
vendored
@ -113,6 +113,16 @@ func (d *Schema) SetRootSchemaName(name string) {
|
|||||||
//
|
//
|
||||||
func (d *Schema) parseSchema(documentNode interface{}, currentSchema *subSchema) error {
|
func (d *Schema) parseSchema(documentNode interface{}, currentSchema *subSchema) error {
|
||||||
|
|
||||||
|
// As of draft 6 "true" is equivalent to an empty schema "{}" and false equals "{"not":{}}"
|
||||||
|
if isKind(documentNode, reflect.Bool) {
|
||||||
|
b := documentNode.(bool)
|
||||||
|
if b {
|
||||||
|
documentNode = map[string]interface{}{}
|
||||||
|
} else {
|
||||||
|
documentNode = map[string]interface{}{"not": true}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if !isKind(documentNode, reflect.Map) {
|
if !isKind(documentNode, reflect.Map) {
|
||||||
return errors.New(formatErrorDescription(
|
return errors.New(formatErrorDescription(
|
||||||
Locale.ParseError(),
|
Locale.ParseError(),
|
||||||
@ -121,28 +131,46 @@ func (d *Schema) parseSchema(documentNode interface{}, currentSchema *subSchema)
|
|||||||
},
|
},
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m := documentNode.(map[string]interface{})
|
||||||
|
|
||||||
if currentSchema.parent == nil {
|
if currentSchema.parent == nil {
|
||||||
currentSchema.ref = &d.documentReference
|
currentSchema.ref = &d.documentReference
|
||||||
currentSchema.id = &d.documentReference
|
currentSchema.id = &d.documentReference
|
||||||
|
|
||||||
|
if existsMapKey(m, KEY_SCHEMA) && false {
|
||||||
|
if !isKind(m[KEY_SCHEMA], reflect.String) {
|
||||||
|
return errors.New(formatErrorDescription(
|
||||||
|
Locale.InvalidType(),
|
||||||
|
ErrorDetails{
|
||||||
|
"expected": TYPE_STRING,
|
||||||
|
"given": KEY_SCHEMA,
|
||||||
|
},
|
||||||
|
))
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if currentSchema.id == nil && currentSchema.parent != nil {
|
if currentSchema.id == nil && currentSchema.parent != nil {
|
||||||
currentSchema.id = currentSchema.parent.id
|
currentSchema.id = currentSchema.parent.id
|
||||||
}
|
}
|
||||||
|
|
||||||
m := documentNode.(map[string]interface{})
|
// In draft 6 the id keyword was renamed to $id
|
||||||
|
// Use the old id by default
|
||||||
// id
|
keyID := KEY_ID_NEW
|
||||||
if existsMapKey(m, KEY_ID) && !isKind(m[KEY_ID], reflect.String) {
|
if existsMapKey(m, KEY_ID) {
|
||||||
|
keyID = KEY_ID
|
||||||
|
}
|
||||||
|
if existsMapKey(m, keyID) && !isKind(m[keyID], reflect.String) {
|
||||||
return errors.New(formatErrorDescription(
|
return errors.New(formatErrorDescription(
|
||||||
Locale.InvalidType(),
|
Locale.InvalidType(),
|
||||||
ErrorDetails{
|
ErrorDetails{
|
||||||
"expected": TYPE_STRING,
|
"expected": TYPE_STRING,
|
||||||
"given": KEY_ID,
|
"given": keyID,
|
||||||
},
|
},
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
if k, ok := m[KEY_ID].(string); ok {
|
if k, ok := m[keyID].(string); ok {
|
||||||
jsonReference, err := gojsonreference.NewJsonReference(k)
|
jsonReference, err := gojsonreference.NewJsonReference(k)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
@ -162,27 +190,9 @@ func (d *Schema) parseSchema(documentNode interface{}, currentSchema *subSchema)
|
|||||||
// subschemas, but as only the first and top one is used it will always reference
|
// subschemas, but as only the first and top one is used it will always reference
|
||||||
// the correct schema. Doing it once here prevents having
|
// the correct schema. Doing it once here prevents having
|
||||||
// to do this same step at every corner case.
|
// to do this same step at every corner case.
|
||||||
|
// TODO Referencing should be rewritten partially in the future and then this workaround should not be needed
|
||||||
d.referencePool.Add(currentSchema.id.String(), currentSchema)
|
d.referencePool.Add(currentSchema.id.String(), currentSchema)
|
||||||
|
|
||||||
// $subSchema
|
|
||||||
if existsMapKey(m, KEY_SCHEMA) {
|
|
||||||
if !isKind(m[KEY_SCHEMA], reflect.String) {
|
|
||||||
return errors.New(formatErrorDescription(
|
|
||||||
Locale.InvalidType(),
|
|
||||||
ErrorDetails{
|
|
||||||
"expected": TYPE_STRING,
|
|
||||||
"given": KEY_SCHEMA,
|
|
||||||
},
|
|
||||||
))
|
|
||||||
}
|
|
||||||
schemaRef := m[KEY_SCHEMA].(string)
|
|
||||||
schemaReference, err := gojsonreference.NewJsonReference(schemaRef)
|
|
||||||
currentSchema.subSchema = &schemaReference
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// $ref
|
// $ref
|
||||||
if existsMapKey(m, KEY_REF) && !isKind(m[KEY_REF], reflect.String) {
|
if existsMapKey(m, KEY_REF) && !isKind(m[KEY_REF], reflect.String) {
|
||||||
return errors.New(formatErrorDescription(
|
return errors.New(formatErrorDescription(
|
||||||
@ -209,6 +219,7 @@ func (d *Schema) parseSchema(documentNode interface{}, currentSchema *subSchema)
|
|||||||
}
|
}
|
||||||
currentSchema.ref = inheritedReference
|
currentSchema.ref = inheritedReference
|
||||||
}
|
}
|
||||||
|
|
||||||
if sch, ok := d.referencePool.Get(currentSchema.ref.String()); ok {
|
if sch, ok := d.referencePool.Get(currentSchema.ref.String()); ok {
|
||||||
currentSchema.refSchema = sch
|
currentSchema.refSchema = sch
|
||||||
} else {
|
} else {
|
||||||
@ -224,7 +235,7 @@ func (d *Schema) parseSchema(documentNode interface{}, currentSchema *subSchema)
|
|||||||
|
|
||||||
// definitions
|
// definitions
|
||||||
if existsMapKey(m, KEY_DEFINITIONS) {
|
if existsMapKey(m, KEY_DEFINITIONS) {
|
||||||
if isKind(m[KEY_DEFINITIONS], reflect.Map) {
|
if isKind(m[KEY_DEFINITIONS], reflect.Map, reflect.Bool) {
|
||||||
currentSchema.definitions = make(map[string]*subSchema)
|
currentSchema.definitions = make(map[string]*subSchema)
|
||||||
for dk, dv := range m[KEY_DEFINITIONS].(map[string]interface{}) {
|
for dk, dv := range m[KEY_DEFINITIONS].(map[string]interface{}) {
|
||||||
if isKind(dv, reflect.Map) {
|
if isKind(dv, reflect.Map) {
|
||||||
@ -397,6 +408,26 @@ func (d *Schema) parseSchema(documentNode interface{}, currentSchema *subSchema)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// propertyNames
|
||||||
|
if existsMapKey(m, KEY_PROPERTY_NAMES) {
|
||||||
|
if isKind(m[KEY_PROPERTY_NAMES], reflect.Map, reflect.Bool) {
|
||||||
|
newSchema := &subSchema{property: KEY_PROPERTY_NAMES, parent: currentSchema, ref: currentSchema.ref}
|
||||||
|
currentSchema.propertyNames = newSchema
|
||||||
|
err := d.parseSchema(m[KEY_PROPERTY_NAMES], newSchema)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return errors.New(formatErrorDescription(
|
||||||
|
Locale.InvalidType(),
|
||||||
|
ErrorDetails{
|
||||||
|
"expected": STRING_SCHEMA,
|
||||||
|
"given": KEY_PATTERN_PROPERTIES,
|
||||||
|
},
|
||||||
|
))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// dependencies
|
// dependencies
|
||||||
if existsMapKey(m, KEY_DEPENDENCIES) {
|
if existsMapKey(m, KEY_DEPENDENCIES) {
|
||||||
err := d.parseDependencies(m[KEY_DEPENDENCIES], currentSchema)
|
err := d.parseDependencies(m[KEY_DEPENDENCIES], currentSchema)
|
||||||
@ -409,7 +440,7 @@ func (d *Schema) parseSchema(documentNode interface{}, currentSchema *subSchema)
|
|||||||
if existsMapKey(m, KEY_ITEMS) {
|
if existsMapKey(m, KEY_ITEMS) {
|
||||||
if isKind(m[KEY_ITEMS], reflect.Slice) {
|
if isKind(m[KEY_ITEMS], reflect.Slice) {
|
||||||
for _, itemElement := range m[KEY_ITEMS].([]interface{}) {
|
for _, itemElement := range m[KEY_ITEMS].([]interface{}) {
|
||||||
if isKind(itemElement, reflect.Map) {
|
if isKind(itemElement, reflect.Map, reflect.Bool) {
|
||||||
newSchema := &subSchema{parent: currentSchema, property: KEY_ITEMS}
|
newSchema := &subSchema{parent: currentSchema, property: KEY_ITEMS}
|
||||||
newSchema.ref = currentSchema.ref
|
newSchema.ref = currentSchema.ref
|
||||||
currentSchema.AddItemsChild(newSchema)
|
currentSchema.AddItemsChild(newSchema)
|
||||||
@ -428,7 +459,7 @@ func (d *Schema) parseSchema(documentNode interface{}, currentSchema *subSchema)
|
|||||||
}
|
}
|
||||||
currentSchema.itemsChildrenIsSingleSchema = false
|
currentSchema.itemsChildrenIsSingleSchema = false
|
||||||
}
|
}
|
||||||
} else if isKind(m[KEY_ITEMS], reflect.Map) {
|
} else if isKind(m[KEY_ITEMS], reflect.Map, reflect.Bool) {
|
||||||
newSchema := &subSchema{parent: currentSchema, property: KEY_ITEMS}
|
newSchema := &subSchema{parent: currentSchema, property: KEY_ITEMS}
|
||||||
newSchema.ref = currentSchema.ref
|
newSchema.ref = currentSchema.ref
|
||||||
currentSchema.AddItemsChild(newSchema)
|
currentSchema.AddItemsChild(newSchema)
|
||||||
@ -513,10 +544,15 @@ func (d *Schema) parseSchema(documentNode interface{}, currentSchema *subSchema)
|
|||||||
}
|
}
|
||||||
exclusiveMinimumValue := m[KEY_EXCLUSIVE_MINIMUM].(bool)
|
exclusiveMinimumValue := m[KEY_EXCLUSIVE_MINIMUM].(bool)
|
||||||
currentSchema.exclusiveMinimum = exclusiveMinimumValue
|
currentSchema.exclusiveMinimum = exclusiveMinimumValue
|
||||||
|
} else if isJsonNumber(m[KEY_EXCLUSIVE_MINIMUM]) {
|
||||||
|
minimumValue := mustBeNumber(m[KEY_EXCLUSIVE_MINIMUM])
|
||||||
|
|
||||||
|
currentSchema.minimum = minimumValue
|
||||||
|
currentSchema.exclusiveMinimum = true
|
||||||
} else {
|
} else {
|
||||||
return errors.New(formatErrorDescription(
|
return errors.New(formatErrorDescription(
|
||||||
Locale.MustBeOfA(),
|
Locale.InvalidType(),
|
||||||
ErrorDetails{"x": KEY_EXCLUSIVE_MINIMUM, "y": TYPE_BOOLEAN},
|
ErrorDetails{"expected": TYPE_BOOLEAN + ", " + TYPE_NUMBER, "given": KEY_EXCLUSIVE_MINIMUM},
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -542,10 +578,15 @@ func (d *Schema) parseSchema(documentNode interface{}, currentSchema *subSchema)
|
|||||||
}
|
}
|
||||||
exclusiveMaximumValue := m[KEY_EXCLUSIVE_MAXIMUM].(bool)
|
exclusiveMaximumValue := m[KEY_EXCLUSIVE_MAXIMUM].(bool)
|
||||||
currentSchema.exclusiveMaximum = exclusiveMaximumValue
|
currentSchema.exclusiveMaximum = exclusiveMaximumValue
|
||||||
|
} else if isJsonNumber(m[KEY_EXCLUSIVE_MAXIMUM]) {
|
||||||
|
maximumValue := mustBeNumber(m[KEY_EXCLUSIVE_MAXIMUM])
|
||||||
|
|
||||||
|
currentSchema.maximum = maximumValue
|
||||||
|
currentSchema.exclusiveMaximum = true
|
||||||
} else {
|
} else {
|
||||||
return errors.New(formatErrorDescription(
|
return errors.New(formatErrorDescription(
|
||||||
Locale.MustBeOfA(),
|
Locale.InvalidType(),
|
||||||
ErrorDetails{"x": KEY_EXCLUSIVE_MAXIMUM, "y": STRING_NUMBER},
|
ErrorDetails{"expected": TYPE_BOOLEAN + ", " + TYPE_NUMBER, "given": KEY_EXCLUSIVE_MAXIMUM},
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -745,8 +786,24 @@ func (d *Schema) parseSchema(documentNode interface{}, currentSchema *subSchema)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if existsMapKey(m, KEY_CONTAINS) {
|
||||||
|
newSchema := &subSchema{property: KEY_CONTAINS, parent: currentSchema, ref: currentSchema.ref}
|
||||||
|
currentSchema.contains = newSchema
|
||||||
|
err := d.parseSchema(m[KEY_CONTAINS], newSchema)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// validation : all
|
// validation : all
|
||||||
|
|
||||||
|
if existsMapKey(m, KEY_CONST) {
|
||||||
|
err := currentSchema.AddConst(m[KEY_CONST])
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if existsMapKey(m, KEY_ENUM) {
|
if existsMapKey(m, KEY_ENUM) {
|
||||||
if isKind(m[KEY_ENUM], reflect.Slice) {
|
if isKind(m[KEY_ENUM], reflect.Slice) {
|
||||||
for _, v := range m[KEY_ENUM].([]interface{}) {
|
for _, v := range m[KEY_ENUM].([]interface{}) {
|
||||||
@ -820,7 +877,7 @@ func (d *Schema) parseSchema(documentNode interface{}, currentSchema *subSchema)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if existsMapKey(m, KEY_NOT) {
|
if existsMapKey(m, KEY_NOT) {
|
||||||
if isKind(m[KEY_NOT], reflect.Map) {
|
if isKind(m[KEY_NOT], reflect.Map, reflect.Bool) {
|
||||||
newSchema := &subSchema{property: KEY_NOT, parent: currentSchema, ref: currentSchema.ref}
|
newSchema := &subSchema{property: KEY_NOT, parent: currentSchema, ref: currentSchema.ref}
|
||||||
currentSchema.SetNot(newSchema)
|
currentSchema.SetNot(newSchema)
|
||||||
err := d.parseSchema(m[KEY_NOT], newSchema)
|
err := d.parseSchema(m[KEY_NOT], newSchema)
|
||||||
@ -836,7 +893,7 @@ func (d *Schema) parseSchema(documentNode interface{}, currentSchema *subSchema)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if existsMapKey(m, KEY_IF) {
|
if existsMapKey(m, KEY_IF) {
|
||||||
if isKind(m[KEY_IF], reflect.Map) {
|
if isKind(m[KEY_IF], reflect.Map, reflect.Bool) {
|
||||||
newSchema := &subSchema{property: KEY_IF, parent: currentSchema, ref: currentSchema.ref}
|
newSchema := &subSchema{property: KEY_IF, parent: currentSchema, ref: currentSchema.ref}
|
||||||
currentSchema.SetIf(newSchema)
|
currentSchema.SetIf(newSchema)
|
||||||
err := d.parseSchema(m[KEY_IF], newSchema)
|
err := d.parseSchema(m[KEY_IF], newSchema)
|
||||||
@ -852,7 +909,7 @@ func (d *Schema) parseSchema(documentNode interface{}, currentSchema *subSchema)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if existsMapKey(m, KEY_THEN) {
|
if existsMapKey(m, KEY_THEN) {
|
||||||
if isKind(m[KEY_THEN], reflect.Map) {
|
if isKind(m[KEY_THEN], reflect.Map, reflect.Bool) {
|
||||||
newSchema := &subSchema{property: KEY_THEN, parent: currentSchema, ref: currentSchema.ref}
|
newSchema := &subSchema{property: KEY_THEN, parent: currentSchema, ref: currentSchema.ref}
|
||||||
currentSchema.SetThen(newSchema)
|
currentSchema.SetThen(newSchema)
|
||||||
err := d.parseSchema(m[KEY_THEN], newSchema)
|
err := d.parseSchema(m[KEY_THEN], newSchema)
|
||||||
@ -868,7 +925,7 @@ func (d *Schema) parseSchema(documentNode interface{}, currentSchema *subSchema)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if existsMapKey(m, KEY_ELSE) {
|
if existsMapKey(m, KEY_ELSE) {
|
||||||
if isKind(m[KEY_ELSE], reflect.Map) {
|
if isKind(m[KEY_ELSE], reflect.Map, reflect.Bool) {
|
||||||
newSchema := &subSchema{property: KEY_ELSE, parent: currentSchema, ref: currentSchema.ref}
|
newSchema := &subSchema{property: KEY_ELSE, parent: currentSchema, ref: currentSchema.ref}
|
||||||
currentSchema.SetElse(newSchema)
|
currentSchema.SetElse(newSchema)
|
||||||
err := d.parseSchema(m[KEY_ELSE], newSchema)
|
err := d.parseSchema(m[KEY_ELSE], newSchema)
|
||||||
@ -918,17 +975,14 @@ func (d *Schema) parseReference(documentNode interface{}, currentSchema *subSche
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if !isKind(refdDocumentNode, reflect.Map) {
|
if !isKind(refdDocumentNode, reflect.Map, reflect.Bool) {
|
||||||
return errors.New(formatErrorDescription(
|
return errors.New(formatErrorDescription(
|
||||||
Locale.MustBeOfType(),
|
Locale.MustBeOfType(),
|
||||||
ErrorDetails{"key": STRING_SCHEMA, "type": TYPE_OBJECT},
|
ErrorDetails{"key": STRING_SCHEMA, "type": TYPE_OBJECT},
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
|
|
||||||
// returns the loaded referenced subSchema for the caller to update its current subSchema
|
err = d.parseSchema(refdDocumentNode, newSchema)
|
||||||
newSchemaDocument := refdDocumentNode.(map[string]interface{})
|
|
||||||
|
|
||||||
err = d.parseSchema(newSchemaDocument, newSchema)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -996,7 +1050,7 @@ func (d *Schema) parseDependencies(documentNode interface{}, currentSchema *subS
|
|||||||
currentSchema.dependencies[k] = valuesToRegister
|
currentSchema.dependencies[k] = valuesToRegister
|
||||||
}
|
}
|
||||||
|
|
||||||
case reflect.Map:
|
case reflect.Map, reflect.Bool:
|
||||||
depSchema := &subSchema{property: k, parent: currentSchema, ref: currentSchema.ref}
|
depSchema := &subSchema{property: k, parent: currentSchema, ref: currentSchema.ref}
|
||||||
err := d.parseSchema(m[k], depSchema)
|
err := d.parseSchema(m[k], depSchema)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
2
vendor/github.com/xeipuuv/gojsonschema/schemaPool.go
generated
vendored
2
vendor/github.com/xeipuuv/gojsonschema/schemaPool.go
generated
vendored
@ -76,7 +76,7 @@ func (p *schemaPool) GetDocument(reference gojsonreference.JsonReference) (*sche
|
|||||||
if !reference.IsCanonical() {
|
if !reference.IsCanonical() {
|
||||||
return nil, errors.New(formatErrorDescription(
|
return nil, errors.New(formatErrorDescription(
|
||||||
Locale.ReferenceMustBeCanonical(),
|
Locale.ReferenceMustBeCanonical(),
|
||||||
ErrorDetails{"reference": reference},
|
ErrorDetails{"reference": reference.String()},
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
refToUrl := reference
|
refToUrl := reference
|
||||||
|
28
vendor/github.com/xeipuuv/gojsonschema/subSchema.go
generated
vendored
28
vendor/github.com/xeipuuv/gojsonschema/subSchema.go
generated
vendored
@ -36,8 +36,9 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
KEY_SCHEMA = "$subSchema"
|
KEY_SCHEMA = "$schema"
|
||||||
KEY_ID = "id"
|
KEY_ID = "id"
|
||||||
|
KEY_ID_NEW = "$id"
|
||||||
KEY_REF = "$ref"
|
KEY_REF = "$ref"
|
||||||
KEY_TITLE = "title"
|
KEY_TITLE = "title"
|
||||||
KEY_DESCRIPTION = "description"
|
KEY_DESCRIPTION = "description"
|
||||||
@ -47,6 +48,7 @@ const (
|
|||||||
KEY_PROPERTIES = "properties"
|
KEY_PROPERTIES = "properties"
|
||||||
KEY_PATTERN_PROPERTIES = "patternProperties"
|
KEY_PATTERN_PROPERTIES = "patternProperties"
|
||||||
KEY_ADDITIONAL_PROPERTIES = "additionalProperties"
|
KEY_ADDITIONAL_PROPERTIES = "additionalProperties"
|
||||||
|
KEY_PROPERTY_NAMES = "propertyNames"
|
||||||
KEY_DEFINITIONS = "definitions"
|
KEY_DEFINITIONS = "definitions"
|
||||||
KEY_MULTIPLE_OF = "multipleOf"
|
KEY_MULTIPLE_OF = "multipleOf"
|
||||||
KEY_MINIMUM = "minimum"
|
KEY_MINIMUM = "minimum"
|
||||||
@ -64,6 +66,8 @@ const (
|
|||||||
KEY_MIN_ITEMS = "minItems"
|
KEY_MIN_ITEMS = "minItems"
|
||||||
KEY_MAX_ITEMS = "maxItems"
|
KEY_MAX_ITEMS = "maxItems"
|
||||||
KEY_UNIQUE_ITEMS = "uniqueItems"
|
KEY_UNIQUE_ITEMS = "uniqueItems"
|
||||||
|
KEY_CONTAINS = "contains"
|
||||||
|
KEY_CONST = "const"
|
||||||
KEY_ENUM = "enum"
|
KEY_ENUM = "enum"
|
||||||
KEY_ONE_OF = "oneOf"
|
KEY_ONE_OF = "oneOf"
|
||||||
KEY_ANY_OF = "anyOf"
|
KEY_ANY_OF = "anyOf"
|
||||||
@ -75,6 +79,7 @@ const (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type subSchema struct {
|
type subSchema struct {
|
||||||
|
|
||||||
// basic subSchema meta properties
|
// basic subSchema meta properties
|
||||||
id *gojsonreference.JsonReference
|
id *gojsonreference.JsonReference
|
||||||
title *string
|
title *string
|
||||||
@ -89,8 +94,6 @@ type subSchema struct {
|
|||||||
ref *gojsonreference.JsonReference
|
ref *gojsonreference.JsonReference
|
||||||
// Schema referenced
|
// Schema referenced
|
||||||
refSchema *subSchema
|
refSchema *subSchema
|
||||||
// Json reference
|
|
||||||
subSchema *gojsonreference.JsonReference
|
|
||||||
|
|
||||||
// hierarchy
|
// hierarchy
|
||||||
parent *subSchema
|
parent *subSchema
|
||||||
@ -121,16 +124,19 @@ type subSchema struct {
|
|||||||
dependencies map[string]interface{}
|
dependencies map[string]interface{}
|
||||||
additionalProperties interface{}
|
additionalProperties interface{}
|
||||||
patternProperties map[string]*subSchema
|
patternProperties map[string]*subSchema
|
||||||
|
propertyNames *subSchema
|
||||||
|
|
||||||
// validation : array
|
// validation : array
|
||||||
minItems *int
|
minItems *int
|
||||||
maxItems *int
|
maxItems *int
|
||||||
uniqueItems bool
|
uniqueItems bool
|
||||||
|
contains *subSchema
|
||||||
|
|
||||||
additionalItems interface{}
|
additionalItems interface{}
|
||||||
|
|
||||||
// validation : all
|
// validation : all
|
||||||
enum []string
|
_const *string //const is a golang keyword
|
||||||
|
enum []string
|
||||||
|
|
||||||
// validation : subSchema
|
// validation : subSchema
|
||||||
oneOf []*subSchema
|
oneOf []*subSchema
|
||||||
@ -142,9 +148,19 @@ type subSchema struct {
|
|||||||
_else *subSchema
|
_else *subSchema
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (s *subSchema) AddConst(i interface{}) error {
|
||||||
|
|
||||||
|
is, err := marshalWithoutNumber(i)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
s._const = is
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
func (s *subSchema) AddEnum(i interface{}) error {
|
func (s *subSchema) AddEnum(i interface{}) error {
|
||||||
|
|
||||||
is, err := marshalToJsonString(i)
|
is, err := marshalWithoutNumber(i)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -163,7 +179,7 @@ func (s *subSchema) AddEnum(i interface{}) error {
|
|||||||
|
|
||||||
func (s *subSchema) ContainsEnum(i interface{}) (bool, error) {
|
func (s *subSchema) ContainsEnum(i interface{}) (bool, error) {
|
||||||
|
|
||||||
is, err := marshalToJsonString(i)
|
is, err := marshalWithoutNumber(i)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return false, err
|
return false, err
|
||||||
}
|
}
|
||||||
|
51
vendor/github.com/xeipuuv/gojsonschema/utils.go
generated
vendored
51
vendor/github.com/xeipuuv/gojsonschema/utils.go
generated
vendored
@ -31,16 +31,21 @@ import (
|
|||||||
"math"
|
"math"
|
||||||
"math/big"
|
"math/big"
|
||||||
"reflect"
|
"reflect"
|
||||||
"strconv"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func isKind(what interface{}, kind reflect.Kind) bool {
|
func isKind(what interface{}, kinds ...reflect.Kind) bool {
|
||||||
target := what
|
target := what
|
||||||
if isJsonNumber(what) {
|
if isJsonNumber(what) {
|
||||||
// JSON Numbers are strings!
|
// JSON Numbers are strings!
|
||||||
target = *mustBeNumber(what)
|
target = *mustBeNumber(what)
|
||||||
}
|
}
|
||||||
return reflect.ValueOf(target).Kind() == kind
|
targetKind := reflect.ValueOf(target).Kind()
|
||||||
|
for _, kind := range kinds {
|
||||||
|
if targetKind == kind {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
func existsMapKey(m map[string]interface{}, k string) bool {
|
func existsMapKey(m map[string]interface{}, k string) bool {
|
||||||
@ -68,6 +73,28 @@ func marshalToJsonString(value interface{}) (*string, error) {
|
|||||||
return &sBytes, nil
|
return &sBytes, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func marshalWithoutNumber(value interface{}) (*string, error) {
|
||||||
|
|
||||||
|
// The JSON is decoded using https://golang.org/pkg/encoding/json/#Decoder.UseNumber
|
||||||
|
// This means the numbers are internally still represented as strings and therefore 1.00 is unequal to 1
|
||||||
|
// One way to eliminate these differences is to decode and encode the JSON one more time without Decoder.UseNumber
|
||||||
|
// so that these differences in representation are removed
|
||||||
|
|
||||||
|
jsonString, err := marshalToJsonString(value)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
var document interface{}
|
||||||
|
|
||||||
|
err = json.Unmarshal([]byte(*jsonString), &document)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return marshalToJsonString(document)
|
||||||
|
}
|
||||||
|
|
||||||
func isJsonNumber(what interface{}) bool {
|
func isJsonNumber(what interface{}) bool {
|
||||||
|
|
||||||
switch what.(type) {
|
switch what.(type) {
|
||||||
@ -79,21 +106,13 @@ func isJsonNumber(what interface{}) bool {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
func checkJsonNumber(what interface{}) (isValidFloat64 bool, isValidInt64 bool, isValidInt32 bool) {
|
func checkJsonInteger(what interface{}) (isInt bool) {
|
||||||
|
|
||||||
jsonNumber := what.(json.Number)
|
jsonNumber := what.(json.Number)
|
||||||
|
|
||||||
f64, errFloat64 := jsonNumber.Float64()
|
bigFloat, isValidNumber := new(big.Float).SetString(string(jsonNumber))
|
||||||
s64 := strconv.FormatFloat(f64, 'f', -1, 64)
|
|
||||||
_, errInt64 := strconv.ParseInt(s64, 10, 64)
|
|
||||||
|
|
||||||
isValidFloat64 = errFloat64 == nil
|
return isValidNumber && bigFloat.IsInt()
|
||||||
isValidInt64 = errInt64 == nil
|
|
||||||
|
|
||||||
_, errInt32 := strconv.ParseInt(s64, 10, 32)
|
|
||||||
isValidInt32 = isValidInt64 && errInt32 == nil
|
|
||||||
|
|
||||||
return
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -118,9 +137,9 @@ func mustBeInteger(what interface{}) *int {
|
|||||||
|
|
||||||
number := what.(json.Number)
|
number := what.(json.Number)
|
||||||
|
|
||||||
_, _, isValidInt32 := checkJsonNumber(number)
|
isInt := checkJsonInteger(number)
|
||||||
|
|
||||||
if isValidInt32 {
|
if isInt {
|
||||||
|
|
||||||
int64Value, err := number.Int64()
|
int64Value, err := number.Int64()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
80
vendor/github.com/xeipuuv/gojsonschema/validation.go
generated
vendored
80
vendor/github.com/xeipuuv/gojsonschema/validation.go
generated
vendored
@ -61,14 +61,17 @@ func (v *Schema) Validate(l JSONLoader) (*Result, error) {
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return v.validateDocument(root), nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (v *Schema) validateDocument(root interface{}) *Result {
|
||||||
// begin validation
|
// begin validation
|
||||||
|
|
||||||
result := &Result{}
|
result := &Result{}
|
||||||
context := NewJsonContext(STRING_CONTEXT_ROOT, nil)
|
context := NewJsonContext(STRING_CONTEXT_ROOT, nil)
|
||||||
v.rootSchema.validateRecursive(v.rootSchema, root, result, context)
|
v.rootSchema.validateRecursive(v.rootSchema, root, result, context)
|
||||||
|
|
||||||
return result, nil
|
return result
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (v *subSchema) subValidateWithContext(document interface{}, context *JsonContext) *Result {
|
func (v *subSchema) subValidateWithContext(document interface{}, context *JsonContext) *Result {
|
||||||
@ -115,14 +118,14 @@ func (v *subSchema) validateRecursive(currentSubSchema *subSchema, currentNode i
|
|||||||
|
|
||||||
value := currentNode.(json.Number)
|
value := currentNode.(json.Number)
|
||||||
|
|
||||||
_, isValidInt64, _ := checkJsonNumber(value)
|
isInt := checkJsonInteger(value)
|
||||||
|
|
||||||
validType := currentSubSchema.types.Contains(TYPE_NUMBER) || (isValidInt64 && currentSubSchema.types.Contains(TYPE_INTEGER))
|
validType := currentSubSchema.types.Contains(TYPE_NUMBER) || (isInt && currentSubSchema.types.Contains(TYPE_INTEGER))
|
||||||
|
|
||||||
if currentSubSchema.types.IsTyped() && !validType {
|
if currentSubSchema.types.IsTyped() && !validType {
|
||||||
|
|
||||||
givenType := TYPE_INTEGER
|
givenType := TYPE_INTEGER
|
||||||
if !isValidInt64 {
|
if !isInt {
|
||||||
givenType = TYPE_NUMBER
|
givenType = TYPE_NUMBER
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -368,7 +371,6 @@ func (v *subSchema) validateSchema(currentSubSchema *subSchema, currentNode inte
|
|||||||
|
|
||||||
case *subSchema:
|
case *subSchema:
|
||||||
dependency.validateRecursive(dependency, currentNode, result, context)
|
dependency.validateRecursive(dependency, currentNode, result, context)
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -403,6 +405,23 @@ func (v *subSchema) validateCommon(currentSubSchema *subSchema, value interface{
|
|||||||
internalLog(" %v", value)
|
internalLog(" %v", value)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// const:
|
||||||
|
if currentSubSchema._const != nil {
|
||||||
|
vString, err := marshalWithoutNumber(value)
|
||||||
|
if err != nil {
|
||||||
|
result.addInternalError(new(InternalError), context, value, ErrorDetails{"error": err})
|
||||||
|
}
|
||||||
|
if *vString != *currentSubSchema._const {
|
||||||
|
result.addInternalError(new(ConstError),
|
||||||
|
context,
|
||||||
|
value,
|
||||||
|
ErrorDetails{
|
||||||
|
"allowed": *currentSubSchema._const,
|
||||||
|
},
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// enum:
|
// enum:
|
||||||
if len(currentSubSchema.enum) > 0 {
|
if len(currentSubSchema.enum) > 0 {
|
||||||
has, err := currentSubSchema.ContainsEnum(value)
|
has, err := currentSubSchema.ContainsEnum(value)
|
||||||
@ -499,7 +518,7 @@ func (v *subSchema) validateArray(currentSubSchema *subSchema, value []interface
|
|||||||
if currentSubSchema.uniqueItems {
|
if currentSubSchema.uniqueItems {
|
||||||
var stringifiedItems []string
|
var stringifiedItems []string
|
||||||
for _, v := range value {
|
for _, v := range value {
|
||||||
vString, err := marshalToJsonString(v)
|
vString, err := marshalWithoutNumber(v)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
result.addInternalError(new(InternalError), context, value, ErrorDetails{"err": err})
|
result.addInternalError(new(InternalError), context, value, ErrorDetails{"err": err})
|
||||||
}
|
}
|
||||||
@ -515,6 +534,38 @@ func (v *subSchema) validateArray(currentSubSchema *subSchema, value []interface
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// contains:
|
||||||
|
|
||||||
|
if currentSubSchema.contains != nil {
|
||||||
|
validatedOne := false
|
||||||
|
var bestValidationResult *Result
|
||||||
|
|
||||||
|
for i, v := range value {
|
||||||
|
subContext := NewJsonContext(strconv.Itoa(i), context)
|
||||||
|
|
||||||
|
validationResult := currentSubSchema.contains.subValidateWithContext(v, subContext)
|
||||||
|
if validationResult.Valid() {
|
||||||
|
validatedOne = true
|
||||||
|
break
|
||||||
|
} else {
|
||||||
|
if bestValidationResult == nil || validationResult.score > bestValidationResult.score {
|
||||||
|
bestValidationResult = validationResult
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if !validatedOne {
|
||||||
|
result.addInternalError(
|
||||||
|
new(ArrayContainsError),
|
||||||
|
context,
|
||||||
|
value,
|
||||||
|
ErrorDetails{},
|
||||||
|
)
|
||||||
|
if bestValidationResult != nil {
|
||||||
|
result.mergeErrors(bestValidationResult)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
result.incrementScore()
|
result.incrementScore()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -661,6 +712,21 @@ func (v *subSchema) validateObject(currentSubSchema *subSchema, value map[string
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// propertyNames:
|
||||||
|
if currentSubSchema.propertyNames != nil {
|
||||||
|
for pk := range value {
|
||||||
|
validationResult := currentSubSchema.propertyNames.subValidateWithContext(pk, context)
|
||||||
|
if !validationResult.Valid() {
|
||||||
|
result.addInternalError(new(InvalidPropertyNameError),
|
||||||
|
context,
|
||||||
|
value, ErrorDetails{
|
||||||
|
"property": pk,
|
||||||
|
})
|
||||||
|
result.mergeErrors(validationResult)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
result.incrementScore()
|
result.incrementScore()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
168
vendor/golang.org/x/net/internal/socks/client.go
generated
vendored
Normal file
168
vendor/golang.org/x/net/internal/socks/client.go
generated
vendored
Normal file
@ -0,0 +1,168 @@
|
|||||||
|
// Copyright 2018 The Go Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a BSD-style
|
||||||
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
package socks
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"errors"
|
||||||
|
"io"
|
||||||
|
"net"
|
||||||
|
"strconv"
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
|
noDeadline = time.Time{}
|
||||||
|
aLongTimeAgo = time.Unix(1, 0)
|
||||||
|
)
|
||||||
|
|
||||||
|
func (d *Dialer) connect(ctx context.Context, c net.Conn, address string) (_ net.Addr, ctxErr error) {
|
||||||
|
host, port, err := splitHostPort(address)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if deadline, ok := ctx.Deadline(); ok && !deadline.IsZero() {
|
||||||
|
c.SetDeadline(deadline)
|
||||||
|
defer c.SetDeadline(noDeadline)
|
||||||
|
}
|
||||||
|
if ctx != context.Background() {
|
||||||
|
errCh := make(chan error, 1)
|
||||||
|
done := make(chan struct{})
|
||||||
|
defer func() {
|
||||||
|
close(done)
|
||||||
|
if ctxErr == nil {
|
||||||
|
ctxErr = <-errCh
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
go func() {
|
||||||
|
select {
|
||||||
|
case <-ctx.Done():
|
||||||
|
c.SetDeadline(aLongTimeAgo)
|
||||||
|
errCh <- ctx.Err()
|
||||||
|
case <-done:
|
||||||
|
errCh <- nil
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
}
|
||||||
|
|
||||||
|
b := make([]byte, 0, 6+len(host)) // the size here is just an estimate
|
||||||
|
b = append(b, Version5)
|
||||||
|
if len(d.AuthMethods) == 0 || d.Authenticate == nil {
|
||||||
|
b = append(b, 1, byte(AuthMethodNotRequired))
|
||||||
|
} else {
|
||||||
|
ams := d.AuthMethods
|
||||||
|
if len(ams) > 255 {
|
||||||
|
return nil, errors.New("too many authentication methods")
|
||||||
|
}
|
||||||
|
b = append(b, byte(len(ams)))
|
||||||
|
for _, am := range ams {
|
||||||
|
b = append(b, byte(am))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if _, ctxErr = c.Write(b); ctxErr != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if _, ctxErr = io.ReadFull(c, b[:2]); ctxErr != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if b[0] != Version5 {
|
||||||
|
return nil, errors.New("unexpected protocol version " + strconv.Itoa(int(b[0])))
|
||||||
|
}
|
||||||
|
am := AuthMethod(b[1])
|
||||||
|
if am == AuthMethodNoAcceptableMethods {
|
||||||
|
return nil, errors.New("no acceptable authentication methods")
|
||||||
|
}
|
||||||
|
if d.Authenticate != nil {
|
||||||
|
if ctxErr = d.Authenticate(ctx, c, am); ctxErr != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
b = b[:0]
|
||||||
|
b = append(b, Version5, byte(d.cmd), 0)
|
||||||
|
if ip := net.ParseIP(host); ip != nil {
|
||||||
|
if ip4 := ip.To4(); ip4 != nil {
|
||||||
|
b = append(b, AddrTypeIPv4)
|
||||||
|
b = append(b, ip4...)
|
||||||
|
} else if ip6 := ip.To16(); ip6 != nil {
|
||||||
|
b = append(b, AddrTypeIPv6)
|
||||||
|
b = append(b, ip6...)
|
||||||
|
} else {
|
||||||
|
return nil, errors.New("unknown address type")
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if len(host) > 255 {
|
||||||
|
return nil, errors.New("FQDN too long")
|
||||||
|
}
|
||||||
|
b = append(b, AddrTypeFQDN)
|
||||||
|
b = append(b, byte(len(host)))
|
||||||
|
b = append(b, host...)
|
||||||
|
}
|
||||||
|
b = append(b, byte(port>>8), byte(port))
|
||||||
|
if _, ctxErr = c.Write(b); ctxErr != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if _, ctxErr = io.ReadFull(c, b[:4]); ctxErr != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if b[0] != Version5 {
|
||||||
|
return nil, errors.New("unexpected protocol version " + strconv.Itoa(int(b[0])))
|
||||||
|
}
|
||||||
|
if cmdErr := Reply(b[1]); cmdErr != StatusSucceeded {
|
||||||
|
return nil, errors.New("unknown error " + cmdErr.String())
|
||||||
|
}
|
||||||
|
if b[2] != 0 {
|
||||||
|
return nil, errors.New("non-zero reserved field")
|
||||||
|
}
|
||||||
|
l := 2
|
||||||
|
var a Addr
|
||||||
|
switch b[3] {
|
||||||
|
case AddrTypeIPv4:
|
||||||
|
l += net.IPv4len
|
||||||
|
a.IP = make(net.IP, net.IPv4len)
|
||||||
|
case AddrTypeIPv6:
|
||||||
|
l += net.IPv6len
|
||||||
|
a.IP = make(net.IP, net.IPv6len)
|
||||||
|
case AddrTypeFQDN:
|
||||||
|
if _, err := io.ReadFull(c, b[:1]); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
l += int(b[0])
|
||||||
|
default:
|
||||||
|
return nil, errors.New("unknown address type " + strconv.Itoa(int(b[3])))
|
||||||
|
}
|
||||||
|
if cap(b) < l {
|
||||||
|
b = make([]byte, l)
|
||||||
|
} else {
|
||||||
|
b = b[:l]
|
||||||
|
}
|
||||||
|
if _, ctxErr = io.ReadFull(c, b); ctxErr != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if a.IP != nil {
|
||||||
|
copy(a.IP, b)
|
||||||
|
} else {
|
||||||
|
a.Name = string(b[:len(b)-2])
|
||||||
|
}
|
||||||
|
a.Port = int(b[len(b)-2])<<8 | int(b[len(b)-1])
|
||||||
|
return &a, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func splitHostPort(address string) (string, int, error) {
|
||||||
|
host, port, err := net.SplitHostPort(address)
|
||||||
|
if err != nil {
|
||||||
|
return "", 0, err
|
||||||
|
}
|
||||||
|
portnum, err := strconv.Atoi(port)
|
||||||
|
if err != nil {
|
||||||
|
return "", 0, err
|
||||||
|
}
|
||||||
|
if 1 > portnum || portnum > 0xffff {
|
||||||
|
return "", 0, errors.New("port number out of range " + port)
|
||||||
|
}
|
||||||
|
return host, portnum, nil
|
||||||
|
}
|
265
vendor/golang.org/x/net/internal/socks/socks.go
generated
vendored
Normal file
265
vendor/golang.org/x/net/internal/socks/socks.go
generated
vendored
Normal file
@ -0,0 +1,265 @@
|
|||||||
|
// Copyright 2018 The Go Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a BSD-style
|
||||||
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
// Package socks provides a SOCKS version 5 client implementation.
|
||||||
|
//
|
||||||
|
// SOCKS protocol version 5 is defined in RFC 1928.
|
||||||
|
// Username/Password authentication for SOCKS version 5 is defined in
|
||||||
|
// RFC 1929.
|
||||||
|
package socks
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"errors"
|
||||||
|
"io"
|
||||||
|
"net"
|
||||||
|
"strconv"
|
||||||
|
)
|
||||||
|
|
||||||
|
// A Command represents a SOCKS command.
|
||||||
|
type Command int
|
||||||
|
|
||||||
|
func (cmd Command) String() string {
|
||||||
|
switch cmd {
|
||||||
|
case CmdConnect:
|
||||||
|
return "socks connect"
|
||||||
|
case cmdBind:
|
||||||
|
return "socks bind"
|
||||||
|
default:
|
||||||
|
return "socks " + strconv.Itoa(int(cmd))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// An AuthMethod represents a SOCKS authentication method.
|
||||||
|
type AuthMethod int
|
||||||
|
|
||||||
|
// A Reply represents a SOCKS command reply code.
|
||||||
|
type Reply int
|
||||||
|
|
||||||
|
func (code Reply) String() string {
|
||||||
|
switch code {
|
||||||
|
case StatusSucceeded:
|
||||||
|
return "succeeded"
|
||||||
|
case 0x01:
|
||||||
|
return "general SOCKS server failure"
|
||||||
|
case 0x02:
|
||||||
|
return "connection not allowed by ruleset"
|
||||||
|
case 0x03:
|
||||||
|
return "network unreachable"
|
||||||
|
case 0x04:
|
||||||
|
return "host unreachable"
|
||||||
|
case 0x05:
|
||||||
|
return "connection refused"
|
||||||
|
case 0x06:
|
||||||
|
return "TTL expired"
|
||||||
|
case 0x07:
|
||||||
|
return "command not supported"
|
||||||
|
case 0x08:
|
||||||
|
return "address type not supported"
|
||||||
|
default:
|
||||||
|
return "unknown code: " + strconv.Itoa(int(code))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Wire protocol constants.
|
||||||
|
const (
|
||||||
|
Version5 = 0x05
|
||||||
|
|
||||||
|
AddrTypeIPv4 = 0x01
|
||||||
|
AddrTypeFQDN = 0x03
|
||||||
|
AddrTypeIPv6 = 0x04
|
||||||
|
|
||||||
|
CmdConnect Command = 0x01 // establishes an active-open forward proxy connection
|
||||||
|
cmdBind Command = 0x02 // establishes a passive-open forward proxy connection
|
||||||
|
|
||||||
|
AuthMethodNotRequired AuthMethod = 0x00 // no authentication required
|
||||||
|
AuthMethodUsernamePassword AuthMethod = 0x02 // use username/password
|
||||||
|
AuthMethodNoAcceptableMethods AuthMethod = 0xff // no acceptable authetication methods
|
||||||
|
|
||||||
|
StatusSucceeded Reply = 0x00
|
||||||
|
)
|
||||||
|
|
||||||
|
// An Addr represents a SOCKS-specific address.
|
||||||
|
// Either Name or IP is used exclusively.
|
||||||
|
type Addr struct {
|
||||||
|
Name string // fully-qualified domain name
|
||||||
|
IP net.IP
|
||||||
|
Port int
|
||||||
|
}
|
||||||
|
|
||||||
|
func (a *Addr) Network() string { return "socks" }
|
||||||
|
|
||||||
|
func (a *Addr) String() string {
|
||||||
|
if a == nil {
|
||||||
|
return "<nil>"
|
||||||
|
}
|
||||||
|
port := strconv.Itoa(a.Port)
|
||||||
|
if a.IP == nil {
|
||||||
|
return net.JoinHostPort(a.Name, port)
|
||||||
|
}
|
||||||
|
return net.JoinHostPort(a.IP.String(), port)
|
||||||
|
}
|
||||||
|
|
||||||
|
// A Conn represents a forward proxy connection.
|
||||||
|
type Conn struct {
|
||||||
|
net.Conn
|
||||||
|
|
||||||
|
boundAddr net.Addr
|
||||||
|
}
|
||||||
|
|
||||||
|
// BoundAddr returns the address assigned by the proxy server for
|
||||||
|
// connecting to the command target address from the proxy server.
|
||||||
|
func (c *Conn) BoundAddr() net.Addr {
|
||||||
|
if c == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
return c.boundAddr
|
||||||
|
}
|
||||||
|
|
||||||
|
// A Dialer holds SOCKS-specific options.
|
||||||
|
type Dialer struct {
|
||||||
|
cmd Command // either CmdConnect or cmdBind
|
||||||
|
proxyNetwork string // network between a proxy server and a client
|
||||||
|
proxyAddress string // proxy server address
|
||||||
|
|
||||||
|
// ProxyDial specifies the optional dial function for
|
||||||
|
// establishing the transport connection.
|
||||||
|
ProxyDial func(context.Context, string, string) (net.Conn, error)
|
||||||
|
|
||||||
|
// AuthMethods specifies the list of request authention
|
||||||
|
// methods.
|
||||||
|
// If empty, SOCKS client requests only AuthMethodNotRequired.
|
||||||
|
AuthMethods []AuthMethod
|
||||||
|
|
||||||
|
// Authenticate specifies the optional authentication
|
||||||
|
// function. It must be non-nil when AuthMethods is not empty.
|
||||||
|
// It must return an error when the authentication is failed.
|
||||||
|
Authenticate func(context.Context, io.ReadWriter, AuthMethod) error
|
||||||
|
}
|
||||||
|
|
||||||
|
// DialContext connects to the provided address on the provided
|
||||||
|
// network.
|
||||||
|
//
|
||||||
|
// The returned error value may be a net.OpError. When the Op field of
|
||||||
|
// net.OpError contains "socks", the Source field contains a proxy
|
||||||
|
// server address and the Addr field contains a command target
|
||||||
|
// address.
|
||||||
|
//
|
||||||
|
// See func Dial of the net package of standard library for a
|
||||||
|
// description of the network and address parameters.
|
||||||
|
func (d *Dialer) DialContext(ctx context.Context, network, address string) (net.Conn, error) {
|
||||||
|
switch network {
|
||||||
|
case "tcp", "tcp6", "tcp4":
|
||||||
|
default:
|
||||||
|
proxy, dst, _ := d.pathAddrs(address)
|
||||||
|
return nil, &net.OpError{Op: d.cmd.String(), Net: network, Source: proxy, Addr: dst, Err: errors.New("network not implemented")}
|
||||||
|
}
|
||||||
|
switch d.cmd {
|
||||||
|
case CmdConnect, cmdBind:
|
||||||
|
default:
|
||||||
|
proxy, dst, _ := d.pathAddrs(address)
|
||||||
|
return nil, &net.OpError{Op: d.cmd.String(), Net: network, Source: proxy, Addr: dst, Err: errors.New("command not implemented")}
|
||||||
|
}
|
||||||
|
if ctx == nil {
|
||||||
|
ctx = context.Background()
|
||||||
|
}
|
||||||
|
var err error
|
||||||
|
var c net.Conn
|
||||||
|
if d.ProxyDial != nil {
|
||||||
|
c, err = d.ProxyDial(ctx, d.proxyNetwork, d.proxyAddress)
|
||||||
|
} else {
|
||||||
|
var dd net.Dialer
|
||||||
|
c, err = dd.DialContext(ctx, d.proxyNetwork, d.proxyAddress)
|
||||||
|
}
|
||||||
|
if err != nil {
|
||||||
|
proxy, dst, _ := d.pathAddrs(address)
|
||||||
|
return nil, &net.OpError{Op: d.cmd.String(), Net: network, Source: proxy, Addr: dst, Err: err}
|
||||||
|
}
|
||||||
|
a, err := d.connect(ctx, c, address)
|
||||||
|
if err != nil {
|
||||||
|
c.Close()
|
||||||
|
proxy, dst, _ := d.pathAddrs(address)
|
||||||
|
return nil, &net.OpError{Op: d.cmd.String(), Net: network, Source: proxy, Addr: dst, Err: err}
|
||||||
|
}
|
||||||
|
return &Conn{Conn: c, boundAddr: a}, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Dial connects to the provided address on the provided network.
|
||||||
|
//
|
||||||
|
// Deprecated: Use DialContext instead.
|
||||||
|
func (d *Dialer) Dial(network, address string) (net.Conn, error) {
|
||||||
|
return d.DialContext(context.Background(), network, address)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (d *Dialer) pathAddrs(address string) (proxy, dst net.Addr, err error) {
|
||||||
|
for i, s := range []string{d.proxyAddress, address} {
|
||||||
|
host, port, err := splitHostPort(s)
|
||||||
|
if err != nil {
|
||||||
|
return nil, nil, err
|
||||||
|
}
|
||||||
|
a := &Addr{Port: port}
|
||||||
|
a.IP = net.ParseIP(host)
|
||||||
|
if a.IP == nil {
|
||||||
|
a.Name = host
|
||||||
|
}
|
||||||
|
if i == 0 {
|
||||||
|
proxy = a
|
||||||
|
} else {
|
||||||
|
dst = a
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewDialer returns a new Dialer that dials through the provided
|
||||||
|
// proxy server's network and address.
|
||||||
|
func NewDialer(network, address string) *Dialer {
|
||||||
|
return &Dialer{proxyNetwork: network, proxyAddress: address, cmd: CmdConnect}
|
||||||
|
}
|
||||||
|
|
||||||
|
const (
|
||||||
|
authUsernamePasswordVersion = 0x01
|
||||||
|
authStatusSucceeded = 0x00
|
||||||
|
)
|
||||||
|
|
||||||
|
// UsernamePassword are the credentials for the username/password
|
||||||
|
// authentication method.
|
||||||
|
type UsernamePassword struct {
|
||||||
|
Username string
|
||||||
|
Password string
|
||||||
|
}
|
||||||
|
|
||||||
|
// Authenticate authenticates a pair of username and password with the
|
||||||
|
// proxy server.
|
||||||
|
func (up *UsernamePassword) Authenticate(ctx context.Context, rw io.ReadWriter, auth AuthMethod) error {
|
||||||
|
switch auth {
|
||||||
|
case AuthMethodNotRequired:
|
||||||
|
return nil
|
||||||
|
case AuthMethodUsernamePassword:
|
||||||
|
if len(up.Username) == 0 || len(up.Username) > 255 || len(up.Password) == 0 || len(up.Password) > 255 {
|
||||||
|
return errors.New("invalid username/password")
|
||||||
|
}
|
||||||
|
b := []byte{authUsernamePasswordVersion}
|
||||||
|
b = append(b, byte(len(up.Username)))
|
||||||
|
b = append(b, up.Username...)
|
||||||
|
b = append(b, byte(len(up.Password)))
|
||||||
|
b = append(b, up.Password...)
|
||||||
|
// TODO(mikio): handle IO deadlines and cancelation if
|
||||||
|
// necessary
|
||||||
|
if _, err := rw.Write(b); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if _, err := io.ReadFull(rw, b[:2]); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if b[0] != authUsernamePasswordVersion {
|
||||||
|
return errors.New("invalid username/password version")
|
||||||
|
}
|
||||||
|
if b[1] != authStatusSucceeded {
|
||||||
|
return errors.New("username/password authentication failed")
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
return errors.New("unsupported authentication method " + strconv.Itoa(int(auth)))
|
||||||
|
}
|
222
vendor/golang.org/x/net/proxy/socks5.go
generated
vendored
222
vendor/golang.org/x/net/proxy/socks5.go
generated
vendored
@ -5,210 +5,32 @@
|
|||||||
package proxy
|
package proxy
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
"context"
|
||||||
"io"
|
|
||||||
"net"
|
"net"
|
||||||
"strconv"
|
|
||||||
|
"golang.org/x/net/internal/socks"
|
||||||
)
|
)
|
||||||
|
|
||||||
// SOCKS5 returns a Dialer that makes SOCKSv5 connections to the given address
|
// SOCKS5 returns a Dialer that makes SOCKSv5 connections to the given
|
||||||
// with an optional username and password. See RFC 1928 and RFC 1929.
|
// address with an optional username and password.
|
||||||
func SOCKS5(network, addr string, auth *Auth, forward Dialer) (Dialer, error) {
|
// See RFC 1928 and RFC 1929.
|
||||||
s := &socks5{
|
func SOCKS5(network, address string, auth *Auth, forward Dialer) (Dialer, error) {
|
||||||
network: network,
|
d := socks.NewDialer(network, address)
|
||||||
addr: addr,
|
if forward != nil {
|
||||||
forward: forward,
|
d.ProxyDial = func(_ context.Context, network string, address string) (net.Conn, error) {
|
||||||
|
return forward.Dial(network, address)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if auth != nil {
|
if auth != nil {
|
||||||
s.user = auth.User
|
up := socks.UsernamePassword{
|
||||||
s.password = auth.Password
|
Username: auth.User,
|
||||||
|
Password: auth.Password,
|
||||||
|
}
|
||||||
|
d.AuthMethods = []socks.AuthMethod{
|
||||||
|
socks.AuthMethodNotRequired,
|
||||||
|
socks.AuthMethodUsernamePassword,
|
||||||
|
}
|
||||||
|
d.Authenticate = up.Authenticate
|
||||||
}
|
}
|
||||||
|
return d, nil
|
||||||
return s, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
type socks5 struct {
|
|
||||||
user, password string
|
|
||||||
network, addr string
|
|
||||||
forward Dialer
|
|
||||||
}
|
|
||||||
|
|
||||||
const socks5Version = 5
|
|
||||||
|
|
||||||
const (
|
|
||||||
socks5AuthNone = 0
|
|
||||||
socks5AuthPassword = 2
|
|
||||||
)
|
|
||||||
|
|
||||||
const socks5Connect = 1
|
|
||||||
|
|
||||||
const (
|
|
||||||
socks5IP4 = 1
|
|
||||||
socks5Domain = 3
|
|
||||||
socks5IP6 = 4
|
|
||||||
)
|
|
||||||
|
|
||||||
var socks5Errors = []string{
|
|
||||||
"",
|
|
||||||
"general failure",
|
|
||||||
"connection forbidden",
|
|
||||||
"network unreachable",
|
|
||||||
"host unreachable",
|
|
||||||
"connection refused",
|
|
||||||
"TTL expired",
|
|
||||||
"command not supported",
|
|
||||||
"address type not supported",
|
|
||||||
}
|
|
||||||
|
|
||||||
// Dial connects to the address addr on the given network via the SOCKS5 proxy.
|
|
||||||
func (s *socks5) Dial(network, addr string) (net.Conn, error) {
|
|
||||||
switch network {
|
|
||||||
case "tcp", "tcp6", "tcp4":
|
|
||||||
default:
|
|
||||||
return nil, errors.New("proxy: no support for SOCKS5 proxy connections of type " + network)
|
|
||||||
}
|
|
||||||
|
|
||||||
conn, err := s.forward.Dial(s.network, s.addr)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
if err := s.connect(conn, addr); err != nil {
|
|
||||||
conn.Close()
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return conn, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// connect takes an existing connection to a socks5 proxy server,
|
|
||||||
// and commands the server to extend that connection to target,
|
|
||||||
// which must be a canonical address with a host and port.
|
|
||||||
func (s *socks5) connect(conn net.Conn, target string) error {
|
|
||||||
host, portStr, err := net.SplitHostPort(target)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
port, err := strconv.Atoi(portStr)
|
|
||||||
if err != nil {
|
|
||||||
return errors.New("proxy: failed to parse port number: " + portStr)
|
|
||||||
}
|
|
||||||
if port < 1 || port > 0xffff {
|
|
||||||
return errors.New("proxy: port number out of range: " + portStr)
|
|
||||||
}
|
|
||||||
|
|
||||||
// the size here is just an estimate
|
|
||||||
buf := make([]byte, 0, 6+len(host))
|
|
||||||
|
|
||||||
buf = append(buf, socks5Version)
|
|
||||||
if len(s.user) > 0 && len(s.user) < 256 && len(s.password) < 256 {
|
|
||||||
buf = append(buf, 2 /* num auth methods */, socks5AuthNone, socks5AuthPassword)
|
|
||||||
} else {
|
|
||||||
buf = append(buf, 1 /* num auth methods */, socks5AuthNone)
|
|
||||||
}
|
|
||||||
|
|
||||||
if _, err := conn.Write(buf); err != nil {
|
|
||||||
return errors.New("proxy: failed to write greeting to SOCKS5 proxy at " + s.addr + ": " + err.Error())
|
|
||||||
}
|
|
||||||
|
|
||||||
if _, err := io.ReadFull(conn, buf[:2]); err != nil {
|
|
||||||
return errors.New("proxy: failed to read greeting from SOCKS5 proxy at " + s.addr + ": " + err.Error())
|
|
||||||
}
|
|
||||||
if buf[0] != 5 {
|
|
||||||
return errors.New("proxy: SOCKS5 proxy at " + s.addr + " has unexpected version " + strconv.Itoa(int(buf[0])))
|
|
||||||
}
|
|
||||||
if buf[1] == 0xff {
|
|
||||||
return errors.New("proxy: SOCKS5 proxy at " + s.addr + " requires authentication")
|
|
||||||
}
|
|
||||||
|
|
||||||
// See RFC 1929
|
|
||||||
if buf[1] == socks5AuthPassword {
|
|
||||||
buf = buf[:0]
|
|
||||||
buf = append(buf, 1 /* password protocol version */)
|
|
||||||
buf = append(buf, uint8(len(s.user)))
|
|
||||||
buf = append(buf, s.user...)
|
|
||||||
buf = append(buf, uint8(len(s.password)))
|
|
||||||
buf = append(buf, s.password...)
|
|
||||||
|
|
||||||
if _, err := conn.Write(buf); err != nil {
|
|
||||||
return errors.New("proxy: failed to write authentication request to SOCKS5 proxy at " + s.addr + ": " + err.Error())
|
|
||||||
}
|
|
||||||
|
|
||||||
if _, err := io.ReadFull(conn, buf[:2]); err != nil {
|
|
||||||
return errors.New("proxy: failed to read authentication reply from SOCKS5 proxy at " + s.addr + ": " + err.Error())
|
|
||||||
}
|
|
||||||
|
|
||||||
if buf[1] != 0 {
|
|
||||||
return errors.New("proxy: SOCKS5 proxy at " + s.addr + " rejected username/password")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
buf = buf[:0]
|
|
||||||
buf = append(buf, socks5Version, socks5Connect, 0 /* reserved */)
|
|
||||||
|
|
||||||
if ip := net.ParseIP(host); ip != nil {
|
|
||||||
if ip4 := ip.To4(); ip4 != nil {
|
|
||||||
buf = append(buf, socks5IP4)
|
|
||||||
ip = ip4
|
|
||||||
} else {
|
|
||||||
buf = append(buf, socks5IP6)
|
|
||||||
}
|
|
||||||
buf = append(buf, ip...)
|
|
||||||
} else {
|
|
||||||
if len(host) > 255 {
|
|
||||||
return errors.New("proxy: destination host name too long: " + host)
|
|
||||||
}
|
|
||||||
buf = append(buf, socks5Domain)
|
|
||||||
buf = append(buf, byte(len(host)))
|
|
||||||
buf = append(buf, host...)
|
|
||||||
}
|
|
||||||
buf = append(buf, byte(port>>8), byte(port))
|
|
||||||
|
|
||||||
if _, err := conn.Write(buf); err != nil {
|
|
||||||
return errors.New("proxy: failed to write connect request to SOCKS5 proxy at " + s.addr + ": " + err.Error())
|
|
||||||
}
|
|
||||||
|
|
||||||
if _, err := io.ReadFull(conn, buf[:4]); err != nil {
|
|
||||||
return errors.New("proxy: failed to read connect reply from SOCKS5 proxy at " + s.addr + ": " + err.Error())
|
|
||||||
}
|
|
||||||
|
|
||||||
failure := "unknown error"
|
|
||||||
if int(buf[1]) < len(socks5Errors) {
|
|
||||||
failure = socks5Errors[buf[1]]
|
|
||||||
}
|
|
||||||
|
|
||||||
if len(failure) > 0 {
|
|
||||||
return errors.New("proxy: SOCKS5 proxy at " + s.addr + " failed to connect: " + failure)
|
|
||||||
}
|
|
||||||
|
|
||||||
bytesToDiscard := 0
|
|
||||||
switch buf[3] {
|
|
||||||
case socks5IP4:
|
|
||||||
bytesToDiscard = net.IPv4len
|
|
||||||
case socks5IP6:
|
|
||||||
bytesToDiscard = net.IPv6len
|
|
||||||
case socks5Domain:
|
|
||||||
_, err := io.ReadFull(conn, buf[:1])
|
|
||||||
if err != nil {
|
|
||||||
return errors.New("proxy: failed to read domain length from SOCKS5 proxy at " + s.addr + ": " + err.Error())
|
|
||||||
}
|
|
||||||
bytesToDiscard = int(buf[0])
|
|
||||||
default:
|
|
||||||
return errors.New("proxy: got unknown address type " + strconv.Itoa(int(buf[3])) + " from SOCKS5 proxy at " + s.addr)
|
|
||||||
}
|
|
||||||
|
|
||||||
if cap(buf) < bytesToDiscard {
|
|
||||||
buf = make([]byte, bytesToDiscard)
|
|
||||||
} else {
|
|
||||||
buf = buf[:bytesToDiscard]
|
|
||||||
}
|
|
||||||
if _, err := io.ReadFull(conn, buf); err != nil {
|
|
||||||
return errors.New("proxy: failed to read address from SOCKS5 proxy at " + s.addr + ": " + err.Error())
|
|
||||||
}
|
|
||||||
|
|
||||||
// Also need to discard the port number
|
|
||||||
if _, err := io.ReadFull(conn, buf[:2]); err != nil {
|
|
||||||
return errors.New("proxy: failed to read port from SOCKS5 proxy at " + s.addr + ": " + err.Error())
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
5
vendor/golang.org/x/sys/unix/zerrors_linux_386.go
generated
vendored
5
vendor/golang.org/x/sys/unix/zerrors_linux_386.go
generated
vendored
@ -392,6 +392,7 @@ const (
|
|||||||
ETH_P_ECONET = 0x18
|
ETH_P_ECONET = 0x18
|
||||||
ETH_P_EDSA = 0xdada
|
ETH_P_EDSA = 0xdada
|
||||||
ETH_P_ERSPAN = 0x88be
|
ETH_P_ERSPAN = 0x88be
|
||||||
|
ETH_P_ERSPAN2 = 0x22eb
|
||||||
ETH_P_FCOE = 0x8906
|
ETH_P_FCOE = 0x8906
|
||||||
ETH_P_FIP = 0x8914
|
ETH_P_FIP = 0x8914
|
||||||
ETH_P_HDLC = 0x19
|
ETH_P_HDLC = 0x19
|
||||||
@ -1117,6 +1118,7 @@ const (
|
|||||||
PERF_EVENT_IOC_ID = 0x80042407
|
PERF_EVENT_IOC_ID = 0x80042407
|
||||||
PERF_EVENT_IOC_PAUSE_OUTPUT = 0x40042409
|
PERF_EVENT_IOC_PAUSE_OUTPUT = 0x40042409
|
||||||
PERF_EVENT_IOC_PERIOD = 0x40082404
|
PERF_EVENT_IOC_PERIOD = 0x40082404
|
||||||
|
PERF_EVENT_IOC_QUERY_BPF = 0xc004240a
|
||||||
PERF_EVENT_IOC_REFRESH = 0x2402
|
PERF_EVENT_IOC_REFRESH = 0x2402
|
||||||
PERF_EVENT_IOC_RESET = 0x2403
|
PERF_EVENT_IOC_RESET = 0x2403
|
||||||
PERF_EVENT_IOC_SET_BPF = 0x40042408
|
PERF_EVENT_IOC_SET_BPF = 0x40042408
|
||||||
@ -1273,6 +1275,7 @@ const (
|
|||||||
PTRACE_POKETEXT = 0x4
|
PTRACE_POKETEXT = 0x4
|
||||||
PTRACE_POKEUSR = 0x6
|
PTRACE_POKEUSR = 0x6
|
||||||
PTRACE_SECCOMP_GET_FILTER = 0x420c
|
PTRACE_SECCOMP_GET_FILTER = 0x420c
|
||||||
|
PTRACE_SECCOMP_GET_METADATA = 0x420d
|
||||||
PTRACE_SEIZE = 0x4206
|
PTRACE_SEIZE = 0x4206
|
||||||
PTRACE_SETFPREGS = 0xf
|
PTRACE_SETFPREGS = 0xf
|
||||||
PTRACE_SETFPXREGS = 0x13
|
PTRACE_SETFPXREGS = 0x13
|
||||||
@ -1881,6 +1884,7 @@ const (
|
|||||||
TUNGETVNETHDRSZ = 0x800454d7
|
TUNGETVNETHDRSZ = 0x800454d7
|
||||||
TUNGETVNETLE = 0x800454dd
|
TUNGETVNETLE = 0x800454dd
|
||||||
TUNSETDEBUG = 0x400454c9
|
TUNSETDEBUG = 0x400454c9
|
||||||
|
TUNSETFILTEREBPF = 0x800454e1
|
||||||
TUNSETGROUP = 0x400454ce
|
TUNSETGROUP = 0x400454ce
|
||||||
TUNSETIFF = 0x400454ca
|
TUNSETIFF = 0x400454ca
|
||||||
TUNSETIFINDEX = 0x400454da
|
TUNSETIFINDEX = 0x400454da
|
||||||
@ -1891,6 +1895,7 @@ const (
|
|||||||
TUNSETPERSIST = 0x400454cb
|
TUNSETPERSIST = 0x400454cb
|
||||||
TUNSETQUEUE = 0x400454d9
|
TUNSETQUEUE = 0x400454d9
|
||||||
TUNSETSNDBUF = 0x400454d4
|
TUNSETSNDBUF = 0x400454d4
|
||||||
|
TUNSETSTEERINGEBPF = 0x800454e0
|
||||||
TUNSETTXFILTER = 0x400454d1
|
TUNSETTXFILTER = 0x400454d1
|
||||||
TUNSETVNETBE = 0x400454de
|
TUNSETVNETBE = 0x400454de
|
||||||
TUNSETVNETHDRSZ = 0x400454d8
|
TUNSETVNETHDRSZ = 0x400454d8
|
||||||
|
5
vendor/golang.org/x/sys/unix/zerrors_linux_amd64.go
generated
vendored
5
vendor/golang.org/x/sys/unix/zerrors_linux_amd64.go
generated
vendored
@ -392,6 +392,7 @@ const (
|
|||||||
ETH_P_ECONET = 0x18
|
ETH_P_ECONET = 0x18
|
||||||
ETH_P_EDSA = 0xdada
|
ETH_P_EDSA = 0xdada
|
||||||
ETH_P_ERSPAN = 0x88be
|
ETH_P_ERSPAN = 0x88be
|
||||||
|
ETH_P_ERSPAN2 = 0x22eb
|
||||||
ETH_P_FCOE = 0x8906
|
ETH_P_FCOE = 0x8906
|
||||||
ETH_P_FIP = 0x8914
|
ETH_P_FIP = 0x8914
|
||||||
ETH_P_HDLC = 0x19
|
ETH_P_HDLC = 0x19
|
||||||
@ -1117,6 +1118,7 @@ const (
|
|||||||
PERF_EVENT_IOC_ID = 0x80082407
|
PERF_EVENT_IOC_ID = 0x80082407
|
||||||
PERF_EVENT_IOC_PAUSE_OUTPUT = 0x40042409
|
PERF_EVENT_IOC_PAUSE_OUTPUT = 0x40042409
|
||||||
PERF_EVENT_IOC_PERIOD = 0x40082404
|
PERF_EVENT_IOC_PERIOD = 0x40082404
|
||||||
|
PERF_EVENT_IOC_QUERY_BPF = 0xc008240a
|
||||||
PERF_EVENT_IOC_REFRESH = 0x2402
|
PERF_EVENT_IOC_REFRESH = 0x2402
|
||||||
PERF_EVENT_IOC_RESET = 0x2403
|
PERF_EVENT_IOC_RESET = 0x2403
|
||||||
PERF_EVENT_IOC_SET_BPF = 0x40042408
|
PERF_EVENT_IOC_SET_BPF = 0x40042408
|
||||||
@ -1274,6 +1276,7 @@ const (
|
|||||||
PTRACE_POKETEXT = 0x4
|
PTRACE_POKETEXT = 0x4
|
||||||
PTRACE_POKEUSR = 0x6
|
PTRACE_POKEUSR = 0x6
|
||||||
PTRACE_SECCOMP_GET_FILTER = 0x420c
|
PTRACE_SECCOMP_GET_FILTER = 0x420c
|
||||||
|
PTRACE_SECCOMP_GET_METADATA = 0x420d
|
||||||
PTRACE_SEIZE = 0x4206
|
PTRACE_SEIZE = 0x4206
|
||||||
PTRACE_SETFPREGS = 0xf
|
PTRACE_SETFPREGS = 0xf
|
||||||
PTRACE_SETFPXREGS = 0x13
|
PTRACE_SETFPXREGS = 0x13
|
||||||
@ -1882,6 +1885,7 @@ const (
|
|||||||
TUNGETVNETHDRSZ = 0x800454d7
|
TUNGETVNETHDRSZ = 0x800454d7
|
||||||
TUNGETVNETLE = 0x800454dd
|
TUNGETVNETLE = 0x800454dd
|
||||||
TUNSETDEBUG = 0x400454c9
|
TUNSETDEBUG = 0x400454c9
|
||||||
|
TUNSETFILTEREBPF = 0x800454e1
|
||||||
TUNSETGROUP = 0x400454ce
|
TUNSETGROUP = 0x400454ce
|
||||||
TUNSETIFF = 0x400454ca
|
TUNSETIFF = 0x400454ca
|
||||||
TUNSETIFINDEX = 0x400454da
|
TUNSETIFINDEX = 0x400454da
|
||||||
@ -1892,6 +1896,7 @@ const (
|
|||||||
TUNSETPERSIST = 0x400454cb
|
TUNSETPERSIST = 0x400454cb
|
||||||
TUNSETQUEUE = 0x400454d9
|
TUNSETQUEUE = 0x400454d9
|
||||||
TUNSETSNDBUF = 0x400454d4
|
TUNSETSNDBUF = 0x400454d4
|
||||||
|
TUNSETSTEERINGEBPF = 0x800454e0
|
||||||
TUNSETTXFILTER = 0x400454d1
|
TUNSETTXFILTER = 0x400454d1
|
||||||
TUNSETVNETBE = 0x400454de
|
TUNSETVNETBE = 0x400454de
|
||||||
TUNSETVNETHDRSZ = 0x400454d8
|
TUNSETVNETHDRSZ = 0x400454d8
|
||||||
|
5
vendor/golang.org/x/sys/unix/zerrors_linux_arm.go
generated
vendored
5
vendor/golang.org/x/sys/unix/zerrors_linux_arm.go
generated
vendored
@ -392,6 +392,7 @@ const (
|
|||||||
ETH_P_ECONET = 0x18
|
ETH_P_ECONET = 0x18
|
||||||
ETH_P_EDSA = 0xdada
|
ETH_P_EDSA = 0xdada
|
||||||
ETH_P_ERSPAN = 0x88be
|
ETH_P_ERSPAN = 0x88be
|
||||||
|
ETH_P_ERSPAN2 = 0x22eb
|
||||||
ETH_P_FCOE = 0x8906
|
ETH_P_FCOE = 0x8906
|
||||||
ETH_P_FIP = 0x8914
|
ETH_P_FIP = 0x8914
|
||||||
ETH_P_HDLC = 0x19
|
ETH_P_HDLC = 0x19
|
||||||
@ -1116,6 +1117,7 @@ const (
|
|||||||
PERF_EVENT_IOC_ID = 0x80042407
|
PERF_EVENT_IOC_ID = 0x80042407
|
||||||
PERF_EVENT_IOC_PAUSE_OUTPUT = 0x40042409
|
PERF_EVENT_IOC_PAUSE_OUTPUT = 0x40042409
|
||||||
PERF_EVENT_IOC_PERIOD = 0x40082404
|
PERF_EVENT_IOC_PERIOD = 0x40082404
|
||||||
|
PERF_EVENT_IOC_QUERY_BPF = 0xc004240a
|
||||||
PERF_EVENT_IOC_REFRESH = 0x2402
|
PERF_EVENT_IOC_REFRESH = 0x2402
|
||||||
PERF_EVENT_IOC_RESET = 0x2403
|
PERF_EVENT_IOC_RESET = 0x2403
|
||||||
PERF_EVENT_IOC_SET_BPF = 0x40042408
|
PERF_EVENT_IOC_SET_BPF = 0x40042408
|
||||||
@ -1278,6 +1280,7 @@ const (
|
|||||||
PTRACE_POKETEXT = 0x4
|
PTRACE_POKETEXT = 0x4
|
||||||
PTRACE_POKEUSR = 0x6
|
PTRACE_POKEUSR = 0x6
|
||||||
PTRACE_SECCOMP_GET_FILTER = 0x420c
|
PTRACE_SECCOMP_GET_FILTER = 0x420c
|
||||||
|
PTRACE_SECCOMP_GET_METADATA = 0x420d
|
||||||
PTRACE_SEIZE = 0x4206
|
PTRACE_SEIZE = 0x4206
|
||||||
PTRACE_SETCRUNCHREGS = 0x1a
|
PTRACE_SETCRUNCHREGS = 0x1a
|
||||||
PTRACE_SETFPREGS = 0xf
|
PTRACE_SETFPREGS = 0xf
|
||||||
@ -1889,6 +1892,7 @@ const (
|
|||||||
TUNGETVNETHDRSZ = 0x800454d7
|
TUNGETVNETHDRSZ = 0x800454d7
|
||||||
TUNGETVNETLE = 0x800454dd
|
TUNGETVNETLE = 0x800454dd
|
||||||
TUNSETDEBUG = 0x400454c9
|
TUNSETDEBUG = 0x400454c9
|
||||||
|
TUNSETFILTEREBPF = 0x800454e1
|
||||||
TUNSETGROUP = 0x400454ce
|
TUNSETGROUP = 0x400454ce
|
||||||
TUNSETIFF = 0x400454ca
|
TUNSETIFF = 0x400454ca
|
||||||
TUNSETIFINDEX = 0x400454da
|
TUNSETIFINDEX = 0x400454da
|
||||||
@ -1899,6 +1903,7 @@ const (
|
|||||||
TUNSETPERSIST = 0x400454cb
|
TUNSETPERSIST = 0x400454cb
|
||||||
TUNSETQUEUE = 0x400454d9
|
TUNSETQUEUE = 0x400454d9
|
||||||
TUNSETSNDBUF = 0x400454d4
|
TUNSETSNDBUF = 0x400454d4
|
||||||
|
TUNSETSTEERINGEBPF = 0x800454e0
|
||||||
TUNSETTXFILTER = 0x400454d1
|
TUNSETTXFILTER = 0x400454d1
|
||||||
TUNSETVNETBE = 0x400454de
|
TUNSETVNETBE = 0x400454de
|
||||||
TUNSETVNETHDRSZ = 0x400454d8
|
TUNSETVNETHDRSZ = 0x400454d8
|
||||||
|
5
vendor/golang.org/x/sys/unix/zerrors_linux_arm64.go
generated
vendored
5
vendor/golang.org/x/sys/unix/zerrors_linux_arm64.go
generated
vendored
@ -393,6 +393,7 @@ const (
|
|||||||
ETH_P_ECONET = 0x18
|
ETH_P_ECONET = 0x18
|
||||||
ETH_P_EDSA = 0xdada
|
ETH_P_EDSA = 0xdada
|
||||||
ETH_P_ERSPAN = 0x88be
|
ETH_P_ERSPAN = 0x88be
|
||||||
|
ETH_P_ERSPAN2 = 0x22eb
|
||||||
ETH_P_FCOE = 0x8906
|
ETH_P_FCOE = 0x8906
|
||||||
ETH_P_FIP = 0x8914
|
ETH_P_FIP = 0x8914
|
||||||
ETH_P_HDLC = 0x19
|
ETH_P_HDLC = 0x19
|
||||||
@ -1118,6 +1119,7 @@ const (
|
|||||||
PERF_EVENT_IOC_ID = 0x80082407
|
PERF_EVENT_IOC_ID = 0x80082407
|
||||||
PERF_EVENT_IOC_PAUSE_OUTPUT = 0x40042409
|
PERF_EVENT_IOC_PAUSE_OUTPUT = 0x40042409
|
||||||
PERF_EVENT_IOC_PERIOD = 0x40082404
|
PERF_EVENT_IOC_PERIOD = 0x40082404
|
||||||
|
PERF_EVENT_IOC_QUERY_BPF = 0xc008240a
|
||||||
PERF_EVENT_IOC_REFRESH = 0x2402
|
PERF_EVENT_IOC_REFRESH = 0x2402
|
||||||
PERF_EVENT_IOC_RESET = 0x2403
|
PERF_EVENT_IOC_RESET = 0x2403
|
||||||
PERF_EVENT_IOC_SET_BPF = 0x40042408
|
PERF_EVENT_IOC_SET_BPF = 0x40042408
|
||||||
@ -1270,6 +1272,7 @@ const (
|
|||||||
PTRACE_POKETEXT = 0x4
|
PTRACE_POKETEXT = 0x4
|
||||||
PTRACE_POKEUSR = 0x6
|
PTRACE_POKEUSR = 0x6
|
||||||
PTRACE_SECCOMP_GET_FILTER = 0x420c
|
PTRACE_SECCOMP_GET_FILTER = 0x420c
|
||||||
|
PTRACE_SECCOMP_GET_METADATA = 0x420d
|
||||||
PTRACE_SEIZE = 0x4206
|
PTRACE_SEIZE = 0x4206
|
||||||
PTRACE_SETOPTIONS = 0x4200
|
PTRACE_SETOPTIONS = 0x4200
|
||||||
PTRACE_SETREGS = 0xd
|
PTRACE_SETREGS = 0xd
|
||||||
@ -1872,6 +1875,7 @@ const (
|
|||||||
TUNGETVNETHDRSZ = 0x800454d7
|
TUNGETVNETHDRSZ = 0x800454d7
|
||||||
TUNGETVNETLE = 0x800454dd
|
TUNGETVNETLE = 0x800454dd
|
||||||
TUNSETDEBUG = 0x400454c9
|
TUNSETDEBUG = 0x400454c9
|
||||||
|
TUNSETFILTEREBPF = 0x800454e1
|
||||||
TUNSETGROUP = 0x400454ce
|
TUNSETGROUP = 0x400454ce
|
||||||
TUNSETIFF = 0x400454ca
|
TUNSETIFF = 0x400454ca
|
||||||
TUNSETIFINDEX = 0x400454da
|
TUNSETIFINDEX = 0x400454da
|
||||||
@ -1882,6 +1886,7 @@ const (
|
|||||||
TUNSETPERSIST = 0x400454cb
|
TUNSETPERSIST = 0x400454cb
|
||||||
TUNSETQUEUE = 0x400454d9
|
TUNSETQUEUE = 0x400454d9
|
||||||
TUNSETSNDBUF = 0x400454d4
|
TUNSETSNDBUF = 0x400454d4
|
||||||
|
TUNSETSTEERINGEBPF = 0x800454e0
|
||||||
TUNSETTXFILTER = 0x400454d1
|
TUNSETTXFILTER = 0x400454d1
|
||||||
TUNSETVNETBE = 0x400454de
|
TUNSETVNETBE = 0x400454de
|
||||||
TUNSETVNETHDRSZ = 0x400454d8
|
TUNSETVNETHDRSZ = 0x400454d8
|
||||||
|
5
vendor/golang.org/x/sys/unix/zerrors_linux_mips.go
generated
vendored
5
vendor/golang.org/x/sys/unix/zerrors_linux_mips.go
generated
vendored
@ -392,6 +392,7 @@ const (
|
|||||||
ETH_P_ECONET = 0x18
|
ETH_P_ECONET = 0x18
|
||||||
ETH_P_EDSA = 0xdada
|
ETH_P_EDSA = 0xdada
|
||||||
ETH_P_ERSPAN = 0x88be
|
ETH_P_ERSPAN = 0x88be
|
||||||
|
ETH_P_ERSPAN2 = 0x22eb
|
||||||
ETH_P_FCOE = 0x8906
|
ETH_P_FCOE = 0x8906
|
||||||
ETH_P_FIP = 0x8914
|
ETH_P_FIP = 0x8914
|
||||||
ETH_P_HDLC = 0x19
|
ETH_P_HDLC = 0x19
|
||||||
@ -1117,6 +1118,7 @@ const (
|
|||||||
PERF_EVENT_IOC_ID = 0x40042407
|
PERF_EVENT_IOC_ID = 0x40042407
|
||||||
PERF_EVENT_IOC_PAUSE_OUTPUT = 0x80042409
|
PERF_EVENT_IOC_PAUSE_OUTPUT = 0x80042409
|
||||||
PERF_EVENT_IOC_PERIOD = 0x80082404
|
PERF_EVENT_IOC_PERIOD = 0x80082404
|
||||||
|
PERF_EVENT_IOC_QUERY_BPF = 0xc004240a
|
||||||
PERF_EVENT_IOC_REFRESH = 0x20002402
|
PERF_EVENT_IOC_REFRESH = 0x20002402
|
||||||
PERF_EVENT_IOC_RESET = 0x20002403
|
PERF_EVENT_IOC_RESET = 0x20002403
|
||||||
PERF_EVENT_IOC_SET_BPF = 0x80042408
|
PERF_EVENT_IOC_SET_BPF = 0x80042408
|
||||||
@ -1278,6 +1280,7 @@ const (
|
|||||||
PTRACE_POKETEXT_3264 = 0xc2
|
PTRACE_POKETEXT_3264 = 0xc2
|
||||||
PTRACE_POKEUSR = 0x6
|
PTRACE_POKEUSR = 0x6
|
||||||
PTRACE_SECCOMP_GET_FILTER = 0x420c
|
PTRACE_SECCOMP_GET_FILTER = 0x420c
|
||||||
|
PTRACE_SECCOMP_GET_METADATA = 0x420d
|
||||||
PTRACE_SEIZE = 0x4206
|
PTRACE_SEIZE = 0x4206
|
||||||
PTRACE_SETFPREGS = 0xf
|
PTRACE_SETFPREGS = 0xf
|
||||||
PTRACE_SETOPTIONS = 0x4200
|
PTRACE_SETOPTIONS = 0x4200
|
||||||
@ -1885,6 +1888,7 @@ const (
|
|||||||
TUNGETVNETHDRSZ = 0x400454d7
|
TUNGETVNETHDRSZ = 0x400454d7
|
||||||
TUNGETVNETLE = 0x400454dd
|
TUNGETVNETLE = 0x400454dd
|
||||||
TUNSETDEBUG = 0x800454c9
|
TUNSETDEBUG = 0x800454c9
|
||||||
|
TUNSETFILTEREBPF = 0x400454e1
|
||||||
TUNSETGROUP = 0x800454ce
|
TUNSETGROUP = 0x800454ce
|
||||||
TUNSETIFF = 0x800454ca
|
TUNSETIFF = 0x800454ca
|
||||||
TUNSETIFINDEX = 0x800454da
|
TUNSETIFINDEX = 0x800454da
|
||||||
@ -1895,6 +1899,7 @@ const (
|
|||||||
TUNSETPERSIST = 0x800454cb
|
TUNSETPERSIST = 0x800454cb
|
||||||
TUNSETQUEUE = 0x800454d9
|
TUNSETQUEUE = 0x800454d9
|
||||||
TUNSETSNDBUF = 0x800454d4
|
TUNSETSNDBUF = 0x800454d4
|
||||||
|
TUNSETSTEERINGEBPF = 0x400454e0
|
||||||
TUNSETTXFILTER = 0x800454d1
|
TUNSETTXFILTER = 0x800454d1
|
||||||
TUNSETVNETBE = 0x800454de
|
TUNSETVNETBE = 0x800454de
|
||||||
TUNSETVNETHDRSZ = 0x800454d8
|
TUNSETVNETHDRSZ = 0x800454d8
|
||||||
|
5
vendor/golang.org/x/sys/unix/zerrors_linux_mips64.go
generated
vendored
5
vendor/golang.org/x/sys/unix/zerrors_linux_mips64.go
generated
vendored
@ -392,6 +392,7 @@ const (
|
|||||||
ETH_P_ECONET = 0x18
|
ETH_P_ECONET = 0x18
|
||||||
ETH_P_EDSA = 0xdada
|
ETH_P_EDSA = 0xdada
|
||||||
ETH_P_ERSPAN = 0x88be
|
ETH_P_ERSPAN = 0x88be
|
||||||
|
ETH_P_ERSPAN2 = 0x22eb
|
||||||
ETH_P_FCOE = 0x8906
|
ETH_P_FCOE = 0x8906
|
||||||
ETH_P_FIP = 0x8914
|
ETH_P_FIP = 0x8914
|
||||||
ETH_P_HDLC = 0x19
|
ETH_P_HDLC = 0x19
|
||||||
@ -1117,6 +1118,7 @@ const (
|
|||||||
PERF_EVENT_IOC_ID = 0x40082407
|
PERF_EVENT_IOC_ID = 0x40082407
|
||||||
PERF_EVENT_IOC_PAUSE_OUTPUT = 0x80042409
|
PERF_EVENT_IOC_PAUSE_OUTPUT = 0x80042409
|
||||||
PERF_EVENT_IOC_PERIOD = 0x80082404
|
PERF_EVENT_IOC_PERIOD = 0x80082404
|
||||||
|
PERF_EVENT_IOC_QUERY_BPF = 0xc008240a
|
||||||
PERF_EVENT_IOC_REFRESH = 0x20002402
|
PERF_EVENT_IOC_REFRESH = 0x20002402
|
||||||
PERF_EVENT_IOC_RESET = 0x20002403
|
PERF_EVENT_IOC_RESET = 0x20002403
|
||||||
PERF_EVENT_IOC_SET_BPF = 0x80042408
|
PERF_EVENT_IOC_SET_BPF = 0x80042408
|
||||||
@ -1278,6 +1280,7 @@ const (
|
|||||||
PTRACE_POKETEXT_3264 = 0xc2
|
PTRACE_POKETEXT_3264 = 0xc2
|
||||||
PTRACE_POKEUSR = 0x6
|
PTRACE_POKEUSR = 0x6
|
||||||
PTRACE_SECCOMP_GET_FILTER = 0x420c
|
PTRACE_SECCOMP_GET_FILTER = 0x420c
|
||||||
|
PTRACE_SECCOMP_GET_METADATA = 0x420d
|
||||||
PTRACE_SEIZE = 0x4206
|
PTRACE_SEIZE = 0x4206
|
||||||
PTRACE_SETFPREGS = 0xf
|
PTRACE_SETFPREGS = 0xf
|
||||||
PTRACE_SETOPTIONS = 0x4200
|
PTRACE_SETOPTIONS = 0x4200
|
||||||
@ -1885,6 +1888,7 @@ const (
|
|||||||
TUNGETVNETHDRSZ = 0x400454d7
|
TUNGETVNETHDRSZ = 0x400454d7
|
||||||
TUNGETVNETLE = 0x400454dd
|
TUNGETVNETLE = 0x400454dd
|
||||||
TUNSETDEBUG = 0x800454c9
|
TUNSETDEBUG = 0x800454c9
|
||||||
|
TUNSETFILTEREBPF = 0x400454e1
|
||||||
TUNSETGROUP = 0x800454ce
|
TUNSETGROUP = 0x800454ce
|
||||||
TUNSETIFF = 0x800454ca
|
TUNSETIFF = 0x800454ca
|
||||||
TUNSETIFINDEX = 0x800454da
|
TUNSETIFINDEX = 0x800454da
|
||||||
@ -1895,6 +1899,7 @@ const (
|
|||||||
TUNSETPERSIST = 0x800454cb
|
TUNSETPERSIST = 0x800454cb
|
||||||
TUNSETQUEUE = 0x800454d9
|
TUNSETQUEUE = 0x800454d9
|
||||||
TUNSETSNDBUF = 0x800454d4
|
TUNSETSNDBUF = 0x800454d4
|
||||||
|
TUNSETSTEERINGEBPF = 0x400454e0
|
||||||
TUNSETTXFILTER = 0x800454d1
|
TUNSETTXFILTER = 0x800454d1
|
||||||
TUNSETVNETBE = 0x800454de
|
TUNSETVNETBE = 0x800454de
|
||||||
TUNSETVNETHDRSZ = 0x800454d8
|
TUNSETVNETHDRSZ = 0x800454d8
|
||||||
|
5
vendor/golang.org/x/sys/unix/zerrors_linux_mips64le.go
generated
vendored
5
vendor/golang.org/x/sys/unix/zerrors_linux_mips64le.go
generated
vendored
@ -392,6 +392,7 @@ const (
|
|||||||
ETH_P_ECONET = 0x18
|
ETH_P_ECONET = 0x18
|
||||||
ETH_P_EDSA = 0xdada
|
ETH_P_EDSA = 0xdada
|
||||||
ETH_P_ERSPAN = 0x88be
|
ETH_P_ERSPAN = 0x88be
|
||||||
|
ETH_P_ERSPAN2 = 0x22eb
|
||||||
ETH_P_FCOE = 0x8906
|
ETH_P_FCOE = 0x8906
|
||||||
ETH_P_FIP = 0x8914
|
ETH_P_FIP = 0x8914
|
||||||
ETH_P_HDLC = 0x19
|
ETH_P_HDLC = 0x19
|
||||||
@ -1117,6 +1118,7 @@ const (
|
|||||||
PERF_EVENT_IOC_ID = 0x40082407
|
PERF_EVENT_IOC_ID = 0x40082407
|
||||||
PERF_EVENT_IOC_PAUSE_OUTPUT = 0x80042409
|
PERF_EVENT_IOC_PAUSE_OUTPUT = 0x80042409
|
||||||
PERF_EVENT_IOC_PERIOD = 0x80082404
|
PERF_EVENT_IOC_PERIOD = 0x80082404
|
||||||
|
PERF_EVENT_IOC_QUERY_BPF = 0xc008240a
|
||||||
PERF_EVENT_IOC_REFRESH = 0x20002402
|
PERF_EVENT_IOC_REFRESH = 0x20002402
|
||||||
PERF_EVENT_IOC_RESET = 0x20002403
|
PERF_EVENT_IOC_RESET = 0x20002403
|
||||||
PERF_EVENT_IOC_SET_BPF = 0x80042408
|
PERF_EVENT_IOC_SET_BPF = 0x80042408
|
||||||
@ -1278,6 +1280,7 @@ const (
|
|||||||
PTRACE_POKETEXT_3264 = 0xc2
|
PTRACE_POKETEXT_3264 = 0xc2
|
||||||
PTRACE_POKEUSR = 0x6
|
PTRACE_POKEUSR = 0x6
|
||||||
PTRACE_SECCOMP_GET_FILTER = 0x420c
|
PTRACE_SECCOMP_GET_FILTER = 0x420c
|
||||||
|
PTRACE_SECCOMP_GET_METADATA = 0x420d
|
||||||
PTRACE_SEIZE = 0x4206
|
PTRACE_SEIZE = 0x4206
|
||||||
PTRACE_SETFPREGS = 0xf
|
PTRACE_SETFPREGS = 0xf
|
||||||
PTRACE_SETOPTIONS = 0x4200
|
PTRACE_SETOPTIONS = 0x4200
|
||||||
@ -1885,6 +1888,7 @@ const (
|
|||||||
TUNGETVNETHDRSZ = 0x400454d7
|
TUNGETVNETHDRSZ = 0x400454d7
|
||||||
TUNGETVNETLE = 0x400454dd
|
TUNGETVNETLE = 0x400454dd
|
||||||
TUNSETDEBUG = 0x800454c9
|
TUNSETDEBUG = 0x800454c9
|
||||||
|
TUNSETFILTEREBPF = 0x400454e1
|
||||||
TUNSETGROUP = 0x800454ce
|
TUNSETGROUP = 0x800454ce
|
||||||
TUNSETIFF = 0x800454ca
|
TUNSETIFF = 0x800454ca
|
||||||
TUNSETIFINDEX = 0x800454da
|
TUNSETIFINDEX = 0x800454da
|
||||||
@ -1895,6 +1899,7 @@ const (
|
|||||||
TUNSETPERSIST = 0x800454cb
|
TUNSETPERSIST = 0x800454cb
|
||||||
TUNSETQUEUE = 0x800454d9
|
TUNSETQUEUE = 0x800454d9
|
||||||
TUNSETSNDBUF = 0x800454d4
|
TUNSETSNDBUF = 0x800454d4
|
||||||
|
TUNSETSTEERINGEBPF = 0x400454e0
|
||||||
TUNSETTXFILTER = 0x800454d1
|
TUNSETTXFILTER = 0x800454d1
|
||||||
TUNSETVNETBE = 0x800454de
|
TUNSETVNETBE = 0x800454de
|
||||||
TUNSETVNETHDRSZ = 0x800454d8
|
TUNSETVNETHDRSZ = 0x800454d8
|
||||||
|
5
vendor/golang.org/x/sys/unix/zerrors_linux_mipsle.go
generated
vendored
5
vendor/golang.org/x/sys/unix/zerrors_linux_mipsle.go
generated
vendored
@ -392,6 +392,7 @@ const (
|
|||||||
ETH_P_ECONET = 0x18
|
ETH_P_ECONET = 0x18
|
||||||
ETH_P_EDSA = 0xdada
|
ETH_P_EDSA = 0xdada
|
||||||
ETH_P_ERSPAN = 0x88be
|
ETH_P_ERSPAN = 0x88be
|
||||||
|
ETH_P_ERSPAN2 = 0x22eb
|
||||||
ETH_P_FCOE = 0x8906
|
ETH_P_FCOE = 0x8906
|
||||||
ETH_P_FIP = 0x8914
|
ETH_P_FIP = 0x8914
|
||||||
ETH_P_HDLC = 0x19
|
ETH_P_HDLC = 0x19
|
||||||
@ -1117,6 +1118,7 @@ const (
|
|||||||
PERF_EVENT_IOC_ID = 0x40042407
|
PERF_EVENT_IOC_ID = 0x40042407
|
||||||
PERF_EVENT_IOC_PAUSE_OUTPUT = 0x80042409
|
PERF_EVENT_IOC_PAUSE_OUTPUT = 0x80042409
|
||||||
PERF_EVENT_IOC_PERIOD = 0x80082404
|
PERF_EVENT_IOC_PERIOD = 0x80082404
|
||||||
|
PERF_EVENT_IOC_QUERY_BPF = 0xc004240a
|
||||||
PERF_EVENT_IOC_REFRESH = 0x20002402
|
PERF_EVENT_IOC_REFRESH = 0x20002402
|
||||||
PERF_EVENT_IOC_RESET = 0x20002403
|
PERF_EVENT_IOC_RESET = 0x20002403
|
||||||
PERF_EVENT_IOC_SET_BPF = 0x80042408
|
PERF_EVENT_IOC_SET_BPF = 0x80042408
|
||||||
@ -1278,6 +1280,7 @@ const (
|
|||||||
PTRACE_POKETEXT_3264 = 0xc2
|
PTRACE_POKETEXT_3264 = 0xc2
|
||||||
PTRACE_POKEUSR = 0x6
|
PTRACE_POKEUSR = 0x6
|
||||||
PTRACE_SECCOMP_GET_FILTER = 0x420c
|
PTRACE_SECCOMP_GET_FILTER = 0x420c
|
||||||
|
PTRACE_SECCOMP_GET_METADATA = 0x420d
|
||||||
PTRACE_SEIZE = 0x4206
|
PTRACE_SEIZE = 0x4206
|
||||||
PTRACE_SETFPREGS = 0xf
|
PTRACE_SETFPREGS = 0xf
|
||||||
PTRACE_SETOPTIONS = 0x4200
|
PTRACE_SETOPTIONS = 0x4200
|
||||||
@ -1885,6 +1888,7 @@ const (
|
|||||||
TUNGETVNETHDRSZ = 0x400454d7
|
TUNGETVNETHDRSZ = 0x400454d7
|
||||||
TUNGETVNETLE = 0x400454dd
|
TUNGETVNETLE = 0x400454dd
|
||||||
TUNSETDEBUG = 0x800454c9
|
TUNSETDEBUG = 0x800454c9
|
||||||
|
TUNSETFILTEREBPF = 0x400454e1
|
||||||
TUNSETGROUP = 0x800454ce
|
TUNSETGROUP = 0x800454ce
|
||||||
TUNSETIFF = 0x800454ca
|
TUNSETIFF = 0x800454ca
|
||||||
TUNSETIFINDEX = 0x800454da
|
TUNSETIFINDEX = 0x800454da
|
||||||
@ -1895,6 +1899,7 @@ const (
|
|||||||
TUNSETPERSIST = 0x800454cb
|
TUNSETPERSIST = 0x800454cb
|
||||||
TUNSETQUEUE = 0x800454d9
|
TUNSETQUEUE = 0x800454d9
|
||||||
TUNSETSNDBUF = 0x800454d4
|
TUNSETSNDBUF = 0x800454d4
|
||||||
|
TUNSETSTEERINGEBPF = 0x400454e0
|
||||||
TUNSETTXFILTER = 0x800454d1
|
TUNSETTXFILTER = 0x800454d1
|
||||||
TUNSETVNETBE = 0x800454de
|
TUNSETVNETBE = 0x800454de
|
||||||
TUNSETVNETHDRSZ = 0x800454d8
|
TUNSETVNETHDRSZ = 0x800454d8
|
||||||
|
5
vendor/golang.org/x/sys/unix/zerrors_linux_ppc64.go
generated
vendored
5
vendor/golang.org/x/sys/unix/zerrors_linux_ppc64.go
generated
vendored
@ -392,6 +392,7 @@ const (
|
|||||||
ETH_P_ECONET = 0x18
|
ETH_P_ECONET = 0x18
|
||||||
ETH_P_EDSA = 0xdada
|
ETH_P_EDSA = 0xdada
|
||||||
ETH_P_ERSPAN = 0x88be
|
ETH_P_ERSPAN = 0x88be
|
||||||
|
ETH_P_ERSPAN2 = 0x22eb
|
||||||
ETH_P_FCOE = 0x8906
|
ETH_P_FCOE = 0x8906
|
||||||
ETH_P_FIP = 0x8914
|
ETH_P_FIP = 0x8914
|
||||||
ETH_P_HDLC = 0x19
|
ETH_P_HDLC = 0x19
|
||||||
@ -1118,6 +1119,7 @@ const (
|
|||||||
PERF_EVENT_IOC_ID = 0x40082407
|
PERF_EVENT_IOC_ID = 0x40082407
|
||||||
PERF_EVENT_IOC_PAUSE_OUTPUT = 0x80042409
|
PERF_EVENT_IOC_PAUSE_OUTPUT = 0x80042409
|
||||||
PERF_EVENT_IOC_PERIOD = 0x80082404
|
PERF_EVENT_IOC_PERIOD = 0x80082404
|
||||||
|
PERF_EVENT_IOC_QUERY_BPF = 0xc008240a
|
||||||
PERF_EVENT_IOC_REFRESH = 0x20002402
|
PERF_EVENT_IOC_REFRESH = 0x20002402
|
||||||
PERF_EVENT_IOC_RESET = 0x20002403
|
PERF_EVENT_IOC_RESET = 0x20002403
|
||||||
PERF_EVENT_IOC_SET_BPF = 0x80042408
|
PERF_EVENT_IOC_SET_BPF = 0x80042408
|
||||||
@ -1277,6 +1279,7 @@ const (
|
|||||||
PTRACE_POKETEXT = 0x4
|
PTRACE_POKETEXT = 0x4
|
||||||
PTRACE_POKEUSR = 0x6
|
PTRACE_POKEUSR = 0x6
|
||||||
PTRACE_SECCOMP_GET_FILTER = 0x420c
|
PTRACE_SECCOMP_GET_FILTER = 0x420c
|
||||||
|
PTRACE_SECCOMP_GET_METADATA = 0x420d
|
||||||
PTRACE_SEIZE = 0x4206
|
PTRACE_SEIZE = 0x4206
|
||||||
PTRACE_SETEVRREGS = 0x15
|
PTRACE_SETEVRREGS = 0x15
|
||||||
PTRACE_SETFPREGS = 0xf
|
PTRACE_SETFPREGS = 0xf
|
||||||
@ -1943,6 +1946,7 @@ const (
|
|||||||
TUNGETVNETHDRSZ = 0x400454d7
|
TUNGETVNETHDRSZ = 0x400454d7
|
||||||
TUNGETVNETLE = 0x400454dd
|
TUNGETVNETLE = 0x400454dd
|
||||||
TUNSETDEBUG = 0x800454c9
|
TUNSETDEBUG = 0x800454c9
|
||||||
|
TUNSETFILTEREBPF = 0x400454e1
|
||||||
TUNSETGROUP = 0x800454ce
|
TUNSETGROUP = 0x800454ce
|
||||||
TUNSETIFF = 0x800454ca
|
TUNSETIFF = 0x800454ca
|
||||||
TUNSETIFINDEX = 0x800454da
|
TUNSETIFINDEX = 0x800454da
|
||||||
@ -1953,6 +1957,7 @@ const (
|
|||||||
TUNSETPERSIST = 0x800454cb
|
TUNSETPERSIST = 0x800454cb
|
||||||
TUNSETQUEUE = 0x800454d9
|
TUNSETQUEUE = 0x800454d9
|
||||||
TUNSETSNDBUF = 0x800454d4
|
TUNSETSNDBUF = 0x800454d4
|
||||||
|
TUNSETSTEERINGEBPF = 0x400454e0
|
||||||
TUNSETTXFILTER = 0x800454d1
|
TUNSETTXFILTER = 0x800454d1
|
||||||
TUNSETVNETBE = 0x800454de
|
TUNSETVNETBE = 0x800454de
|
||||||
TUNSETVNETHDRSZ = 0x800454d8
|
TUNSETVNETHDRSZ = 0x800454d8
|
||||||
|
5
vendor/golang.org/x/sys/unix/zerrors_linux_ppc64le.go
generated
vendored
5
vendor/golang.org/x/sys/unix/zerrors_linux_ppc64le.go
generated
vendored
@ -392,6 +392,7 @@ const (
|
|||||||
ETH_P_ECONET = 0x18
|
ETH_P_ECONET = 0x18
|
||||||
ETH_P_EDSA = 0xdada
|
ETH_P_EDSA = 0xdada
|
||||||
ETH_P_ERSPAN = 0x88be
|
ETH_P_ERSPAN = 0x88be
|
||||||
|
ETH_P_ERSPAN2 = 0x22eb
|
||||||
ETH_P_FCOE = 0x8906
|
ETH_P_FCOE = 0x8906
|
||||||
ETH_P_FIP = 0x8914
|
ETH_P_FIP = 0x8914
|
||||||
ETH_P_HDLC = 0x19
|
ETH_P_HDLC = 0x19
|
||||||
@ -1118,6 +1119,7 @@ const (
|
|||||||
PERF_EVENT_IOC_ID = 0x40082407
|
PERF_EVENT_IOC_ID = 0x40082407
|
||||||
PERF_EVENT_IOC_PAUSE_OUTPUT = 0x80042409
|
PERF_EVENT_IOC_PAUSE_OUTPUT = 0x80042409
|
||||||
PERF_EVENT_IOC_PERIOD = 0x80082404
|
PERF_EVENT_IOC_PERIOD = 0x80082404
|
||||||
|
PERF_EVENT_IOC_QUERY_BPF = 0xc008240a
|
||||||
PERF_EVENT_IOC_REFRESH = 0x20002402
|
PERF_EVENT_IOC_REFRESH = 0x20002402
|
||||||
PERF_EVENT_IOC_RESET = 0x20002403
|
PERF_EVENT_IOC_RESET = 0x20002403
|
||||||
PERF_EVENT_IOC_SET_BPF = 0x80042408
|
PERF_EVENT_IOC_SET_BPF = 0x80042408
|
||||||
@ -1277,6 +1279,7 @@ const (
|
|||||||
PTRACE_POKETEXT = 0x4
|
PTRACE_POKETEXT = 0x4
|
||||||
PTRACE_POKEUSR = 0x6
|
PTRACE_POKEUSR = 0x6
|
||||||
PTRACE_SECCOMP_GET_FILTER = 0x420c
|
PTRACE_SECCOMP_GET_FILTER = 0x420c
|
||||||
|
PTRACE_SECCOMP_GET_METADATA = 0x420d
|
||||||
PTRACE_SEIZE = 0x4206
|
PTRACE_SEIZE = 0x4206
|
||||||
PTRACE_SETEVRREGS = 0x15
|
PTRACE_SETEVRREGS = 0x15
|
||||||
PTRACE_SETFPREGS = 0xf
|
PTRACE_SETFPREGS = 0xf
|
||||||
@ -1943,6 +1946,7 @@ const (
|
|||||||
TUNGETVNETHDRSZ = 0x400454d7
|
TUNGETVNETHDRSZ = 0x400454d7
|
||||||
TUNGETVNETLE = 0x400454dd
|
TUNGETVNETLE = 0x400454dd
|
||||||
TUNSETDEBUG = 0x800454c9
|
TUNSETDEBUG = 0x800454c9
|
||||||
|
TUNSETFILTEREBPF = 0x400454e1
|
||||||
TUNSETGROUP = 0x800454ce
|
TUNSETGROUP = 0x800454ce
|
||||||
TUNSETIFF = 0x800454ca
|
TUNSETIFF = 0x800454ca
|
||||||
TUNSETIFINDEX = 0x800454da
|
TUNSETIFINDEX = 0x800454da
|
||||||
@ -1953,6 +1957,7 @@ const (
|
|||||||
TUNSETPERSIST = 0x800454cb
|
TUNSETPERSIST = 0x800454cb
|
||||||
TUNSETQUEUE = 0x800454d9
|
TUNSETQUEUE = 0x800454d9
|
||||||
TUNSETSNDBUF = 0x800454d4
|
TUNSETSNDBUF = 0x800454d4
|
||||||
|
TUNSETSTEERINGEBPF = 0x400454e0
|
||||||
TUNSETTXFILTER = 0x800454d1
|
TUNSETTXFILTER = 0x800454d1
|
||||||
TUNSETVNETBE = 0x800454de
|
TUNSETVNETBE = 0x800454de
|
||||||
TUNSETVNETHDRSZ = 0x800454d8
|
TUNSETVNETHDRSZ = 0x800454d8
|
||||||
|
5
vendor/golang.org/x/sys/unix/zerrors_linux_s390x.go
generated
vendored
5
vendor/golang.org/x/sys/unix/zerrors_linux_s390x.go
generated
vendored
@ -392,6 +392,7 @@ const (
|
|||||||
ETH_P_ECONET = 0x18
|
ETH_P_ECONET = 0x18
|
||||||
ETH_P_EDSA = 0xdada
|
ETH_P_EDSA = 0xdada
|
||||||
ETH_P_ERSPAN = 0x88be
|
ETH_P_ERSPAN = 0x88be
|
||||||
|
ETH_P_ERSPAN2 = 0x22eb
|
||||||
ETH_P_FCOE = 0x8906
|
ETH_P_FCOE = 0x8906
|
||||||
ETH_P_FIP = 0x8914
|
ETH_P_FIP = 0x8914
|
||||||
ETH_P_HDLC = 0x19
|
ETH_P_HDLC = 0x19
|
||||||
@ -1116,6 +1117,7 @@ const (
|
|||||||
PERF_EVENT_IOC_ID = 0x80082407
|
PERF_EVENT_IOC_ID = 0x80082407
|
||||||
PERF_EVENT_IOC_PAUSE_OUTPUT = 0x40042409
|
PERF_EVENT_IOC_PAUSE_OUTPUT = 0x40042409
|
||||||
PERF_EVENT_IOC_PERIOD = 0x40082404
|
PERF_EVENT_IOC_PERIOD = 0x40082404
|
||||||
|
PERF_EVENT_IOC_QUERY_BPF = 0xc008240a
|
||||||
PERF_EVENT_IOC_REFRESH = 0x2402
|
PERF_EVENT_IOC_REFRESH = 0x2402
|
||||||
PERF_EVENT_IOC_RESET = 0x2403
|
PERF_EVENT_IOC_RESET = 0x2403
|
||||||
PERF_EVENT_IOC_SET_BPF = 0x40042408
|
PERF_EVENT_IOC_SET_BPF = 0x40042408
|
||||||
@ -1281,6 +1283,7 @@ const (
|
|||||||
PTRACE_POKE_SYSTEM_CALL = 0x5008
|
PTRACE_POKE_SYSTEM_CALL = 0x5008
|
||||||
PTRACE_PROT = 0x15
|
PTRACE_PROT = 0x15
|
||||||
PTRACE_SECCOMP_GET_FILTER = 0x420c
|
PTRACE_SECCOMP_GET_FILTER = 0x420c
|
||||||
|
PTRACE_SECCOMP_GET_METADATA = 0x420d
|
||||||
PTRACE_SEIZE = 0x4206
|
PTRACE_SEIZE = 0x4206
|
||||||
PTRACE_SETOPTIONS = 0x4200
|
PTRACE_SETOPTIONS = 0x4200
|
||||||
PTRACE_SETREGS = 0xd
|
PTRACE_SETREGS = 0xd
|
||||||
@ -1943,6 +1946,7 @@ const (
|
|||||||
TUNGETVNETHDRSZ = 0x800454d7
|
TUNGETVNETHDRSZ = 0x800454d7
|
||||||
TUNGETVNETLE = 0x800454dd
|
TUNGETVNETLE = 0x800454dd
|
||||||
TUNSETDEBUG = 0x400454c9
|
TUNSETDEBUG = 0x400454c9
|
||||||
|
TUNSETFILTEREBPF = 0x800454e1
|
||||||
TUNSETGROUP = 0x400454ce
|
TUNSETGROUP = 0x400454ce
|
||||||
TUNSETIFF = 0x400454ca
|
TUNSETIFF = 0x400454ca
|
||||||
TUNSETIFINDEX = 0x400454da
|
TUNSETIFINDEX = 0x400454da
|
||||||
@ -1953,6 +1957,7 @@ const (
|
|||||||
TUNSETPERSIST = 0x400454cb
|
TUNSETPERSIST = 0x400454cb
|
||||||
TUNSETQUEUE = 0x400454d9
|
TUNSETQUEUE = 0x400454d9
|
||||||
TUNSETSNDBUF = 0x400454d4
|
TUNSETSNDBUF = 0x400454d4
|
||||||
|
TUNSETSTEERINGEBPF = 0x800454e0
|
||||||
TUNSETTXFILTER = 0x400454d1
|
TUNSETTXFILTER = 0x400454d1
|
||||||
TUNSETVNETBE = 0x400454de
|
TUNSETVNETBE = 0x400454de
|
||||||
TUNSETVNETHDRSZ = 0x400454d8
|
TUNSETVNETHDRSZ = 0x400454d8
|
||||||
|
3
vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64.go
generated
vendored
3
vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64.go
generated
vendored
@ -367,4 +367,7 @@ const (
|
|||||||
SYS_PWRITEV2 = 381
|
SYS_PWRITEV2 = 381
|
||||||
SYS_KEXEC_FILE_LOAD = 382
|
SYS_KEXEC_FILE_LOAD = 382
|
||||||
SYS_STATX = 383
|
SYS_STATX = 383
|
||||||
|
SYS_PKEY_ALLOC = 384
|
||||||
|
SYS_PKEY_FREE = 385
|
||||||
|
SYS_PKEY_MPROTECT = 386
|
||||||
)
|
)
|
||||||
|
3
vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64le.go
generated
vendored
3
vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64le.go
generated
vendored
@ -367,4 +367,7 @@ const (
|
|||||||
SYS_PWRITEV2 = 381
|
SYS_PWRITEV2 = 381
|
||||||
SYS_KEXEC_FILE_LOAD = 382
|
SYS_KEXEC_FILE_LOAD = 382
|
||||||
SYS_STATX = 383
|
SYS_STATX = 383
|
||||||
|
SYS_PKEY_ALLOC = 384
|
||||||
|
SYS_PKEY_FREE = 385
|
||||||
|
SYS_PKEY_MPROTECT = 386
|
||||||
)
|
)
|
||||||
|
44
vendor/golang.org/x/sys/unix/zsysnum_linux_s390x.go
generated
vendored
44
vendor/golang.org/x/sys/unix/zsysnum_linux_s390x.go
generated
vendored
@ -109,6 +109,7 @@ const (
|
|||||||
SYS_PERSONALITY = 136
|
SYS_PERSONALITY = 136
|
||||||
SYS_AFS_SYSCALL = 137
|
SYS_AFS_SYSCALL = 137
|
||||||
SYS_GETDENTS = 141
|
SYS_GETDENTS = 141
|
||||||
|
SYS_SELECT = 142
|
||||||
SYS_FLOCK = 143
|
SYS_FLOCK = 143
|
||||||
SYS_MSYNC = 144
|
SYS_MSYNC = 144
|
||||||
SYS_READV = 145
|
SYS_READV = 145
|
||||||
@ -151,6 +152,26 @@ const (
|
|||||||
SYS_GETPMSG = 188
|
SYS_GETPMSG = 188
|
||||||
SYS_PUTPMSG = 189
|
SYS_PUTPMSG = 189
|
||||||
SYS_VFORK = 190
|
SYS_VFORK = 190
|
||||||
|
SYS_GETRLIMIT = 191
|
||||||
|
SYS_LCHOWN = 198
|
||||||
|
SYS_GETUID = 199
|
||||||
|
SYS_GETGID = 200
|
||||||
|
SYS_GETEUID = 201
|
||||||
|
SYS_GETEGID = 202
|
||||||
|
SYS_SETREUID = 203
|
||||||
|
SYS_SETREGID = 204
|
||||||
|
SYS_GETGROUPS = 205
|
||||||
|
SYS_SETGROUPS = 206
|
||||||
|
SYS_FCHOWN = 207
|
||||||
|
SYS_SETRESUID = 208
|
||||||
|
SYS_GETRESUID = 209
|
||||||
|
SYS_SETRESGID = 210
|
||||||
|
SYS_GETRESGID = 211
|
||||||
|
SYS_CHOWN = 212
|
||||||
|
SYS_SETUID = 213
|
||||||
|
SYS_SETGID = 214
|
||||||
|
SYS_SETFSUID = 215
|
||||||
|
SYS_SETFSGID = 216
|
||||||
SYS_PIVOT_ROOT = 217
|
SYS_PIVOT_ROOT = 217
|
||||||
SYS_MINCORE = 218
|
SYS_MINCORE = 218
|
||||||
SYS_MADVISE = 219
|
SYS_MADVISE = 219
|
||||||
@ -222,6 +243,7 @@ const (
|
|||||||
SYS_MKNODAT = 290
|
SYS_MKNODAT = 290
|
||||||
SYS_FCHOWNAT = 291
|
SYS_FCHOWNAT = 291
|
||||||
SYS_FUTIMESAT = 292
|
SYS_FUTIMESAT = 292
|
||||||
|
SYS_NEWFSTATAT = 293
|
||||||
SYS_UNLINKAT = 294
|
SYS_UNLINKAT = 294
|
||||||
SYS_RENAMEAT = 295
|
SYS_RENAMEAT = 295
|
||||||
SYS_LINKAT = 296
|
SYS_LINKAT = 296
|
||||||
@ -309,26 +331,4 @@ const (
|
|||||||
SYS_S390_GUARDED_STORAGE = 378
|
SYS_S390_GUARDED_STORAGE = 378
|
||||||
SYS_STATX = 379
|
SYS_STATX = 379
|
||||||
SYS_S390_STHYI = 380
|
SYS_S390_STHYI = 380
|
||||||
SYS_SELECT = 142
|
|
||||||
SYS_GETRLIMIT = 191
|
|
||||||
SYS_LCHOWN = 198
|
|
||||||
SYS_GETUID = 199
|
|
||||||
SYS_GETGID = 200
|
|
||||||
SYS_GETEUID = 201
|
|
||||||
SYS_GETEGID = 202
|
|
||||||
SYS_SETREUID = 203
|
|
||||||
SYS_SETREGID = 204
|
|
||||||
SYS_GETGROUPS = 205
|
|
||||||
SYS_SETGROUPS = 206
|
|
||||||
SYS_FCHOWN = 207
|
|
||||||
SYS_SETRESUID = 208
|
|
||||||
SYS_GETRESUID = 209
|
|
||||||
SYS_SETRESGID = 210
|
|
||||||
SYS_GETRESGID = 211
|
|
||||||
SYS_CHOWN = 212
|
|
||||||
SYS_SETUID = 213
|
|
||||||
SYS_SETGID = 214
|
|
||||||
SYS_SETFSUID = 215
|
|
||||||
SYS_SETFSGID = 216
|
|
||||||
SYS_NEWFSTATAT = 293
|
|
||||||
)
|
)
|
||||||
|
2
vendor/golang.org/x/sys/unix/ztypes_linux_386.go
generated
vendored
2
vendor/golang.org/x/sys/unix/ztypes_linux_386.go
generated
vendored
@ -491,7 +491,7 @@ const (
|
|||||||
IFLA_EVENT = 0x2c
|
IFLA_EVENT = 0x2c
|
||||||
IFLA_NEW_NETNSID = 0x2d
|
IFLA_NEW_NETNSID = 0x2d
|
||||||
IFLA_IF_NETNSID = 0x2e
|
IFLA_IF_NETNSID = 0x2e
|
||||||
IFLA_MAX = 0x2e
|
IFLA_MAX = 0x31
|
||||||
RT_SCOPE_UNIVERSE = 0x0
|
RT_SCOPE_UNIVERSE = 0x0
|
||||||
RT_SCOPE_SITE = 0xc8
|
RT_SCOPE_SITE = 0xc8
|
||||||
RT_SCOPE_LINK = 0xfd
|
RT_SCOPE_LINK = 0xfd
|
||||||
|
2
vendor/golang.org/x/sys/unix/ztypes_linux_amd64.go
generated
vendored
2
vendor/golang.org/x/sys/unix/ztypes_linux_amd64.go
generated
vendored
@ -495,7 +495,7 @@ const (
|
|||||||
IFLA_EVENT = 0x2c
|
IFLA_EVENT = 0x2c
|
||||||
IFLA_NEW_NETNSID = 0x2d
|
IFLA_NEW_NETNSID = 0x2d
|
||||||
IFLA_IF_NETNSID = 0x2e
|
IFLA_IF_NETNSID = 0x2e
|
||||||
IFLA_MAX = 0x2e
|
IFLA_MAX = 0x31
|
||||||
RT_SCOPE_UNIVERSE = 0x0
|
RT_SCOPE_UNIVERSE = 0x0
|
||||||
RT_SCOPE_SITE = 0xc8
|
RT_SCOPE_SITE = 0xc8
|
||||||
RT_SCOPE_LINK = 0xfd
|
RT_SCOPE_LINK = 0xfd
|
||||||
|
2
vendor/golang.org/x/sys/unix/ztypes_linux_arm.go
generated
vendored
2
vendor/golang.org/x/sys/unix/ztypes_linux_arm.go
generated
vendored
@ -495,7 +495,7 @@ const (
|
|||||||
IFLA_EVENT = 0x2c
|
IFLA_EVENT = 0x2c
|
||||||
IFLA_NEW_NETNSID = 0x2d
|
IFLA_NEW_NETNSID = 0x2d
|
||||||
IFLA_IF_NETNSID = 0x2e
|
IFLA_IF_NETNSID = 0x2e
|
||||||
IFLA_MAX = 0x2e
|
IFLA_MAX = 0x31
|
||||||
RT_SCOPE_UNIVERSE = 0x0
|
RT_SCOPE_UNIVERSE = 0x0
|
||||||
RT_SCOPE_SITE = 0xc8
|
RT_SCOPE_SITE = 0xc8
|
||||||
RT_SCOPE_LINK = 0xfd
|
RT_SCOPE_LINK = 0xfd
|
||||||
|
2
vendor/golang.org/x/sys/unix/ztypes_linux_arm64.go
generated
vendored
2
vendor/golang.org/x/sys/unix/ztypes_linux_arm64.go
generated
vendored
@ -496,7 +496,7 @@ const (
|
|||||||
IFLA_EVENT = 0x2c
|
IFLA_EVENT = 0x2c
|
||||||
IFLA_NEW_NETNSID = 0x2d
|
IFLA_NEW_NETNSID = 0x2d
|
||||||
IFLA_IF_NETNSID = 0x2e
|
IFLA_IF_NETNSID = 0x2e
|
||||||
IFLA_MAX = 0x2e
|
IFLA_MAX = 0x31
|
||||||
RT_SCOPE_UNIVERSE = 0x0
|
RT_SCOPE_UNIVERSE = 0x0
|
||||||
RT_SCOPE_SITE = 0xc8
|
RT_SCOPE_SITE = 0xc8
|
||||||
RT_SCOPE_LINK = 0xfd
|
RT_SCOPE_LINK = 0xfd
|
||||||
|
2
vendor/golang.org/x/sys/unix/ztypes_linux_mips.go
generated
vendored
2
vendor/golang.org/x/sys/unix/ztypes_linux_mips.go
generated
vendored
@ -494,7 +494,7 @@ const (
|
|||||||
IFLA_EVENT = 0x2c
|
IFLA_EVENT = 0x2c
|
||||||
IFLA_NEW_NETNSID = 0x2d
|
IFLA_NEW_NETNSID = 0x2d
|
||||||
IFLA_IF_NETNSID = 0x2e
|
IFLA_IF_NETNSID = 0x2e
|
||||||
IFLA_MAX = 0x2e
|
IFLA_MAX = 0x31
|
||||||
RT_SCOPE_UNIVERSE = 0x0
|
RT_SCOPE_UNIVERSE = 0x0
|
||||||
RT_SCOPE_SITE = 0xc8
|
RT_SCOPE_SITE = 0xc8
|
||||||
RT_SCOPE_LINK = 0xfd
|
RT_SCOPE_LINK = 0xfd
|
||||||
|
2
vendor/golang.org/x/sys/unix/ztypes_linux_mips64.go
generated
vendored
2
vendor/golang.org/x/sys/unix/ztypes_linux_mips64.go
generated
vendored
@ -496,7 +496,7 @@ const (
|
|||||||
IFLA_EVENT = 0x2c
|
IFLA_EVENT = 0x2c
|
||||||
IFLA_NEW_NETNSID = 0x2d
|
IFLA_NEW_NETNSID = 0x2d
|
||||||
IFLA_IF_NETNSID = 0x2e
|
IFLA_IF_NETNSID = 0x2e
|
||||||
IFLA_MAX = 0x2e
|
IFLA_MAX = 0x31
|
||||||
RT_SCOPE_UNIVERSE = 0x0
|
RT_SCOPE_UNIVERSE = 0x0
|
||||||
RT_SCOPE_SITE = 0xc8
|
RT_SCOPE_SITE = 0xc8
|
||||||
RT_SCOPE_LINK = 0xfd
|
RT_SCOPE_LINK = 0xfd
|
||||||
|
2
vendor/golang.org/x/sys/unix/ztypes_linux_mips64le.go
generated
vendored
2
vendor/golang.org/x/sys/unix/ztypes_linux_mips64le.go
generated
vendored
@ -496,7 +496,7 @@ const (
|
|||||||
IFLA_EVENT = 0x2c
|
IFLA_EVENT = 0x2c
|
||||||
IFLA_NEW_NETNSID = 0x2d
|
IFLA_NEW_NETNSID = 0x2d
|
||||||
IFLA_IF_NETNSID = 0x2e
|
IFLA_IF_NETNSID = 0x2e
|
||||||
IFLA_MAX = 0x2e
|
IFLA_MAX = 0x31
|
||||||
RT_SCOPE_UNIVERSE = 0x0
|
RT_SCOPE_UNIVERSE = 0x0
|
||||||
RT_SCOPE_SITE = 0xc8
|
RT_SCOPE_SITE = 0xc8
|
||||||
RT_SCOPE_LINK = 0xfd
|
RT_SCOPE_LINK = 0xfd
|
||||||
|
2
vendor/golang.org/x/sys/unix/ztypes_linux_mipsle.go
generated
vendored
2
vendor/golang.org/x/sys/unix/ztypes_linux_mipsle.go
generated
vendored
@ -494,7 +494,7 @@ const (
|
|||||||
IFLA_EVENT = 0x2c
|
IFLA_EVENT = 0x2c
|
||||||
IFLA_NEW_NETNSID = 0x2d
|
IFLA_NEW_NETNSID = 0x2d
|
||||||
IFLA_IF_NETNSID = 0x2e
|
IFLA_IF_NETNSID = 0x2e
|
||||||
IFLA_MAX = 0x2e
|
IFLA_MAX = 0x31
|
||||||
RT_SCOPE_UNIVERSE = 0x0
|
RT_SCOPE_UNIVERSE = 0x0
|
||||||
RT_SCOPE_SITE = 0xc8
|
RT_SCOPE_SITE = 0xc8
|
||||||
RT_SCOPE_LINK = 0xfd
|
RT_SCOPE_LINK = 0xfd
|
||||||
|
2
vendor/golang.org/x/sys/unix/ztypes_linux_ppc64.go
generated
vendored
2
vendor/golang.org/x/sys/unix/ztypes_linux_ppc64.go
generated
vendored
@ -497,7 +497,7 @@ const (
|
|||||||
IFLA_EVENT = 0x2c
|
IFLA_EVENT = 0x2c
|
||||||
IFLA_NEW_NETNSID = 0x2d
|
IFLA_NEW_NETNSID = 0x2d
|
||||||
IFLA_IF_NETNSID = 0x2e
|
IFLA_IF_NETNSID = 0x2e
|
||||||
IFLA_MAX = 0x2e
|
IFLA_MAX = 0x31
|
||||||
RT_SCOPE_UNIVERSE = 0x0
|
RT_SCOPE_UNIVERSE = 0x0
|
||||||
RT_SCOPE_SITE = 0xc8
|
RT_SCOPE_SITE = 0xc8
|
||||||
RT_SCOPE_LINK = 0xfd
|
RT_SCOPE_LINK = 0xfd
|
||||||
|
2
vendor/golang.org/x/sys/unix/ztypes_linux_ppc64le.go
generated
vendored
2
vendor/golang.org/x/sys/unix/ztypes_linux_ppc64le.go
generated
vendored
@ -497,7 +497,7 @@ const (
|
|||||||
IFLA_EVENT = 0x2c
|
IFLA_EVENT = 0x2c
|
||||||
IFLA_NEW_NETNSID = 0x2d
|
IFLA_NEW_NETNSID = 0x2d
|
||||||
IFLA_IF_NETNSID = 0x2e
|
IFLA_IF_NETNSID = 0x2e
|
||||||
IFLA_MAX = 0x2e
|
IFLA_MAX = 0x31
|
||||||
RT_SCOPE_UNIVERSE = 0x0
|
RT_SCOPE_UNIVERSE = 0x0
|
||||||
RT_SCOPE_SITE = 0xc8
|
RT_SCOPE_SITE = 0xc8
|
||||||
RT_SCOPE_LINK = 0xfd
|
RT_SCOPE_LINK = 0xfd
|
||||||
|
2
vendor/golang.org/x/sys/unix/ztypes_linux_s390x.go
generated
vendored
2
vendor/golang.org/x/sys/unix/ztypes_linux_s390x.go
generated
vendored
@ -496,7 +496,7 @@ const (
|
|||||||
IFLA_EVENT = 0x2c
|
IFLA_EVENT = 0x2c
|
||||||
IFLA_NEW_NETNSID = 0x2d
|
IFLA_NEW_NETNSID = 0x2d
|
||||||
IFLA_IF_NETNSID = 0x2e
|
IFLA_IF_NETNSID = 0x2e
|
||||||
IFLA_MAX = 0x2e
|
IFLA_MAX = 0x31
|
||||||
RT_SCOPE_UNIVERSE = 0x0
|
RT_SCOPE_UNIVERSE = 0x0
|
||||||
RT_SCOPE_SITE = 0xc8
|
RT_SCOPE_SITE = 0xc8
|
||||||
RT_SCOPE_LINK = 0xfd
|
RT_SCOPE_LINK = 0xfd
|
||||||
|
Loading…
Reference in New Issue
Block a user