Documentation ¶
Index ¶
- Constants
- func CollectImageFileMap(rootPath string, fmap map[string]string) (int, error)
- func CreateImagePath(uid string) string
- func DownloadFromUrl(url, fileName string) error
- func GetAwsFuncPackages(fileName string) ([]*share.ScanAppPackage, error)
- func NormalizeImageCmd(cmd string) string
- func ParseImageCmds(cmds []string) (bool, bool, bool)
- func ParseImageName(image string) (string, string, string, error)
- func ParseRegistryURI(ur string) (string, error)
- func ScanErrorToStr(e share.ScanErrorCode) string
- func SelectiveFilesFromPath(rootPath string, maxFileSize int64, selected func(string) bool) (map[string]string, error)
- type AppPackage
- type ImageInfo
- type ImageManifest
- type LayerFiles
- type LayerMetadata
- type RegClient
- func (rc *RegClient) Alive() (uint, error)
- func (rc *RegClient) DownloadRemoteImage(ctx context.Context, name, imgPath string, layers []string, ...) (map[string]*LayerFiles, share.ScanErrorCode)
- func (rc *RegClient) GetImageInfo(ctx context.Context, name, tag string) (*ImageInfo, share.ScanErrorCode)
- type ScanApps
- type ScanUtil
- func (s *ScanUtil) GetLocalImageMeta(ctx context.Context, repository, tag, rtSock string) (*container.ImageMeta, share.ScanErrorCode)
- func (s *ScanUtil) GetRunningPackages(id string, objType share.ScanObjectType, pid int, kernel string) ([]byte, share.ScanErrorCode)
- func (s *ScanUtil) LoadLocalImage(ctx context.Context, repository, tag, rtSock, imgPath string) (*ImageInfo, map[string]*LayerFiles, share.ScanErrorCode)
Constants ¶
View Source
const ( AppFileName = "apps_pkg" WPVerFileSuffix = "wp-includes/version.php" )
View Source
const ImageWorkingPath = "/tmp/images"
Variables ¶
This section is empty.
Functions ¶
func CollectImageFileMap ¶
CollectImageFileMap creates a virtual file map for a image to save real copy efforts
func CreateImagePath ¶
Get an unique image folder under /tmp, return "" if can not allocate a good folder
func GetAwsFuncPackages ¶
func GetAwsFuncPackages(fileName string) ([]*share.ScanAppPackage, error)
func NormalizeImageCmd ¶
func ParseImageName ¶
Not a strict parsing, if the input is wrong, we just cannot get the image.
func ParseRegistryURI ¶
func ScanErrorToStr ¶
func ScanErrorToStr(e share.ScanErrorCode) string
Types ¶
type AppPackage ¶
type ImageManifest ¶
type LayerFiles ¶
type LayerFiles struct { Size int64 Pkgs map[string][]byte Apps map[string][]AppPackage }
type LayerMetadata ¶
type LayerMetadata struct { ID string `json:"id"` Parent string `json:"parent"` Created time.Time `json:"created"` Container string `json:"container"` ContainerConfig struct { Hostname string `json:"Hostname"` Domainname string `json:"Domainname"` User string `json:"User"` Env []string `json:"Env"` Cmd []string `json:"Cmd"` Labels map[string]string `json:"Labels"` } `json:"container_config"` Config struct { Hostname string `json:"Hostname"` Domainname string `json:"Domainname"` User string `json:"User"` Env []string `json:"Env"` Cmd []string `json:"Cmd"` ArgsEscaped bool `json:"ArgsEscaped"` Image string `json:"Image"` WorkingDir string `json:"WorkingDir"` Labels map[string]string `json:"Labels"` } `json:"config"` Architecture string `json:"architecture"` Os string `json:"os"` }
type RegClient ¶
func NewRegClient ¶
func (*RegClient) DownloadRemoteImage ¶
func (rc *RegClient) DownloadRemoteImage(ctx context.Context, name, imgPath string, layers []string, sizes map[string]int64) (map[string]*LayerFiles, share.ScanErrorCode)
this function will be called at scanner side
func (*RegClient) GetImageInfo ¶
type ScanApps ¶
type ScanApps struct {
// contains filtered or unexported fields
}
func NewScanApps ¶
type ScanUtil ¶
type ScanUtil struct {
// contains filtered or unexported fields
}
func NewScanUtil ¶
func NewScanUtil(sys *system.SystemTools) *ScanUtil
Scan normally doesn't require contaiener runtime socket, except for local image scan
func (*ScanUtil) GetLocalImageMeta ¶
func (*ScanUtil) GetRunningPackages ¶
func (s *ScanUtil) GetRunningPackages(id string, objType share.ScanObjectType, pid int, kernel string) ([]byte, share.ScanErrorCode)
func (*ScanUtil) LoadLocalImage ¶
func (s *ScanUtil) LoadLocalImage(ctx context.Context, repository, tag, rtSock, imgPath string) (*ImageInfo, map[string]*LayerFiles, share.ScanErrorCode)
Click to show internal directories.
Click to hide internal directories.