report geoip separately (#87)

* report geoip separately

* default 30s
This commit is contained in:
UUBulb
2024-11-22 22:36:50 +08:00
committed by GitHub
parent 32481e2b6f
commit 3dfb62287b
8 changed files with 359 additions and 274 deletions
+2
View File
@@ -53,6 +53,8 @@ func (c *AgentConfig) Read(path string) error {
if c.IPReportPeriod == 0 {
c.IPReportPeriod = 1800
} else if c.IPReportPeriod < 30 {
c.IPReportPeriod = 30
}
return nil
+10 -4
View File
@@ -69,8 +69,6 @@ type Host struct {
Arch string
Virtualization string
BootTime uint64
IP string `json:"-"`
CountryCode string
Version string
GPU []string
}
@@ -86,9 +84,17 @@ func (h *Host) PB() *pb.Host {
Arch: h.Arch,
Virtualization: h.Virtualization,
BootTime: h.BootTime,
Ip: h.IP,
CountryCode: h.CountryCode,
Version: h.Version,
Gpu: h.GPU,
}
}
type GeoIP struct {
IP IP `json:"ip,omitempty"`
CountryCode string `json:"country_code,omitempty"`
}
type IP struct {
IPv4Addr string `json:"ipv4_addr,omitempty"`
IPv6Addr string `json:"ipv6_addr,omitempty"`
}