Documentation ¶
Index ¶
- Constants
- Variables
- 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
- type Encoder
- type FrameReader
- type FrameWriter
- type Option
Constants ¶
View Source
const ( Metadata = 1 PrivateChain = 2 PublicChain = 3 PublicKey = 4 )
Variables ¶
View Source
var ErrFramePayloadLengthInvalid = errors.New(`frame payload length invalid`)
View Source
var ErrFrameWriterExpired = errors.New(`frame writer expired`)
View Source
var ErrIdBitsInvalid = errors.New(`id bits invalid`)
View Source
var ErrIdInvalid = errors.New(`ID Invalid`)
View Source
var ErrNotMetadata = errors.New(`not a metadata`)
View Source
var ErrNotPrivateChain = errors.New(`not a private chain`)
View Source
var ErrNotPublicChain = errors.New(`not a public chain`)
View Source
var ErrNotPublicKey = errors.New(`not a public key`)
View Source
var ErrPayloadBitsInvalid = errors.New(`payload bits invalid`)
Functions ¶
func BytesToString ¶
func MarshalPrivateChain ¶
func MarshalPrivateChain(m *raw.PrivateChain) (b []byte, e error)
func MarshalPublicChain ¶
func MarshalPublicChain(m *raw.PublicChain) (b []byte, e error)
func StringToBytes ¶
func UnmarshalPrivateChain ¶
func UnmarshalPrivateChain(b []byte, m *raw.PrivateChain) (e error)
func UnmarshalPublicChain ¶
func UnmarshalPublicChain(b []byte, m *raw.PublicChain) (e error)
Types ¶
type Decoder ¶
type Decoder struct {
// contains filtered or unexported fields
}
解析器
func (*Decoder) NextReader ¶
func (dec *Decoder) NextReader() (id uint64, r *FrameReader, e error)
創建一個幀讀取器
type Encoder ¶
type Encoder struct {
// contains filtered or unexported fields
}
編碼器
func (*Encoder) EncodeString ¶
編碼一個完整的幀
func (*Encoder) NextWriter ¶
func (enc *Encoder) NextWriter(id uint64) (w *FrameWriter, e error)
創建一個幀寫入器
type FrameReader ¶
type FrameReader struct {
// contains filtered or unexported fields
}
type FrameWriter ¶
type FrameWriter struct {
// contains filtered or unexported fields
}
func (*FrameWriter) Close ¶
func (f *FrameWriter) Close() (e error)
func (*FrameWriter) WriteClose ¶
func (f *FrameWriter) WriteClose(b []byte) (n int, e error)
Click to show internal directories.
Click to hide internal directories.