Documentation ¶
Index ¶
- Constants
- Variables
- func GetCommand(id uint32) (interface{}, bool)
- type AccountUsage
- type AccountUsage2
- type AttributeStream
- type ChangeDirAttributes
- type CreateDirectory
- type CreateDirectory2
- type DeleteDirectory
- type DeleteFile
- type DirStream
- type EntryStream
- type Error
- type FileBlockIndex
- type FileBlockIndexEntry
- type FileStreamFormat
- type Finished
- type GetAccountUsage
- type GetAccountUsage2
- type GetBlockIndexByID
- type GetBlockIndexByName
- type GetFile
- type GetIsAlive
- type GetObject
- type GetObjectName
- type Header
- type IsAlive
- type ListDirectory
- type Login
- type LoginConfirmed
- type MoveObject
- type ObjectName
- type SetClientStoreMarker
- type SetReplacementFileAttributes
- type StoreFile
- type Success
- type UndeleteDirectory
- type UndeleteFile
- type Version
Constants ¶
const HandshakeLen = 32
const STREAM_TYPE = 0xffffffff
Variables ¶
var Commands = map[string][2]uint32{
"proto.Error": {0, 0},
"proto.Version": {1, 1},
"proto.Login": {2, 3},
"proto.LoginConfirmed": {3, 0},
"proto.Finished": {4, 4},
"proto.Success": {5, 0},
"proto.SetClientStoreMarker": {6, 0},
"proto.GetObject": {10, 5},
"proto.MoveObject": {11, 0},
"proto.GetObjectName": {12, 13},
"proto.ObjectName": {13, 0},
"proto.CreateDirectory": {20, 0},
"proto.ListDirectory": {21, 5},
"proto.ChangeDirAttributes": {22, 0},
"proto.DeleteDirectory": {23, 0},
"proto.UndeleteDirectory": {24, 0},
"proto.StoreFile": {30, 5},
"proto.GetFile": {31, 5},
"proto.SetReplacementFileAttributes": {32, 0},
"proto.DeleteFile": {33, 5},
"proto.GetBlockIndexByID": {34, 5},
"proto.GetBlockIndexByName": {35, 5},
"proto.UndeleteFile": {36, 0},
"proto.GetAccountUsage": {40, 41},
"proto.AccountUsage": {41, 0},
"proto.GetIsAlive": {42, 0},
"proto.IsAlive": {43, 0},
"proto.GetAccountUsage2": {44, 45},
"proto.AccountUsage2": {45, 0},
"proto.CreateDirectory2": {46, 0},
}
This map contains commands with their responses.
var Handshake = "Box-Backup:v=C"
Functions ¶
func GetCommand ¶
Types ¶
type AccountUsage ¶
type AccountUsage2 ¶
type AccountUsage2 struct { //String AccountName Padding uint32 // maybe number of accounts? AccountEnabled bool ClientStoreMarker int64 BlockSize int32 LastObjectIDUsed int64 BlocksUsed int64 BlocksInCurrentFiles int64 BlocksInOldFiles int64 BlocksInDeletedFiles int64 BlocksInDirectories int64 BlocksSoftLimit int64 BlocksHardLimit int64 NumCurrentFiles int64 NumOldFiles int64 NumDeletedFiles int64 NumDirectories int64 }
type AttributeStream ¶
type AttributeStream struct { AttributeType int32 UID uint32 GID uint32 ModificationTime uint64 AttrModificationTime uint64 UserDefinedFlags uint32 FileGenerationNumber uint32 Mode uint16 }
BackupClientFileAttributes
type ChangeDirAttributes ¶
type CreateDirectory ¶
------------------------------------------------------------------------------------- # Directory commands # -----------------------------------------------------------------------------------
type CreateDirectory2 ¶
type DeleteDirectory ¶
type DeleteDirectory struct {
ObjectID int64
}
type DeleteFile ¶
type DeleteFile struct {
InDirectory int64
}
type EntryStream ¶
type FileBlockIndex ¶
type FileBlockIndex struct { // #define OBJECTMAGIC_FILE_BLOCKS_MAGIC_VALUE_V1 0x62696478 MagicValue int32 // different magic value OtherFileID int64 // the file ID of the 'other' file which may be referenced by the index EntryIVBase [8]byte // base value for block IV NumBlocks int64 // repeat of value in file header }
type FileBlockIndexEntry ¶
type FileBlockIndexEntry struct { Size int32 // size in clear WeakChecksum uint32 // weak, rolling checksum StrongChecksum [16]byte //StrongChecksum[MD5Digest::DigestLength] uint8_t }
FileBlockIndex is followed by the blocks, where each FileBlockIndexEntry is prefixed by the 8 byte header, which is either size or a block number in another file. typedef struct
{ union { int64_t mEncodedSize; // size encoded, if > 0 int64_t mOtherBlockIndex; // 0 - block number in other file, if <= 0 }; uint8_t mEnEnc[sizeof(file_BlockIndexEntryEnc)]; // Encoded section } file_BlockIndexEntry;
type FileStreamFormat ¶
type FileStreamFormat struct { // #define OBJECTMAGIC_FILE_MAGIC_VALUE_V1 0x66696C65 // #define OBJECTMAGIC_DIR_MAGIC_VALUE 0x4449525F MagicValue int32 // also the version number NumBlocks int64 // number of blocks contained in the file ContainerID int64 ModificationTime int64 MaxBlockClearSize int32 // Maximum clear size that can be expected for a block Options int32 // bitmask of options used }
The stream contains this header with a magic marker specifying whether this is a file or directory.
type GetAccountUsage ¶
type GetAccountUsage struct { }
type GetAccountUsage2 ¶
type GetAccountUsage2 struct { }
type GetBlockIndexByID ¶
type GetBlockIndexByID struct {
ObjectID int64
}
type GetBlockIndexByName ¶
type GetBlockIndexByName struct {
InDirectory int64
}
type GetIsAlive ¶
type GetIsAlive struct { }
type GetObject ¶
type GetObject struct {
ObjectID int64
}
GetObject
Returns the object (file or directory) in store format, e.g. with file data first, followed by block index appended at the end. This means that whole encrypted stream needs to be fetched before accessing the block index.
type GetObjectName ¶
type ListDirectory ¶
type LoginConfirmed ¶
type MoveObject ¶
type ObjectName ¶
type SetClientStoreMarker ¶
type SetClientStoreMarker struct {
ClientStoreMarker int64
}
type UndeleteDirectory ¶
type UndeleteDirectory struct {
ObjectID int64
}