splice

package
v0.1.20 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2023 License: Unlicense Imports: 13 Imported by: 0

Documentation

Overview

Package splice is a collection of tools for encoding and decoding variables into byte buffers with a fluent chained method interface.

Index

Constants

View Source
const AddrLen = net.IPv6len + 2

Variables

This section is empty.

Functions

This section is empty.

Types

type NameOffset

type NameOffset struct {
	Offset int
	Name   string
	slice.Bytes
}

type Segments

type Segments []NameOffset

func (Segments) Len

func (s Segments) Len() int

func (Segments) Less

func (s Segments) Less(i, j int) bool

func (Segments) Swap

func (s Segments) Swap(i, j int)

type Splice

type Splice struct {
	Segments
	E error
	// contains filtered or unexported fields
}

func BudgeUp

func BudgeUp(s *Splice) (o *Splice)

func Load

func Load(b slice.Bytes, c *slice.Cursor) (splicer *Splice)

func New

func New(length int) (splicer *Splice)

func NewFrom

func NewFrom(b slice.Bytes) (splicer *Splice)

func (*Splice) AddrPort

func (s *Splice) AddrPort(a *netip.AddrPort) *Splice

func (*Splice) Advance

func (s *Splice) Advance(n int, name string) int

func (*Splice) Byte

func (s *Splice) Byte(b byte) *Splice

func (*Splice) Bytes

func (s *Splice) Bytes(b []byte) *Splice

func (*Splice) Check

func (s *Splice) Check(c slice.Bytes) *Splice

func (*Splice) Ciphers

func (s *Splice) Ciphers(h crypto.Ciphers) *Splice

func (*Splice) Cloak

func (s *Splice) Cloak(pk *crypto.Pub) *Splice

func (*Splice) CopyIntoRange

func (s *Splice) CopyIntoRange(b slice.Bytes, start, end int)

func (*Splice) CopyRanges

func (s *Splice) CopyRanges(start1, end1, start2, end2 int)

func (*Splice) Done

func (s *Splice) Done()

func (*Splice) Duration

func (s *Splice) Duration(v time.Duration) *Splice

func (*Splice) GetAll

func (s *Splice) GetAll() slice.Bytes

GetAll returns the whole of the buffer.

func (*Splice) GetCursor

func (s *Splice) GetCursor() int

func (*Splice) GetFrom

func (s *Splice) GetFrom(p int) slice.Bytes

func (*Splice) GetRange

func (s *Splice) GetRange(start, end int) slice.Bytes

GetRange slices out a segment of the splicer's data bytes and returns it. Use -1 to indicate start or beginning respectively, or both to get all of it.

func (*Splice) GetRest

func (s *Splice) GetRest() slice.Bytes

func (*Splice) GetSegments

func (s *Splice) GetSegments() (segments Segments)

func (*Splice) GetSlicesFromSegments

func (s *Splice) GetSlicesFromSegments() (segments []interface{})

func (*Splice) GetUntil

func (s *Splice) GetUntil(p int) slice.Bytes

func (*Splice) GetUntilCursor added in v0.1.20

func (s *Splice) GetUntilCursor() slice.Bytes

func (*Splice) Hash

func (s *Splice) Hash(h sha256.Hash) *Splice

func (*Splice) ID

func (s *Splice) ID(id nonce.ID) *Splice

func (*Splice) IV

func (s *Splice) IV(iv nonce.IV) *Splice

func (*Splice) Len

func (s *Splice) Len() int

func (*Splice) Magic

func (s *Splice) Magic(magic string) *Splice

func (*Splice) Nonces

func (s *Splice) Nonces(iv crypto.Nonces) *Splice

func (*Splice) Prvkey

func (s *Splice) Prvkey(from *crypto.Prv) *Splice

func (*Splice) Pubkey

func (s *Splice) Pubkey(from *crypto.Pub) *Splice

func (*Splice) ReadAddrPort

func (s *Splice) ReadAddrPort(ap **netip.AddrPort) *Splice

func (*Splice) ReadByte

func (s *Splice) ReadByte(b *byte) *Splice

func (*Splice) ReadBytes

func (s *Splice) ReadBytes(b *slice.Bytes) *Splice

func (*Splice) ReadCheck

func (s *Splice) ReadCheck(c *slice.Bytes) *Splice

func (*Splice) ReadCiphers

func (s *Splice) ReadCiphers(h *crypto.Ciphers) *Splice

func (*Splice) ReadCloak

func (s *Splice) ReadCloak(ck *crypto.CloakedPubKey) *Splice

func (*Splice) ReadDuration

func (s *Splice) ReadDuration(v *time.Duration) *Splice

func (*Splice) ReadHash

func (s *Splice) ReadHash(h *sha256.Hash) *Splice

func (*Splice) ReadID

func (s *Splice) ReadID(id *nonce.ID) *Splice

func (*Splice) ReadIV

func (s *Splice) ReadIV(iv *nonce.IV) *Splice

func (*Splice) ReadMagic

func (s *Splice) ReadMagic(magic *string) *Splice

func (*Splice) ReadMilliSatoshi

func (s *Splice) ReadMilliSatoshi(v *lnwire.MilliSatoshi) *Splice

func (*Splice) ReadNonces

func (s *Splice) ReadNonces(iv *crypto.Nonces) *Splice

func (*Splice) ReadPrvkey

func (s *Splice) ReadPrvkey(out **crypto.Prv) *Splice

func (*Splice) ReadPubkey

func (s *Splice) ReadPubkey(from **crypto.Pub) *Splice

func (*Splice) ReadSignature

func (s *Splice) ReadSignature(sb *crypto.SigBytes) *Splice

func (*Splice) ReadTime

func (s *Splice) ReadTime(v *time.Time) *Splice

func (*Splice) ReadUint16

func (s *Splice) ReadUint16(v *uint16) *Splice

func (*Splice) ReadUint32

func (s *Splice) ReadUint32(v *uint32) *Splice

func (*Splice) ReadUint64

func (s *Splice) ReadUint64(v *uint64) *Splice

func (*Splice) Remaining

func (s *Splice) Remaining() int

func (*Splice) Rewind

func (s *Splice) Rewind(n int) int

func (*Splice) SetCursor

func (s *Splice) SetCursor(c int) *Splice

func (*Splice) Signature

func (s *Splice) Signature(sb crypto.SigBytes) *Splice

func (*Splice) StoreCursor

func (s *Splice) StoreCursor(c *int) *Splice

func (*Splice) Time

func (s *Splice) Time(v time.Time) *Splice

func (*Splice) TrailingBytes

func (s *Splice) TrailingBytes(b slice.Bytes) *Splice

func (*Splice) Uint16

func (s *Splice) Uint16(v uint16) *Splice

func (*Splice) Uint32

func (s *Splice) Uint32(v uint32) *Splice

func (*Splice) Uint64

func (s *Splice) Uint64(v uint64) *Splice

Jump to

Keyboard shortcuts

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