Files
EdgeCommon/pkg/iplibrary/ip_item.go

28 lines
516 B
Go
Raw Normal View History

// Copyright 2022 Liuxiangchao iwind.liu@gmail.com. All rights reserved. Official site: https://goedge.cn .
package iplibrary
2022-08-21 23:09:25 +08:00
import (
"bytes"
"encoding/binary"
)
type ipItem struct {
2022-08-21 23:09:25 +08:00
CountryId uint32
ProvinceId uint32
CityId uint32
TownId uint32
ProviderId uint32
IPFrom uint64
IPTo uint64
}
func (this *ipItem) AsBinary() ([]byte, error) {
var buf = &bytes.Buffer{}
err := binary.Write(buf, binary.BigEndian, this)
if err != nil {
return nil, err
}
return buf.Bytes(), nil
}