Documentation
¶
Index ¶
- Variables
- func BigIntToIPv6(ipaddr big.Int) net.IP
- func IPv4ToInt(ipaddr net.IP) (uint32, error)
- func IPv6ToBigInt(ipaddr net.IP) (*big.Int, error)
- func IPv6ToInt(ipaddr net.IP) ([2]uint64, error)
- func IntToIPv4(ipaddr uint32) net.IP
- func IntToIPv6(high, low uint64) net.IP
- type Reader
- func (r *Reader) Bool() (bool, error)
- func (r *Reader) Close() (err error)
- func (r *Reader) Float32() (float32, error)
- func (r *Reader) Float64() (float64, error)
- func (r *Reader) IP() (string, error)
- func (r *Reader) IPArray() ([]string, error)
- func (r *Reader) Int() (int, error)
- func (r *Reader) Int16() (int16, error)
- func (r *Reader) Int32() (int32, error)
- func (r *Reader) Int64() (int64, error)
- func (r *Reader) Int8() (int8, error)
- func (r *Reader) IntArray() ([]int, error)
- func (r *Reader) Object() (result []byte, err error)
- func (r *Reader) ObjectArray() ([][]byte, error)
- func (r *Reader) String() (string, error)
- func (r *Reader) StringArray() ([]string, error)
- func (r *Reader) Timestamp() (entity.Timestamp, error)
- func (r *Reader) Uint() (uint, error)
- func (r *Reader) Uint16() (uint16, error)
- func (r *Reader) Uint32() (uint32, error)
- func (r *Reader) Uint64() (v uint64, err error)
- func (r *Reader) Uint8() (uint8, error)
- type Writer
- func (w *Writer) Bool(v bool) *Writer
- func (w *Writer) Close() (err error)
- func (w *Writer) Float32(v float32) *Writer
- func (w *Writer) Float32Array(v []float32) *Writer
- func (w *Writer) Float64(v float64) *Writer
- func (w *Writer) Float64Array(v []float64) *Writer
- func (w *Writer) GetBytes() []byte
- func (w *Writer) IP(v string) *Writer
- func (w *Writer) IPArray(v []string) *Writer
- func (w *Writer) Int(v int) *Writer
- func (w *Writer) Int16(v int16) *Writer
- func (w *Writer) Int32(v int32) *Writer
- func (w *Writer) Int64(v int64) *Writer
- func (w *Writer) Int8(v int8) *Writer
- func (w *Writer) IntArray(v []int) *Writer
- func (w *Writer) Object(v *[]byte) *Writer
- func (w *Writer) ObjectArray(v *[][]byte) *Writer
- func (w *Writer) Reset()
- func (w *Writer) String(v string) *Writer
- func (w *Writer) StringArray(v []string) *Writer
- func (w *Writer) Timestamp(v entity.Timestamp) *Writer
- func (w *Writer) Uint(v uint) *Writer
- func (w *Writer) Uint16(v uint16) *Writer
- func (w *Writer) Uint32(v uint32) *Writer
- func (w *Writer) Uint64(v uint64) *Writer
- func (w *Writer) Uint8(v uint8) *Writer
- func (w *Writer) WriteTo(dest io.Writer) (int64, error)
- func (w *Writer) Written() int64
Constants ¶
This section is empty.
Variables ¶
var ErrInvalidIPAddress = errors.New("invalid ip address")
var ErrNotIPv4Address = errors.New("not an IPv4 addres")
var ErrNotIPv6Address = errors.New("not an IPv6 addres")
Functions ¶
func BigIntToIPv6 ¶ added in v1.2.66
BigIntToIPv6 converts IP address of version 6 from big integer to net.IP representation.
func IPv4ToInt ¶ added in v1.2.66
IPv4ToInt converts IP address of version 4 from net.IP to uint32 representation.
func IPv6ToBigInt ¶ added in v1.2.66
IPv6ToBigInt converts IP address of version 6 from net.IP to math big integer representation.
func IPv6ToInt ¶ added in v1.2.66
IPv6ToInt converts IP address of version 6 from net.IP to uint64 array representation. Return value contains high integer value on the first place and low integer value on second place.
Types ¶
type Reader ¶
type Reader struct {
// contains filtered or unexported fields
}
Reader manages the reading of binary data
func (*Reader) IP ¶ added in v1.2.66
IP read encoded IP value that can be represented as uint32 (IPv4), bigInt (IPv6) or string (dns) In order to parse header correctly, we need to read the header first: 1: IP represented as string, 4: IP represented as IPv4 int (uint32), 6: IP represented as IPv6 bigInt (2 * uint64)
func (*Reader) IPArray ¶ added in v1.2.66
IPArray will encode a list of IPv4 or IPv6 to byte array, each IP is stored as defined in the IP() method
func (*Reader) ObjectArray ¶
ObjectArray read variable length array of arbitrary objects
func (*Reader) StringArray ¶
StringArray read array of strings
type Writer ¶
type Writer struct {
// contains filtered or unexported fields
}
Writer manages the writing of the output
func (*Writer) Float32Array ¶
Float32Array will encode variable length array of float32 values
func (*Writer) Float64Array ¶
Float64Array will encode variable length array of float64 values
func (*Writer) IP ¶ added in v1.2.66
IP will encode an IPv4 or IPv6 to byte array, to distinguish between IP types, we need a small uint8 header: 1: IP represented as string, 4: IP represented as IPv4 int (uint32), 6: IP represented as IPv6 bigInt (2 * uint64)
func (*Writer) IPArray ¶ added in v1.2.66
IPArray will encode a list of IPv4 or IPv6 to byte array, each IP is stored as defined in the IP() method
func (*Writer) Int64 ¶
Int64 will encode int 64 bit value (-9,223,372,036,854,775,808 .. 9,223,372,036,854,775,807)
func (*Writer) Object ¶
Object will encode an arbitrary object represented as variable length byte array
func (*Writer) ObjectArray ¶
ObjectArray will encode variable length array of arbitrary objects
func (*Writer) Reset ¶
func (w *Writer) Reset()
Reset will reset the underlying bytes of the Encoder
func (*Writer) StringArray ¶
StringArray will encode variable length array of strings
func (*Writer) Uint64 ¶
Uint64 will encode unsigned int 64 bits value (0 .. 18,446,744,073,709,551,615)