Documentation ¶
Overview ¶
Package protocol implements the Block Exchange Protocol.
Index ¶
- Constants
- Variables
- func HasPermissionBits(bits uint32) bool
- func IsDeleted(bits uint32) bool
- func IsDirectory(bits uint32) bool
- func IsInvalid(bits uint32) bool
- func TotalInOut() (uint64, uint64)
- type BlockInfo
- func (o BlockInfo) AppendXDR(bs []byte) ([]byte, error)
- func (o *BlockInfo) DecodeXDR(r io.Reader) error
- func (o BlockInfo) EncodeXDR(w io.Writer) (int, error)
- func (o BlockInfo) MarshalXDR() ([]byte, error)
- func (o BlockInfo) MustMarshalXDR() []byte
- func (b BlockInfo) String() string
- func (o *BlockInfo) UnmarshalXDR(bs []byte) error
- type CloseMessage
- func (o CloseMessage) AppendXDR(bs []byte) ([]byte, error)
- func (o *CloseMessage) DecodeXDR(r io.Reader) error
- func (o CloseMessage) EncodeXDR(w io.Writer) (int, error)
- func (o CloseMessage) MarshalXDR() ([]byte, error)
- func (o CloseMessage) MustMarshalXDR() []byte
- func (o *CloseMessage) UnmarshalXDR(bs []byte) error
- type ClusterConfigMessage
- func (o ClusterConfigMessage) AppendXDR(bs []byte) ([]byte, error)
- func (o *ClusterConfigMessage) DecodeXDR(r io.Reader) error
- func (o ClusterConfigMessage) EncodeXDR(w io.Writer) (int, error)
- func (o *ClusterConfigMessage) GetOption(key string) string
- func (o ClusterConfigMessage) MarshalXDR() ([]byte, error)
- func (o ClusterConfigMessage) MustMarshalXDR() []byte
- func (o *ClusterConfigMessage) UnmarshalXDR(bs []byte) error
- type Connection
- type Device
- type DeviceID
- type EmptyMessage
- func (o EmptyMessage) AppendXDR(bs []byte) ([]byte, error)
- func (o *EmptyMessage) DecodeXDR(r io.Reader) error
- func (o EmptyMessage) EncodeXDR(w io.Writer) (int, error)
- func (o EmptyMessage) MarshalXDR() ([]byte, error)
- func (o EmptyMessage) MustMarshalXDR() []byte
- func (o *EmptyMessage) UnmarshalXDR(bs []byte) error
- type FileInfo
- func (o FileInfo) AppendXDR(bs []byte) ([]byte, error)
- func (o *FileInfo) DecodeXDR(r io.Reader) error
- func (o FileInfo) EncodeXDR(w io.Writer) (int, error)
- func (f FileInfo) IsDeleted() bool
- func (f FileInfo) IsDirectory() bool
- func (f FileInfo) IsInvalid() bool
- func (o FileInfo) MarshalXDR() ([]byte, error)
- func (o FileInfo) MustMarshalXDR() []byte
- func (f FileInfo) Size() (bytes int64)
- func (f FileInfo) String() string
- func (o *FileInfo) UnmarshalXDR(bs []byte) error
- type FileInfoTruncated
- func (o FileInfoTruncated) AppendXDR(bs []byte) ([]byte, error)
- func (o *FileInfoTruncated) DecodeXDR(r io.Reader) error
- func (o FileInfoTruncated) EncodeXDR(w io.Writer) (int, error)
- func (f FileInfoTruncated) IsDeleted() bool
- func (f FileInfoTruncated) IsInvalid() bool
- func (o FileInfoTruncated) MarshalXDR() ([]byte, error)
- func (o FileInfoTruncated) MustMarshalXDR() []byte
- func (f FileInfoTruncated) Size() int64
- func (f FileInfoTruncated) String() string
- func (o *FileInfoTruncated) UnmarshalXDR(bs []byte) error
- type FileIntf
- type Folder
- type IndexMessage
- func (o IndexMessage) AppendXDR(bs []byte) ([]byte, error)
- func (o *IndexMessage) DecodeXDR(r io.Reader) error
- func (o IndexMessage) EncodeXDR(w io.Writer) (int, error)
- func (o IndexMessage) MarshalXDR() ([]byte, error)
- func (o IndexMessage) MustMarshalXDR() []byte
- func (o *IndexMessage) UnmarshalXDR(bs []byte) error
- type Model
- type Option
- type RequestMessage
- func (o RequestMessage) AppendXDR(bs []byte) ([]byte, error)
- func (o *RequestMessage) DecodeXDR(r io.Reader) error
- func (o RequestMessage) EncodeXDR(w io.Writer) (int, error)
- func (o RequestMessage) MarshalXDR() ([]byte, error)
- func (o RequestMessage) MustMarshalXDR() []byte
- func (o *RequestMessage) UnmarshalXDR(bs []byte) error
- type ResponseMessage
- func (o ResponseMessage) AppendXDR(bs []byte) ([]byte, error)
- func (o *ResponseMessage) DecodeXDR(r io.Reader) error
- func (o ResponseMessage) EncodeXDR(w io.Writer) (int, error)
- func (o ResponseMessage) MarshalXDR() ([]byte, error)
- func (o ResponseMessage) MustMarshalXDR() []byte
- func (o *ResponseMessage) UnmarshalXDR(bs []byte) error
- type Statistics
Constants ¶
View Source
const ( FlagDeleted uint32 = 1 << 12 FlagInvalid = 1 << 13 FlagDirectory = 1 << 14 FlagNoPermBits = 1 << 15 )
View Source
const ( FlagIntroducer = 1 << 2 )
View Source
const (
BlockSize = 128 * 1024
)
Variables ¶
View Source
var ( ErrClusterHash = fmt.Errorf("configuration error: mismatched cluster hash") ErrClosed = errors.New("connection closed") )
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}
Functions ¶
func HasPermissionBits ¶
func IsDirectory ¶
func TotalInOut ¶
Types ¶
type BlockInfo ¶
func (BlockInfo) MarshalXDR ¶
func (BlockInfo) MustMarshalXDR ¶ added in v0.10.3
func (*BlockInfo) UnmarshalXDR ¶
type CloseMessage ¶
type CloseMessage struct {
Reason string // max:1024
}
func (CloseMessage) MarshalXDR ¶
func (o CloseMessage) MarshalXDR() ([]byte, error)
func (CloseMessage) MustMarshalXDR ¶ added in v0.10.3
func (o CloseMessage) MustMarshalXDR() []byte
func (*CloseMessage) UnmarshalXDR ¶
func (o *CloseMessage) UnmarshalXDR(bs []byte) error
type ClusterConfigMessage ¶
type ClusterConfigMessage struct { ClientName string // max:64 ClientVersion string // max:64 Folders []Folder // max:64 Options []Option // max:64 }
func (ClusterConfigMessage) AppendXDR ¶
func (o ClusterConfigMessage) AppendXDR(bs []byte) ([]byte, error)
func (*ClusterConfigMessage) DecodeXDR ¶
func (o *ClusterConfigMessage) DecodeXDR(r io.Reader) error
func (ClusterConfigMessage) EncodeXDR ¶
func (o ClusterConfigMessage) EncodeXDR(w io.Writer) (int, error)
func (*ClusterConfigMessage) GetOption ¶
func (o *ClusterConfigMessage) GetOption(key string) string
func (ClusterConfigMessage) MarshalXDR ¶
func (o ClusterConfigMessage) MarshalXDR() ([]byte, error)
func (ClusterConfigMessage) MustMarshalXDR ¶ added in v0.10.3
func (o ClusterConfigMessage) MustMarshalXDR() []byte
func (*ClusterConfigMessage) UnmarshalXDR ¶
func (o *ClusterConfigMessage) UnmarshalXDR(bs []byte) error
type Connection ¶
type Device ¶ added in v0.10.0
func (Device) MarshalXDR ¶ added in v0.10.0
func (Device) MustMarshalXDR ¶ added in v0.10.3
func (*Device) UnmarshalXDR ¶ added in v0.10.0
type DeviceID ¶ added in v0.10.0
type DeviceID [32]byte
func DeviceIDFromBytes ¶ added in v0.10.0
func DeviceIDFromString ¶ added in v0.10.0
func NewDeviceID ¶ added in v0.10.0
NewDeviceID generates a new device ID from the raw bytes of a certificate
func (*DeviceID) MarshalText ¶ added in v0.10.0
func (DeviceID) String ¶ added in v0.10.0
String returns the canonical string representation of the device ID
func (*DeviceID) UnmarshalText ¶ added in v0.10.0
type EmptyMessage ¶
type EmptyMessage struct{}
func (EmptyMessage) MarshalXDR ¶
func (o EmptyMessage) MarshalXDR() ([]byte, error)
func (EmptyMessage) MustMarshalXDR ¶ added in v0.10.3
func (o EmptyMessage) MustMarshalXDR() []byte
func (*EmptyMessage) UnmarshalXDR ¶
func (o *EmptyMessage) UnmarshalXDR(bs []byte) error
type FileInfo ¶
type FileInfo struct { Name string // max:8192 Flags uint32 Modified int64 Version uint64 LocalVersion uint64 Blocks []BlockInfo }
func (FileInfo) IsDirectory ¶ added in v0.10.2
func (FileInfo) MarshalXDR ¶
func (FileInfo) MustMarshalXDR ¶ added in v0.10.3
func (*FileInfo) UnmarshalXDR ¶
type FileInfoTruncated ¶
type FileInfoTruncated struct { Name string // max:8192 Flags uint32 Modified int64 Version uint64 LocalVersion uint64 NumBlocks uint32 }
Used for unmarshalling a FileInfo structure but skipping the actual block list
func (FileInfoTruncated) AppendXDR ¶
func (o FileInfoTruncated) AppendXDR(bs []byte) ([]byte, error)
func (FileInfoTruncated) IsDeleted ¶
func (f FileInfoTruncated) IsDeleted() bool
func (FileInfoTruncated) IsInvalid ¶
func (f FileInfoTruncated) IsInvalid() bool
func (FileInfoTruncated) MarshalXDR ¶
func (o FileInfoTruncated) MarshalXDR() ([]byte, error)
func (FileInfoTruncated) MustMarshalXDR ¶ added in v0.10.3
func (o FileInfoTruncated) MustMarshalXDR() []byte
func (FileInfoTruncated) Size ¶
func (f FileInfoTruncated) Size() int64
Returns a statistical guess on the size, not the exact figure
func (FileInfoTruncated) String ¶ added in v0.10.2
func (f FileInfoTruncated) String() string
func (*FileInfoTruncated) UnmarshalXDR ¶
func (o *FileInfoTruncated) UnmarshalXDR(bs []byte) error
type Folder ¶ added in v0.10.0
func (Folder) MarshalXDR ¶ added in v0.10.0
func (Folder) MustMarshalXDR ¶ added in v0.10.3
func (*Folder) UnmarshalXDR ¶ added in v0.10.0
type IndexMessage ¶
func (IndexMessage) MarshalXDR ¶
func (o IndexMessage) MarshalXDR() ([]byte, error)
func (IndexMessage) MustMarshalXDR ¶ added in v0.10.3
func (o IndexMessage) MustMarshalXDR() []byte
func (*IndexMessage) UnmarshalXDR ¶
func (o *IndexMessage) UnmarshalXDR(bs []byte) error
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, size int) ([]byte, error) // A cluster configuration message was received ClusterConfig(deviceID DeviceID, config ClusterConfigMessage) // The peer device closed the connection Close(deviceID DeviceID, err error) }
type Option ¶
func (Option) MarshalXDR ¶
func (Option) MustMarshalXDR ¶ added in v0.10.3
func (*Option) UnmarshalXDR ¶
type RequestMessage ¶
type RequestMessage struct { Folder string // max:64 Name string // max:8192 Offset uint64 Size uint32 }
func (RequestMessage) MarshalXDR ¶
func (o RequestMessage) MarshalXDR() ([]byte, error)
func (RequestMessage) MustMarshalXDR ¶ added in v0.10.3
func (o RequestMessage) MustMarshalXDR() []byte
func (*RequestMessage) UnmarshalXDR ¶
func (o *RequestMessage) UnmarshalXDR(bs []byte) error
type ResponseMessage ¶
type ResponseMessage struct {
Data []byte
}
func (ResponseMessage) MarshalXDR ¶
func (o ResponseMessage) MarshalXDR() ([]byte, error)
func (ResponseMessage) MustMarshalXDR ¶ added in v0.10.3
func (o ResponseMessage) MustMarshalXDR() []byte
func (*ResponseMessage) UnmarshalXDR ¶
func (o *ResponseMessage) UnmarshalXDR(bs []byte) error
Click to show internal directories.
Click to hide internal directories.