Documentation ¶
Overview ¶
Package protocol implements the Block Exchange Protocol.
Index ¶
- Constants
- Variables
- func BlockSize(fileSize int64) int
- func BlocksHash(bs []BlockInfo) []byte
- func IsVersionMismatch(err error) bool
- func ModTimeEqual(a, b time.Time, modTimeWindow time.Duration) bool
- func PermsEqual(a, b uint32) bool
- func TotalInOut() (int64, int64)
- type BlockInfo
- func (*BlockInfo) Descriptor() ([]byte, []int)
- func (b BlockInfo) IsEmpty() bool
- func (m *BlockInfo) Marshal() (dAtA []byte, err error)
- func (m *BlockInfo) MarshalTo(dAtA []byte) (int, error)
- func (m *BlockInfo) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*BlockInfo) ProtoMessage()
- func (m *BlockInfo) ProtoSize() (n int)
- func (m *BlockInfo) Reset()
- func (b BlockInfo) String() string
- func (m *BlockInfo) Unmarshal(dAtA []byte) error
- func (m *BlockInfo) XXX_DiscardUnknown()
- func (m *BlockInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *BlockInfo) XXX_Merge(src proto.Message)
- func (m *BlockInfo) XXX_Size() int
- func (m *BlockInfo) XXX_Unmarshal(b []byte) error
- type Close
- func (*Close) Descriptor() ([]byte, []int)
- func (m *Close) Marshal() (dAtA []byte, err error)
- func (m *Close) MarshalTo(dAtA []byte) (int, error)
- func (m *Close) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*Close) ProtoMessage()
- func (m *Close) ProtoSize() (n int)
- func (m *Close) Reset()
- func (m *Close) String() string
- func (m *Close) Unmarshal(dAtA []byte) error
- func (m *Close) XXX_DiscardUnknown()
- func (m *Close) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *Close) XXX_Merge(src proto.Message)
- func (m *Close) XXX_Size() int
- func (m *Close) XXX_Unmarshal(b []byte) error
- type ClusterConfig
- func (*ClusterConfig) Descriptor() ([]byte, []int)
- func (m *ClusterConfig) Marshal() (dAtA []byte, err error)
- func (m *ClusterConfig) MarshalTo(dAtA []byte) (int, error)
- func (m *ClusterConfig) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*ClusterConfig) ProtoMessage()
- func (m *ClusterConfig) ProtoSize() (n int)
- func (m *ClusterConfig) Reset()
- func (m *ClusterConfig) String() string
- func (m *ClusterConfig) Unmarshal(dAtA []byte) error
- func (m *ClusterConfig) XXX_DiscardUnknown()
- func (m *ClusterConfig) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *ClusterConfig) XXX_Merge(src proto.Message)
- func (m *ClusterConfig) XXX_Size() int
- func (m *ClusterConfig) XXX_Unmarshal(b []byte) error
- type Compression
- type Connection
- type Counter
- func (*Counter) Descriptor() ([]byte, []int)
- func (m *Counter) Marshal() (dAtA []byte, err error)
- func (m *Counter) MarshalTo(dAtA []byte) (int, error)
- func (m *Counter) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*Counter) ProtoMessage()
- func (m *Counter) ProtoSize() (n int)
- func (m *Counter) Reset()
- func (m *Counter) String() string
- func (m *Counter) Unmarshal(dAtA []byte) error
- func (m *Counter) XXX_DiscardUnknown()
- func (m *Counter) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *Counter) XXX_Merge(src proto.Message)
- func (m *Counter) XXX_Size() int
- func (m *Counter) XXX_Unmarshal(b []byte) error
- type Device
- func (*Device) Descriptor() ([]byte, []int)
- func (m *Device) Marshal() (dAtA []byte, err error)
- func (m *Device) MarshalTo(dAtA []byte) (int, error)
- func (m *Device) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*Device) ProtoMessage()
- func (m *Device) ProtoSize() (n int)
- func (m *Device) Reset()
- func (m *Device) String() string
- func (m *Device) Unmarshal(dAtA []byte) error
- func (m *Device) XXX_DiscardUnknown()
- func (m *Device) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *Device) XXX_Merge(src proto.Message)
- func (m *Device) XXX_Size() int
- func (m *Device) XXX_Unmarshal(b []byte) error
- type DeviceID
- func (n DeviceID) Compare(other DeviceID) int
- func (n DeviceID) Equals(other DeviceID) bool
- func (n DeviceID) GoString() string
- func (n *DeviceID) MarshalText() ([]byte, error)
- func (n *DeviceID) MarshalTo(bs []byte) (int, error)
- func (n *DeviceID) ProtoSize() int
- func (n DeviceID) Short() ShortID
- func (n DeviceID) String() string
- func (n *DeviceID) Unmarshal(bs []byte) error
- func (n *DeviceID) UnmarshalText(bs []byte) error
- type DeviceIDs
- type DownloadProgress
- func (*DownloadProgress) Descriptor() ([]byte, []int)
- func (m *DownloadProgress) Marshal() (dAtA []byte, err error)
- func (m *DownloadProgress) MarshalTo(dAtA []byte) (int, error)
- func (m *DownloadProgress) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*DownloadProgress) ProtoMessage()
- func (m *DownloadProgress) ProtoSize() (n int)
- func (m *DownloadProgress) Reset()
- func (m *DownloadProgress) String() string
- func (m *DownloadProgress) Unmarshal(dAtA []byte) error
- func (m *DownloadProgress) XXX_DiscardUnknown()
- func (m *DownloadProgress) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *DownloadProgress) XXX_Merge(src proto.Message)
- func (m *DownloadProgress) XXX_Size() int
- func (m *DownloadProgress) XXX_Unmarshal(b []byte) error
- type ErrorCode
- type FileDownloadProgressUpdate
- func (*FileDownloadProgressUpdate) Descriptor() ([]byte, []int)
- func (m *FileDownloadProgressUpdate) Marshal() (dAtA []byte, err error)
- func (m *FileDownloadProgressUpdate) MarshalTo(dAtA []byte) (int, error)
- func (m *FileDownloadProgressUpdate) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*FileDownloadProgressUpdate) ProtoMessage()
- func (m *FileDownloadProgressUpdate) ProtoSize() (n int)
- func (m *FileDownloadProgressUpdate) Reset()
- func (m *FileDownloadProgressUpdate) String() string
- func (m *FileDownloadProgressUpdate) Unmarshal(dAtA []byte) error
- func (m *FileDownloadProgressUpdate) XXX_DiscardUnknown()
- func (m *FileDownloadProgressUpdate) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *FileDownloadProgressUpdate) XXX_Merge(src proto.Message)
- func (m *FileDownloadProgressUpdate) XXX_Size() int
- func (m *FileDownloadProgressUpdate) XXX_Unmarshal(b []byte) error
- type FileDownloadProgressUpdateType
- type FileInfo
- func (f FileInfo) BlockSize() int
- func (f FileInfo) BlocksEqual(other FileInfo) bool
- func (*FileInfo) Descriptor() ([]byte, []int)
- func (f FileInfo) FileLocalFlags() uint32
- func (f FileInfo) FileModifiedBy() ShortID
- func (f FileInfo) FileName() string
- func (f FileInfo) FilePermissions() uint32
- func (f FileInfo) FileSize() int64
- func (f FileInfo) FileType() FileInfoType
- func (f FileInfo) FileVersion() Vector
- func (f FileInfo) HasPermissionBits() bool
- func (f FileInfo) IsDeleted() bool
- func (f FileInfo) IsDirectory() bool
- func (f FileInfo) IsEmpty() bool
- func (f FileInfo) IsEquivalent(other FileInfo, modTimeWindow time.Duration) bool
- func (f FileInfo) IsEquivalentOptional(other FileInfo, modTimeWindow time.Duration, ignorePerms bool, ...) bool
- func (f FileInfo) IsIgnored() bool
- func (f FileInfo) IsInvalid() bool
- func (f FileInfo) IsReceiveOnlyChanged() bool
- func (f FileInfo) IsSymlink() bool
- func (f FileInfo) IsUnsupported() bool
- func (m *FileInfo) Marshal() (dAtA []byte, err error)
- func (m *FileInfo) MarshalTo(dAtA []byte) (int, error)
- func (m *FileInfo) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (f FileInfo) ModTime() time.Time
- func (f FileInfo) MustRescan() bool
- func (*FileInfo) ProtoMessage()
- func (m *FileInfo) ProtoSize() (n int)
- func (m *FileInfo) Reset()
- func (f FileInfo) SequenceNo() int64
- func (f *FileInfo) SetDeleted(by ShortID)
- func (f *FileInfo) SetIgnored(by ShortID)
- func (f *FileInfo) SetMustRescan(by ShortID)
- func (f *FileInfo) SetUnsupported(by ShortID)
- func (f FileInfo) ShouldConflict() bool
- func (f FileInfo) String() string
- func (m *FileInfo) Unmarshal(dAtA []byte) error
- func (f FileInfo) WinsConflict(other FileInfo) bool
- func (m *FileInfo) XXX_DiscardUnknown()
- func (m *FileInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *FileInfo) XXX_Merge(src proto.Message)
- func (m *FileInfo) XXX_Size() int
- func (m *FileInfo) XXX_Unmarshal(b []byte) error
- type FileInfoType
- type Folder
- func (f Folder) Description() string
- func (*Folder) Descriptor() ([]byte, []int)
- func (m *Folder) Marshal() (dAtA []byte, err error)
- func (m *Folder) MarshalTo(dAtA []byte) (int, error)
- func (m *Folder) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*Folder) ProtoMessage()
- func (m *Folder) ProtoSize() (n int)
- func (m *Folder) Reset()
- func (m *Folder) String() string
- func (m *Folder) Unmarshal(dAtA []byte) error
- func (m *Folder) XXX_DiscardUnknown()
- func (m *Folder) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *Folder) XXX_Merge(src proto.Message)
- func (m *Folder) XXX_Size() int
- func (m *Folder) XXX_Unmarshal(b []byte) error
- type Header
- func (*Header) Descriptor() ([]byte, []int)
- func (m *Header) Marshal() (dAtA []byte, err error)
- func (m *Header) MarshalTo(dAtA []byte) (int, error)
- func (m *Header) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*Header) ProtoMessage()
- func (m *Header) ProtoSize() (n int)
- func (m *Header) Reset()
- func (m *Header) String() string
- func (m *Header) Unmarshal(dAtA []byte) error
- func (m *Header) XXX_DiscardUnknown()
- func (m *Header) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *Header) XXX_Merge(src proto.Message)
- func (m *Header) XXX_Size() int
- func (m *Header) XXX_Unmarshal(b []byte) error
- type Hello
- func (*Hello) Descriptor() ([]byte, []int)
- func (m Hello) Magic() uint32
- func (m *Hello) Marshal() (dAtA []byte, err error)
- func (m *Hello) MarshalTo(dAtA []byte) (int, error)
- func (m *Hello) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*Hello) ProtoMessage()
- func (m *Hello) ProtoSize() (n int)
- func (m *Hello) Reset()
- func (m *Hello) String() string
- func (m *Hello) Unmarshal(dAtA []byte) error
- func (m *Hello) XXX_DiscardUnknown()
- func (m *Hello) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *Hello) XXX_Merge(src proto.Message)
- func (m *Hello) XXX_Size() int
- func (m *Hello) XXX_Unmarshal(b []byte) error
- type HelloIntf
- type HelloResult
- type Index
- func (*Index) Descriptor() ([]byte, []int)
- func (m *Index) Marshal() (dAtA []byte, err error)
- func (m *Index) MarshalTo(dAtA []byte) (int, error)
- func (m *Index) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*Index) ProtoMessage()
- func (m *Index) ProtoSize() (n int)
- func (m *Index) Reset()
- func (m *Index) String() string
- func (m *Index) Unmarshal(dAtA []byte) error
- func (m *Index) XXX_DiscardUnknown()
- func (m *Index) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *Index) XXX_Merge(src proto.Message)
- func (m *Index) XXX_Size() int
- func (m *Index) XXX_Unmarshal(b []byte) error
- type IndexID
- type IndexUpdate
- func (*IndexUpdate) Descriptor() ([]byte, []int)
- func (m *IndexUpdate) Marshal() (dAtA []byte, err error)
- func (m *IndexUpdate) MarshalTo(dAtA []byte) (int, error)
- func (m *IndexUpdate) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*IndexUpdate) ProtoMessage()
- func (m *IndexUpdate) ProtoSize() (n int)
- func (m *IndexUpdate) Reset()
- func (m *IndexUpdate) String() string
- func (m *IndexUpdate) Unmarshal(dAtA []byte) error
- func (m *IndexUpdate) XXX_DiscardUnknown()
- func (m *IndexUpdate) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *IndexUpdate) XXX_Merge(src proto.Message)
- func (m *IndexUpdate) XXX_Size() int
- func (m *IndexUpdate) XXX_Unmarshal(b []byte) error
- type MessageCompression
- type MessageType
- type Model
- type Ordering
- type Ping
- func (*Ping) Descriptor() ([]byte, []int)
- func (m *Ping) Marshal() (dAtA []byte, err error)
- func (m *Ping) MarshalTo(dAtA []byte) (int, error)
- func (m *Ping) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*Ping) ProtoMessage()
- func (m *Ping) ProtoSize() (n int)
- func (m *Ping) Reset()
- func (m *Ping) String() string
- func (m *Ping) Unmarshal(dAtA []byte) error
- func (m *Ping) XXX_DiscardUnknown()
- func (m *Ping) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *Ping) XXX_Merge(src proto.Message)
- func (m *Ping) XXX_Size() int
- func (m *Ping) XXX_Unmarshal(b []byte) error
- type Request
- func (*Request) Descriptor() ([]byte, []int)
- func (m *Request) Marshal() (dAtA []byte, err error)
- func (m *Request) MarshalTo(dAtA []byte) (int, error)
- func (m *Request) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*Request) ProtoMessage()
- func (m *Request) ProtoSize() (n int)
- func (m *Request) Reset()
- func (m *Request) String() string
- func (m *Request) Unmarshal(dAtA []byte) error
- func (m *Request) XXX_DiscardUnknown()
- func (m *Request) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *Request) XXX_Merge(src proto.Message)
- func (m *Request) XXX_Size() int
- func (m *Request) XXX_Unmarshal(b []byte) error
- type RequestResponse
- type Response
- func (*Response) Descriptor() ([]byte, []int)
- func (m *Response) Marshal() (dAtA []byte, err error)
- func (m *Response) MarshalTo(dAtA []byte) (int, error)
- func (m *Response) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*Response) ProtoMessage()
- func (m *Response) ProtoSize() (n int)
- func (m *Response) Reset()
- func (m *Response) String() string
- func (m *Response) Unmarshal(dAtA []byte) error
- func (m *Response) XXX_DiscardUnknown()
- func (m *Response) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *Response) XXX_Merge(src proto.Message)
- func (m *Response) XXX_Size() int
- func (m *Response) XXX_Unmarshal(b []byte) error
- type ShortID
- type Statistics
- type TestNewDeviceID
- func (*TestNewDeviceID) Descriptor() ([]byte, []int)
- func (m *TestNewDeviceID) Marshal() (dAtA []byte, err error)
- func (m *TestNewDeviceID) MarshalTo(dAtA []byte) (int, error)
- func (m *TestNewDeviceID) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*TestNewDeviceID) ProtoMessage()
- func (m *TestNewDeviceID) ProtoSize() (n int)
- func (m *TestNewDeviceID) Reset()
- func (m *TestNewDeviceID) String() string
- func (m *TestNewDeviceID) Unmarshal(dAtA []byte) error
- func (m *TestNewDeviceID) XXX_DiscardUnknown()
- func (m *TestNewDeviceID) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *TestNewDeviceID) XXX_Merge(src proto.Message)
- func (m *TestNewDeviceID) XXX_Size() int
- func (m *TestNewDeviceID) XXX_Unmarshal(b []byte) error
- type TestOldDeviceID
- func (*TestOldDeviceID) Descriptor() ([]byte, []int)
- func (m *TestOldDeviceID) Marshal() (dAtA []byte, err error)
- func (m *TestOldDeviceID) MarshalTo(dAtA []byte) (int, error)
- func (m *TestOldDeviceID) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*TestOldDeviceID) ProtoMessage()
- func (m *TestOldDeviceID) ProtoSize() (n int)
- func (m *TestOldDeviceID) Reset()
- func (m *TestOldDeviceID) String() string
- func (m *TestOldDeviceID) Unmarshal(dAtA []byte) error
- func (m *TestOldDeviceID) XXX_DiscardUnknown()
- func (m *TestOldDeviceID) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *TestOldDeviceID) XXX_Merge(src proto.Message)
- func (m *TestOldDeviceID) XXX_Size() int
- func (m *TestOldDeviceID) XXX_Unmarshal(b []byte) error
- type Vector
- func (v Vector) Compare(b Vector) Ordering
- func (v Vector) Concurrent(b Vector) bool
- func (v Vector) Copy() Vector
- func (v Vector) Counter(id ShortID) uint64
- func (*Vector) Descriptor() ([]byte, []int)
- func (v Vector) DropOthers(id ShortID) Vector
- func (v Vector) Equal(b Vector) bool
- func (v Vector) GreaterEqual(b Vector) bool
- func (v Vector) LesserEqual(b Vector) bool
- func (m *Vector) Marshal() (dAtA []byte, err error)
- func (m *Vector) MarshalTo(dAtA []byte) (int, error)
- func (m *Vector) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (v Vector) Merge(b Vector) Vector
- func (*Vector) ProtoMessage()
- func (m *Vector) ProtoSize() (n int)
- func (m *Vector) Reset()
- func (m *Vector) String() string
- func (m *Vector) Unmarshal(dAtA []byte) error
- func (v Vector) Update(id ShortID) Vector
- func (m *Vector) XXX_DiscardUnknown()
- func (m *Vector) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *Vector) XXX_Merge(src proto.Message)
- func (m *Vector) XXX_Size() int
- func (m *Vector) XXX_Unmarshal(b []byte) error
Constants ¶
const ( SyntheticDirectorySize = 128 HelloMessageMagic uint32 = 0x2EA7D90B Version13HelloMagic uint32 = 0x9F79BC40 // old )
const ( // Shifts KiB = 10 MiB = 20 GiB = 30 )
const ( // MaxMessageLen is the largest message size allowed on the wire. (500 MB) MaxMessageLen = 500 * 1000 * 1000 // MinBlockSize is the minimum block size allowed MinBlockSize = 128 << KiB // MaxBlockSize is the maximum block size allowed MaxBlockSize = 16 << MiB // DesiredPerFileBlocks is the number of blocks we aim for per file DesiredPerFileBlocks = 2000 )
const ( FlagLocalUnsupported = 1 << 0 // The kind is unsupported, e.g. symlinks on Windows FlagLocalIgnored = 1 << 1 // Matches local ignore patterns FlagLocalMustRescan = 1 << 2 // Doesn't match content on disk, must be rechecked fully FlagLocalReceiveOnly = 1 << 3 // Change detected on receive only folder // Flags that should result in the Invalid bit on outgoing updates LocalInvalidFlags = FlagLocalUnsupported | FlagLocalIgnored | FlagLocalMustRescan | FlagLocalReceiveOnly // Flags that should result in a file being in conflict with its // successor, due to us not having an up to date picture of its state on // disk. LocalConflictFlags = FlagLocalUnsupported | FlagLocalIgnored | FlagLocalReceiveOnly LocalAllFlags = FlagLocalUnsupported | FlagLocalIgnored | FlagLocalMustRescan | FlagLocalReceiveOnly )
FileInfo.LocalFlags flags
const ( // PingSendInterval is how often we make sure to send a message, by // triggering pings if necessary. PingSendInterval = 90 * time.Second // ReceiveTimeout is the longest we'll wait for a message from the other // side before closing the connection. ReceiveTimeout = 300 * time.Second )
const DeviceIDLength = 32
Variables ¶
var ( ErrInvalidLengthBep = fmt.Errorf("proto: negative length found during unmarshaling") ErrIntOverflowBep = fmt.Errorf("proto: integer overflow") ErrUnexpectedEndOfGroupBep = fmt.Errorf("proto: unexpected end of group") )
var ( LocalDeviceID = repeatedDeviceID(0xff) GlobalDeviceID = repeatedDeviceID(0xf8) EmptyDeviceID = DeviceID{} )
var ( ErrInvalidLengthDeviceidTest = fmt.Errorf("proto: negative length found during unmarshaling") ErrIntOverflowDeviceidTest = fmt.Errorf("proto: integer overflow") ErrUnexpectedEndOfGroupDeviceidTest = fmt.Errorf("proto: unexpected end of group") )
var ( ErrNoError error ErrGeneric = errors.New("generic error") ErrNoSuchFile = errors.New("no such file") ErrInvalid = errors.New("file is invalid") )
var ( // ErrTooOldVersion is returned by ExchangeHello when the other side // speaks an older, incompatible version of the protocol. ErrTooOldVersion = errors.New("the remote device speaks an older version of the protocol not compatible with this version") // ErrUnknownMagic is returned by ExchangeHellow when the other side // speaks something entirely unknown. ErrUnknownMagic = errors.New("the remote device speaks an unknown (newer?) version of the protocol") )
var ( ErrClosed = errors.New("connection closed") ErrTimeout = errors.New("read timeout") )
var BlockSizes []int
BlockSizes is the list of valid block sizes, from min to max
var BufferPool bufferPool
Global pool to get buffers from. Requires Blocksizes to be initialised, therefore it is initialized in the same init() as BlockSizes
var CloseTimeout = 10 * time.Second
CloseTimeout is the longest we'll wait when trying to send the close message before just closing the connection. Should not be modified in production code, just for testing.
var Compression_name = map[int32]string{
0: "METADATA",
1: "NEVER",
2: "ALWAYS",
}
var Compression_value = map[string]int32{
"METADATA": 0,
"NEVER": 1,
"ALWAYS": 2,
}
var ErrorCode_name = map[int32]string{
0: "NO_ERROR",
1: "GENERIC",
2: "NO_SUCH_FILE",
3: "INVALID_FILE",
}
var ErrorCode_value = map[string]int32{
"NO_ERROR": 0,
"GENERIC": 1,
"NO_SUCH_FILE": 2,
"INVALID_FILE": 3,
}
var FileDownloadProgressUpdateType_name = map[int32]string{
0: "APPEND",
1: "FORGET",
}
var FileDownloadProgressUpdateType_value = map[string]int32{
"APPEND": 0,
"FORGET": 1,
}
var FileInfoType_name = map[int32]string{
0: "FILE",
1: "DIRECTORY",
2: "SYMLINK_FILE",
3: "SYMLINK_DIRECTORY",
4: "SYMLINK",
}
var FileInfoType_value = map[string]int32{
"FILE": 0,
"DIRECTORY": 1,
"SYMLINK_FILE": 2,
"SYMLINK_DIRECTORY": 3,
"SYMLINK": 4,
}
var MessageCompression_name = map[int32]string{
0: "NONE",
1: "LZ4",
}
var MessageCompression_value = map[string]int32{
"NONE": 0,
"LZ4": 1,
}
var MessageType_name = map[int32]string{
0: "CLUSTER_CONFIG",
1: "INDEX",
2: "INDEX_UPDATE",
3: "REQUEST",
4: "RESPONSE",
5: "DOWNLOAD_PROGRESS",
6: "PING",
7: "CLOSE",
}
var MessageType_value = map[string]int32{
"CLUSTER_CONFIG": 0,
"INDEX": 1,
"INDEX_UPDATE": 2,
"REQUEST": 3,
"RESPONSE": 4,
"DOWNLOAD_PROGRESS": 5,
"PING": 6,
"CLOSE": 7,
}
Functions ¶
func BlocksHash ¶ added in v1.4.0
func IsVersionMismatch ¶ added in v0.13.6
IsVersionMismatch returns true if the error is a reliable indication of a version mismatch that we might want to alert the user about.
func ModTimeEqual ¶ added in v1.2.2
func PermsEqual ¶ added in v0.14.46
func TotalInOut ¶
Types ¶
type BlockInfo ¶
type BlockInfo struct { Hash []byte `protobuf:"bytes,3,opt,name=hash,proto3" json:"hash,omitempty"` Offset int64 `protobuf:"varint,1,opt,name=offset,proto3" json:"offset,omitempty"` Size int32 `protobuf:"varint,2,opt,name=size,proto3" json:"size,omitempty"` WeakHash uint32 `protobuf:"varint,4,opt,name=weak_hash,json=weakHash,proto3" json:"weak_hash,omitempty"` }
func (*BlockInfo) Descriptor ¶ added in v0.14.0
func (BlockInfo) IsEmpty ¶ added in v0.12.4
IsEmpty returns true if the block is a full block of zeroes.
func (*BlockInfo) MarshalToSizedBuffer ¶ added in v1.3.0
func (*BlockInfo) ProtoMessage ¶ added in v0.14.0
func (*BlockInfo) ProtoMessage()
func (*BlockInfo) XXX_DiscardUnknown ¶ added in v1.0.1
func (m *BlockInfo) XXX_DiscardUnknown()
func (*BlockInfo) XXX_Marshal ¶ added in v1.0.1
func (*BlockInfo) XXX_Unmarshal ¶ added in v1.0.1
type Close ¶ added in v0.14.0
type Close struct {
Reason string `protobuf:"bytes,1,opt,name=reason,proto3" json:"reason,omitempty"`
}
func (*Close) Descriptor ¶ added in v0.14.0
func (*Close) MarshalToSizedBuffer ¶ added in v1.3.0
func (*Close) ProtoMessage ¶ added in v0.14.0
func (*Close) ProtoMessage()
func (*Close) XXX_DiscardUnknown ¶ added in v1.0.1
func (m *Close) XXX_DiscardUnknown()
func (*Close) XXX_Marshal ¶ added in v1.0.1
func (*Close) XXX_Unmarshal ¶ added in v1.0.1
type ClusterConfig ¶ added in v0.14.0
type ClusterConfig struct {
Folders []Folder `protobuf:"bytes,1,rep,name=folders,proto3" json:"folders"`
}
func (*ClusterConfig) Descriptor ¶ added in v0.14.0
func (*ClusterConfig) Descriptor() ([]byte, []int)
func (*ClusterConfig) Marshal ¶ added in v0.14.0
func (m *ClusterConfig) Marshal() (dAtA []byte, err error)
func (*ClusterConfig) MarshalTo ¶ added in v0.14.0
func (m *ClusterConfig) MarshalTo(dAtA []byte) (int, error)
func (*ClusterConfig) MarshalToSizedBuffer ¶ added in v1.3.0
func (m *ClusterConfig) MarshalToSizedBuffer(dAtA []byte) (int, error)
func (*ClusterConfig) ProtoMessage ¶ added in v0.14.0
func (*ClusterConfig) ProtoMessage()
func (*ClusterConfig) ProtoSize ¶ added in v0.14.0
func (m *ClusterConfig) ProtoSize() (n int)
func (*ClusterConfig) Reset ¶ added in v0.14.0
func (m *ClusterConfig) Reset()
func (*ClusterConfig) String ¶ added in v0.14.0
func (m *ClusterConfig) String() string
func (*ClusterConfig) Unmarshal ¶ added in v0.14.0
func (m *ClusterConfig) Unmarshal(dAtA []byte) error
func (*ClusterConfig) XXX_DiscardUnknown ¶ added in v1.0.1
func (m *ClusterConfig) XXX_DiscardUnknown()
func (*ClusterConfig) XXX_Marshal ¶ added in v1.0.1
func (m *ClusterConfig) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*ClusterConfig) XXX_Merge ¶ added in v1.0.1
func (m *ClusterConfig) XXX_Merge(src proto.Message)
func (*ClusterConfig) XXX_Size ¶ added in v1.0.1
func (m *ClusterConfig) XXX_Size() int
func (*ClusterConfig) XXX_Unmarshal ¶ added in v1.0.1
func (m *ClusterConfig) XXX_Unmarshal(b []byte) error
type Compression ¶
type Compression int32
const ( CompressMetadata Compression = 0 CompressNever Compression = 1 CompressAlways Compression = 2 )
func (Compression) EnumDescriptor ¶ added in v0.14.0
func (Compression) EnumDescriptor() ([]byte, []int)
func (Compression) GoString ¶
func (c Compression) GoString() string
func (Compression) MarshalText ¶
func (c Compression) MarshalText() ([]byte, error)
func (Compression) String ¶
func (x Compression) String() string
func (*Compression) UnmarshalText ¶
func (c *Compression) UnmarshalText(bs []byte) error
type Connection ¶
type Connection interface { Start() Close(err error) ID() DeviceID Name() string Index(ctx context.Context, folder string, files []FileInfo) error IndexUpdate(ctx context.Context, folder string, files []FileInfo) error Request(ctx context.Context, folder string, name string, offset int64, size int, hash []byte, weakHash uint32, fromTemporary bool) ([]byte, error) ClusterConfig(config ClusterConfig) DownloadProgress(ctx context.Context, folder string, updates []FileDownloadProgressUpdate) Statistics() Statistics Closed() bool }
func NewConnection ¶
func NewConnection(deviceID DeviceID, reader io.Reader, writer io.Writer, receiver Model, name string, compress Compression) Connection
type Counter ¶
type Counter struct { ID ShortID `protobuf:"varint,1,opt,name=id,proto3,customtype=ShortID" json:"id"` Value uint64 `protobuf:"varint,2,opt,name=value,proto3" json:"value,omitempty"` }
func (*Counter) Descriptor ¶ added in v0.14.0
func (*Counter) MarshalToSizedBuffer ¶ added in v1.3.0
func (*Counter) ProtoMessage ¶ added in v0.14.0
func (*Counter) ProtoMessage()
func (*Counter) XXX_DiscardUnknown ¶ added in v1.0.1
func (m *Counter) XXX_DiscardUnknown()
func (*Counter) XXX_Marshal ¶ added in v1.0.1
func (*Counter) XXX_Unmarshal ¶ added in v1.0.1
type Device ¶
type Device struct { ID DeviceID `protobuf:"bytes,1,opt,name=id,proto3,customtype=DeviceID" json:"id"` Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` Addresses []string `protobuf:"bytes,3,rep,name=addresses,proto3" json:"addresses,omitempty"` Compression Compression `protobuf:"varint,4,opt,name=compression,proto3,enum=protocol.Compression" json:"compression,omitempty"` CertName string `protobuf:"bytes,5,opt,name=cert_name,json=certName,proto3" json:"cert_name,omitempty"` MaxSequence int64 `protobuf:"varint,6,opt,name=max_sequence,json=maxSequence,proto3" json:"max_sequence,omitempty"` Introducer bool `protobuf:"varint,7,opt,name=introducer,proto3" json:"introducer,omitempty"` IndexID IndexID `protobuf:"varint,8,opt,name=index_id,json=indexId,proto3,customtype=IndexID" json:"index_id"` SkipIntroductionRemovals bool `` /* 136-byte string literal not displayed */ }
func (*Device) Descriptor ¶ added in v0.14.0
func (*Device) MarshalToSizedBuffer ¶ added in v1.3.0
func (*Device) ProtoMessage ¶ added in v0.14.0
func (*Device) ProtoMessage()
func (*Device) XXX_DiscardUnknown ¶ added in v1.0.1
func (m *Device) XXX_DiscardUnknown()
func (*Device) XXX_Marshal ¶ added in v1.0.1
func (*Device) XXX_Unmarshal ¶ added in v1.0.1
type DeviceID ¶
type DeviceID [DeviceIDLength]byte
func DeviceIDFromBytes ¶
func DeviceIDFromString ¶
func NewDeviceID ¶
NewDeviceID generates a new device ID from the raw bytes of a certificate
func (*DeviceID) MarshalText ¶
func (*DeviceID) UnmarshalText ¶
type DeviceIDs ¶ added in v0.14.12
type DeviceIDs []DeviceID
DeviceIDs is a sortable slice of DeviceID
type DownloadProgress ¶ added in v0.14.0
type DownloadProgress struct { Folder string `protobuf:"bytes,1,opt,name=folder,proto3" json:"folder,omitempty"` Updates []FileDownloadProgressUpdate `protobuf:"bytes,2,rep,name=updates,proto3" json:"updates"` }
func (*DownloadProgress) Descriptor ¶ added in v0.14.0
func (*DownloadProgress) Descriptor() ([]byte, []int)
func (*DownloadProgress) Marshal ¶ added in v0.14.0
func (m *DownloadProgress) Marshal() (dAtA []byte, err error)
func (*DownloadProgress) MarshalTo ¶ added in v0.14.0
func (m *DownloadProgress) MarshalTo(dAtA []byte) (int, error)
func (*DownloadProgress) MarshalToSizedBuffer ¶ added in v1.3.0
func (m *DownloadProgress) MarshalToSizedBuffer(dAtA []byte) (int, error)
func (*DownloadProgress) ProtoMessage ¶ added in v0.14.0
func (*DownloadProgress) ProtoMessage()
func (*DownloadProgress) ProtoSize ¶ added in v0.14.0
func (m *DownloadProgress) ProtoSize() (n int)
func (*DownloadProgress) Reset ¶ added in v0.14.0
func (m *DownloadProgress) Reset()
func (*DownloadProgress) String ¶ added in v0.14.0
func (m *DownloadProgress) String() string
func (*DownloadProgress) Unmarshal ¶ added in v0.14.0
func (m *DownloadProgress) Unmarshal(dAtA []byte) error
func (*DownloadProgress) XXX_DiscardUnknown ¶ added in v1.0.1
func (m *DownloadProgress) XXX_DiscardUnknown()
func (*DownloadProgress) XXX_Marshal ¶ added in v1.0.1
func (m *DownloadProgress) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*DownloadProgress) XXX_Merge ¶ added in v1.0.1
func (m *DownloadProgress) XXX_Merge(src proto.Message)
func (*DownloadProgress) XXX_Size ¶ added in v1.0.1
func (m *DownloadProgress) XXX_Size() int
func (*DownloadProgress) XXX_Unmarshal ¶ added in v1.0.1
func (m *DownloadProgress) XXX_Unmarshal(b []byte) error
type ErrorCode ¶ added in v0.14.0
type ErrorCode int32
func (ErrorCode) EnumDescriptor ¶ added in v0.14.0
type FileDownloadProgressUpdate ¶ added in v0.13.0
type FileDownloadProgressUpdate struct { UpdateType FileDownloadProgressUpdateType `` /* 137-byte string literal not displayed */ Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` Version Vector `protobuf:"bytes,3,opt,name=version,proto3" json:"version"` BlockIndexes []int32 `protobuf:"varint,4,rep,name=block_indexes,json=blockIndexes,proto3" json:"block_indexes,omitempty"` BlockSize int32 `protobuf:"varint,5,opt,name=block_size,json=blockSize,proto3" json:"block_size,omitempty"` }
func (*FileDownloadProgressUpdate) Descriptor ¶ added in v0.14.0
func (*FileDownloadProgressUpdate) Descriptor() ([]byte, []int)
func (*FileDownloadProgressUpdate) Marshal ¶ added in v0.14.0
func (m *FileDownloadProgressUpdate) Marshal() (dAtA []byte, err error)
func (*FileDownloadProgressUpdate) MarshalTo ¶ added in v0.14.0
func (m *FileDownloadProgressUpdate) MarshalTo(dAtA []byte) (int, error)
func (*FileDownloadProgressUpdate) MarshalToSizedBuffer ¶ added in v1.3.0
func (m *FileDownloadProgressUpdate) MarshalToSizedBuffer(dAtA []byte) (int, error)
func (*FileDownloadProgressUpdate) ProtoMessage ¶ added in v0.14.0
func (*FileDownloadProgressUpdate) ProtoMessage()
func (*FileDownloadProgressUpdate) ProtoSize ¶ added in v0.14.0
func (m *FileDownloadProgressUpdate) ProtoSize() (n int)
func (*FileDownloadProgressUpdate) Reset ¶ added in v0.14.0
func (m *FileDownloadProgressUpdate) Reset()
func (*FileDownloadProgressUpdate) String ¶ added in v0.14.0
func (m *FileDownloadProgressUpdate) String() string
func (*FileDownloadProgressUpdate) Unmarshal ¶ added in v0.14.0
func (m *FileDownloadProgressUpdate) Unmarshal(dAtA []byte) error
func (*FileDownloadProgressUpdate) XXX_DiscardUnknown ¶ added in v1.0.1
func (m *FileDownloadProgressUpdate) XXX_DiscardUnknown()
func (*FileDownloadProgressUpdate) XXX_Marshal ¶ added in v1.0.1
func (m *FileDownloadProgressUpdate) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*FileDownloadProgressUpdate) XXX_Merge ¶ added in v1.0.1
func (m *FileDownloadProgressUpdate) XXX_Merge(src proto.Message)
func (*FileDownloadProgressUpdate) XXX_Size ¶ added in v1.0.1
func (m *FileDownloadProgressUpdate) XXX_Size() int
func (*FileDownloadProgressUpdate) XXX_Unmarshal ¶ added in v1.0.1
func (m *FileDownloadProgressUpdate) XXX_Unmarshal(b []byte) error
type FileDownloadProgressUpdateType ¶ added in v0.14.0
type FileDownloadProgressUpdateType int32
const ( UpdateTypeAppend FileDownloadProgressUpdateType = 0 UpdateTypeForget FileDownloadProgressUpdateType = 1 )
func (FileDownloadProgressUpdateType) EnumDescriptor ¶ added in v0.14.0
func (FileDownloadProgressUpdateType) EnumDescriptor() ([]byte, []int)
func (FileDownloadProgressUpdateType) String ¶ added in v0.14.0
func (x FileDownloadProgressUpdateType) String() string
type FileInfo ¶
type FileInfo struct { Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` Size int64 `protobuf:"varint,3,opt,name=size,proto3" json:"size,omitempty"` ModifiedS int64 `protobuf:"varint,5,opt,name=modified_s,json=modifiedS,proto3" json:"modified_s,omitempty"` ModifiedBy ShortID `protobuf:"varint,12,opt,name=modified_by,json=modifiedBy,proto3,customtype=ShortID" json:"modified_by"` Version Vector `protobuf:"bytes,9,opt,name=version,proto3" json:"version"` Sequence int64 `protobuf:"varint,10,opt,name=sequence,proto3" json:"sequence,omitempty"` Blocks []BlockInfo `protobuf:"bytes,16,rep,name=blocks,proto3" json:"blocks"` SymlinkTarget string `protobuf:"bytes,17,opt,name=symlink_target,json=symlinkTarget,proto3" json:"symlink_target,omitempty"` BlocksHash []byte `protobuf:"bytes,18,opt,name=blocks_hash,json=blocksHash,proto3" json:"blocks_hash,omitempty"` Type FileInfoType `protobuf:"varint,2,opt,name=type,proto3,enum=protocol.FileInfoType" json:"type,omitempty"` Permissions uint32 `protobuf:"varint,4,opt,name=permissions,proto3" json:"permissions,omitempty"` ModifiedNs int32 `protobuf:"varint,11,opt,name=modified_ns,json=modifiedNs,proto3" json:"modified_ns,omitempty"` RawBlockSize int32 `protobuf:"varint,13,opt,name=block_size,json=blockSize,proto3" json:"block_size,omitempty"` // The local_flags fields stores flags that are relevant to the local // host only. It is not part of the protocol, doesn't get sent or // received (we make sure to zero it), nonetheless we need it on our // struct and to be able to serialize it to/from the database. LocalFlags uint32 `protobuf:"varint,1000,opt,name=local_flags,json=localFlags,proto3" json:"local_flags,omitempty"` Deleted bool `protobuf:"varint,6,opt,name=deleted,proto3" json:"deleted,omitempty"` RawInvalid bool `protobuf:"varint,7,opt,name=invalid,proto3" json:"invalid,omitempty"` NoPermissions bool `protobuf:"varint,8,opt,name=no_permissions,json=noPermissions,proto3" json:"no_permissions,omitempty"` }
func (FileInfo) BlocksEqual ¶ added in v1.4.1
BlocksEqual returns true when the two files have identical block lists.
func (*FileInfo) Descriptor ¶ added in v0.14.0
func (FileInfo) FileLocalFlags ¶ added in v0.14.50
func (FileInfo) FileModifiedBy ¶ added in v1.3.2
func (FileInfo) FilePermissions ¶ added in v1.3.2
func (FileInfo) FileType ¶ added in v1.3.2
func (f FileInfo) FileType() FileInfoType
func (FileInfo) FileVersion ¶ added in v0.14.49
func (FileInfo) HasPermissionBits ¶
func (FileInfo) IsDirectory ¶
func (FileInfo) IsEquivalent ¶ added in v0.14.46
func (FileInfo) IsEquivalentOptional ¶ added in v0.14.50
func (FileInfo) IsReceiveOnlyChanged ¶ added in v0.14.50
func (FileInfo) IsUnsupported ¶ added in v0.14.50
func (*FileInfo) MarshalToSizedBuffer ¶ added in v1.3.0
func (FileInfo) MustRescan ¶ added in v0.14.49
func (*FileInfo) ProtoMessage ¶ added in v0.14.0
func (*FileInfo) ProtoMessage()
func (FileInfo) SequenceNo ¶ added in v0.14.43
func (*FileInfo) SetDeleted ¶ added in v1.4.0
func (*FileInfo) SetIgnored ¶ added in v0.14.49
func (*FileInfo) SetMustRescan ¶ added in v0.14.49
func (*FileInfo) SetUnsupported ¶ added in v0.14.49
func (FileInfo) ShouldConflict ¶ added in v0.14.49
func (FileInfo) WinsConflict ¶
WinsConflict returns true if "f" is the one to choose when it is in conflict with "other".
func (*FileInfo) XXX_DiscardUnknown ¶ added in v1.0.1
func (m *FileInfo) XXX_DiscardUnknown()
func (*FileInfo) XXX_Marshal ¶ added in v1.0.1
func (*FileInfo) XXX_Unmarshal ¶ added in v1.0.1
type FileInfoType ¶ added in v0.14.0
type FileInfoType int32
const ( FileInfoTypeFile FileInfoType = 0 FileInfoTypeDirectory FileInfoType = 1 FileInfoTypeDeprecatedSymlinkFile FileInfoType = 2 // Deprecated: Do not use. FileInfoTypeDeprecatedSymlinkDirectory FileInfoType = 3 // Deprecated: Do not use. FileInfoTypeSymlink FileInfoType = 4 )
func (FileInfoType) EnumDescriptor ¶ added in v0.14.0
func (FileInfoType) EnumDescriptor() ([]byte, []int)
func (FileInfoType) String ¶ added in v0.14.0
func (x FileInfoType) String() string
type Folder ¶
type Folder struct { ID string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` Label string `protobuf:"bytes,2,opt,name=label,proto3" json:"label,omitempty"` ReadOnly bool `protobuf:"varint,3,opt,name=read_only,json=readOnly,proto3" json:"read_only,omitempty"` IgnorePermissions bool `protobuf:"varint,4,opt,name=ignore_permissions,json=ignorePermissions,proto3" json:"ignore_permissions,omitempty"` IgnoreDelete bool `protobuf:"varint,5,opt,name=ignore_delete,json=ignoreDelete,proto3" json:"ignore_delete,omitempty"` DisableTempIndexes bool `protobuf:"varint,6,opt,name=disable_temp_indexes,json=disableTempIndexes,proto3" json:"disable_temp_indexes,omitempty"` Paused bool `protobuf:"varint,7,opt,name=paused,proto3" json:"paused,omitempty"` Devices []Device `protobuf:"bytes,16,rep,name=devices,proto3" json:"devices"` }
func (Folder) Description ¶ added in v0.14.12
func (*Folder) Descriptor ¶ added in v0.14.0
func (*Folder) MarshalToSizedBuffer ¶ added in v1.3.0
func (*Folder) ProtoMessage ¶ added in v0.14.0
func (*Folder) ProtoMessage()
func (*Folder) XXX_DiscardUnknown ¶ added in v1.0.1
func (m *Folder) XXX_DiscardUnknown()
func (*Folder) XXX_Marshal ¶ added in v1.0.1
func (*Folder) XXX_Unmarshal ¶ added in v1.0.1
type Header ¶ added in v0.14.0
type Header struct { Type MessageType `protobuf:"varint,1,opt,name=type,proto3,enum=protocol.MessageType" json:"type,omitempty"` Compression MessageCompression `protobuf:"varint,2,opt,name=compression,proto3,enum=protocol.MessageCompression" json:"compression,omitempty"` }
func (*Header) Descriptor ¶ added in v0.14.0
func (*Header) MarshalToSizedBuffer ¶ added in v1.3.0
func (*Header) ProtoMessage ¶ added in v0.14.0
func (*Header) ProtoMessage()
func (*Header) XXX_DiscardUnknown ¶ added in v1.0.1
func (m *Header) XXX_DiscardUnknown()
func (*Header) XXX_Marshal ¶ added in v1.0.1
func (*Header) XXX_Unmarshal ¶ added in v1.0.1
type Hello ¶ added in v0.14.0
type Hello struct { DeviceName string `protobuf:"bytes,1,opt,name=device_name,json=deviceName,proto3" json:"device_name,omitempty"` ClientName string `protobuf:"bytes,2,opt,name=client_name,json=clientName,proto3" json:"client_name,omitempty"` ClientVersion string `protobuf:"bytes,3,opt,name=client_version,json=clientVersion,proto3" json:"client_version,omitempty"` }
func (*Hello) Descriptor ¶ added in v0.14.0
func (*Hello) MarshalToSizedBuffer ¶ added in v1.3.0
func (*Hello) ProtoMessage ¶ added in v0.14.0
func (*Hello) ProtoMessage()
func (*Hello) XXX_DiscardUnknown ¶ added in v1.0.1
func (m *Hello) XXX_DiscardUnknown()
func (*Hello) XXX_Marshal ¶ added in v1.0.1
func (*Hello) XXX_Unmarshal ¶ added in v1.0.1
type HelloIntf ¶ added in v0.14.0
The HelloIntf interface is implemented by the version specific hello message. It knows its magic number and how to serialize itself to a byte buffer.
type HelloResult ¶ added in v0.13.6
The HelloResult is the non version specific interpretation of the other side's Hello message.
func ExchangeHello ¶ added in v0.13.6
func ExchangeHello(c io.ReadWriter, h HelloIntf) (HelloResult, error)
type Index ¶ added in v0.14.0
type Index struct { Folder string `protobuf:"bytes,1,opt,name=folder,proto3" json:"folder,omitempty"` Files []FileInfo `protobuf:"bytes,2,rep,name=files,proto3" json:"files"` }
func (*Index) Descriptor ¶ added in v0.14.0
func (*Index) MarshalToSizedBuffer ¶ added in v1.3.0
func (*Index) ProtoMessage ¶ added in v0.14.0
func (*Index) ProtoMessage()
func (*Index) XXX_DiscardUnknown ¶ added in v1.0.1
func (m *Index) XXX_DiscardUnknown()
func (*Index) XXX_Marshal ¶ added in v1.0.1
func (*Index) XXX_Unmarshal ¶ added in v1.0.1
type IndexID ¶ added in v0.14.1
type IndexID uint64
func NewIndexID ¶ added in v0.14.1
func NewIndexID() IndexID
type IndexUpdate ¶ added in v0.14.0
type IndexUpdate struct { Folder string `protobuf:"bytes,1,opt,name=folder,proto3" json:"folder,omitempty"` Files []FileInfo `protobuf:"bytes,2,rep,name=files,proto3" json:"files"` }
func (*IndexUpdate) Descriptor ¶ added in v0.14.0
func (*IndexUpdate) Descriptor() ([]byte, []int)
func (*IndexUpdate) Marshal ¶ added in v0.14.0
func (m *IndexUpdate) Marshal() (dAtA []byte, err error)
func (*IndexUpdate) MarshalTo ¶ added in v0.14.0
func (m *IndexUpdate) MarshalTo(dAtA []byte) (int, error)
func (*IndexUpdate) MarshalToSizedBuffer ¶ added in v1.3.0
func (m *IndexUpdate) MarshalToSizedBuffer(dAtA []byte) (int, error)
func (*IndexUpdate) ProtoMessage ¶ added in v0.14.0
func (*IndexUpdate) ProtoMessage()
func (*IndexUpdate) ProtoSize ¶ added in v0.14.0
func (m *IndexUpdate) ProtoSize() (n int)
func (*IndexUpdate) Reset ¶ added in v0.14.0
func (m *IndexUpdate) Reset()
func (*IndexUpdate) String ¶ added in v0.14.0
func (m *IndexUpdate) String() string
func (*IndexUpdate) Unmarshal ¶ added in v0.14.0
func (m *IndexUpdate) Unmarshal(dAtA []byte) error
func (*IndexUpdate) XXX_DiscardUnknown ¶ added in v1.0.1
func (m *IndexUpdate) XXX_DiscardUnknown()
func (*IndexUpdate) XXX_Marshal ¶ added in v1.0.1
func (m *IndexUpdate) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*IndexUpdate) XXX_Merge ¶ added in v1.0.1
func (m *IndexUpdate) XXX_Merge(src proto.Message)
func (*IndexUpdate) XXX_Size ¶ added in v1.0.1
func (m *IndexUpdate) XXX_Size() int
func (*IndexUpdate) XXX_Unmarshal ¶ added in v1.0.1
func (m *IndexUpdate) XXX_Unmarshal(b []byte) error
type MessageCompression ¶ added in v0.14.0
type MessageCompression int32
const ( MessageCompressionNone MessageCompression = 0 MessageCompressionLZ4 MessageCompression = 1 )
func (MessageCompression) EnumDescriptor ¶ added in v0.14.0
func (MessageCompression) EnumDescriptor() ([]byte, []int)
func (MessageCompression) String ¶ added in v0.14.0
func (x MessageCompression) String() string
type MessageType ¶ added in v0.14.0
type MessageType int32
func (MessageType) EnumDescriptor ¶ added in v0.14.0
func (MessageType) EnumDescriptor() ([]byte, []int)
func (MessageType) String ¶ added in v0.14.0
func (x MessageType) String() string
type Model ¶
type Model interface { // An index was received from the peer device Index(deviceID DeviceID, folder string, files []FileInfo) error // An index update was received from the peer device IndexUpdate(deviceID DeviceID, folder string, files []FileInfo) error // A request was made by the peer device Request(deviceID DeviceID, folder, name string, size int32, offset int64, hash []byte, weakHash uint32, fromTemporary bool) (RequestResponse, error) // A cluster configuration message was received ClusterConfig(deviceID DeviceID, config ClusterConfig) error // The peer device closed the connection Closed(conn Connection, err error) // The peer device sent progress updates for the files it is currently downloading DownloadProgress(deviceID DeviceID, folder string, updates []FileDownloadProgressUpdate) error }
type Ping ¶ added in v0.14.0
type Ping struct { }
func (*Ping) Descriptor ¶ added in v0.14.0
func (*Ping) MarshalToSizedBuffer ¶ added in v1.3.0
func (*Ping) ProtoMessage ¶ added in v0.14.0
func (*Ping) ProtoMessage()
func (*Ping) XXX_DiscardUnknown ¶ added in v1.0.1
func (m *Ping) XXX_DiscardUnknown()
func (*Ping) XXX_Marshal ¶ added in v1.0.1
func (*Ping) XXX_Unmarshal ¶ added in v1.0.1
type Request ¶ added in v0.14.0
type Request struct { ID int32 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` Folder string `protobuf:"bytes,2,opt,name=folder,proto3" json:"folder,omitempty"` Name string `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"` Offset int64 `protobuf:"varint,4,opt,name=offset,proto3" json:"offset,omitempty"` Size int32 `protobuf:"varint,5,opt,name=size,proto3" json:"size,omitempty"` Hash []byte `protobuf:"bytes,6,opt,name=hash,proto3" json:"hash,omitempty"` FromTemporary bool `protobuf:"varint,7,opt,name=from_temporary,json=fromTemporary,proto3" json:"from_temporary,omitempty"` WeakHash uint32 `protobuf:"varint,8,opt,name=weak_hash,json=weakHash,proto3" json:"weak_hash,omitempty"` }
func (*Request) Descriptor ¶ added in v0.14.0
func (*Request) MarshalToSizedBuffer ¶ added in v1.3.0
func (*Request) ProtoMessage ¶ added in v0.14.0
func (*Request) ProtoMessage()
func (*Request) XXX_DiscardUnknown ¶ added in v1.0.1
func (m *Request) XXX_DiscardUnknown()
func (*Request) XXX_Marshal ¶ added in v1.0.1
func (*Request) XXX_Unmarshal ¶ added in v1.0.1
type RequestResponse ¶ added in v0.14.53
type RequestResponse interface { Data() []byte Close() // Must always be called once the byte slice is no longer in use Wait() // Blocks until Close is called }
type Response ¶ added in v0.14.0
type Response struct { ID int32 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` Data []byte `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"` Code ErrorCode `protobuf:"varint,3,opt,name=code,proto3,enum=protocol.ErrorCode" json:"code,omitempty"` }
func (*Response) Descriptor ¶ added in v0.14.0
func (*Response) MarshalToSizedBuffer ¶ added in v1.3.0
func (*Response) ProtoMessage ¶ added in v0.14.0
func (*Response) ProtoMessage()
func (*Response) XXX_DiscardUnknown ¶ added in v1.0.1
func (m *Response) XXX_DiscardUnknown()
func (*Response) XXX_Marshal ¶ added in v1.0.1
func (*Response) XXX_Unmarshal ¶ added in v1.0.1
type Statistics ¶
type TestNewDeviceID ¶ added in v0.14.10
type TestNewDeviceID struct {
Test DeviceID `protobuf:"bytes,1,opt,name=test,proto3,customtype=DeviceID" json:"test"`
}
func (*TestNewDeviceID) Descriptor ¶ added in v0.14.10
func (*TestNewDeviceID) Descriptor() ([]byte, []int)
func (*TestNewDeviceID) Marshal ¶ added in v0.14.10
func (m *TestNewDeviceID) Marshal() (dAtA []byte, err error)
func (*TestNewDeviceID) MarshalTo ¶ added in v0.14.10
func (m *TestNewDeviceID) MarshalTo(dAtA []byte) (int, error)
func (*TestNewDeviceID) MarshalToSizedBuffer ¶ added in v1.3.0
func (m *TestNewDeviceID) MarshalToSizedBuffer(dAtA []byte) (int, error)
func (*TestNewDeviceID) ProtoMessage ¶ added in v0.14.10
func (*TestNewDeviceID) ProtoMessage()
func (*TestNewDeviceID) ProtoSize ¶ added in v0.14.10
func (m *TestNewDeviceID) ProtoSize() (n int)
func (*TestNewDeviceID) Reset ¶ added in v0.14.10
func (m *TestNewDeviceID) Reset()
func (*TestNewDeviceID) String ¶ added in v0.14.10
func (m *TestNewDeviceID) String() string
func (*TestNewDeviceID) Unmarshal ¶ added in v0.14.10
func (m *TestNewDeviceID) Unmarshal(dAtA []byte) error
func (*TestNewDeviceID) XXX_DiscardUnknown ¶ added in v1.0.1
func (m *TestNewDeviceID) XXX_DiscardUnknown()
func (*TestNewDeviceID) XXX_Marshal ¶ added in v1.0.1
func (m *TestNewDeviceID) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*TestNewDeviceID) XXX_Merge ¶ added in v1.0.1
func (m *TestNewDeviceID) XXX_Merge(src proto.Message)
func (*TestNewDeviceID) XXX_Size ¶ added in v1.0.1
func (m *TestNewDeviceID) XXX_Size() int
func (*TestNewDeviceID) XXX_Unmarshal ¶ added in v1.0.1
func (m *TestNewDeviceID) XXX_Unmarshal(b []byte) error
type TestOldDeviceID ¶ added in v0.14.10
type TestOldDeviceID struct {
Test []byte `protobuf:"bytes,1,opt,name=test,proto3" json:"test,omitempty"`
}
func (*TestOldDeviceID) Descriptor ¶ added in v0.14.10
func (*TestOldDeviceID) Descriptor() ([]byte, []int)
func (*TestOldDeviceID) Marshal ¶ added in v0.14.10
func (m *TestOldDeviceID) Marshal() (dAtA []byte, err error)
func (*TestOldDeviceID) MarshalTo ¶ added in v0.14.10
func (m *TestOldDeviceID) MarshalTo(dAtA []byte) (int, error)
func (*TestOldDeviceID) MarshalToSizedBuffer ¶ added in v1.3.0
func (m *TestOldDeviceID) MarshalToSizedBuffer(dAtA []byte) (int, error)
func (*TestOldDeviceID) ProtoMessage ¶ added in v0.14.10
func (*TestOldDeviceID) ProtoMessage()
func (*TestOldDeviceID) ProtoSize ¶ added in v0.14.10
func (m *TestOldDeviceID) ProtoSize() (n int)
func (*TestOldDeviceID) Reset ¶ added in v0.14.10
func (m *TestOldDeviceID) Reset()
func (*TestOldDeviceID) String ¶ added in v0.14.10
func (m *TestOldDeviceID) String() string
func (*TestOldDeviceID) Unmarshal ¶ added in v0.14.10
func (m *TestOldDeviceID) Unmarshal(dAtA []byte) error
func (*TestOldDeviceID) XXX_DiscardUnknown ¶ added in v1.0.1
func (m *TestOldDeviceID) XXX_DiscardUnknown()
func (*TestOldDeviceID) XXX_Marshal ¶ added in v1.0.1
func (m *TestOldDeviceID) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*TestOldDeviceID) XXX_Merge ¶ added in v1.0.1
func (m *TestOldDeviceID) XXX_Merge(src proto.Message)
func (*TestOldDeviceID) XXX_Size ¶ added in v1.0.1
func (m *TestOldDeviceID) XXX_Size() int
func (*TestOldDeviceID) XXX_Unmarshal ¶ added in v1.0.1
func (m *TestOldDeviceID) XXX_Unmarshal(b []byte) error
type Vector ¶
type Vector struct {
Counters []Counter `protobuf:"bytes,1,rep,name=counters,proto3" json:"counters"`
}
func (Vector) Concurrent ¶
Concurrent returns true when the two vectors are concurrent.
func (*Vector) Descriptor ¶ added in v0.14.0
func (Vector) DropOthers ¶ added in v0.14.46
DropOthers removes all counters, keeping only the one with given id. If there is no such counter, an empty Vector is returned.
func (Vector) GreaterEqual ¶
GreaterEqual returns true when the two vectors are equivalent or v is Greater than b.
func (Vector) LesserEqual ¶
LesserEqual returns true when the two vectors are equivalent or v is Lesser than b.
func (*Vector) MarshalToSizedBuffer ¶ added in v1.3.0
func (Vector) Merge ¶
Merge returns the vector containing the maximum indexes from v and b. If it is possible, the vector v is updated and returned. If it is not, a copy will be created, updated and returned.
func (*Vector) ProtoMessage ¶ added in v0.14.0
func (*Vector) ProtoMessage()
func (Vector) Update ¶
Update returns a Vector with the index for the specific ID incremented by one. If it is possible, the vector v is updated and returned. If it is not, a copy will be created, updated and returned.
func (*Vector) XXX_DiscardUnknown ¶ added in v1.0.1
func (m *Vector) XXX_DiscardUnknown()