add String method
This commit is contained in:
parent
a220db2345
commit
540831e6a9
|
|
@ -76,3 +76,10 @@ func NewHeader(input []byte) (*Header, error) {
|
||||||
RuntimePtrBytes: int(binary.LittleEndian.Uint16(input[18:])),
|
RuntimePtrBytes: int(binary.LittleEndian.Uint16(input[18:])),
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (h *Header) String() string {
|
||||||
|
return fmt.Sprintf(
|
||||||
|
"{version:%d, index_policy:%d, created_at:%d, start_index_ptr:%d, end_index_ptr:%d, ip_version:%d, runtime_ptr_bytes:%d}",
|
||||||
|
h.Version, h.IndexPolicy, h.CreatedAt, h.StartIndexPtr, h.EndIndexPtr, h.IPVersion, h.RuntimePtrBytes,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,13 @@ type Version struct {
|
||||||
IPCompare func([]byte, []byte) int
|
IPCompare func([]byte, []byte) int
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (v *Version) String() string {
|
||||||
|
return fmt.Sprintf(
|
||||||
|
"id:%d, name:%s, bytes:%d, segment_index_size:%d",
|
||||||
|
v.Id, v.Name, v.Bytes, v.SegmentIndexSize,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
const (
|
const (
|
||||||
IPv4VersionNo = 4
|
IPv4VersionNo = 4
|
||||||
IPv6VersionNo = 6
|
IPv6VersionNo = 6
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue