protocol

package
v0.0.0-...-b5ba5ed Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 31, 2024 License: MPL-2.0, MIT Imports: 34 Imported by: 0

Documentation

Overview

Package protocol implements the Block Exchange Protocol.

Index

Constants

View Source
const (
	SyntheticDirectorySize        = 128
	HelloMessageMagic      uint32 = 0x2EA7D90B
	Version13HelloMagic    uint32 = 0x9F79BC40 // old
)
View Source
const (
	DeviceIDLength = 32
	// keep consistent with shortIDStringLength in gui/default/syncthing/app.js
	ShortIDStringLength = 7
)
View Source
const (
	// Shifts
	KiB = 10
	MiB = 20
	GiB = 30
)
View Source
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
)
View Source
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

View Source
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
)

Variables

View Source
var (
	ErrInvalidLengthBep        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowBep          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupBep = fmt.Errorf("proto: unexpected end of group")
)
View Source
var (
	LocalDeviceID  = repeatedDeviceID(0xff)
	GlobalDeviceID = repeatedDeviceID(0xf8)
	EmptyDeviceID  = DeviceID{}
)
View Source
var (
	ErrInvalidLengthDeviceidTest        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowDeviceidTest          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupDeviceidTest = fmt.Errorf("proto: unexpected end of group")
)
View Source
var (
	ErrGeneric    = errors.New("generic error")
	ErrNoSuchFile = errors.New("no such file")
	ErrInvalid    = errors.New("file is invalid")
)
View Source
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 ExchangeHello when the other side
	// speaks something entirely unknown.
	ErrUnknownMagic = errors.New("the remote device speaks an unknown (newer?) version of the protocol")
)
View Source
var (
	ErrClosed  = errors.New("connection closed")
	ErrTimeout = errors.New("read timeout")
)
View Source
var BlockSizes []int

BlockSizes is the list of valid block sizes, from min to max

View Source
var BufferPool bufferPool

Global pool to get buffers from. Requires Blocksizes to be initialised, therefore it is initialized in the same init() as BlockSizes

View Source
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.

View Source
var Compression_name = map[int32]string{
	0: "COMPRESSION_METADATA",
	1: "COMPRESSION_NEVER",
	2: "COMPRESSION_ALWAYS",
}
View Source
var Compression_value = map[string]int32{
	"COMPRESSION_METADATA": 0,
	"COMPRESSION_NEVER":    1,
	"COMPRESSION_ALWAYS":   2,
}
View Source
var ErrorCode_name = map[int32]string{
	0: "ERROR_CODE_NO_ERROR",
	1: "ERROR_CODE_GENERIC",
	2: "ERROR_CODE_NO_SUCH_FILE",
	3: "ERROR_CODE_INVALID_FILE",
}
View Source
var ErrorCode_value = map[string]int32{
	"ERROR_CODE_NO_ERROR":     0,
	"ERROR_CODE_GENERIC":      1,
	"ERROR_CODE_NO_SUCH_FILE": 2,
	"ERROR_CODE_INVALID_FILE": 3,
}
View Source
var FileDownloadProgressUpdateType_name = map[int32]string{
	0: "FILE_DOWNLOAD_PROGRESS_UPDATE_TYPE_APPEND",
	1: "FILE_DOWNLOAD_PROGRESS_UPDATE_TYPE_FORGET",
}
View Source
var FileDownloadProgressUpdateType_value = map[string]int32{
	"FILE_DOWNLOAD_PROGRESS_UPDATE_TYPE_APPEND": 0,
	"FILE_DOWNLOAD_PROGRESS_UPDATE_TYPE_FORGET": 1,
}
View Source
var FileInfoType_name = map[int32]string{
	0: "FILE_INFO_TYPE_FILE",
	1: "FILE_INFO_TYPE_DIRECTORY",
	2: "FILE_INFO_TYPE_SYMLINK_FILE",
	3: "FILE_INFO_TYPE_SYMLINK_DIRECTORY",
	4: "FILE_INFO_TYPE_SYMLINK",
}
View Source
var FileInfoType_value = map[string]int32{
	"FILE_INFO_TYPE_FILE":              0,
	"FILE_INFO_TYPE_DIRECTORY":         1,
	"FILE_INFO_TYPE_SYMLINK_FILE":      2,
	"FILE_INFO_TYPE_SYMLINK_DIRECTORY": 3,
	"FILE_INFO_TYPE_SYMLINK":           4,
}
View Source
var MessageCompression_name = map[int32]string{
	0: "MESSAGE_COMPRESSION_NONE",
	1: "MESSAGE_COMPRESSION_LZ4",
}
View Source
var MessageCompression_value = map[string]int32{
	"MESSAGE_COMPRESSION_NONE": 0,
	"MESSAGE_COMPRESSION_LZ4":  1,
}
View Source
var MessageType_name = map[int32]string{
	0: "MESSAGE_TYPE_CLUSTER_CONFIG",
	1: "MESSAGE_TYPE_INDEX",
	2: "MESSAGE_TYPE_INDEX_UPDATE",
	3: "MESSAGE_TYPE_REQUEST",
	4: "MESSAGE_TYPE_RESPONSE",
	5: "MESSAGE_TYPE_DOWNLOAD_PROGRESS",
	6: "MESSAGE_TYPE_PING",
	7: "MESSAGE_TYPE_CLOSE",
}
View Source
var MessageType_value = map[string]int32{
	"MESSAGE_TYPE_CLUSTER_CONFIG":    0,
	"MESSAGE_TYPE_INDEX":             1,
	"MESSAGE_TYPE_INDEX_UPDATE":      2,
	"MESSAGE_TYPE_REQUEST":           3,
	"MESSAGE_TYPE_RESPONSE":          4,
	"MESSAGE_TYPE_DOWNLOAD_PROGRESS": 5,
	"MESSAGE_TYPE_PING":              6,
	"MESSAGE_TYPE_CLOSE":             7,
}

Functions

func BlockSize

func BlockSize(fileSize int64) int

BlockSize returns the block size to use for the given file size

func BlocksHash

func BlocksHash(bs []BlockInfo) []byte

func DecryptBytes

func DecryptBytes(data []byte, key *[keySize]byte) ([]byte, error)

DecryptBytes returns the decrypted bytes, or an error if decryption failed.

func IsEncryptedParent

func IsEncryptedParent(pathComponents []string) bool

IsEncryptedParent returns true if the path points at a parent directory of encrypted data, i.e. is not a "real" directory. This is determined by checking for a sentinel string in the path.

func IsVersionMismatch

func IsVersionMismatch(err error) bool

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

func ModTimeEqual(a, b time.Time, modTimeWindow time.Duration) bool

func PasswordToken

func PasswordToken(keyGen *KeyGenerator, folderID, password string) []byte

func PermsEqual

func PermsEqual(a, b uint32) bool

func TotalInOut

func TotalInOut() (int64, int64)

func VectorHash

func VectorHash(v Vector) []byte

func WinsConflict

func WinsConflict(f, other FileIntf) bool

WinsConflict returns true if "f" is the one to choose when it is in conflict with "other".

Types

type BlockInfo

type BlockInfo struct {
	Hash     []byte `protobuf:"bytes,3,opt,name=hash,proto3" json:"hash" xml:"hash"`
	Offset   int64  `protobuf:"varint,1,opt,name=offset,proto3" json:"offset" xml:"offset"`
	Size     int    `protobuf:"varint,2,opt,name=size,proto3,casttype=int" json:"size" xml:"size"`
	WeakHash uint32 `protobuf:"varint,4,opt,name=weak_hash,json=weakHash,proto3" json:"weakHash" xml:"weakHash"`
}

func (*BlockInfo) Descriptor

func (*BlockInfo) Descriptor() ([]byte, []int)

func (BlockInfo) IsEmpty

func (b BlockInfo) IsEmpty() bool

IsEmpty returns true if the block is a full block of zeroes.

func (*BlockInfo) Marshal

func (m *BlockInfo) Marshal() (dAtA []byte, err error)

func (*BlockInfo) MarshalTo

func (m *BlockInfo) MarshalTo(dAtA []byte) (int, error)

func (*BlockInfo) MarshalToSizedBuffer

func (m *BlockInfo) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*BlockInfo) ProtoMessage

func (*BlockInfo) ProtoMessage()

func (*BlockInfo) ProtoSize

func (m *BlockInfo) ProtoSize() (n int)

func (*BlockInfo) Reset

func (m *BlockInfo) Reset()

func (BlockInfo) String

func (b BlockInfo) String() string

func (*BlockInfo) Unmarshal

func (m *BlockInfo) Unmarshal(dAtA []byte) error

func (*BlockInfo) XXX_DiscardUnknown

func (m *BlockInfo) XXX_DiscardUnknown()

func (*BlockInfo) XXX_Marshal

func (m *BlockInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*BlockInfo) XXX_Merge

func (m *BlockInfo) XXX_Merge(src proto.Message)

func (*BlockInfo) XXX_Size

func (m *BlockInfo) XXX_Size() int

func (*BlockInfo) XXX_Unmarshal

func (m *BlockInfo) XXX_Unmarshal(b []byte) error

type Close

type Close struct {
	Reason string `protobuf:"bytes,1,opt,name=reason,proto3" json:"reason" xml:"reason"`
}

func (*Close) Descriptor

func (*Close) Descriptor() ([]byte, []int)

func (*Close) Marshal

func (m *Close) Marshal() (dAtA []byte, err error)

func (*Close) MarshalTo

func (m *Close) MarshalTo(dAtA []byte) (int, error)

func (*Close) MarshalToSizedBuffer

func (m *Close) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*Close) ProtoMessage

func (*Close) ProtoMessage()

func (*Close) ProtoSize

func (m *Close) ProtoSize() (n int)

func (*Close) Reset

func (m *Close) Reset()

func (*Close) String

func (m *Close) String() string

func (*Close) Unmarshal

func (m *Close) Unmarshal(dAtA []byte) error

func (*Close) XXX_DiscardUnknown

func (m *Close) XXX_DiscardUnknown()

func (*Close) XXX_Marshal

func (m *Close) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Close) XXX_Merge

func (m *Close) XXX_Merge(src proto.Message)

func (*Close) XXX_Size

func (m *Close) XXX_Size() int

func (*Close) XXX_Unmarshal

func (m *Close) XXX_Unmarshal(b []byte) error

type ClusterConfig

type ClusterConfig struct {
	Folders   []Folder `protobuf:"bytes,1,rep,name=folders,proto3" json:"folders" xml:"folder"`
	Secondary bool     `protobuf:"varint,2,opt,name=secondary,proto3" json:"secondary" xml:"secondary"`
}

func (*ClusterConfig) Descriptor

func (*ClusterConfig) Descriptor() ([]byte, []int)

func (*ClusterConfig) Marshal

func (m *ClusterConfig) Marshal() (dAtA []byte, err error)

func (*ClusterConfig) MarshalTo

func (m *ClusterConfig) MarshalTo(dAtA []byte) (int, error)

func (*ClusterConfig) MarshalToSizedBuffer

func (m *ClusterConfig) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*ClusterConfig) ProtoMessage

func (*ClusterConfig) ProtoMessage()

func (*ClusterConfig) ProtoSize

func (m *ClusterConfig) ProtoSize() (n int)

func (*ClusterConfig) Reset

func (m *ClusterConfig) Reset()

func (*ClusterConfig) String

func (m *ClusterConfig) String() string

func (*ClusterConfig) Unmarshal

func (m *ClusterConfig) Unmarshal(dAtA []byte) error

func (*ClusterConfig) XXX_DiscardUnknown

func (m *ClusterConfig) XXX_DiscardUnknown()

func (*ClusterConfig) XXX_Marshal

func (m *ClusterConfig) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*ClusterConfig) XXX_Merge

func (m *ClusterConfig) XXX_Merge(src proto.Message)

func (*ClusterConfig) XXX_Size

func (m *ClusterConfig) XXX_Size() int

func (*ClusterConfig) XXX_Unmarshal

func (m *ClusterConfig) XXX_Unmarshal(b []byte) error

type Compression

type Compression int32
const (
	CompressionMetadata Compression = 0
	CompressionNever    Compression = 1
	CompressionAlways   Compression = 2
)

func (Compression) EnumDescriptor

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()
	SetFolderPasswords(passwords map[string]string)
	Close(err error)
	DeviceID() DeviceID
	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, blockNo int, 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() <-chan struct{}
	ConnectionInfo
}

func NewConnection

func NewConnection(deviceID DeviceID, reader io.Reader, writer io.Writer, closer io.Closer, model Model, connInfo ConnectionInfo, compress Compression, passwords map[string]string, keyGen *KeyGenerator) Connection

type ConnectionInfo

type ConnectionInfo interface {
	Type() string
	Transport() string
	IsLocal() bool
	RemoteAddr() net.Addr
	Priority() int
	String() string
	Crypto() string
	EstablishedAt() time.Time
	ConnectionID() string
}

type Counter

type Counter struct {
	ID    ShortID `protobuf:"varint,1,opt,name=id,proto3,customtype=ShortID" json:"id" xml:"id"`
	Value uint64  `protobuf:"varint,2,opt,name=value,proto3" json:"value" xml:"value"`
}

func (*Counter) Descriptor

func (*Counter) Descriptor() ([]byte, []int)

func (*Counter) Marshal

func (m *Counter) Marshal() (dAtA []byte, err error)

func (*Counter) MarshalTo

func (m *Counter) MarshalTo(dAtA []byte) (int, error)

func (*Counter) MarshalToSizedBuffer

func (m *Counter) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*Counter) ProtoMessage

func (*Counter) ProtoMessage()

func (*Counter) ProtoSize

func (m *Counter) ProtoSize() (n int)

func (*Counter) Reset

func (m *Counter) Reset()

func (*Counter) String

func (m *Counter) String() string

func (*Counter) Unmarshal

func (m *Counter) Unmarshal(dAtA []byte) error

func (*Counter) XXX_DiscardUnknown

func (m *Counter) XXX_DiscardUnknown()

func (*Counter) XXX_Marshal

func (m *Counter) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Counter) XXX_Merge

func (m *Counter) XXX_Merge(src proto.Message)

func (*Counter) XXX_Size

func (m *Counter) XXX_Size() int

func (*Counter) XXX_Unmarshal

func (m *Counter) XXX_Unmarshal(b []byte) error

type Device

type Device struct {
	ID                       DeviceID    `protobuf:"bytes,1,opt,name=id,proto3,customtype=DeviceID" json:"id" xml:"id"`
	Name                     string      `protobuf:"bytes,2,opt,name=name,proto3" json:"name" xml:"name"`
	Addresses                []string    `protobuf:"bytes,3,rep,name=addresses,proto3" json:"addresses" xml:"address"`
	Compression              Compression `protobuf:"varint,4,opt,name=compression,proto3,enum=protocol.Compression" json:"compression" xml:"compression"`
	CertName                 string      `protobuf:"bytes,5,opt,name=cert_name,json=certName,proto3" json:"certName" xml:"certName"`
	MaxSequence              int64       `protobuf:"varint,6,opt,name=max_sequence,json=maxSequence,proto3" json:"maxSequence" xml:"maxSequence"`
	Introducer               bool        `protobuf:"varint,7,opt,name=introducer,proto3" json:"introducer" xml:"introducer"`
	IndexID                  IndexID     `protobuf:"varint,8,opt,name=index_id,json=indexId,proto3,customtype=IndexID" json:"indexId" xml:"indexId"`
	SkipIntroductionRemovals bool        `` /* 155-byte string literal not displayed */
	EncryptionPasswordToken  []byte      `` /* 151-byte string literal not displayed */
}

func (*Device) Descriptor

func (*Device) Descriptor() ([]byte, []int)

func (*Device) Marshal

func (m *Device) Marshal() (dAtA []byte, err error)

func (*Device) MarshalTo

func (m *Device) MarshalTo(dAtA []byte) (int, error)

func (*Device) MarshalToSizedBuffer

func (m *Device) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*Device) ProtoMessage

func (*Device) ProtoMessage()

func (*Device) ProtoSize

func (m *Device) ProtoSize() (n int)

func (*Device) Reset

func (m *Device) Reset()

func (*Device) String

func (m *Device) String() string

func (*Device) Unmarshal

func (m *Device) Unmarshal(dAtA []byte) error

func (*Device) XXX_DiscardUnknown

func (m *Device) XXX_DiscardUnknown()

func (*Device) XXX_Marshal

func (m *Device) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Device) XXX_Merge

func (m *Device) XXX_Merge(src proto.Message)

func (*Device) XXX_Size

func (m *Device) XXX_Size() int

func (*Device) XXX_Unmarshal

func (m *Device) XXX_Unmarshal(b []byte) error

type DeviceID

type DeviceID [DeviceIDLength]byte

func DeviceIDFromBytes

func DeviceIDFromBytes(bs []byte) (DeviceID, error)

func DeviceIDFromString

func DeviceIDFromString(s string) (DeviceID, error)

func NewDeviceID

func NewDeviceID(rawCert []byte) DeviceID

NewDeviceID generates a new device ID from the raw bytes of a certificate

func (DeviceID) Compare

func (n DeviceID) Compare(other DeviceID) int

func (DeviceID) Equals

func (n DeviceID) Equals(other DeviceID) bool

func (DeviceID) GoString

func (n DeviceID) GoString() string

func (DeviceID) MarshalText

func (n DeviceID) MarshalText() ([]byte, error)

func (*DeviceID) MarshalTo

func (n *DeviceID) MarshalTo(bs []byte) (int, error)

func (*DeviceID) ProtoSize

func (*DeviceID) ProtoSize() int

func (DeviceID) Short

func (n DeviceID) Short() ShortID

Short returns an integer representing bits 0-63 of the device ID.

func (DeviceID) String

func (n DeviceID) String() string

String returns the canonical string representation of the device ID

func (*DeviceID) Unmarshal

func (n *DeviceID) Unmarshal(bs []byte) error

func (*DeviceID) UnmarshalText

func (n *DeviceID) UnmarshalText(bs []byte) error

type DownloadProgress

type DownloadProgress struct {
	Folder  string                       `protobuf:"bytes,1,opt,name=folder,proto3" json:"folder" xml:"folder"`
	Updates []FileDownloadProgressUpdate `protobuf:"bytes,2,rep,name=updates,proto3" json:"updates" xml:"update"`
}

func (*DownloadProgress) Descriptor

func (*DownloadProgress) Descriptor() ([]byte, []int)

func (*DownloadProgress) Marshal

func (m *DownloadProgress) Marshal() (dAtA []byte, err error)

func (*DownloadProgress) MarshalTo

func (m *DownloadProgress) MarshalTo(dAtA []byte) (int, error)

func (*DownloadProgress) MarshalToSizedBuffer

func (m *DownloadProgress) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*DownloadProgress) ProtoMessage

func (*DownloadProgress) ProtoMessage()

func (*DownloadProgress) ProtoSize

func (m *DownloadProgress) ProtoSize() (n int)

func (*DownloadProgress) Reset

func (m *DownloadProgress) Reset()

func (*DownloadProgress) String

func (m *DownloadProgress) String() string

func (*DownloadProgress) Unmarshal

func (m *DownloadProgress) Unmarshal(dAtA []byte) error

func (*DownloadProgress) XXX_DiscardUnknown

func (m *DownloadProgress) XXX_DiscardUnknown()

func (*DownloadProgress) XXX_Marshal

func (m *DownloadProgress) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*DownloadProgress) XXX_Merge

func (m *DownloadProgress) XXX_Merge(src proto.Message)

func (*DownloadProgress) XXX_Size

func (m *DownloadProgress) XXX_Size() int

func (*DownloadProgress) XXX_Unmarshal

func (m *DownloadProgress) XXX_Unmarshal(b []byte) error

type ErrorCode

type ErrorCode int32
const (
	ErrorCodeNoError     ErrorCode = 0
	ErrorCodeGeneric     ErrorCode = 1
	ErrorCodeNoSuchFile  ErrorCode = 2
	ErrorCodeInvalidFile ErrorCode = 3
)

func (ErrorCode) EnumDescriptor

func (ErrorCode) EnumDescriptor() ([]byte, []int)

func (ErrorCode) String

func (x ErrorCode) String() string

type FileDownloadProgressUpdate

type FileDownloadProgressUpdate struct {
	UpdateType   FileDownloadProgressUpdateType `` /* 143-byte string literal not displayed */
	Name         string                         `protobuf:"bytes,2,opt,name=name,proto3" json:"name" xml:"name"`
	Version      Vector                         `protobuf:"bytes,3,opt,name=version,proto3" json:"version" xml:"version"`
	BlockIndexes []int                          `protobuf:"varint,4,rep,name=block_indexes,json=blockIndexes,proto3,casttype=int" json:"blockIndexes" xml:"blockIndexe"`
	BlockSize    int                            `protobuf:"varint,5,opt,name=block_size,json=blockSize,proto3,casttype=int" json:"blockSize" xml:"blockSize"`
}

func (*FileDownloadProgressUpdate) Descriptor

func (*FileDownloadProgressUpdate) Descriptor() ([]byte, []int)

func (*FileDownloadProgressUpdate) Marshal

func (m *FileDownloadProgressUpdate) Marshal() (dAtA []byte, err error)

func (*FileDownloadProgressUpdate) MarshalTo

func (m *FileDownloadProgressUpdate) MarshalTo(dAtA []byte) (int, error)

func (*FileDownloadProgressUpdate) MarshalToSizedBuffer

func (m *FileDownloadProgressUpdate) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*FileDownloadProgressUpdate) ProtoMessage

func (*FileDownloadProgressUpdate) ProtoMessage()

func (*FileDownloadProgressUpdate) ProtoSize

func (m *FileDownloadProgressUpdate) ProtoSize() (n int)

func (*FileDownloadProgressUpdate) Reset

func (m *FileDownloadProgressUpdate) Reset()

func (*FileDownloadProgressUpdate) String

func (m *FileDownloadProgressUpdate) String() string

func (*FileDownloadProgressUpdate) Unmarshal

func (m *FileDownloadProgressUpdate) Unmarshal(dAtA []byte) error

func (*FileDownloadProgressUpdate) XXX_DiscardUnknown

func (m *FileDownloadProgressUpdate) XXX_DiscardUnknown()

func (*FileDownloadProgressUpdate) XXX_Marshal

func (m *FileDownloadProgressUpdate) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*FileDownloadProgressUpdate) XXX_Merge

func (m *FileDownloadProgressUpdate) XXX_Merge(src proto.Message)

func (*FileDownloadProgressUpdate) XXX_Size

func (m *FileDownloadProgressUpdate) XXX_Size() int

func (*FileDownloadProgressUpdate) XXX_Unmarshal

func (m *FileDownloadProgressUpdate) XXX_Unmarshal(b []byte) error

type FileDownloadProgressUpdateType

type FileDownloadProgressUpdateType int32
const (
	FileDownloadProgressUpdateTypeAppend FileDownloadProgressUpdateType = 0
	FileDownloadProgressUpdateTypeForget FileDownloadProgressUpdateType = 1
)

func (FileDownloadProgressUpdateType) EnumDescriptor

func (FileDownloadProgressUpdateType) EnumDescriptor() ([]byte, []int)

func (FileDownloadProgressUpdateType) String

type FileInfo

type FileInfo struct {
	Name          string       `protobuf:"bytes,1,opt,name=name,proto3" json:"name" xml:"name"`
	Size          int64        `protobuf:"varint,3,opt,name=size,proto3" json:"size" xml:"size"`
	ModifiedS     int64        `protobuf:"varint,5,opt,name=modified_s,json=modifiedS,proto3" json:"modifiedS" xml:"modifiedS"`
	ModifiedBy    ShortID      `protobuf:"varint,12,opt,name=modified_by,json=modifiedBy,proto3,customtype=ShortID" json:"modifiedBy" xml:"modifiedBy"`
	Version       Vector       `protobuf:"bytes,9,opt,name=version,proto3" json:"version" xml:"version"`
	Sequence      int64        `protobuf:"varint,10,opt,name=sequence,proto3" json:"sequence" xml:"sequence"`
	Blocks        []BlockInfo  `protobuf:"bytes,16,rep,name=blocks,proto3" json:"blocks" xml:"block"`
	SymlinkTarget string       `protobuf:"bytes,17,opt,name=symlink_target,json=symlinkTarget,proto3" json:"symlinkTarget" xml:"symlinkTarget"`
	BlocksHash    []byte       `protobuf:"bytes,18,opt,name=blocks_hash,json=blocksHash,proto3" json:"blocksHash" xml:"blocksHash"`
	Encrypted     []byte       `protobuf:"bytes,19,opt,name=encrypted,proto3" json:"encrypted" xml:"encrypted"`
	Type          FileInfoType `protobuf:"varint,2,opt,name=type,proto3,enum=protocol.FileInfoType" json:"type" xml:"type"`
	Permissions   uint32       `protobuf:"varint,4,opt,name=permissions,proto3" json:"permissions" xml:"permissions"`
	ModifiedNs    int          `protobuf:"varint,11,opt,name=modified_ns,json=modifiedNs,proto3,casttype=int" json:"modifiedNs" xml:"modifiedNs"`
	RawBlockSize  int          `protobuf:"varint,13,opt,name=block_size,json=blockSize,proto3,casttype=int" json:"blockSize" xml:"blockSize"`
	Platform      PlatformData `protobuf:"bytes,14,opt,name=platform,proto3" json:"platform" xml:"platform"`
	// 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:"localFlags" xml:"localFlags"`
	// The version_hash is an implementation detail and not part of the wire
	// format.
	VersionHash []byte `protobuf:"bytes,1001,opt,name=version_hash,json=versionHash,proto3" json:"versionHash" xml:"versionHash"`
	// The time when the inode was last changed (i.e., permissions, xattrs
	// etc changed). This is host-local, not sent over the wire.
	InodeChangeNs int64 `protobuf:"varint,1002,opt,name=inode_change_ns,json=inodeChangeNs,proto3" json:"inodeChangeNs" xml:"inodeChangeNs"`
	// The size of the data appended to the encrypted file on disk. This is
	// host-local, not sent over the wire.
	EncryptionTrailerSize int  `` /* 159-byte string literal not displayed */
	Deleted               bool `protobuf:"varint,6,opt,name=deleted,proto3" json:"deleted" xml:"deleted"`
	RawInvalid            bool `protobuf:"varint,7,opt,name=invalid,proto3" json:"invalid" xml:"invalid"`
	NoPermissions         bool `protobuf:"varint,8,opt,name=no_permissions,json=noPermissions,proto3" json:"noPermissions" xml:"noPermissions"`
}

func DecryptFileInfo

func DecryptFileInfo(keyGen *KeyGenerator, fi FileInfo, folderKey *[keySize]byte) (FileInfo, error)

DecryptFileInfo extracts the encrypted portion of a FileInfo, decrypts it and returns that.

func (FileInfo) BlockSize

func (f FileInfo) BlockSize() int

func (FileInfo) BlocksEqual

func (f FileInfo) BlocksEqual(other FileInfo) bool

BlocksEqual returns true when the two files have identical block lists.

func (*FileInfo) Descriptor

func (*FileInfo) Descriptor() ([]byte, []int)

func (FileInfo) FileBlocksHash

func (f FileInfo) FileBlocksHash() []byte

func (FileInfo) FileLocalFlags

func (f FileInfo) FileLocalFlags() uint32

func (FileInfo) FileModifiedBy

func (f FileInfo) FileModifiedBy() ShortID

func (FileInfo) FileName

func (f FileInfo) FileName() string

func (FileInfo) FilePermissions

func (f FileInfo) FilePermissions() uint32

func (FileInfo) FileSize

func (f FileInfo) FileSize() int64

func (FileInfo) FileType

func (f FileInfo) FileType() FileInfoType

func (FileInfo) FileVersion

func (f FileInfo) FileVersion() Vector

func (FileInfo) HasPermissionBits

func (f FileInfo) HasPermissionBits() bool

func (FileInfo) InodeChangeTime

func (f FileInfo) InodeChangeTime() time.Time

func (FileInfo) IsDeleted

func (f FileInfo) IsDeleted() bool

func (FileInfo) IsDirectory

func (f FileInfo) IsDirectory() bool

func (FileInfo) IsEquivalent

func (f FileInfo) IsEquivalent(other FileInfo, modTimeWindow time.Duration) bool

func (FileInfo) IsEquivalentOptional

func (f FileInfo) IsEquivalentOptional(other FileInfo, comp FileInfoComparison) bool

func (FileInfo) IsIgnored

func (f FileInfo) IsIgnored() bool

func (FileInfo) IsInvalid

func (f FileInfo) IsInvalid() bool

func (FileInfo) IsReceiveOnlyChanged

func (f FileInfo) IsReceiveOnlyChanged() bool
func (f FileInfo) IsSymlink() bool

func (FileInfo) IsUnsupported

func (f FileInfo) IsUnsupported() bool

func (*FileInfo) Marshal

func (m *FileInfo) Marshal() (dAtA []byte, err error)

func (*FileInfo) MarshalTo

func (m *FileInfo) MarshalTo(dAtA []byte) (int, error)

func (*FileInfo) MarshalToSizedBuffer

func (m *FileInfo) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (FileInfo) ModTime

func (f FileInfo) ModTime() time.Time

func (FileInfo) MustRescan

func (f FileInfo) MustRescan() bool

func (FileInfo) PlatformData

func (f FileInfo) PlatformData() PlatformData

func (*FileInfo) ProtoMessage

func (*FileInfo) ProtoMessage()

func (*FileInfo) ProtoSize

func (m *FileInfo) ProtoSize() (n int)

func (*FileInfo) Reset

func (m *FileInfo) Reset()

func (FileInfo) SequenceNo

func (f FileInfo) SequenceNo() int64

func (*FileInfo) SetDeleted

func (f *FileInfo) SetDeleted(by ShortID)

func (*FileInfo) SetIgnored

func (f *FileInfo) SetIgnored()

func (*FileInfo) SetMustRescan

func (f *FileInfo) SetMustRescan()

func (*FileInfo) SetUnsupported

func (f *FileInfo) SetUnsupported()

func (FileInfo) ShouldConflict

func (f FileInfo) ShouldConflict() bool

func (FileInfo) String

func (f FileInfo) String() string

func (*FileInfo) Unmarshal

func (m *FileInfo) Unmarshal(dAtA []byte) error

func (*FileInfo) XXX_DiscardUnknown

func (m *FileInfo) XXX_DiscardUnknown()

func (*FileInfo) XXX_Marshal

func (m *FileInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*FileInfo) XXX_Merge

func (m *FileInfo) XXX_Merge(src proto.Message)

func (*FileInfo) XXX_Size

func (m *FileInfo) XXX_Size() int

func (*FileInfo) XXX_Unmarshal

func (m *FileInfo) XXX_Unmarshal(b []byte) error

type FileInfoComparison

type FileInfoComparison struct {
	ModTimeWindow   time.Duration
	IgnorePerms     bool
	IgnoreBlocks    bool
	IgnoreFlags     uint32
	IgnoreOwnership bool
	IgnoreXattrs    bool
}

type FileInfoType

type FileInfoType int32
const (
	FileInfoTypeFile             FileInfoType = 0
	FileInfoTypeDirectory        FileInfoType = 1
	FileInfoTypeSymlinkFile      FileInfoType = 2 // Deprecated: Do not use.
	FileInfoTypeSymlinkDirectory FileInfoType = 3 // Deprecated: Do not use.
	FileInfoTypeSymlink          FileInfoType = 4
)

func (FileInfoType) EnumDescriptor

func (FileInfoType) EnumDescriptor() ([]byte, []int)

func (*FileInfoType) MarshalJSON

func (x *FileInfoType) MarshalJSON() ([]byte, error)

func (FileInfoType) String

func (x FileInfoType) String() string

func (*FileInfoType) UnmarshalJSON

func (x *FileInfoType) UnmarshalJSON(data []byte) error

type FileIntf

type FileIntf interface {
	FileSize() int64
	FileName() string
	FileLocalFlags() uint32
	IsDeleted() bool
	IsInvalid() bool
	IsIgnored() bool
	IsUnsupported() bool
	MustRescan() bool
	IsReceiveOnlyChanged() bool
	IsDirectory() bool
	IsSymlink() bool
	ShouldConflict() bool
	HasPermissionBits() bool
	SequenceNo() int64
	BlockSize() int
	FileVersion() Vector
	FileType() FileInfoType
	FilePermissions() uint32
	FileModifiedBy() ShortID
	ModTime() time.Time
	PlatformData() PlatformData
	InodeChangeTime() time.Time
	FileBlocksHash() []byte
}

FileIntf is the set of methods implemented by both FileInfo and db.FileInfoTruncated.

type Folder

type Folder struct {
	ID                 string   `protobuf:"bytes,1,opt,name=id,proto3" json:"id" xml:"id"`
	Label              string   `protobuf:"bytes,2,opt,name=label,proto3" json:"label" xml:"label"`
	ReadOnly           bool     `protobuf:"varint,3,opt,name=read_only,json=readOnly,proto3" json:"readOnly" xml:"readOnly"`
	IgnorePermissions  bool     `` /* 126-byte string literal not displayed */
	IgnoreDelete       bool     `protobuf:"varint,5,opt,name=ignore_delete,json=ignoreDelete,proto3" json:"ignoreDelete" xml:"ignoreDelete"`
	DisableTempIndexes bool     `` /* 131-byte string literal not displayed */
	Paused             bool     `protobuf:"varint,7,opt,name=paused,proto3" json:"paused" xml:"paused"`
	Devices            []Device `protobuf:"bytes,16,rep,name=devices,proto3" json:"devices" xml:"device"`
}

func (Folder) Description

func (f Folder) Description() string

func (*Folder) Descriptor

func (*Folder) Descriptor() ([]byte, []int)

func (*Folder) Marshal

func (m *Folder) Marshal() (dAtA []byte, err error)

func (*Folder) MarshalTo

func (m *Folder) MarshalTo(dAtA []byte) (int, error)

func (*Folder) MarshalToSizedBuffer

func (m *Folder) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*Folder) ProtoMessage

func (*Folder) ProtoMessage()

func (*Folder) ProtoSize

func (m *Folder) ProtoSize() (n int)

func (*Folder) Reset

func (m *Folder) Reset()

func (*Folder) String

func (m *Folder) String() string

func (*Folder) Unmarshal

func (m *Folder) Unmarshal(dAtA []byte) error

func (*Folder) XXX_DiscardUnknown

func (m *Folder) XXX_DiscardUnknown()

func (*Folder) XXX_Marshal

func (m *Folder) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Folder) XXX_Merge

func (m *Folder) XXX_Merge(src proto.Message)

func (*Folder) XXX_Size

func (m *Folder) XXX_Size() int

func (*Folder) XXX_Unmarshal

func (m *Folder) XXX_Unmarshal(b []byte) error
type Header struct {
	Type        MessageType        `protobuf:"varint,1,opt,name=type,proto3,enum=protocol.MessageType" json:"type" xml:"type"`
	Compression MessageCompression `protobuf:"varint,2,opt,name=compression,proto3,enum=protocol.MessageCompression" json:"compression" xml:"compression"`
}

func (*Header) Descriptor

func (*Header) Descriptor() ([]byte, []int)

func (*Header) Marshal

func (m *Header) Marshal() (dAtA []byte, err error)

func (*Header) MarshalTo

func (m *Header) MarshalTo(dAtA []byte) (int, error)

func (*Header) MarshalToSizedBuffer

func (m *Header) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*Header) ProtoMessage

func (*Header) ProtoMessage()

func (*Header) ProtoSize

func (m *Header) ProtoSize() (n int)

func (*Header) Reset

func (m *Header) Reset()

func (*Header) String

func (m *Header) String() string

func (*Header) Unmarshal

func (m *Header) Unmarshal(dAtA []byte) error

func (*Header) XXX_DiscardUnknown

func (m *Header) XXX_DiscardUnknown()

func (*Header) XXX_Marshal

func (m *Header) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Header) XXX_Merge

func (m *Header) XXX_Merge(src proto.Message)

func (*Header) XXX_Size

func (m *Header) XXX_Size() int

func (*Header) XXX_Unmarshal

func (m *Header) XXX_Unmarshal(b []byte) error

type Hello

type Hello struct {
	DeviceName     string `protobuf:"bytes,1,opt,name=device_name,json=deviceName,proto3" json:"deviceName" xml:"deviceName"`
	ClientName     string `protobuf:"bytes,2,opt,name=client_name,json=clientName,proto3" json:"clientName" xml:"clientName"`
	ClientVersion  string `protobuf:"bytes,3,opt,name=client_version,json=clientVersion,proto3" json:"clientVersion" xml:"clientVersion"`
	NumConnections int    `` /* 127-byte string literal not displayed */
	Timestamp      int64  `protobuf:"varint,5,opt,name=timestamp,proto3" json:"timestamp" xml:"timestamp"`
}

func ExchangeHello

func ExchangeHello(c io.ReadWriter, h Hello) (Hello, error)

func (*Hello) Descriptor

func (*Hello) Descriptor() ([]byte, []int)

func (Hello) Magic

func (Hello) Magic() uint32

func (*Hello) Marshal

func (m *Hello) Marshal() (dAtA []byte, err error)

func (*Hello) MarshalTo

func (m *Hello) MarshalTo(dAtA []byte) (int, error)

func (*Hello) MarshalToSizedBuffer

func (m *Hello) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*Hello) ProtoMessage

func (*Hello) ProtoMessage()

func (*Hello) ProtoSize

func (m *Hello) ProtoSize() (n int)

func (*Hello) Reset

func (m *Hello) Reset()

func (*Hello) String

func (m *Hello) String() string

func (*Hello) Unmarshal

func (m *Hello) Unmarshal(dAtA []byte) error

func (*Hello) XXX_DiscardUnknown

func (m *Hello) XXX_DiscardUnknown()

func (*Hello) XXX_Marshal

func (m *Hello) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Hello) XXX_Merge

func (m *Hello) XXX_Merge(src proto.Message)

func (*Hello) XXX_Size

func (m *Hello) XXX_Size() int

func (*Hello) XXX_Unmarshal

func (m *Hello) XXX_Unmarshal(b []byte) error

type Index

type Index struct {
	Folder string     `protobuf:"bytes,1,opt,name=folder,proto3" json:"folder" xml:"folder"`
	Files  []FileInfo `protobuf:"bytes,2,rep,name=files,proto3" json:"files" xml:"file"`
}

func (*Index) Descriptor

func (*Index) Descriptor() ([]byte, []int)

func (*Index) Marshal

func (m *Index) Marshal() (dAtA []byte, err error)

func (*Index) MarshalTo

func (m *Index) MarshalTo(dAtA []byte) (int, error)

func (*Index) MarshalToSizedBuffer

func (m *Index) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*Index) ProtoMessage

func (*Index) ProtoMessage()

func (*Index) ProtoSize

func (m *Index) ProtoSize() (n int)

func (*Index) Reset

func (m *Index) Reset()

func (*Index) String

func (m *Index) String() string

func (*Index) Unmarshal

func (m *Index) Unmarshal(dAtA []byte) error

func (*Index) XXX_DiscardUnknown

func (m *Index) XXX_DiscardUnknown()

func (*Index) XXX_Marshal

func (m *Index) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Index) XXX_Merge

func (m *Index) XXX_Merge(src proto.Message)

func (*Index) XXX_Size

func (m *Index) XXX_Size() int

func (*Index) XXX_Unmarshal

func (m *Index) XXX_Unmarshal(b []byte) error

type IndexID

type IndexID uint64

func NewIndexID

func NewIndexID() IndexID

func (IndexID) Marshal

func (i IndexID) Marshal() ([]byte, error)

func (IndexID) String

func (i IndexID) String() string

func (*IndexID) Unmarshal

func (i *IndexID) Unmarshal(bs []byte) error

type IndexUpdate

type IndexUpdate struct {
	Folder string     `protobuf:"bytes,1,opt,name=folder,proto3" json:"folder" xml:"folder"`
	Files  []FileInfo `protobuf:"bytes,2,rep,name=files,proto3" json:"files" xml:"file"`
}

func (*IndexUpdate) Descriptor

func (*IndexUpdate) Descriptor() ([]byte, []int)

func (*IndexUpdate) Marshal

func (m *IndexUpdate) Marshal() (dAtA []byte, err error)

func (*IndexUpdate) MarshalTo

func (m *IndexUpdate) MarshalTo(dAtA []byte) (int, error)

func (*IndexUpdate) MarshalToSizedBuffer

func (m *IndexUpdate) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*IndexUpdate) ProtoMessage

func (*IndexUpdate) ProtoMessage()

func (*IndexUpdate) ProtoSize

func (m *IndexUpdate) ProtoSize() (n int)

func (*IndexUpdate) Reset

func (m *IndexUpdate) Reset()

func (*IndexUpdate) String

func (m *IndexUpdate) String() string

func (*IndexUpdate) Unmarshal

func (m *IndexUpdate) Unmarshal(dAtA []byte) error

func (*IndexUpdate) XXX_DiscardUnknown

func (m *IndexUpdate) XXX_DiscardUnknown()

func (*IndexUpdate) XXX_Marshal

func (m *IndexUpdate) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*IndexUpdate) XXX_Merge

func (m *IndexUpdate) XXX_Merge(src proto.Message)

func (*IndexUpdate) XXX_Size

func (m *IndexUpdate) XXX_Size() int

func (*IndexUpdate) XXX_Unmarshal

func (m *IndexUpdate) XXX_Unmarshal(b []byte) error

type KeyGenerator

type KeyGenerator struct {
	// contains filtered or unexported fields
}

func NewKeyGenerator

func NewKeyGenerator() *KeyGenerator

func (*KeyGenerator) FileKey

func (g *KeyGenerator) FileKey(filename string, folderKey *[keySize]byte) *[keySize]byte

func (*KeyGenerator) KeyFromPassword

func (g *KeyGenerator) KeyFromPassword(folderID, password string) *[keySize]byte

KeyFromPassword uses key derivation to generate a stronger key from a probably weak password.

type MessageCompression

type MessageCompression int32
const (
	MessageCompressionNone MessageCompression = 0
	MessageCompressionLZ4  MessageCompression = 1
)

func (MessageCompression) EnumDescriptor

func (MessageCompression) EnumDescriptor() ([]byte, []int)

func (MessageCompression) String

func (x MessageCompression) String() string

type MessageType

type MessageType int32
const (
	MessageTypeClusterConfig    MessageType = 0
	MessageTypeIndex            MessageType = 1
	MessageTypeIndexUpdate      MessageType = 2
	MessageTypeRequest          MessageType = 3
	MessageTypeResponse         MessageType = 4
	MessageTypeDownloadProgress MessageType = 5
	MessageTypePing             MessageType = 6
	MessageTypeClose            MessageType = 7
)

func (MessageType) EnumDescriptor

func (MessageType) EnumDescriptor() ([]byte, []int)

func (MessageType) String

func (x MessageType) String() string

type Model

type Model interface {
	// An index was received from the peer device
	Index(conn Connection, folder string, files []FileInfo) error
	// An index update was received from the peer device
	IndexUpdate(conn Connection, folder string, files []FileInfo) error
	// A request was made by the peer device
	Request(conn Connection, folder, name string, blockNo, size int32, offset int64, hash []byte, weakHash uint32, fromTemporary bool) (RequestResponse, error)
	// A cluster configuration message was received
	ClusterConfig(conn Connection, config ClusterConfig) error
	// The peer device closed the connection or an error occurred
	Closed(conn Connection, err error)
	// The peer device sent progress updates for the files it is currently downloading
	DownloadProgress(conn Connection, folder string, updates []FileDownloadProgressUpdate) error
}

type Ordering

type Ordering int

Ordering represents the relationship between two Vectors.

const (
	Equal Ordering = iota
	Greater
	Lesser
	ConcurrentLesser
	ConcurrentGreater
)

type Ping

type Ping struct {
}

func (*Ping) Descriptor

func (*Ping) Descriptor() ([]byte, []int)

func (*Ping) Marshal

func (m *Ping) Marshal() (dAtA []byte, err error)

func (*Ping) MarshalTo

func (m *Ping) MarshalTo(dAtA []byte) (int, error)

func (*Ping) MarshalToSizedBuffer

func (m *Ping) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*Ping) ProtoMessage

func (*Ping) ProtoMessage()

func (*Ping) ProtoSize

func (m *Ping) ProtoSize() (n int)

func (*Ping) Reset

func (m *Ping) Reset()

func (*Ping) String

func (m *Ping) String() string

func (*Ping) Unmarshal

func (m *Ping) Unmarshal(dAtA []byte) error

func (*Ping) XXX_DiscardUnknown

func (m *Ping) XXX_DiscardUnknown()

func (*Ping) XXX_Marshal

func (m *Ping) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Ping) XXX_Merge

func (m *Ping) XXX_Merge(src proto.Message)

func (*Ping) XXX_Size

func (m *Ping) XXX_Size() int

func (*Ping) XXX_Unmarshal

func (m *Ping) XXX_Unmarshal(b []byte) error

type PlatformData

type PlatformData struct {
	Unix    *UnixData    `protobuf:"bytes,1,opt,name=unix,proto3" json:"unix" xml:"unix"`
	Windows *WindowsData `protobuf:"bytes,2,opt,name=windows,proto3" json:"windows" xml:"windows"`
	Linux   *XattrData   `protobuf:"bytes,3,opt,name=linux,proto3" json:"linux" xml:"linux"`
	Darwin  *XattrData   `protobuf:"bytes,4,opt,name=darwin,proto3" json:"darwin" xml:"darwin"`
	FreeBSD *XattrData   `protobuf:"bytes,5,opt,name=freebsd,proto3" json:"freebsd" xml:"freebsd"`
	NetBSD  *XattrData   `protobuf:"bytes,6,opt,name=netbsd,proto3" json:"netbsd" xml:"netbsd"`
}

func (*PlatformData) Descriptor

func (*PlatformData) Descriptor() ([]byte, []int)

func (*PlatformData) Marshal

func (m *PlatformData) Marshal() (dAtA []byte, err error)

func (*PlatformData) MarshalTo

func (m *PlatformData) MarshalTo(dAtA []byte) (int, error)

func (*PlatformData) MarshalToSizedBuffer

func (m *PlatformData) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*PlatformData) MergeWith

func (p *PlatformData) MergeWith(other *PlatformData)

MergeWith copies platform data from other, for platforms where it's not already set on p.

func (*PlatformData) ProtoMessage

func (*PlatformData) ProtoMessage()

func (*PlatformData) ProtoSize

func (m *PlatformData) ProtoSize() (n int)

func (*PlatformData) Reset

func (m *PlatformData) Reset()

func (*PlatformData) SetXattrs

func (p *PlatformData) SetXattrs(xattrs []Xattr)

SetXattrs is a convenience method to set the extended attributes of the file for the current platform.

func (*PlatformData) String

func (m *PlatformData) String() string

func (*PlatformData) Unmarshal

func (m *PlatformData) Unmarshal(dAtA []byte) error

func (*PlatformData) XXX_DiscardUnknown

func (m *PlatformData) XXX_DiscardUnknown()

func (*PlatformData) XXX_Marshal

func (m *PlatformData) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*PlatformData) XXX_Merge

func (m *PlatformData) XXX_Merge(src proto.Message)

func (*PlatformData) XXX_Size

func (m *PlatformData) XXX_Size() int

func (*PlatformData) XXX_Unmarshal

func (m *PlatformData) XXX_Unmarshal(b []byte) error

func (*PlatformData) Xattrs

func (f *PlatformData) Xattrs() []Xattr

Xattrs is a convenience method to return the extended attributes of the file for the current platform.

type Request

type Request struct {
	ID            int    `protobuf:"varint,1,opt,name=id,proto3,casttype=int" json:"id" xml:"id"`
	Folder        string `protobuf:"bytes,2,opt,name=folder,proto3" json:"folder" xml:"folder"`
	Name          string `protobuf:"bytes,3,opt,name=name,proto3" json:"name" xml:"name"`
	Offset        int64  `protobuf:"varint,4,opt,name=offset,proto3" json:"offset" xml:"offset"`
	Size          int    `protobuf:"varint,5,opt,name=size,proto3,casttype=int" json:"size" xml:"size"`
	Hash          []byte `protobuf:"bytes,6,opt,name=hash,proto3" json:"hash" xml:"hash"`
	FromTemporary bool   `protobuf:"varint,7,opt,name=from_temporary,json=fromTemporary,proto3" json:"fromTemporary" xml:"fromTemporary"`
	WeakHash      uint32 `protobuf:"varint,8,opt,name=weak_hash,json=weakHash,proto3" json:"weakHash" xml:"weakHash"`
	BlockNo       int    `protobuf:"varint,9,opt,name=block_no,json=blockNo,proto3,casttype=int" json:"blockNo" xml:"blockNo"`
}

func (*Request) Descriptor

func (*Request) Descriptor() ([]byte, []int)

func (*Request) Marshal

func (m *Request) Marshal() (dAtA []byte, err error)

func (*Request) MarshalTo

func (m *Request) MarshalTo(dAtA []byte) (int, error)

func (*Request) MarshalToSizedBuffer

func (m *Request) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*Request) ProtoMessage

func (*Request) ProtoMessage()

func (*Request) ProtoSize

func (m *Request) ProtoSize() (n int)

func (*Request) Reset

func (m *Request) Reset()

func (*Request) String

func (m *Request) String() string

func (*Request) Unmarshal

func (m *Request) Unmarshal(dAtA []byte) error

func (*Request) XXX_DiscardUnknown

func (m *Request) XXX_DiscardUnknown()

func (*Request) XXX_Marshal

func (m *Request) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Request) XXX_Merge

func (m *Request) XXX_Merge(src proto.Message)

func (*Request) XXX_Size

func (m *Request) XXX_Size() int

func (*Request) XXX_Unmarshal

func (m *Request) XXX_Unmarshal(b []byte) error

type RequestResponse

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

type Response struct {
	ID   int       `protobuf:"varint,1,opt,name=id,proto3,casttype=int" json:"id" xml:"id"`
	Data []byte    `protobuf:"bytes,2,opt,name=data,proto3" json:"data" xml:"data"`
	Code ErrorCode `protobuf:"varint,3,opt,name=code,proto3,enum=protocol.ErrorCode" json:"code" xml:"code"`
}

func (*Response) Descriptor

func (*Response) Descriptor() ([]byte, []int)

func (*Response) Marshal

func (m *Response) Marshal() (dAtA []byte, err error)

func (*Response) MarshalTo

func (m *Response) MarshalTo(dAtA []byte) (int, error)

func (*Response) MarshalToSizedBuffer

func (m *Response) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*Response) ProtoMessage

func (*Response) ProtoMessage()

func (*Response) ProtoSize

func (m *Response) ProtoSize() (n int)

func (*Response) Reset

func (m *Response) Reset()

func (*Response) String

func (m *Response) String() string

func (*Response) Unmarshal

func (m *Response) Unmarshal(dAtA []byte) error

func (*Response) XXX_DiscardUnknown

func (m *Response) XXX_DiscardUnknown()

func (*Response) XXX_Marshal

func (m *Response) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Response) XXX_Merge

func (m *Response) XXX_Merge(src proto.Message)

func (*Response) XXX_Size

func (m *Response) XXX_Size() int

func (*Response) XXX_Unmarshal

func (m *Response) XXX_Unmarshal(b []byte) error

type ShortID

type ShortID uint64

func (ShortID) String

func (s ShortID) String() string

type Statistics

type Statistics struct {
	At            time.Time `json:"at"`
	InBytesTotal  int64     `json:"inBytesTotal"`
	OutBytesTotal int64     `json:"outBytesTotal"`
	StartedAt     time.Time `json:"startedAt"`
}

type TestNewDeviceID

type TestNewDeviceID struct {
	Test DeviceID `protobuf:"bytes,1,opt,name=test,proto3,customtype=DeviceID" json:"test" xml:"test"`
}

func (*TestNewDeviceID) Descriptor

func (*TestNewDeviceID) Descriptor() ([]byte, []int)

func (*TestNewDeviceID) Marshal

func (m *TestNewDeviceID) Marshal() (dAtA []byte, err error)

func (*TestNewDeviceID) MarshalTo

func (m *TestNewDeviceID) MarshalTo(dAtA []byte) (int, error)

func (*TestNewDeviceID) MarshalToSizedBuffer

func (m *TestNewDeviceID) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*TestNewDeviceID) ProtoMessage

func (*TestNewDeviceID) ProtoMessage()

func (*TestNewDeviceID) ProtoSize

func (m *TestNewDeviceID) ProtoSize() (n int)

func (*TestNewDeviceID) Reset

func (m *TestNewDeviceID) Reset()

func (*TestNewDeviceID) String

func (m *TestNewDeviceID) String() string

func (*TestNewDeviceID) Unmarshal

func (m *TestNewDeviceID) Unmarshal(dAtA []byte) error

func (*TestNewDeviceID) XXX_DiscardUnknown

func (m *TestNewDeviceID) XXX_DiscardUnknown()

func (*TestNewDeviceID) XXX_Marshal

func (m *TestNewDeviceID) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*TestNewDeviceID) XXX_Merge

func (m *TestNewDeviceID) XXX_Merge(src proto.Message)

func (*TestNewDeviceID) XXX_Size

func (m *TestNewDeviceID) XXX_Size() int

func (*TestNewDeviceID) XXX_Unmarshal

func (m *TestNewDeviceID) XXX_Unmarshal(b []byte) error

type TestOldDeviceID

type TestOldDeviceID struct {
	Test []byte `protobuf:"bytes,1,opt,name=test,proto3" json:"test" xml:"test"`
}

func (*TestOldDeviceID) Descriptor

func (*TestOldDeviceID) Descriptor() ([]byte, []int)

func (*TestOldDeviceID) Marshal

func (m *TestOldDeviceID) Marshal() (dAtA []byte, err error)

func (*TestOldDeviceID) MarshalTo

func (m *TestOldDeviceID) MarshalTo(dAtA []byte) (int, error)

func (*TestOldDeviceID) MarshalToSizedBuffer

func (m *TestOldDeviceID) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*TestOldDeviceID) ProtoMessage

func (*TestOldDeviceID) ProtoMessage()

func (*TestOldDeviceID) ProtoSize

func (m *TestOldDeviceID) ProtoSize() (n int)

func (*TestOldDeviceID) Reset

func (m *TestOldDeviceID) Reset()

func (*TestOldDeviceID) String

func (m *TestOldDeviceID) String() string

func (*TestOldDeviceID) Unmarshal

func (m *TestOldDeviceID) Unmarshal(dAtA []byte) error

func (*TestOldDeviceID) XXX_DiscardUnknown

func (m *TestOldDeviceID) XXX_DiscardUnknown()

func (*TestOldDeviceID) XXX_Marshal

func (m *TestOldDeviceID) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*TestOldDeviceID) XXX_Merge

func (m *TestOldDeviceID) XXX_Merge(src proto.Message)

func (*TestOldDeviceID) XXX_Size

func (m *TestOldDeviceID) XXX_Size() int

func (*TestOldDeviceID) XXX_Unmarshal

func (m *TestOldDeviceID) XXX_Unmarshal(b []byte) error

type UnixData

type UnixData struct {
	// The owner name and group name are set when known (i.e., could be
	// resolved on the source device), while the UID and GID are always set
	// as they come directly from the stat() call.
	OwnerName string `protobuf:"bytes,1,opt,name=owner_name,json=ownerName,proto3" json:"ownerName" xml:"ownerName"`
	GroupName string `protobuf:"bytes,2,opt,name=group_name,json=groupName,proto3" json:"groupName" xml:"groupName"`
	UID       int    `protobuf:"varint,3,opt,name=uid,proto3,casttype=int" json:"uid" xml:"uid"`
	GID       int    `protobuf:"varint,4,opt,name=gid,proto3,casttype=int" json:"gid" xml:"gid"`
}

func (*UnixData) Descriptor

func (*UnixData) Descriptor() ([]byte, []int)

func (*UnixData) Marshal

func (m *UnixData) Marshal() (dAtA []byte, err error)

func (*UnixData) MarshalTo

func (m *UnixData) MarshalTo(dAtA []byte) (int, error)

func (*UnixData) MarshalToSizedBuffer

func (m *UnixData) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*UnixData) ProtoMessage

func (*UnixData) ProtoMessage()

func (*UnixData) ProtoSize

func (m *UnixData) ProtoSize() (n int)

func (*UnixData) Reset

func (m *UnixData) Reset()

func (*UnixData) String

func (m *UnixData) String() string

func (*UnixData) Unmarshal

func (m *UnixData) Unmarshal(dAtA []byte) error

func (*UnixData) XXX_DiscardUnknown

func (m *UnixData) XXX_DiscardUnknown()

func (*UnixData) XXX_Marshal

func (m *UnixData) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*UnixData) XXX_Merge

func (m *UnixData) XXX_Merge(src proto.Message)

func (*UnixData) XXX_Size

func (m *UnixData) XXX_Size() int

func (*UnixData) XXX_Unmarshal

func (m *UnixData) XXX_Unmarshal(b []byte) error

type Vector

type Vector struct {
	Counters []Counter `protobuf:"bytes,1,rep,name=counters,proto3" json:"counters" xml:"counter"`
}

func (Vector) Compare

func (v Vector) Compare(b Vector) Ordering

Compare returns the Ordering that describes a's relation to b.

func (Vector) Concurrent

func (v Vector) Concurrent(b Vector) bool

Concurrent returns true when the two vectors are concurrent.

func (Vector) Copy

func (v Vector) Copy() Vector

Copy returns an identical vector that is not shared with v.

func (Vector) Counter

func (v Vector) Counter(id ShortID) uint64

Counter returns the current value of the given counter ID.

func (*Vector) Descriptor

func (*Vector) Descriptor() ([]byte, []int)

func (Vector) DropOthers

func (v Vector) DropOthers(id ShortID) Vector

DropOthers removes all counters, keeping only the one with given id. If there is no such counter, an empty Vector is returned.

func (Vector) Equal

func (v Vector) Equal(b Vector) bool

Equal returns true when the two vectors are equivalent.

func (Vector) GreaterEqual

func (v Vector) GreaterEqual(b Vector) bool

GreaterEqual returns true when the two vectors are equivalent or v is Greater than b.

func (Vector) IsEmpty

func (v Vector) IsEmpty() bool

IsEmpty returns true when there are no counters.

func (Vector) LesserEqual

func (v Vector) LesserEqual(b Vector) bool

LesserEqual returns true when the two vectors are equivalent or v is Lesser than b.

func (*Vector) Marshal

func (m *Vector) Marshal() (dAtA []byte, err error)

func (*Vector) MarshalTo

func (m *Vector) MarshalTo(dAtA []byte) (int, error)

func (*Vector) MarshalToSizedBuffer

func (m *Vector) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (Vector) Merge

func (v Vector) Merge(b Vector) Vector

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

func (*Vector) ProtoMessage()

func (*Vector) ProtoSize

func (m *Vector) ProtoSize() (n int)

func (*Vector) Reset

func (m *Vector) Reset()

func (*Vector) String

func (m *Vector) String() string

func (*Vector) Unmarshal

func (m *Vector) Unmarshal(dAtA []byte) error

func (Vector) Update

func (v Vector) Update(id ShortID) Vector

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

func (m *Vector) XXX_DiscardUnknown()

func (*Vector) XXX_Marshal

func (m *Vector) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Vector) XXX_Merge

func (m *Vector) XXX_Merge(src proto.Message)

func (*Vector) XXX_Size

func (m *Vector) XXX_Size() int

func (*Vector) XXX_Unmarshal

func (m *Vector) XXX_Unmarshal(b []byte) error

type WindowsData

type WindowsData struct {
	// Windows file objects have a single owner, which may be a user or a
	// group. We keep the name of that account, and a flag to indicate what
	// type it is.
	OwnerName    string `protobuf:"bytes,1,opt,name=owner_name,json=ownerName,proto3" json:"ownerName" xml:"ownerName"`
	OwnerIsGroup bool   `protobuf:"varint,2,opt,name=owner_is_group,json=ownerIsGroup,proto3" json:"ownerIsGroup" xml:"ownerIsGroup"`
}

func (*WindowsData) Descriptor

func (*WindowsData) Descriptor() ([]byte, []int)

func (*WindowsData) Marshal

func (m *WindowsData) Marshal() (dAtA []byte, err error)

func (*WindowsData) MarshalTo

func (m *WindowsData) MarshalTo(dAtA []byte) (int, error)

func (*WindowsData) MarshalToSizedBuffer

func (m *WindowsData) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*WindowsData) ProtoMessage

func (*WindowsData) ProtoMessage()

func (*WindowsData) ProtoSize

func (m *WindowsData) ProtoSize() (n int)

func (*WindowsData) Reset

func (m *WindowsData) Reset()

func (*WindowsData) String

func (m *WindowsData) String() string

func (*WindowsData) Unmarshal

func (m *WindowsData) Unmarshal(dAtA []byte) error

func (*WindowsData) XXX_DiscardUnknown

func (m *WindowsData) XXX_DiscardUnknown()

func (*WindowsData) XXX_Marshal

func (m *WindowsData) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*WindowsData) XXX_Merge

func (m *WindowsData) XXX_Merge(src proto.Message)

func (*WindowsData) XXX_Size

func (m *WindowsData) XXX_Size() int

func (*WindowsData) XXX_Unmarshal

func (m *WindowsData) XXX_Unmarshal(b []byte) error

type Xattr

type Xattr struct {
	Name  string `protobuf:"bytes,1,opt,name=name,proto3" json:"name" xml:"name"`
	Value []byte `protobuf:"bytes,2,opt,name=value,proto3" json:"value" xml:"value"`
}

func (*Xattr) Descriptor

func (*Xattr) Descriptor() ([]byte, []int)

func (*Xattr) Marshal

func (m *Xattr) Marshal() (dAtA []byte, err error)

func (*Xattr) MarshalTo

func (m *Xattr) MarshalTo(dAtA []byte) (int, error)

func (*Xattr) MarshalToSizedBuffer

func (m *Xattr) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*Xattr) ProtoMessage

func (*Xattr) ProtoMessage()

func (*Xattr) ProtoSize

func (m *Xattr) ProtoSize() (n int)

func (*Xattr) Reset

func (m *Xattr) Reset()

func (*Xattr) String

func (m *Xattr) String() string

func (*Xattr) Unmarshal

func (m *Xattr) Unmarshal(dAtA []byte) error

func (*Xattr) XXX_DiscardUnknown

func (m *Xattr) XXX_DiscardUnknown()

func (*Xattr) XXX_Marshal

func (m *Xattr) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Xattr) XXX_Merge

func (m *Xattr) XXX_Merge(src proto.Message)

func (*Xattr) XXX_Size

func (m *Xattr) XXX_Size() int

func (*Xattr) XXX_Unmarshal

func (m *Xattr) XXX_Unmarshal(b []byte) error

type XattrData

type XattrData struct {
	Xattrs []Xattr `protobuf:"bytes,1,rep,name=xattrs,proto3" json:"xattrs" xml:"xattr"`
}

func (*XattrData) Descriptor

func (*XattrData) Descriptor() ([]byte, []int)

func (*XattrData) Marshal

func (m *XattrData) Marshal() (dAtA []byte, err error)

func (*XattrData) MarshalTo

func (m *XattrData) MarshalTo(dAtA []byte) (int, error)

func (*XattrData) MarshalToSizedBuffer

func (m *XattrData) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*XattrData) ProtoMessage

func (*XattrData) ProtoMessage()

func (*XattrData) ProtoSize

func (m *XattrData) ProtoSize() (n int)

func (*XattrData) Reset

func (m *XattrData) Reset()

func (*XattrData) String

func (m *XattrData) String() string

func (*XattrData) Unmarshal

func (m *XattrData) Unmarshal(dAtA []byte) error

func (*XattrData) XXX_DiscardUnknown

func (m *XattrData) XXX_DiscardUnknown()

func (*XattrData) XXX_Marshal

func (m *XattrData) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*XattrData) XXX_Merge

func (m *XattrData) XXX_Merge(src proto.Message)

func (*XattrData) XXX_Size

func (m *XattrData) XXX_Size() int

func (*XattrData) XXX_Unmarshal

func (m *XattrData) XXX_Unmarshal(b []byte) error

Directories

Path Synopsis
Code generated by counterfeiter.
Code generated by counterfeiter.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL