Documentation
¶
Index ¶
Constants ¶
View Source
const ( VersionV1 = 1 MaxFrameSize = 1024 * 1024 MaxIDLength = 128 )
View Source
const ( TransferProtocolVersion = 1 MaxTransferChunkBytes = 256 * 1024 MaxTransferMetadataBytes = 16 * 1024 MaxTransferFileBytes = 1024 * 1024 * 1024 )
Variables ¶
View Source
var ( ErrFrameTooLarge = errors.New("node protocol frame exceeds size limit") ErrInvalidFrame = errors.New("invalid node protocol frame") )
View Source
var (
ErrInvalidTransferFrame = errors.New("invalid node transfer frame")
)
Functions ¶
func EncodeTransferFrame ¶
func EncodeTransferFrame(frame TransferFrame) ([]byte, error)
Types ¶
type Envelope ¶
type Envelope struct {
Type FrameType `json:"type"`
ID string `json:"id,omitempty"`
Method string `json:"method,omitempty"`
Params json.RawMessage `json:"params,omitempty"`
IdempotencyKey string `json:"idempotency_key,omitempty"`
OK *bool `json:"ok,omitempty"`
Result json.RawMessage `json:"result,omitempty"`
Error *Error `json:"error,omitempty"`
Event string `json:"event,omitempty"`
Payload json.RawMessage `json:"payload,omitempty"`
}
type Error ¶
type Error struct {
Code string `json:"code"`
Message string `json:"message"`
Details json.RawMessage `json:"details,omitempty"`
}
type TransferDirection ¶
type TransferDirection uint8
const ( TransferUpload TransferDirection = iota + 1 TransferDownload )
type TransferFrame ¶
type TransferFrame struct {
Type TransferFrameType
Direction TransferDirection
TransferID string
PolicyRevision string
Sequence uint64
TotalSize uint64
SHA256 [32]byte
Payload []byte
}
TransferFrame is the bounded binary frame carried only inside one authenticated node WebSocket generation. The live peer generation is the session binding; a frame is never accepted before admission or routed across peer replacement.
func DecodeTransferFrame ¶
func DecodeTransferFrame(data []byte) (TransferFrame, error)
func (TransferFrame) SameBinding ¶
func (frame TransferFrame) SameBinding(other TransferFrame) bool
func (TransferFrame) Validate ¶
func (frame TransferFrame) Validate() error
type TransferFrameType ¶
type TransferFrameType uint8
const ( TransferFramePrepare TransferFrameType = iota + 1 TransferFrameAccept TransferFrameDeny TransferFrameChunk TransferFrameAck TransferFrameCommit TransferFrameCommitted TransferFrameCancel TransferFrameStatus TransferFrameFailure )
Click to show internal directories.
Click to hide internal directories.