...

Package mesh

import "github.com/Diarkis/diarkis/mesh/lib/msg"
Overview
Index

Overview ▾

Constants

MaxMessageSize max size of a message before split - 1GB in bytes

const MaxMessageSize = 1073741824

MaxPacketSize The max size of mesh message in bytes.

const MaxPacketSize = 1400

MaxSize The threshold of packet size to split - if a packet is greater than this value, it will split

const MaxSize = 1300

Shrink The number of deletes until we shrink msgmap size

const Shrink = 10

func Add

func Add(packet []byte) ([]byte, error)

Add Adds a split packet to msgmap

type Msg

Msg Data structure of Msg

type Msg struct {
    UUID         []byte
    Packet       []byte
    SplitOffsets []int
    SplitSizes   []int
    AddedSize    int
    SplitLength  int
    sync.RWMutex
}

func New

func New(packet []byte) (*Msg, error)

New Creates a new msg data structure

func (*Msg) Split

func (msg *Msg) Split() []byte

Split Splits a packet into multiple packets