Versions in this module Expand all Collapse all v0 v0.0.2 Oct 14, 2024 Changes in this version + const Metadata + const PrivateChain + const PublicChain + const PublicKey + var ErrFramePayloadLengthInvalid = errors.New(`frame payload length invalid`) + var ErrFrameWriterExpired = errors.New(`frame writer expired`) + var ErrIdBitsInvalid = errors.New(`id bits invalid`) + var ErrIdInvalid = errors.New(`ID Invalid`) + var ErrNotMetadata = errors.New(`not a metadata`) + var ErrNotPrivateChain = errors.New(`not a private chain`) + var ErrNotPublicChain = errors.New(`not a public chain`) + var ErrNotPublicKey = errors.New(`not a public key`) + var ErrPayloadBitsInvalid = errors.New(`payload bits invalid`) + func BytesToString(b []byte) string + func MarshalMetadata(m *raw.Metadata) (b []byte, e error) + func MarshalPrivateChain(m *raw.PrivateChain) (b []byte, e error) + func MarshalPublicChain(m *raw.PublicChain) (b []byte, e error) + func MarshalPublicKey(m *raw.PublicKey) (b []byte, e error) + func StringToBytes(s string) []byte + func UnmarshalMetadata(b []byte, m *raw.Metadata) (e error) + func UnmarshalPrivateChain(b []byte, m *raw.PrivateChain) (e error) + func UnmarshalPublicChain(b []byte, m *raw.PublicChain) (e error) + func UnmarshalPublicKey(b []byte, m *raw.PublicKey) (e error) + func Write(w io.Writer, id uint8, data []byte) (n uint64, e error) + func WriteString(w io.Writer, id uint8, data string) (uint64, error) + type Decoder struct + func NewDecoder(r io.Reader, opt ...Option) (dec *Decoder, e error) + func (dec *Decoder) Decode() (id uint64, data []byte, e error) + func (dec *Decoder) NextReader() (id uint64, r *FrameReader, e error) + type Encoder struct + func NewEncoder(w io.Writer, opt ...Option) (enc *Encoder, e error) + func (enc *Encoder) Encode(id uint64, data []byte) (e error) + func (enc *Encoder) EncodeString(id uint64, data string) (e error) + func (enc *Encoder) NextWriter(id uint64) (w *FrameWriter, e error) + type FrameReader struct + func (f *FrameReader) Read(b []byte) (n int, e error) + type FrameWriter struct + func (f *FrameWriter) Close() (e error) + func (f *FrameWriter) Write(b []byte) (n int, e error) + func (f *FrameWriter) WriteClose(b []byte) (n int, e error) + type Option interface + func WithByteOrder(byteOrder binary.ByteOrder) Option + func WithId(bits int) Option + func WithPayload(bits int) Option