protocol

package
v0.14.48-rc.2 Latest Latest
Warning

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

Go to latest
Published: May 8, 2018 License: MPL-2.0, MIT Imports: 24 Imported by: 0

Documentation

Overview

Package protocol is a generated protocol buffer package.

It is generated from these files:
	bep.proto

It has these top-level messages:
	Hello
	Header
	ClusterConfig
	Folder
	Device
	Index
	IndexUpdate
	FileInfo
	BlockInfo
	Vector
	Counter
	Request
	Response
	DownloadProgress
	FileDownloadProgressUpdate
	Ping
	Close

Package protocol is a generated protocol buffer package.

It is generated from these files:

deviceid_test.proto

It has these top-level messages:

TestOldDeviceID
TestNewDeviceID

Package protocol implements the Block Exchange Protocol.

Index

Constants

View Source
const (
	SyntheticDirectorySize = 128
	HelloMessageMagic      = uint32(0x2EA7D90B)
)
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 (
	FlagFolderReadOnly            uint32 = 1 << 0
	FlagFolderIgnorePerms                = 1 << 1
	FlagFolderIgnoreDelete               = 1 << 2
	FlagFolderDisabledTempIndexes        = 1 << 3
	FlagFolderAll                        = 1<<4 - 1
)

ClusterConfigMessage.Folders flags

View Source
const (
	FlagShareTrusted  uint32 = 1 << 0
	FlagShareReadOnly        = 1 << 1
	FlagIntroducer           = 1 << 2
	FlagShareBits            = 0x000000ff
)

ClusterConfigMessage.Folders.Devices 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
)
View Source
const DeviceIDLength = 32
View Source
const (
	FlagFromTemporary uint32 = 1 << iota
)

Request message flags

Variables

View Source
var (
	ErrInvalidLengthBep = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowBep   = fmt.Errorf("proto: integer overflow")
)
View Source
var (
	LocalDeviceID = DeviceID{0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}
	EmptyDeviceID = DeviceID{}
)
View Source
var (
	ErrInvalidLengthDeviceidTest = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowDeviceidTest   = fmt.Errorf("proto: integer overflow")
)
View Source
var (
	ErrNoError    error
	ErrGeneric    = errors.New("generic error")
	ErrNoSuchFile = errors.New("no such file")
	ErrInvalid    = errors.New("file is invalid")
)
View Source
var (
	// ErrTooOldVersion12 is returned by ExchangeHello when the other side
	// speaks the older, incompatible version 0.12 of the protocol.
	ErrTooOldVersion12 = errors.New("the remote device speaks an older version of the protocol (v0.12) not compatible with this version")
	// ErrTooOldVersion13 is returned by ExchangeHello when the other side
	// speaks the older, incompatible version 0.12 of the protocol.
	ErrTooOldVersion13 = errors.New("the remote device speaks an older version of the protocol (v0.13) 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")
)
View Source
var (
	ErrClosed               = errors.New("connection closed")
	ErrTimeout              = errors.New("read timeout")
	ErrSwitchingConnections = errors.New("switching connections")
)
View Source
var BlockSizes []int

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

View Source
var Compression_name = map[int32]string{
	0: "METADATA",
	1: "NEVER",
	2: "ALWAYS",
}
View Source
var Compression_value = map[string]int32{
	"METADATA": 0,
	"NEVER":    1,
	"ALWAYS":   2,
}
View Source
var ErrorCode_name = map[int32]string{
	0: "NO_ERROR",
	1: "GENERIC",
	2: "NO_SUCH_FILE",
	3: "INVALID_FILE",
}
View Source
var ErrorCode_value = map[string]int32{
	"NO_ERROR":     0,
	"GENERIC":      1,
	"NO_SUCH_FILE": 2,
	"INVALID_FILE": 3,
}
View Source
var FileDownloadProgressUpdateType_name = map[int32]string{
	0: "APPEND",
	1: "FORGET",
}
View Source
var FileDownloadProgressUpdateType_value = map[string]int32{
	"APPEND": 0,
	"FORGET": 1,
}
View Source
var FileInfoType_name = map[int32]string{
	0: "FILE",
	1: "DIRECTORY",
	2: "SYMLINK_FILE",
	3: "SYMLINK_DIRECTORY",
	4: "SYMLINK",
}
View Source
var FileInfoType_value = map[string]int32{
	"FILE":              0,
	"DIRECTORY":         1,
	"SYMLINK_FILE":      2,
	"SYMLINK_DIRECTORY": 3,
	"SYMLINK":           4,
}
View Source
var MessageCompression_name = map[int32]string{
	0: "NONE",
	1: "LZ4",
}
View Source
var MessageCompression_value = map[string]int32{
	"NONE": 0,
	"LZ4":  1,
}
View Source
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",
}
View Source
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,
}
View Source
var (
	Version13HelloMagic uint32 = 0x9F79BC40
)

Functions

func BlockSize

func BlockSize(fileSize int64) int

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

func BlocksEqual added in v0.14.46

func BlocksEqual(a, b []BlockInfo) bool

BlocksEqual returns whether two slices of blocks are exactly the same hash and index pair wise.

func IsVersionMismatch added in v0.13.6

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 PermsEqual added in v0.14.46

func PermsEqual(a, b uint32) bool

func TotalInOut

func TotalInOut() (int64, int64)

Types

type BlockInfo

type BlockInfo struct {
	Offset   int64  `protobuf:"varint,1,opt,name=offset,proto3" json:"offset,omitempty"`
	Size     int32  `protobuf:"varint,2,opt,name=size,proto3" json:"size,omitempty"`
	Hash     []byte `protobuf:"bytes,3,opt,name=hash,proto3" json:"hash,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) Descriptor() ([]byte, []int)

func (BlockInfo) IsEmpty added in v0.12.4

func (b BlockInfo) IsEmpty() bool

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

func (*BlockInfo) Marshal added in v0.14.0

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

func (*BlockInfo) MarshalTo added in v0.14.0

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

func (*BlockInfo) ProtoMessage added in v0.14.0

func (*BlockInfo) ProtoMessage()

func (*BlockInfo) ProtoSize added in v0.14.0

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

func (*BlockInfo) Reset added in v0.14.0

func (m *BlockInfo) Reset()

func (BlockInfo) String

func (b BlockInfo) String() string

func (*BlockInfo) Unmarshal added in v0.14.0

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

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) Descriptor() ([]byte, []int)

func (*Close) Marshal added in v0.14.0

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

func (*Close) MarshalTo added in v0.14.0

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

func (*Close) ProtoMessage added in v0.14.0

func (*Close) ProtoMessage()

func (*Close) ProtoSize added in v0.14.0

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

func (*Close) Reset added in v0.14.0

func (m *Close) Reset()

func (*Close) String added in v0.14.0

func (m *Close) String() string

func (*Close) Unmarshal added in v0.14.0

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

type ClusterConfig added in v0.14.0

type ClusterConfig struct {
	Folders []Folder `protobuf:"bytes,1,rep,name=folders" 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) 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

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()
	ID() DeviceID
	Name() string
	Index(folder string, files []FileInfo) error
	IndexUpdate(folder string, files []FileInfo) error
	Request(folder string, name string, offset int64, size int, hash []byte, weakHash uint32, fromTemporary bool) ([]byte, error)
	ClusterConfig(config ClusterConfig)
	DownloadProgress(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) Descriptor() ([]byte, []int)

func (*Counter) Marshal added in v0.14.0

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

func (*Counter) MarshalTo added in v0.14.0

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

func (*Counter) ProtoMessage added in v0.14.0

func (*Counter) ProtoMessage()

func (*Counter) ProtoSize added in v0.14.0

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

func (*Counter) Reset added in v0.14.0

func (m *Counter) Reset()

func (*Counter) String added in v0.14.0

func (m *Counter) String() string

func (*Counter) Unmarshal added in v0.14.0

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

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" 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) Descriptor() ([]byte, []int)

func (*Device) Marshal added in v0.14.0

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

func (*Device) MarshalTo added in v0.14.0

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

func (*Device) ProtoMessage added in v0.14.0

func (*Device) ProtoMessage()

func (*Device) ProtoSize added in v0.14.0

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

func (*Device) Reset added in v0.14.0

func (m *Device) Reset()

func (*Device) String added in v0.14.0

func (m *Device) String() string

func (*Device) Unmarshal added in v0.14.0

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

type DeviceID

type DeviceID [DeviceIDLength]byte

func DeviceIDFromBytes

func DeviceIDFromBytes(bs []byte) DeviceID

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 added in v0.14.10

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

func (*DeviceID) ProtoSize added in v0.14.10

func (n *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 added in v0.14.10

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

func (*DeviceID) UnmarshalText

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

type DeviceIDs added in v0.14.12

type DeviceIDs []DeviceID

DeviceIDs is a sortable slice of DeviceID

func (DeviceIDs) Len added in v0.14.12

func (l DeviceIDs) Len() int

func (DeviceIDs) Less added in v0.14.12

func (l DeviceIDs) Less(a, b int) bool

func (DeviceIDs) Swap added in v0.14.12

func (l DeviceIDs) Swap(a, b int)

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" 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) 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

type ErrorCode added in v0.14.0

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

func (ErrorCode) EnumDescriptor added in v0.14.0

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

func (ErrorCode) String added in v0.14.0

func (x ErrorCode) String() string

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" json:"version"`
	BlockIndexes []int32                        `protobuf:"varint,4,rep,name=block_indexes,json=blockIndexes" json:"block_indexes,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) 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

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

type FileInfo

type FileInfo struct {
	Name          string       `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
	Type          FileInfoType `protobuf:"varint,2,opt,name=type,proto3,enum=protocol.FileInfoType" json:"type,omitempty"`
	Size          int64        `protobuf:"varint,3,opt,name=size,proto3" json:"size,omitempty"`
	Permissions   uint32       `protobuf:"varint,4,opt,name=permissions,proto3" json:"permissions,omitempty"`
	ModifiedS     int64        `protobuf:"varint,5,opt,name=modified_s,json=modifiedS,proto3" json:"modified_s,omitempty"`
	ModifiedNs    int32        `protobuf:"varint,11,opt,name=modified_ns,json=modifiedNs,proto3" json:"modified_ns,omitempty"`
	ModifiedBy    ShortID      `protobuf:"varint,12,opt,name=modified_by,json=modifiedBy,proto3,customtype=ShortID" json:"modified_by"`
	Deleted       bool         `protobuf:"varint,6,opt,name=deleted,proto3" json:"deleted,omitempty"`
	Invalid       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"`
	Version       Vector       `protobuf:"bytes,9,opt,name=version" json:"version"`
	Sequence      int64        `protobuf:"varint,10,opt,name=sequence,proto3" json:"sequence,omitempty"`
	RawBlockSize  int32        `protobuf:"varint,13,opt,name=block_size,json=blockSize,proto3" json:"block_size,omitempty"`
	Blocks        []BlockInfo  `protobuf:"bytes,16,rep,name=Blocks" json:"Blocks"`
	SymlinkTarget string       `protobuf:"bytes,17,opt,name=symlink_target,json=symlinkTarget,proto3" json:"symlink_target,omitempty"`
}

func (FileInfo) BlockSize added in v0.14.48

func (f FileInfo) BlockSize() int

func (*FileInfo) Descriptor added in v0.14.0

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

func (FileInfo) FileName added in v0.14.0

func (f FileInfo) FileName() string

func (FileInfo) FileSize added in v0.14.0

func (f FileInfo) FileSize() int64

func (FileInfo) HasPermissionBits

func (f FileInfo) HasPermissionBits() bool

func (*FileInfo) Invalidate added in v0.14.41

func (f *FileInfo) Invalidate(invalidatedBy ShortID)

func (FileInfo) IsDeleted

func (f FileInfo) IsDeleted() bool

func (FileInfo) IsDirectory

func (f FileInfo) IsDirectory() bool

func (FileInfo) IsEmpty added in v0.14.46

func (f FileInfo) IsEmpty() bool

func (FileInfo) IsEquivalent added in v0.14.46

func (f FileInfo) IsEquivalent(other FileInfo, ignorePerms bool, ignoreBlocks bool) bool

IsEquivalent checks that the two file infos represent the same actual file content, i.e. it does purposely not check only selected (see below) struct members. Permissions (config) and blocks (scanning) can be excluded from the comparison. Any file info is not "equivalent", if it has different

  • type
  • deleted flag
  • invalid flag
  • permissions, unless they are ignored

A file is not "equivalent", if it has different

  • modification time
  • size
  • blocks, unless there are no blocks to compare (scanning)

A symlink is not "equivalent", if it has different

  • target

A directory does not have anything specific to check.

func (FileInfo) IsInvalid

func (f FileInfo) IsInvalid() bool
func (f FileInfo) IsSymlink() bool

func (*FileInfo) Marshal added in v0.14.0

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

func (*FileInfo) MarshalTo added in v0.14.0

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

func (FileInfo) ModTime added in v0.14.4

func (f FileInfo) ModTime() time.Time

func (*FileInfo) ProtoMessage added in v0.14.0

func (*FileInfo) ProtoMessage()

func (*FileInfo) ProtoSize added in v0.14.0

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

func (*FileInfo) Reset added in v0.14.0

func (m *FileInfo) Reset()

func (FileInfo) SequenceNo added in v0.14.43

func (f FileInfo) SequenceNo() int64

func (FileInfo) String

func (f FileInfo) String() string

func (*FileInfo) Unmarshal added in v0.14.0

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

func (FileInfo) WinsConflict

func (f FileInfo) WinsConflict(other FileInfo) bool

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

type FileInfoType added in v0.14.0

type FileInfoType int32
const (
	FileInfoTypeFile                       FileInfoType = 0
	FileInfoTypeDirectory                  FileInfoType = 1
	FileInfoTypeDeprecatedSymlinkFile      FileInfoType = 2
	FileInfoTypeDeprecatedSymlinkDirectory FileInfoType = 3
	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" json:"devices"`
}

func (Folder) Description added in v0.14.12

func (f Folder) Description() string

func (*Folder) Descriptor added in v0.14.0

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

func (*Folder) Marshal added in v0.14.0

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

func (*Folder) MarshalTo added in v0.14.0

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

func (*Folder) ProtoMessage added in v0.14.0

func (*Folder) ProtoMessage()

func (*Folder) ProtoSize added in v0.14.0

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

func (*Folder) Reset added in v0.14.0

func (m *Folder) Reset()

func (*Folder) String added in v0.14.0

func (m *Folder) String() string

func (*Folder) Unmarshal added in v0.14.0

func (m *Folder) Unmarshal(dAtA []byte) error
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) Descriptor() ([]byte, []int)

func (*Header) Marshal added in v0.14.0

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

func (*Header) MarshalTo added in v0.14.0

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

func (*Header) ProtoMessage added in v0.14.0

func (*Header) ProtoMessage()

func (*Header) ProtoSize added in v0.14.0

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

func (*Header) Reset added in v0.14.0

func (m *Header) Reset()

func (*Header) String added in v0.14.0

func (m *Header) String() string

func (*Header) Unmarshal added in v0.14.0

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

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) Descriptor() ([]byte, []int)

func (Hello) Magic added in v0.14.0

func (m Hello) Magic() uint32

func (*Hello) Marshal added in v0.14.0

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

func (*Hello) MarshalTo added in v0.14.0

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

func (*Hello) ProtoMessage added in v0.14.0

func (*Hello) ProtoMessage()

func (*Hello) ProtoSize added in v0.14.0

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

func (*Hello) Reset added in v0.14.0

func (m *Hello) Reset()

func (*Hello) String added in v0.14.0

func (m *Hello) String() string

func (*Hello) Unmarshal added in v0.14.0

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

type HelloIntf added in v0.14.0

type HelloIntf interface {
	Magic() uint32
	Marshal() ([]byte, error)
}

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

type HelloResult struct {
	DeviceName    string
	ClientName    string
	ClientVersion string
}

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" json:"files"`
}

func (*Index) Descriptor added in v0.14.0

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

func (*Index) Marshal added in v0.14.0

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

func (*Index) MarshalTo added in v0.14.0

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

func (*Index) ProtoMessage added in v0.14.0

func (*Index) ProtoMessage()

func (*Index) ProtoSize added in v0.14.0

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

func (*Index) Reset added in v0.14.0

func (m *Index) Reset()

func (*Index) String added in v0.14.0

func (m *Index) String() string

func (*Index) Unmarshal added in v0.14.0

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

type IndexID added in v0.14.1

type IndexID uint64

func NewIndexID added in v0.14.1

func NewIndexID() IndexID

func (IndexID) Marshal added in v0.14.1

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

func (IndexID) String added in v0.14.1

func (i IndexID) String() string

func (*IndexID) Unmarshal added in v0.14.1

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

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" 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) 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

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)
	// An index update was received from the peer device
	IndexUpdate(deviceID DeviceID, folder string, files []FileInfo)
	// A request was made by the peer device
	Request(deviceID DeviceID, folder string, name string, offset int64, hash []byte, weakHash uint32, fromTemporary bool, buf []byte) error
	// A cluster configuration message was received
	ClusterConfig(deviceID DeviceID, config ClusterConfig)
	// 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)
}

type Ordering

type Ordering int

Ordering represents the relationship between two Vectors.

const (
	Equal Ordering = iota
	Greater
	Lesser
	ConcurrentLesser
	ConcurrentGreater
)

type Ping added in v0.14.0

type Ping struct {
}

func (*Ping) Descriptor added in v0.14.0

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

func (*Ping) Marshal added in v0.14.0

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

func (*Ping) MarshalTo added in v0.14.0

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

func (*Ping) ProtoMessage added in v0.14.0

func (*Ping) ProtoMessage()

func (*Ping) ProtoSize added in v0.14.0

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

func (*Ping) Reset added in v0.14.0

func (m *Ping) Reset()

func (*Ping) String added in v0.14.0

func (m *Ping) String() string

func (*Ping) Unmarshal added in v0.14.0

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

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) Descriptor() ([]byte, []int)

func (*Request) Marshal added in v0.14.0

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

func (*Request) MarshalTo added in v0.14.0

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

func (*Request) ProtoMessage added in v0.14.0

func (*Request) ProtoMessage()

func (*Request) ProtoSize added in v0.14.0

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

func (*Request) Reset added in v0.14.0

func (m *Request) Reset()

func (*Request) String added in v0.14.0

func (m *Request) String() string

func (*Request) Unmarshal added in v0.14.0

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

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) Descriptor() ([]byte, []int)

func (*Response) Marshal added in v0.14.0

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

func (*Response) MarshalTo added in v0.14.0

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

func (*Response) ProtoMessage added in v0.14.0

func (*Response) ProtoMessage()

func (*Response) ProtoSize added in v0.14.0

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

func (*Response) Reset added in v0.14.0

func (m *Response) Reset()

func (*Response) String added in v0.14.0

func (m *Response) String() string

func (*Response) Unmarshal added in v0.14.0

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

type ShortID added in v0.12.16

type ShortID uint64

func (ShortID) String added in v0.12.16

func (s ShortID) String() string

type Statistics

type Statistics struct {
	At            time.Time
	InBytesTotal  int64
	OutBytesTotal int64
}

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

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

type Vector

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

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 added in v0.14.0

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

func (Vector) DropOthers added in v0.14.46

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) 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 added in v0.14.0

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

func (*Vector) MarshalTo added in v0.14.0

func (m *Vector) MarshalTo(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 added in v0.14.0

func (*Vector) ProtoMessage()

func (*Vector) ProtoSize added in v0.14.0

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

func (*Vector) Reset added in v0.14.0

func (m *Vector) Reset()

func (*Vector) String added in v0.14.0

func (m *Vector) String() string

func (*Vector) Unmarshal added in v0.14.0

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.

type Version13HelloMessage added in v0.13.6

type Version13HelloMessage struct {
	DeviceName    string // max:64
	ClientName    string // max:64
	ClientVersion string // max:64
}

func (Version13HelloMessage) Magic added in v0.13.6

func (m Version13HelloMessage) Magic() uint32

func (Version13HelloMessage) Marshal added in v0.13.6

func (m Version13HelloMessage) Marshal() ([]byte, error)

func (Version13HelloMessage) MarshalXDR added in v0.13.6

func (o Version13HelloMessage) MarshalXDR() ([]byte, error)

func (Version13HelloMessage) MarshalXDRInto added in v0.13.6

func (o Version13HelloMessage) MarshalXDRInto(m *xdr.Marshaller) error

func (Version13HelloMessage) MustMarshalXDR added in v0.13.6

func (o Version13HelloMessage) MustMarshalXDR() []byte

func (*Version13HelloMessage) UnmarshalXDR added in v0.13.6

func (o *Version13HelloMessage) UnmarshalXDR(bs []byte) error

func (*Version13HelloMessage) UnmarshalXDRFrom added in v0.13.6

func (o *Version13HelloMessage) UnmarshalXDRFrom(u *xdr.Unmarshaller) error

func (Version13HelloMessage) XDRSize added in v0.13.6

func (o Version13HelloMessage) XDRSize() int

Jump to

Keyboard shortcuts

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