Documentation ¶
Overview ¶
Package utils collects various services: simple operations, compression, etc.
Index ¶
- Variables
- func CompressFile(source *os.File) error
- func HumanBytes(i int64) (result string)
- func LoadConfig(filename string, config *ConfigStructure) error
- func SaveConfig(filename string, config *ConfigStructure) error
- func StrMapSortedKeys(m map[string]string) []string
- func StrMapsEqual(m1, m2 map[string]string) bool
- func StrSliceDeduplicate(s []string) []string
- func StrSliceHasItem(s []string, item string) bool
- func StrSlicesEqual(s1, s2 []string) bool
- func StrSlicesSubstract(l, r []string) []string
- func StringsIsSubset(subset, full []string, errorFmt string) error
- type ChecksumInfo
- type ChecksumWriter
- type ConfigStructure
- type GpgSigner
- type GpgVerifier
- func (g *GpgVerifier) AddKeyring(keyring string)
- func (g *GpgVerifier) ExtractClearsigned(clearsigned io.Reader) (text *os.File, err error)
- func (g *GpgVerifier) InitKeyring() error
- func (g *GpgVerifier) VerifyClearsigned(clearsigned io.Reader) error
- func (g *GpgVerifier) VerifyDetachedSignature(signature, cleartext io.Reader) error
- type S3PublishRoot
- type Signer
- type Verifier
Constants ¶
This section is empty.
Variables ¶
var Config = ConfigStructure{ RootDir: filepath.Join(os.Getenv("HOME"), ".aptly"), DownloadConcurrency: 4, DownloadLimit: 0, Architectures: []string{}, DepFollowSuggests: false, DepFollowRecommends: false, DepFollowAllVariants: false, DepFollowSource: false, GpgDisableSign: false, GpgDisableVerify: false, DownloadSourcePackages: false, PpaDistributorID: "ubuntu", PpaCodename: "", S3PublishRoots: map[string]S3PublishRoot{}, }
Config is configuration for aptly, shared by all modules
Functions ¶
func CompressFile ¶
CompressFile compresses file specified by source to .gz & .bz2
It uses internal gzip and external bzip2, see: https://code.google.com/p/go/issues/detail?id=4828
func HumanBytes ¶ added in v0.5.1
HumanBytes converts bytes to human readable string
func LoadConfig ¶
func LoadConfig(filename string, config *ConfigStructure) error
LoadConfig loads configuration from json file
func SaveConfig ¶
func SaveConfig(filename string, config *ConfigStructure) error
SaveConfig write configuration to json file
func StrMapSortedKeys ¶
StrMapSortedKeys returns keys of map[string]string sorted
func StrMapsEqual ¶
StrMapsEqual compares two map[string]string
func StrSliceDeduplicate ¶
StrSliceDeduplicate removes dups in slice
func StrSliceHasItem ¶
StrSliceHasItem checks item for presence in slice
func StrSlicesEqual ¶
StrSlicesEqual compares two slices for equality
func StrSlicesSubstract ¶
StrSlicesSubstract finds all the strings which are in l but not in r, both slices shoult be sorted
func StringsIsSubset ¶
StringsIsSubset checks that subset is strict subset of full, and returns error formatted with errorFmt otherwise
Types ¶
type ChecksumInfo ¶
ChecksumInfo represents checksums for a single file
func ChecksumsForFile ¶
func ChecksumsForFile(path string) (ChecksumInfo, error)
ChecksumsForFile generates size, MD5, SHA1 & SHA256 checksums for given file
type ChecksumWriter ¶
type ChecksumWriter struct {
// contains filtered or unexported fields
}
ChecksumWriter is a writer that does checksum calculation on the fly passing data to real writer
func NewChecksumWriter ¶
func NewChecksumWriter() *ChecksumWriter
NewChecksumWriter creates checksum calculator for given writer w
func (*ChecksumWriter) Sum ¶
func (c *ChecksumWriter) Sum() ChecksumInfo
Sum returns caculated ChecksumInfo
type ConfigStructure ¶
type ConfigStructure struct { RootDir string `json:"rootDir"` DownloadConcurrency int `json:"downloadConcurrency"` DownloadLimit int64 `json:"downloadSpeedLimit"` Architectures []string `json:"architectures"` DepFollowSuggests bool `json:"dependencyFollowSuggests"` DepFollowRecommends bool `json:"dependencyFollowRecommends"` DepFollowAllVariants bool `json:"dependencyFollowAllVariants"` DepFollowSource bool `json:"dependencyFollowSource"` GpgDisableSign bool `json:"gpgDisableSign"` GpgDisableVerify bool `json:"gpgDisableVerify"` DownloadSourcePackages bool `json:"downloadSourcePackages"` PpaDistributorID string `json:"ppaDistributorID"` PpaCodename string `json:"ppaCodename"` S3PublishRoots map[string]S3PublishRoot `json:"S3PublishEndpoints"` }
ConfigStructure is structure of main configuration
type GpgSigner ¶
type GpgSigner struct {
// contains filtered or unexported fields
}
GpgSigner is implementation of Signer interface using gpg
func (*GpgSigner) DetachedSign ¶
DetachedSign signs file with detached signature in ASCII format
func (*GpgSigner) SetKeyRing ¶
SetKeyRing allows to set custom keyring and secretkeyring
type GpgVerifier ¶
type GpgVerifier struct {
// contains filtered or unexported fields
}
GpgVerifier is implementation of Verifier interface using gpgv
func (*GpgVerifier) AddKeyring ¶
func (g *GpgVerifier) AddKeyring(keyring string)
AddKeyring adds custom keyring to GPG parameters
func (*GpgVerifier) ExtractClearsigned ¶
ExtractClearsigned extracts cleartext from clearsigned file WITHOUT signature verification
func (*GpgVerifier) InitKeyring ¶
func (g *GpgVerifier) InitKeyring() error
InitKeyring verifies that gpg is installed and some keys are trusted
func (*GpgVerifier) VerifyClearsigned ¶
func (g *GpgVerifier) VerifyClearsigned(clearsigned io.Reader) error
VerifyClearsigned verifies clearsigned file using gpgv
func (*GpgVerifier) VerifyDetachedSignature ¶
func (g *GpgVerifier) VerifyDetachedSignature(signature, cleartext io.Reader) error
VerifyDetachedSignature verifies combination of signature and cleartext using gpgv
type S3PublishRoot ¶ added in v0.7.1
type S3PublishRoot struct { Region string `json:"region"` Bucket string `json:"bucket"` AccessKeyID string `json:"awsAccessKeyID"` SecretAccessKey string `json:"awsSecretAccessKey"` Prefix string `json:"prefix"` ACL string `json:"acl"` }
S3PublishRoot describes single S3 publishing entry point
type Signer ¶
type Signer interface { Init() error SetKey(keyRef string) SetKeyRing(keyring, secretKeyring string) DetachedSign(source string, destination string) error ClearSign(source string, destination string) error }
Signer interface describes facility implementing signing of files
type Verifier ¶
type Verifier interface { InitKeyring() error AddKeyring(keyring string) VerifyDetachedSignature(signature, cleartext io.Reader) error VerifyClearsigned(clearsigned io.Reader) error ExtractClearsigned(clearsigned io.Reader) (text *os.File, err error) }
Verifier interface describes signature verification factility