block

package
v1.0.8-0...-ea572ad Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2020 License: AGPL-3.0 Imports: 3 Imported by: 3

Documentation

Index

Constants

View Source
const (
	TypeConnect = iota
	TypeDisconnect
	TypeData

	ShutdownRead = iota
	ShutdownWrite
	ShutdownBoth

	HeaderSize = 1 + 4 + 4 + 4
	DataSize   = 16*1024 - 13
	MaxSize    = HeaderSize + DataSize
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Block

type Block struct {
	Type         uint8  // 1 byte
	ConnectionID uint32 // 4 bytes
	BlockID      uint32 // 4 bytes
	BlockLength  uint32 // 4 bytes
	BlockData    []byte
	// contains filtered or unexported fields
}

func NewBlockFromReader

func NewBlockFromReader(reader io.Reader) (*Block, error)

func NewConnectBlock

func NewConnectBlock(connectID uint32, blockID uint32, address string) Block

func NewDataBlocks

func NewDataBlocks(connectID uint32, blockID *atomic.Uint32, data []byte) []Block

func NewDisconnectBlock

func NewDisconnectBlock(connectID uint32, blockID uint32, shutdownType uint8) Block

func (*Block) Pack

func (block *Block) Pack() []byte

Jump to

Keyboard shortcuts

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