Documentation ¶
Index ¶
- Constants
- Variables
- type BinReader
- func (r *BinReader) Count() uint64
- func (r *BinReader) Error() error
- func (r *BinReader) ReadByteAsInt() int
- func (r *BinReader) ReadByteAsShort() int16
- func (r *BinReader) ReadBytesByLength() []byte
- func (r *BinReader) ReadDate() time.Time
- func (r *BinReader) ReadIntSpl() int
- func (r *BinReader) ReadNBytes(len int) []byte
- func (r *BinReader) ReadPu32() int64
- func (r *BinReader) ReadString() string
- func (r *BinReader) ReadULong() uint64
- type BinWriter
- func (w *BinWriter) Bytes() []byte
- func (w *BinWriter) Reader() io.Reader
- func (w *BinWriter) Write(buf []byte)
- func (w *BinWriter) WritePu16(val int)
- func (w *BinWriter) WritePu32(val int64)
- func (w *BinWriter) WritePu64(val int64)
- func (w *BinWriter) WriteString(str string)
- func (w *BinWriter) WriteWithLength(buf []byte)
- type CleanupResponse
- type FileErrorResponse
- type FolderInfoResponse
- type GenericBodyResponse
- type GenericResponse
- type ItemInfoResponse
- type ListItem
- type ServerErrorResponse
- type UserInfoResponse
Constants ¶
const ( BinContentType = "application/x-www-form-urlencoded" TreeIDLength = 12 DunnoNodeIDLength = 16 )
BIN protocol constants
const ( OperationAddFile = 103 // 0x67 OperationRename = 105 // 0x69 OperationCreateFolder = 106 // 0x6A OperationFolderList = 117 // 0x75 // TODO investigate opcodes below Operation154MaybeItemInfo = 154 // 0x9A Operation102MaybeAbout = 102 // 0x66 Operation104MaybeDelete = 104 // 0x68 )
Operations in binary protocol
const ( MkdirResultOK = 0 MkdirResultSourceNotExists = 1 MkdirResultAlreadyExists = 4 MkdirResultExistsDifferentCase = 9 MkdirResultInvalidName = 10 MkdirResultFailed254 = 254 )
CreateDir protocol constants
const ( MoveResultOK = 0 MoveResultSourceNotExists = 1 MoveResultFailed002 = 2 MoveResultAlreadyExists = 4 MoveResultFailed005 = 5 MoveResultFailed254 = 254 )
Move result codes
const ( AddResultOK = 0 AddResultError01 = 1 AddResultDunno04 = 4 AddResultWrongPath = 5 AddResultNoFreeSpace = 7 AddResultDunno09 = 9 AddResultInvalidName = 10 AddResultNotModified = 12 AddResultFailedA = 253 AddResultFailedB = 254 )
AddFile result codes
const ( ListOptTotalSpace = 1 ListOptDelete = 2 ListOptFingerprint = 4 ListOptUnknown8 = 8 ListOptUnknown16 = 16 ListOptFolderSize = 32 ListOptUsedSpace = 64 ListOptUnknown128 = 128 ListOptUnknown256 = 256 )
List request options
const ( ListParseDone = 0 ListParseReadItem = 1 ListParsePin = 2 ListParsePinUpper = 3 ListParseUnknown15 = 15 )
List parse flags
const ( ListResultOK = 0 ListResultNotExists = 1 ListResultDunno02 = 2 ListResultDunno03 = 3 ListResultAlreadyExists04 = 4 ListResultDunno05 = 5 ListResultDunno06 = 6 ListResultDunno07 = 7 ListResultDunno08 = 8 ListResultAlreadyExists09 = 9 ListResultDunno10 = 10 ListResultDunno11 = 11 ListResultDunno12 = 12 ListResultFailedB = 253 ListResultFailedA = 254 )
List operation results
const ( ListItemMountPoint = 0 ListItemFile = 1 ListItemFolder = 2 )
Directory item types
const ( APIServerURL = "https://cloud.mail.ru" PublicLinkURL = "https://cloud.mail.ru/public/" DispatchServerURL = "https://dispatcher.cloud.mail.ru" OAuthURL = "https://o2.mail.ru/token" OAuthClientID = "cloud-win" )
M1 protocol constants and structures
const ListOptDefaults = ListOptUnknown128 | ListOptUnknown256 | ListOptFolderSize | ListOptTotalSpace | ListOptUsedSpace
ListOptDefaults ...
Variables ¶
var ( ErrorPrematureEOF = errors.New("Premature EOF") ErrorInvalidLength = errors.New("Invalid length") ErrorZeroTerminate = errors.New("String must end with zero") )
protocol errors
Functions ¶
This section is empty.
Types ¶
type BinReader ¶
type BinReader struct {
// contains filtered or unexported fields
}
BinReader is a binary protocol reader helper
func NewBinReader ¶
NewBinReader creates a binary protocol reader helper
func (*BinReader) ReadByteAsInt ¶
ReadByteAsInt reads a single byte as uint32, returns -1 for EOF or errors
func (*BinReader) ReadByteAsShort ¶
ReadByteAsShort reads a single byte as uint16, returns -1 for EOF or errors
func (*BinReader) ReadBytesByLength ¶
ReadBytesByLength reads buffer length and its bytes
func (*BinReader) ReadIntSpl ¶
ReadIntSpl reads two bytes as little-endian uint16, returns -1 for EOF or errors
func (*BinReader) ReadNBytes ¶
ReadNBytes reads given number of bytes, returns invalid data for EOF or errors
func (*BinReader) ReadString ¶
ReadString reads a zero-terminated string with length
type BinWriter ¶
type BinWriter struct {
// contains filtered or unexported fields
}
BinWriter is a binary protocol writer
func (*BinWriter) WritePu64 ¶
WritePu64 writes an unsigned (actually, signed) long as unsigned varint
func (*BinWriter) WriteString ¶
WriteString writes a zero-terminated string
func (*BinWriter) WriteWithLength ¶
WriteWithLength writes a byte buffer prepended with its length as varint
type CleanupResponse ¶
type CleanupResponse struct { Email string `json:"email"` Time int64 `json:"time"` StatusStr string `json:"status"` }
CleanupResponse ...
type FileErrorResponse ¶
type FileErrorResponse struct { Body struct { Home struct { Value string `json:"value"` Error string `json:"error"` } `json:"home"` } `json:"body"` Status int `json:"status"` Account string `json:"email,omitempty"` Time int64 `json:"time,omitempty"` Message string // non-json, calculated field }
FileErrorResponse represents erroneous API response for a file
func (*FileErrorResponse) Error ¶
func (e *FileErrorResponse) Error() string
type FolderInfoResponse ¶
type FolderInfoResponse struct { Body struct { Count struct { Folders int `json:"folders"` Files int `json:"files"` } `json:"count"` Tree string `json:"tree"` Name string `json:"name"` Grev int `json:"grev"` Size int64 `json:"size"` Sort struct { Order string `json:"order"` Type string `json:"type"` } `json:"sort"` Kind string `json:"kind"` Rev int `json:"rev"` Type string `json:"type"` Home string `json:"home"` List []ListItem `json:"list"` } `json:"body,omitempty"` Time int64 `json:"time"` Status int `json:"status"` Email string `json:"email"` }
FolderInfoResponse ...
type GenericBodyResponse ¶
type GenericBodyResponse struct { Email string `json:"email"` Body string `json:"body"` Time int64 `json:"time"` Status int `json:"status"` }
GenericBodyResponse ...
type GenericResponse ¶
type GenericResponse struct { Email string `json:"email"` Time int64 `json:"time"` Status int `json:"status"` }
GenericResponse ...
type ItemInfoResponse ¶
type ItemInfoResponse struct { Email string `json:"email"` Body ListItem `json:"body"` Time int64 `json:"time"` Status int `json:"status"` }
ItemInfoResponse ...
type ListItem ¶
type ListItem struct { Count struct { Folders int `json:"folders"` Files int `json:"files"` } `json:"count,omitempty"` Kind string `json:"kind"` Type string `json:"type"` Name string `json:"name"` Home string `json:"home"` Size int64 `json:"size"` Mtime uint64 `json:"mtime,omitempty"` Hash string `json:"hash,omitempty"` VirusScan string `json:"virus_scan,omitempty"` Tree string `json:"tree,omitempty"` Grev int `json:"grev,omitempty"` Rev int `json:"rev,omitempty"` }
ListItem ...
type ServerErrorResponse ¶
type ServerErrorResponse struct { Message string `json:"body"` Time int64 `json:"time"` Status int `json:"status"` }
ServerErrorResponse represents erroneous API response.
func (*ServerErrorResponse) Error ¶
func (e *ServerErrorResponse) Error() string
type UserInfoResponse ¶
type UserInfoResponse struct { Body struct { AccountType string `json:"account_type"` AccountVerified bool `json:"account_verified"` Cloud struct { Beta struct { Allowed bool `json:"allowed"` Asked bool `json:"asked"` } `json:"beta"` Billing struct { ActiveCostID string `json:"active_cost_id"` ActiveRateID string `json:"active_rate_id"` AutoProlong bool `json:"auto_prolong"` Basequota int64 `json:"basequota"` Enabled bool `json:"enabled"` Expires int `json:"expires"` Prolong bool `json:"prolong"` Promocodes struct { } `json:"promocodes"` Subscription []interface{} `json:"subscription"` Version string `json:"version"` } `json:"billing"` Bonuses struct { CameraUpload bool `json:"camera_upload"` Complete bool `json:"complete"` Desktop bool `json:"desktop"` Feedback bool `json:"feedback"` Links bool `json:"links"` Mobile bool `json:"mobile"` Registration bool `json:"registration"` } `json:"bonuses"` Enable struct { Sharing bool `json:"sharing"` } `json:"enable"` FileSizeLimit int64 `json:"file_size_limit"` Space struct { BytesTotal int64 `json:"bytes_total"` BytesUsed int `json:"bytes_used"` Overquota bool `json:"overquota"` } `json:"space"` } `json:"cloud"` Cloudflags struct { Exists bool `json:"exists"` } `json:"cloudflags"` Domain string `json:"domain"` Login string `json:"login"` Newbie bool `json:"newbie"` UI struct { ExpandLoader bool `json:"expand_loader"` Kind string `json:"kind"` Sidebar bool `json:"sidebar"` Sort struct { Order string `json:"order"` Type string `json:"type"` } `json:"sort"` Thumbs bool `json:"thumbs"` } `json:"ui"` } `json:"body"` Email string `json:"email"` Status int `json:"status"` Time int64 `json:"time"` }
UserInfoResponse contains account metadata