Documentation
¶
Index ¶
- Variables
- func AddSecretEncryptKeys(secret ...string)
- func AesDecrypt(crypted, key []byte) ([]byte, error)
- func AesEncrypt(origData, key []byte) ([]byte, error)
- func ClearList(l *list.List)
- func CollectMapKeys(m map[string]string) []string
- func ConvertLogFileSize(s int) int
- func ConvertLogLevel(levelString string) logger.Level
- func ConvertRollInterval(rollString string) int
- func CreateAlias(fid string, instanceId string, isPrivate bool, ts time.Time) string
- func CreateCRCFileID(instanceId string, crc32 string, fileSize uint64) string
- func CreateCrc32Hash() hash.Hash32
- func CreateMD5FileID(instanceId string, md5 string) string
- func CreateMd5Hash() hash.Hash
- func CreateRandNumber(max int) int
- func DefaultAdvertiseAddress()
- func DefaultDataDir(mode common.BootMode) string
- func DefaultLogDir() string
- func ExchangeEnvValue(key string, then func(envValue string))
- func ExistsFile(fInfo *common.FileInfo) bool
- func FixZeros(i int, width int) string
- func GenerateDecKey(secret string)
- func GenerateToken(fileId, secret string, expireTimestamp string) string
- func GetCrc32HashString(h hash.Hash32) string
- func GetEnv(key string) string
- func GetMd5HashString(h hash.Hash) string
- func GetSecrets() (map[string]string, error)
- func HttpFileNotFoundError(w http.ResponseWriter)
- func HttpForbiddenError(w http.ResponseWriter, message string)
- func HttpInternalServerError(w http.ResponseWriter, message string)
- func HttpWriteResponse(writer http.ResponseWriter, statusCode int, message string)
- func InitialConfigMap(path string)
- func LoadConfig(c string, mode common.BootMode, container interface{}) error
- func LoadInstanceData() string
- func PKCS7Padding(ciphertext []byte, blockSize int) []byte
- func PKCS7UnPadding(origData []byte) []byte
- func ParseAlias(alias, currentSecret string) (fileInfo *common.FileInfo, secret string, err error)
- func ParseServer(s string) (*common.Server, error)
- func ParseServers(servers string) ([]*common.Server, error)
- func PrepareDirs(tmpDir string) error
- func PrintLogo()
- func StoreSecrets(instanceId string, secret ...string) error
- func StringListExists(list *list.List, ele string) bool
- func ValidateAgentConfig(c *common.AgentConfig) error
- func ValidateClientConfig(c *common.ClientConfig) error
- func ValidateStorageConfig(c *common.StorageConfig) error
- func ValidateTrackerConfig(c *common.TrackerConfig) error
- func WriteConfig(c string, container interface{}) error
Constants ¶
This section is empty.
Variables ¶
var (
ErrInvalidFileId = errors.New("invalid fileId")
)
Functions ¶
func AddSecretEncryptKeys ¶
func AddSecretEncryptKeys(secret ...string)
AddSecretEncryptKeys adds all history secrets of all storage servers.
func AesDecrypt ¶
func AesEncrypt ¶
func CollectMapKeys ¶
func ConvertLogFileSize ¶
func ConvertLogLevel ¶
func ConvertRollInterval ¶
func CreateAlias ¶
CreateAlias create an 86 bytes long, self description alias name from file meta info.
Alias name contains file's path, instanceId, private flag, timestamp and a random number, these information combines with '|' and encrypt using AES.
Alias name is a little bit long...
func CreateCRCFileID ¶
CreateCRCFileID creates a file id by instance, crc, file length, timestamp and random int
func CreateCrc32Hash ¶
func CreateMD5FileID ¶
CreateCRCFileID creates a file id by instance, md5, timestamp and random int
func CreateMd5Hash ¶
func CreateRandNumber ¶
CreateRandNumber create a random int value.
func DefaultAdvertiseAddress ¶
func DefaultAdvertiseAddress()
func DefaultDataDir ¶
DefaultLogDir returns default system log directory.
func DefaultLogDir ¶
func DefaultLogDir() string
DefaultLogDir returns default system log directory.
func ExchangeEnvValue ¶
if these param exist in system env , then replace it with system env
func ExistsFile ¶
func GenerateDecKey ¶
func GenerateDecKey(secret string)
GenerateDecKey generates aes encrypt key for current usage.
func GenerateToken ¶
GenerateToken generates token for http file download.
func GetCrc32HashString ¶
func GetMd5HashString ¶
func GetSecrets ¶
func HttpFileNotFoundError ¶
func HttpFileNotFoundError(w http.ResponseWriter)
func HttpForbiddenError ¶
func HttpForbiddenError(w http.ResponseWriter, message string)
func HttpInternalServerError ¶
func HttpInternalServerError(w http.ResponseWriter, message string)
func HttpWriteResponse ¶
func HttpWriteResponse(writer http.ResponseWriter, statusCode int, message string)
HttpWriteResponse writes error response.
func InitialConfigMap ¶
func InitialConfigMap(path string)
func LoadConfig ¶
LoadConfig loads config from config file.
func LoadInstanceData ¶
func LoadInstanceData() string
LoadInstanceData load old instance id from data dir. If there is no old instance id before, create a new instance id for this data dir.
func PKCS7Padding ¶
func PKCS7UnPadding ¶
func ParseAlias ¶
ParseAlias parses file info from file alias name, and returns *common.FileInfo
func ParseServers ¶
ParseServers parses server infos from a string.
func PrepareDirs ¶
func StoreSecrets ¶
StoreSecrets stores secrets to config bucket.
func StringListExists ¶
StringListExists checks if a string list contains the string.
func ValidateAgentConfig ¶
func ValidateAgentConfig(c *common.AgentConfig) error
ValidateAgentConfig validates agent config.
func ValidateClientConfig ¶
func ValidateClientConfig(c *common.ClientConfig) error
ValidateStorageConfig validates storage config.
func ValidateStorageConfig ¶
func ValidateStorageConfig(c *common.StorageConfig) error
ValidateStorageConfig validates storage config.
func ValidateTrackerConfig ¶
func ValidateTrackerConfig(c *common.TrackerConfig) error
ValidateTrackerConfig validates tracker config.
func WriteConfig ¶
WriteConfig writes config to file.
Types ¶
This section is empty.