func (manifest DistributionManifest) GetLayerDigests() []Digest {
	digests := []Digest{}
	for _, descriptor := range manifest.Layers {
		digests = append(digests, descriptor.Digest)
	}
	return digests
}
GetLayerDigests returns the list of layer digests of the image.
package image
import (
	"encoding/json"
	"fmt"
	"mime"
)
const (
	MediaTypeManifest = "application/vnd.docker.distribution.manifest.v2+json"
	MediaTypeConfig = "application/vnd.docker.container.image.v1+json"
	MediaTypeLayer = "application/vnd.docker.image.rootfs.diff.tar.gzip"
)
type DistributionManifest struct {
	SchemaVersion int `json:"schemaVersion"`
	MediaType string `json:"mediaType,omitempty"`
	Config Descriptor `json:"config"`
	Layers []Descriptor `json:"layers"`
}
type Descriptor struct {
	MediaType string `json:"mediaType,omitempty"`
	Size int64 `json:"size,omitempty"`
	Digest Digest `json:"digest,omitempty"`
}
type DigestPair struct {
	TarDigest      Digest
	GzipDescriptor Descriptor
}
func UnmarshalDistributionManifest(ctHeader string, p []byte) (DistributionManifest, Descriptor, error) {
	var mediatype string
	if ctHeader != "" {
		var err error
		mediatype, _, err = mime.ParseMediaType(ctHeader)
		if err != nil {
			return DistributionManifest{}, Descriptor{}, err
		}
	}
	if mediatype != MediaTypeManifest {
		return DistributionManifest{},
			Descriptor{},
			fmt.Errorf("unsupported manifest mediatype: %s", mediatype)
	}
	manifest := DistributionManifest{}
	if err := json.Unmarshal(p, &manifest); err != nil {
		return DistributionManifest{}, Descriptor{}, err
	}
	digest, err := NewDigester().FromBytes(p)
	if err != nil {
		return DistributionManifest{}, Descriptor{}, err
	}
	return manifest, Descriptor{Digest: digest, Size: int64(len(p)), MediaType: MediaTypeManifest}, nil
}