Documentation ¶
Index ¶
- Constants
- Variables
- func Contain(obj interface{}, target interface{}) (bool, error)
- func DecodeBasicAuth(authorization string) (username string, password string, err error)
- func EncodeBasicAuth(username string, password string) string
- func GenerateRSAKeyPair(bits int) ([]byte, []byte, error)
- func GetFileSize(path string) (int64, error)
- func IsDirExist(path string) bool
- func IsFileExist(filename string) bool
- func IsImageCached(imageName string) (bool, error)
- func MD5(key string) string
- func PullImage(imageName string) error
- func RSADecrypt(keyBytes []byte, contentBytes []byte) ([]byte, error)
- func RSAEncrypt(keyBytes []byte, contentBytes []byte) ([]byte, error)
- func SHA256Sign(keyBytes []byte, contentBytes []byte) ([]byte, error)
- func SHA256Verify(keyBytes []byte, contentBytes []byte, signBytes []byte) error
- func StartContainer(config container.Config, hostConfig container.HostConfig, containerName string) error
- func TokenMarshal(v interface{}, key string) ([]byte, error)
- func TokenUnmarshal(token string, key string, v interface{}) error
- func ValidatePassword(password string) error
- type EncryptMethod
- type Meta
- type MetaItem
- func (a MetaItem) Compare(b MetaItem) int
- func (a MetaItem) GetCreated() time.Time
- func (a MetaItem) GetEncryption() EncryptMethod
- func (a MetaItem) GetExpired() time.Time
- func (a MetaItem) GetHash() string
- func (a MetaItem) IsExpired() bool
- func (a *MetaItem) SetCreated(t time.Time)
- func (a *MetaItem) SetEncryption(method EncryptMethod)
- func (a *MetaItem) SetExpired(t time.Time)
Constants ¶
const ( EncryptRSA = "rsa" EncryptNone = "none" EncryptNotSupported = "not-supported" )
Variables ¶
var (
ErrorsNoDockerClient = errors.New("No docker client detected")
)
Functions ¶
func DecodeBasicAuth ¶
DecodeBasicAuth decode a base64 string into a username and a password
func EncodeBasicAuth ¶
EncodeBasicAuth encode username and password into a base64 string
func GenerateRSAKeyPair ¶
GenerateRSAKeyPair generate a private key and a public key
func GetFileSize ¶
func IsFileExist ¶
IsFileExist checks if a file url is an exist file
func IsImageCached ¶
func RSADecrypt ¶
RSADecrypt decrypts content by a private key
func RSAEncrypt ¶
RSAEncrypt encrypts a content by a public key
func SHA256Sign ¶
SHA256Sign signs a content by a private key
func SHA256Verify ¶
SHA256Verify verifies if a content is valid by a signed data an a public key
func StartContainer ¶
func StartContainer(config container.Config, hostConfig container.HostConfig, containerName string) error
StartContainer start and create a container
func TokenMarshal ¶
TokenMarshal encrypts data in `v`
func TokenUnmarshal ¶
TokenUnmarshal decryptes a token and save the original data to `v`.
func ValidatePassword ¶
ValidatePassword verifies if a password is valid
Types ¶
type EncryptMethod ¶
type EncryptMethod string
func NewEncryptMethod ¶
func NewEncryptMethod(method string) EncryptMethod
type MetaItem ¶
type MetaItem struct { Name string Hash string Method EncryptMethod Created time.Time Expired time.Time }
MetaItem represents the meta information of a repository app/vm/image
func GenerateMetaItem ¶
GenerateMetaItem generates a meta data by a file name and file content
func (MetaItem) GetCreated ¶
GetCreated returns the created time of an application
func (MetaItem) GetEncryption ¶
func (a MetaItem) GetEncryption() EncryptMethod
func (MetaItem) GetExpired ¶
GetExpired get the expired time of an application
func (*MetaItem) SetCreated ¶
SetCreated set the created time of an application
func (*MetaItem) SetEncryption ¶
func (a *MetaItem) SetEncryption(method EncryptMethod)
func (*MetaItem) SetExpired ¶
SetExpired set the expired time of an application