Documentation
¶
Overview ¶
Package wire provides hand-written protobuf wire-format encoding for Mumble protocol messages. Produces Mumble-compatible binary without using google.golang.org/protobuf.
Index ¶
- Constants
- Variables
- func AppendBytes(b []byte, fieldNum int, data []byte) []byte
- func AppendFixed32(b []byte, v uint32) []byte
- func AppendFixed64(b []byte, v uint64) []byte
- func AppendString(b []byte, fieldNum int, s string) []byte
- func AppendTag(b []byte, fieldNum int, wireType int) []byte
- func AppendVarint(b []byte, v uint64) []byte
- func Float32bits(f float32) uint32
- func Float32frombits(u uint32) float32
- func ReadFixed32(b []byte) uint32
- func ReadFixed64(b []byte) uint64
- func ReadLengthDelimited(b []byte) ([]byte, int, error)
- func ReadTag(b []byte) (fieldNum int, wireType int, n int, err error)
- func ReadVarint(b []byte) (uint64, int, error)
- func SkipField(b []byte, wireType int) (int, error)
Constants ¶
const ( WireVarint = 0 WireFixed64 = 1 WireLengthDelimited = 2 WireFixed32 = 5 )
Wire types per protobuf spec
Variables ¶
var ( ErrBufferTooShort = errors.New("wire: buffer too short") ErrInvalidTag = errors.New("wire: invalid tag") )
Functions ¶
func AppendBytes ¶
AppendBytes appends length-delimited bytes (field tag + length + data).
func AppendFixed32 ¶
AppendFixed32 appends a little-endian uint32 (protobuf fixed32).
func AppendFixed64 ¶
AppendFixed64 appends a little-endian uint64 (protobuf fixed64).
func AppendString ¶
AppendString appends a length-delimited string.
func AppendVarint ¶
AppendVarint appends a standard protobuf varint.
func Float32bits ¶
Float32bits converts float32 to uint32 for wire encoding.
func Float32frombits ¶
Float32frombits converts uint32 from wire to float32.
func ReadFixed32 ¶
ReadFixed32 reads a fixed32 from b. Caller must ensure len(b) >= 4.
func ReadFixed64 ¶
ReadFixed64 reads a fixed64 from b. Caller must ensure len(b) >= 8.
func ReadLengthDelimited ¶
ReadLengthDelimited returns the length-delimited bytes and bytes consumed.
func ReadVarint ¶
ReadVarint reads a varint from b. Returns value and bytes consumed.
Types ¶
This section is empty.