From 3dfb62287b9f7e823009ff56d50d68d802d3db75 Mon Sep 17 00:00:00 2001 From: UUBulb <35923940+uubulb@users.noreply.github.com> Date: Fri, 22 Nov 2024 22:36:50 +0800 Subject: [PATCH] report geoip separately (#87) * report geoip separately * default 30s --- cmd/agent/main.go | 44 +++-- model/config.go | 2 + model/host.go | 14 +- pkg/monitor/monitor.go | 1 - pkg/monitor/myip.go | 81 +++++----- proto/nezha.pb.go | 353 ++++++++++++++++++++++++----------------- proto/nezha.proto | 110 ++++++------- proto/nezha_grpc.pb.go | 28 ++-- 8 files changed, 359 insertions(+), 274 deletions(-) diff --git a/cmd/agent/main.go b/cmd/agent/main.go index f5396b5..d21e089 100644 --- a/cmd/agent/main.go +++ b/cmd/agent/main.go @@ -69,6 +69,7 @@ var ( } hostStatus = new(atomic.Bool) + ipStatus = new(atomic.Bool) ) const ( @@ -252,10 +253,9 @@ func run() { } }() } + // 上报服务器信息 go reportStateDaemon() - // 更新IP信息 - go monitor.UpdateIP(agentConfig.UseIPv6CountryCode, agentConfig.IPReportPeriod) // 定时检查更新 if _, err := semver.Parse(version); err == nil && !agentConfig.DisableAutoUpdate { @@ -427,6 +427,7 @@ func doTask(task *pb.Task) { return case model.TaskTypeReportHostInfo: reportHost() + reportGeoIP(agentConfig.UseIPv6CountryCode) return case model.TaskTypeFM: handleFMTask(task) @@ -442,17 +443,17 @@ func doTask(task *pb.Task) { // reportStateDaemon 向server上报状态信息 func reportStateDaemon() { - var lastReportHostInfo time.Time + var lastReportHostInfo, lastReportIPInfo time.Time var err error defer printf("reportState exit %v => %v", time.Now(), err) for { // 为了更准确的记录时段流量,inited 后再上传状态信息 - lastReportHostInfo = reportState(lastReportHostInfo) + lastReportHostInfo, lastReportIPInfo = reportState(lastReportHostInfo, lastReportIPInfo) time.Sleep(time.Second * time.Duration(agentConfig.ReportDelay)) } } -func reportState(lastReportHostInfo time.Time) time.Time { +func reportState(host, ip time.Time) (time.Time, time.Time) { if client != nil && initialized { monitor.TrackNetworkSpeed() timeOutCtx, cancel := context.WithTimeout(context.Background(), networkTimeOut) @@ -464,14 +465,20 @@ func reportState(lastReportHostInfo time.Time) time.Time { } // 每10分钟重新获取一次硬件信息 - if lastReportHostInfo.Before(time.Now().Add(-10*time.Minute)) || monitor.GeoQueryIPChanged { + if host.Before(time.Now().Add(-10 * time.Minute)) { if reportHost() { - monitor.GeoQueryIPChanged = false - lastReportHostInfo = time.Now() + host = time.Now() + } + } + + // 更新IP信息 + if time.Since(ip) > time.Second*time.Duration(agentConfig.IPReportPeriod) { + if reportGeoIP(agentConfig.UseIPv6CountryCode) { + ip = time.Now() } } } - return lastReportHostInfo + return host, ip } func reportHost() bool { @@ -482,11 +489,26 @@ func reportHost() bool { if client != nil && initialized { client.ReportSystemInfo(context.Background(), monitor.GetHost().PB()) - if monitor.GeoQueryIP != "" { - geoip, err := client.LookupGeoIP(context.Background(), &pb.GeoIP{Ip: monitor.GeoQueryIP}) + } + + return true +} + +func reportGeoIP(use6 bool) bool { + if !ipStatus.CompareAndSwap(false, true) { + return false + } + defer ipStatus.Store(false) + + if client != nil && initialized { + pbg := monitor.FetchIP(use6) + if pbg != nil && monitor.GeoQueryIPChanged { + geoip, err := client.ReportGeoIP(context.Background(), pbg) if err == nil { monitor.CachedCountryCode = geoip.GetCountryCode() } + } else { + return false } } diff --git a/model/config.go b/model/config.go index 8060fcb..083b5cb 100644 --- a/model/config.go +++ b/model/config.go @@ -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 diff --git a/model/host.go b/model/host.go index cda665f..5abfe3f 100644 --- a/model/host.go +++ b/model/host.go @@ -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"` +} diff --git a/pkg/monitor/monitor.go b/pkg/monitor/monitor.go index 7566b5f..f40740c 100644 --- a/pkg/monitor/monitor.go +++ b/pkg/monitor/monitor.go @@ -116,7 +116,6 @@ func GetHost() *model.Host { cachedBootTime = time.Unix(int64(hi.BootTime), 0) - ret.IP = CachedIP ret.Version = Version return &ret diff --git a/pkg/monitor/myip.go b/pkg/monitor/myip.go index 398fb8f..9f1605d 100644 --- a/pkg/monitor/myip.go +++ b/pkg/monitor/myip.go @@ -1,7 +1,6 @@ package monitor import ( - "fmt" "io" "net/http" "strings" @@ -9,6 +8,7 @@ import ( "time" "github.com/nezhahq/agent/pkg/util" + pb "github.com/nezhahq/agent/proto" ) var ( @@ -17,54 +17,47 @@ var ( "https://dash.cloudflare.com/cdn-cgi/trace", "https://developers.cloudflare.com/cdn-cgi/trace", } - CachedIP, GeoQueryIP, CachedCountryCode string - GeoQueryIPChanged bool = true - httpClientV4 = util.NewSingleStackHTTPClient(time.Second*20, time.Second*5, time.Second*10, false) - httpClientV6 = util.NewSingleStackHTTPClient(time.Second*20, time.Second*5, time.Second*10, true) + GeoQueryIP, CachedCountryCode string + GeoQueryIPChanged bool = true + httpClientV4 = util.NewSingleStackHTTPClient(time.Second*20, time.Second*5, time.Second*10, false) + httpClientV6 = util.NewSingleStackHTTPClient(time.Second*20, time.Second*5, time.Second*10, true) ) // UpdateIP 按设置时间间隔更新IP地址的缓存 -func UpdateIP(useIPv6CountryCode bool, period uint32) { - for { - util.Println(agentConfig.Debug, "正在更新本地缓存IP信息") - wg := new(sync.WaitGroup) - wg.Add(2) - var ipv4, ipv6 string - go func() { - defer wg.Done() - ipv4 = fetchIP(cfList, false) - }() - go func() { - defer wg.Done() - ipv6 = fetchIP(cfList, true) - }() - wg.Wait() +func FetchIP(useIPv6CountryCode bool) *pb.GeoIP { + util.Println(agentConfig.Debug, "正在更新本地缓存IP信息") + wg := new(sync.WaitGroup) + wg.Add(2) + var ipv4, ipv6 string + go func() { + defer wg.Done() + ipv4 = fetchIP(cfList, false) + }() + go func() { + defer wg.Done() + ipv6 = fetchIP(cfList, true) + }() + wg.Wait() - if ipv4 == "" && ipv6 == "" { - if period > 60 { - time.Sleep(time.Minute) - } else { - time.Sleep(time.Second * time.Duration(period)) - } - continue - } - - if ipv4 == "" || ipv6 == "" { - CachedIP = fmt.Sprintf("%s%s", ipv4, ipv6) - } else { - CachedIP = fmt.Sprintf("%s/%s", ipv4, ipv6) - } - - if ipv6 != "" && (useIPv6CountryCode || ipv4 == "") { - GeoQueryIPChanged = GeoQueryIP != ipv6 || GeoQueryIPChanged - GeoQueryIP = ipv6 - } else { - GeoQueryIPChanged = GeoQueryIP != ipv4 || GeoQueryIPChanged - GeoQueryIP = ipv4 - } - - time.Sleep(time.Second * time.Duration(period)) + if ipv6 != "" && (useIPv6CountryCode || ipv4 == "") { + GeoQueryIPChanged = GeoQueryIP != ipv6 || GeoQueryIPChanged + GeoQueryIP = ipv6 + } else { + GeoQueryIPChanged = GeoQueryIP != ipv4 || GeoQueryIPChanged + GeoQueryIP = ipv4 } + + if GeoQueryIP != "" { + return &pb.GeoIP{ + Use6: useIPv6CountryCode, + Ip: &pb.IP{ + Ipv4: ipv4, + Ipv6: ipv6, + }, + } + } + + return nil } func fetchIP(servers []string, isV6 bool) string { diff --git a/proto/nezha.pb.go b/proto/nezha.pb.go index e994794..ec5c12b 100644 --- a/proto/nezha.pb.go +++ b/proto/nezha.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.34.1 -// protoc v5.28.2 +// protoc v5.28.3 // source: proto/nezha.proto package proto @@ -34,10 +34,8 @@ type Host struct { Arch string `protobuf:"bytes,7,opt,name=arch,proto3" json:"arch,omitempty"` Virtualization string `protobuf:"bytes,8,opt,name=virtualization,proto3" json:"virtualization,omitempty"` BootTime uint64 `protobuf:"varint,9,opt,name=boot_time,json=bootTime,proto3" json:"boot_time,omitempty"` - Ip string `protobuf:"bytes,10,opt,name=ip,proto3" json:"ip,omitempty"` - CountryCode string `protobuf:"bytes,11,opt,name=country_code,json=countryCode,proto3" json:"country_code,omitempty"` // deprecated - Version string `protobuf:"bytes,12,opt,name=version,proto3" json:"version,omitempty"` - Gpu []string `protobuf:"bytes,13,rep,name=gpu,proto3" json:"gpu,omitempty"` + Version string `protobuf:"bytes,10,opt,name=version,proto3" json:"version,omitempty"` + Gpu []string `protobuf:"bytes,11,rep,name=gpu,proto3" json:"gpu,omitempty"` } func (x *Host) Reset() { @@ -135,20 +133,6 @@ func (x *Host) GetBootTime() uint64 { return 0 } -func (x *Host) GetIp() string { - if x != nil { - return x.Ip - } - return "" -} - -func (x *Host) GetCountryCode() string { - if x != nil { - return x.CountryCode - } - return "" -} - func (x *Host) GetVersion() string { if x != nil { return x.Version @@ -169,22 +153,22 @@ type State struct { unknownFields protoimpl.UnknownFields Cpu float64 `protobuf:"fixed64,1,opt,name=cpu,proto3" json:"cpu,omitempty"` - MemUsed uint64 `protobuf:"varint,3,opt,name=mem_used,json=memUsed,proto3" json:"mem_used,omitempty"` - SwapUsed uint64 `protobuf:"varint,4,opt,name=swap_used,json=swapUsed,proto3" json:"swap_used,omitempty"` - DiskUsed uint64 `protobuf:"varint,5,opt,name=disk_used,json=diskUsed,proto3" json:"disk_used,omitempty"` - NetInTransfer uint64 `protobuf:"varint,6,opt,name=net_in_transfer,json=netInTransfer,proto3" json:"net_in_transfer,omitempty"` - NetOutTransfer uint64 `protobuf:"varint,7,opt,name=net_out_transfer,json=netOutTransfer,proto3" json:"net_out_transfer,omitempty"` - NetInSpeed uint64 `protobuf:"varint,8,opt,name=net_in_speed,json=netInSpeed,proto3" json:"net_in_speed,omitempty"` - NetOutSpeed uint64 `protobuf:"varint,9,opt,name=net_out_speed,json=netOutSpeed,proto3" json:"net_out_speed,omitempty"` - Uptime uint64 `protobuf:"varint,10,opt,name=uptime,proto3" json:"uptime,omitempty"` - Load1 float64 `protobuf:"fixed64,11,opt,name=load1,proto3" json:"load1,omitempty"` - Load5 float64 `protobuf:"fixed64,12,opt,name=load5,proto3" json:"load5,omitempty"` - Load15 float64 `protobuf:"fixed64,13,opt,name=load15,proto3" json:"load15,omitempty"` - TcpConnCount uint64 `protobuf:"varint,14,opt,name=tcp_conn_count,json=tcpConnCount,proto3" json:"tcp_conn_count,omitempty"` - UdpConnCount uint64 `protobuf:"varint,15,opt,name=udp_conn_count,json=udpConnCount,proto3" json:"udp_conn_count,omitempty"` - ProcessCount uint64 `protobuf:"varint,16,opt,name=process_count,json=processCount,proto3" json:"process_count,omitempty"` - Temperatures []*State_SensorTemperature `protobuf:"bytes,17,rep,name=temperatures,proto3" json:"temperatures,omitempty"` - Gpu []float64 `protobuf:"fixed64,18,rep,packed,name=gpu,proto3" json:"gpu,omitempty"` + MemUsed uint64 `protobuf:"varint,2,opt,name=mem_used,json=memUsed,proto3" json:"mem_used,omitempty"` + SwapUsed uint64 `protobuf:"varint,3,opt,name=swap_used,json=swapUsed,proto3" json:"swap_used,omitempty"` + DiskUsed uint64 `protobuf:"varint,4,opt,name=disk_used,json=diskUsed,proto3" json:"disk_used,omitempty"` + NetInTransfer uint64 `protobuf:"varint,5,opt,name=net_in_transfer,json=netInTransfer,proto3" json:"net_in_transfer,omitempty"` + NetOutTransfer uint64 `protobuf:"varint,6,opt,name=net_out_transfer,json=netOutTransfer,proto3" json:"net_out_transfer,omitempty"` + NetInSpeed uint64 `protobuf:"varint,7,opt,name=net_in_speed,json=netInSpeed,proto3" json:"net_in_speed,omitempty"` + NetOutSpeed uint64 `protobuf:"varint,8,opt,name=net_out_speed,json=netOutSpeed,proto3" json:"net_out_speed,omitempty"` + Uptime uint64 `protobuf:"varint,9,opt,name=uptime,proto3" json:"uptime,omitempty"` + Load1 float64 `protobuf:"fixed64,10,opt,name=load1,proto3" json:"load1,omitempty"` + Load5 float64 `protobuf:"fixed64,11,opt,name=load5,proto3" json:"load5,omitempty"` + Load15 float64 `protobuf:"fixed64,12,opt,name=load15,proto3" json:"load15,omitempty"` + TcpConnCount uint64 `protobuf:"varint,13,opt,name=tcp_conn_count,json=tcpConnCount,proto3" json:"tcp_conn_count,omitempty"` + UdpConnCount uint64 `protobuf:"varint,14,opt,name=udp_conn_count,json=udpConnCount,proto3" json:"udp_conn_count,omitempty"` + ProcessCount uint64 `protobuf:"varint,15,opt,name=process_count,json=processCount,proto3" json:"process_count,omitempty"` + Temperatures []*State_SensorTemperature `protobuf:"bytes,16,rep,name=temperatures,proto3" json:"temperatures,omitempty"` + Gpu []float64 `protobuf:"fixed64,17,rep,packed,name=gpu,proto3" json:"gpu,omitempty"` } func (x *State) Reset() { @@ -634,8 +618,9 @@ type GeoIP struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Ip string `protobuf:"bytes,1,opt,name=ip,proto3" json:"ip,omitempty"` - CountryCode string `protobuf:"bytes,2,opt,name=country_code,json=countryCode,proto3" json:"country_code,omitempty"` + Use6 bool `protobuf:"varint,1,opt,name=use6,proto3" json:"use6,omitempty"` + Ip *IP `protobuf:"bytes,2,opt,name=ip,proto3" json:"ip,omitempty"` + CountryCode string `protobuf:"bytes,3,opt,name=country_code,json=countryCode,proto3" json:"country_code,omitempty"` } func (x *GeoIP) Reset() { @@ -670,11 +655,18 @@ func (*GeoIP) Descriptor() ([]byte, []int) { return file_proto_nezha_proto_rawDescGZIP(), []int{7} } -func (x *GeoIP) GetIp() string { +func (x *GeoIP) GetUse6() bool { + if x != nil { + return x.Use6 + } + return false +} + +func (x *GeoIP) GetIp() *IP { if x != nil { return x.Ip } - return "" + return nil } func (x *GeoIP) GetCountryCode() string { @@ -684,11 +676,66 @@ func (x *GeoIP) GetCountryCode() string { return "" } +type IP struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Ipv4 string `protobuf:"bytes,1,opt,name=ipv4,proto3" json:"ipv4,omitempty"` + Ipv6 string `protobuf:"bytes,2,opt,name=ipv6,proto3" json:"ipv6,omitempty"` +} + +func (x *IP) Reset() { + *x = IP{} + if protoimpl.UnsafeEnabled { + mi := &file_proto_nezha_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *IP) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*IP) ProtoMessage() {} + +func (x *IP) ProtoReflect() protoreflect.Message { + mi := &file_proto_nezha_proto_msgTypes[8] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use IP.ProtoReflect.Descriptor instead. +func (*IP) Descriptor() ([]byte, []int) { + return file_proto_nezha_proto_rawDescGZIP(), []int{8} +} + +func (x *IP) GetIpv4() string { + if x != nil { + return x.Ipv4 + } + return "" +} + +func (x *IP) GetIpv6() string { + if x != nil { + return x.Ipv6 + } + return "" +} + var File_proto_nezha_proto protoreflect.FileDescriptor var file_proto_nezha_proto_rawDesc = []byte{ 0x0a, 0x11, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x6e, 0x65, 0x7a, 0x68, 0x61, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x12, 0x05, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xf2, 0x02, 0x0a, 0x04, 0x48, + 0x6f, 0x74, 0x6f, 0x12, 0x05, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xbf, 0x02, 0x0a, 0x04, 0x48, 0x6f, 0x73, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x12, 0x29, 0x0a, 0x10, 0x70, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x5f, 0x76, 0x65, 0x72, 0x73, @@ -706,93 +753,95 @@ var file_proto_nezha_proto_rawDesc = []byte{ 0x01, 0x28, 0x09, 0x52, 0x0e, 0x76, 0x69, 0x72, 0x74, 0x75, 0x61, 0x6c, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x1b, 0x0a, 0x09, 0x62, 0x6f, 0x6f, 0x74, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x09, 0x20, 0x01, 0x28, 0x04, 0x52, 0x08, 0x62, 0x6f, 0x6f, 0x74, 0x54, 0x69, 0x6d, 0x65, - 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x70, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x70, - 0x12, 0x21, 0x0a, 0x0c, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x72, 0x79, 0x5f, 0x63, 0x6f, 0x64, 0x65, - 0x18, 0x0b, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x72, 0x79, 0x43, - 0x6f, 0x64, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x0c, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x10, 0x0a, - 0x03, 0x67, 0x70, 0x75, 0x18, 0x0d, 0x20, 0x03, 0x28, 0x09, 0x52, 0x03, 0x67, 0x70, 0x75, 0x22, - 0xa9, 0x04, 0x0a, 0x05, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x63, 0x70, 0x75, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x01, 0x52, 0x03, 0x63, 0x70, 0x75, 0x12, 0x19, 0x0a, 0x08, 0x6d, - 0x65, 0x6d, 0x5f, 0x75, 0x73, 0x65, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x52, 0x07, 0x6d, - 0x65, 0x6d, 0x55, 0x73, 0x65, 0x64, 0x12, 0x1b, 0x0a, 0x09, 0x73, 0x77, 0x61, 0x70, 0x5f, 0x75, - 0x73, 0x65, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x04, 0x52, 0x08, 0x73, 0x77, 0x61, 0x70, 0x55, - 0x73, 0x65, 0x64, 0x12, 0x1b, 0x0a, 0x09, 0x64, 0x69, 0x73, 0x6b, 0x5f, 0x75, 0x73, 0x65, 0x64, - 0x18, 0x05, 0x20, 0x01, 0x28, 0x04, 0x52, 0x08, 0x64, 0x69, 0x73, 0x6b, 0x55, 0x73, 0x65, 0x64, - 0x12, 0x26, 0x0a, 0x0f, 0x6e, 0x65, 0x74, 0x5f, 0x69, 0x6e, 0x5f, 0x74, 0x72, 0x61, 0x6e, 0x73, - 0x66, 0x65, 0x72, 0x18, 0x06, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0d, 0x6e, 0x65, 0x74, 0x49, 0x6e, - 0x54, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x65, 0x72, 0x12, 0x28, 0x0a, 0x10, 0x6e, 0x65, 0x74, 0x5f, - 0x6f, 0x75, 0x74, 0x5f, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x65, 0x72, 0x18, 0x07, 0x20, 0x01, - 0x28, 0x04, 0x52, 0x0e, 0x6e, 0x65, 0x74, 0x4f, 0x75, 0x74, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x66, - 0x65, 0x72, 0x12, 0x20, 0x0a, 0x0c, 0x6e, 0x65, 0x74, 0x5f, 0x69, 0x6e, 0x5f, 0x73, 0x70, 0x65, - 0x65, 0x64, 0x18, 0x08, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0a, 0x6e, 0x65, 0x74, 0x49, 0x6e, 0x53, - 0x70, 0x65, 0x65, 0x64, 0x12, 0x22, 0x0a, 0x0d, 0x6e, 0x65, 0x74, 0x5f, 0x6f, 0x75, 0x74, 0x5f, - 0x73, 0x70, 0x65, 0x65, 0x64, 0x18, 0x09, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0b, 0x6e, 0x65, 0x74, - 0x4f, 0x75, 0x74, 0x53, 0x70, 0x65, 0x65, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x75, 0x70, 0x74, 0x69, - 0x6d, 0x65, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x04, 0x52, 0x06, 0x75, 0x70, 0x74, 0x69, 0x6d, 0x65, - 0x12, 0x14, 0x0a, 0x05, 0x6c, 0x6f, 0x61, 0x64, 0x31, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x01, 0x52, - 0x05, 0x6c, 0x6f, 0x61, 0x64, 0x31, 0x12, 0x14, 0x0a, 0x05, 0x6c, 0x6f, 0x61, 0x64, 0x35, 0x18, - 0x0c, 0x20, 0x01, 0x28, 0x01, 0x52, 0x05, 0x6c, 0x6f, 0x61, 0x64, 0x35, 0x12, 0x16, 0x0a, 0x06, - 0x6c, 0x6f, 0x61, 0x64, 0x31, 0x35, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x01, 0x52, 0x06, 0x6c, 0x6f, - 0x61, 0x64, 0x31, 0x35, 0x12, 0x24, 0x0a, 0x0e, 0x74, 0x63, 0x70, 0x5f, 0x63, 0x6f, 0x6e, 0x6e, - 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0c, 0x74, 0x63, - 0x70, 0x43, 0x6f, 0x6e, 0x6e, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x24, 0x0a, 0x0e, 0x75, 0x64, - 0x70, 0x5f, 0x63, 0x6f, 0x6e, 0x6e, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x0f, 0x20, 0x01, - 0x28, 0x04, 0x52, 0x0c, 0x75, 0x64, 0x70, 0x43, 0x6f, 0x6e, 0x6e, 0x43, 0x6f, 0x75, 0x6e, 0x74, - 0x12, 0x23, 0x0a, 0x0d, 0x70, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x5f, 0x63, 0x6f, 0x75, 0x6e, - 0x74, 0x18, 0x10, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0c, 0x70, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, - 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x42, 0x0a, 0x0c, 0x74, 0x65, 0x6d, 0x70, 0x65, 0x72, 0x61, - 0x74, 0x75, 0x72, 0x65, 0x73, 0x18, 0x11, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x5f, 0x53, 0x65, 0x6e, 0x73, 0x6f, 0x72, - 0x54, 0x65, 0x6d, 0x70, 0x65, 0x72, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x0c, 0x74, 0x65, 0x6d, - 0x70, 0x65, 0x72, 0x61, 0x74, 0x75, 0x72, 0x65, 0x73, 0x12, 0x10, 0x0a, 0x03, 0x67, 0x70, 0x75, - 0x18, 0x12, 0x20, 0x03, 0x28, 0x01, 0x52, 0x03, 0x67, 0x70, 0x75, 0x22, 0x4f, 0x0a, 0x17, 0x53, - 0x74, 0x61, 0x74, 0x65, 0x5f, 0x53, 0x65, 0x6e, 0x73, 0x6f, 0x72, 0x54, 0x65, 0x6d, 0x70, 0x65, - 0x72, 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x74, 0x65, - 0x6d, 0x70, 0x65, 0x72, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x01, 0x52, - 0x0b, 0x74, 0x65, 0x6d, 0x70, 0x65, 0x72, 0x61, 0x74, 0x75, 0x72, 0x65, 0x22, 0x3e, 0x0a, 0x04, - 0x54, 0x61, 0x73, 0x6b, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, - 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x04, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, - 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x22, 0x7a, 0x0a, 0x0a, - 0x54, 0x61, 0x73, 0x6b, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, - 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x14, - 0x0a, 0x05, 0x64, 0x65, 0x6c, 0x61, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x02, 0x52, 0x05, 0x64, - 0x65, 0x6c, 0x61, 0x79, 0x12, 0x12, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x04, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x12, 0x1e, 0x0a, 0x0a, 0x73, 0x75, 0x63, 0x63, - 0x65, 0x73, 0x73, 0x66, 0x75, 0x6c, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, 0x73, 0x75, - 0x63, 0x63, 0x65, 0x73, 0x73, 0x66, 0x75, 0x6c, 0x22, 0x21, 0x0a, 0x07, 0x52, 0x65, 0x63, 0x65, - 0x69, 0x70, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x70, 0x72, 0x6f, 0x63, 0x65, 0x64, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x08, 0x52, 0x06, 0x70, 0x72, 0x6f, 0x63, 0x65, 0x64, 0x22, 0x22, 0x0a, 0x0c, 0x49, - 0x4f, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x44, 0x61, 0x74, 0x61, 0x12, 0x12, 0x0a, 0x04, 0x64, - 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x22, - 0x3a, 0x0a, 0x05, 0x47, 0x65, 0x6f, 0x49, 0x50, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x70, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x70, 0x12, 0x21, 0x0a, 0x0c, 0x63, 0x6f, 0x75, 0x6e, - 0x74, 0x72, 0x79, 0x5f, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, - 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x72, 0x79, 0x43, 0x6f, 0x64, 0x65, 0x32, 0xbf, 0x02, 0x0a, 0x0c, - 0x4e, 0x65, 0x7a, 0x68, 0x61, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x33, 0x0a, 0x11, - 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x53, 0x74, 0x61, 0x74, - 0x65, 0x12, 0x0c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x1a, + 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x0a, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x10, 0x0a, 0x03, 0x67, 0x70, + 0x75, 0x18, 0x0b, 0x20, 0x03, 0x28, 0x09, 0x52, 0x03, 0x67, 0x70, 0x75, 0x22, 0xa9, 0x04, 0x0a, + 0x05, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x63, 0x70, 0x75, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x01, 0x52, 0x03, 0x63, 0x70, 0x75, 0x12, 0x19, 0x0a, 0x08, 0x6d, 0x65, 0x6d, 0x5f, + 0x75, 0x73, 0x65, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x07, 0x6d, 0x65, 0x6d, 0x55, + 0x73, 0x65, 0x64, 0x12, 0x1b, 0x0a, 0x09, 0x73, 0x77, 0x61, 0x70, 0x5f, 0x75, 0x73, 0x65, 0x64, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x52, 0x08, 0x73, 0x77, 0x61, 0x70, 0x55, 0x73, 0x65, 0x64, + 0x12, 0x1b, 0x0a, 0x09, 0x64, 0x69, 0x73, 0x6b, 0x5f, 0x75, 0x73, 0x65, 0x64, 0x18, 0x04, 0x20, + 0x01, 0x28, 0x04, 0x52, 0x08, 0x64, 0x69, 0x73, 0x6b, 0x55, 0x73, 0x65, 0x64, 0x12, 0x26, 0x0a, + 0x0f, 0x6e, 0x65, 0x74, 0x5f, 0x69, 0x6e, 0x5f, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x65, 0x72, + 0x18, 0x05, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0d, 0x6e, 0x65, 0x74, 0x49, 0x6e, 0x54, 0x72, 0x61, + 0x6e, 0x73, 0x66, 0x65, 0x72, 0x12, 0x28, 0x0a, 0x10, 0x6e, 0x65, 0x74, 0x5f, 0x6f, 0x75, 0x74, + 0x5f, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x65, 0x72, 0x18, 0x06, 0x20, 0x01, 0x28, 0x04, 0x52, + 0x0e, 0x6e, 0x65, 0x74, 0x4f, 0x75, 0x74, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x65, 0x72, 0x12, + 0x20, 0x0a, 0x0c, 0x6e, 0x65, 0x74, 0x5f, 0x69, 0x6e, 0x5f, 0x73, 0x70, 0x65, 0x65, 0x64, 0x18, + 0x07, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0a, 0x6e, 0x65, 0x74, 0x49, 0x6e, 0x53, 0x70, 0x65, 0x65, + 0x64, 0x12, 0x22, 0x0a, 0x0d, 0x6e, 0x65, 0x74, 0x5f, 0x6f, 0x75, 0x74, 0x5f, 0x73, 0x70, 0x65, + 0x65, 0x64, 0x18, 0x08, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0b, 0x6e, 0x65, 0x74, 0x4f, 0x75, 0x74, + 0x53, 0x70, 0x65, 0x65, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x75, 0x70, 0x74, 0x69, 0x6d, 0x65, 0x18, + 0x09, 0x20, 0x01, 0x28, 0x04, 0x52, 0x06, 0x75, 0x70, 0x74, 0x69, 0x6d, 0x65, 0x12, 0x14, 0x0a, + 0x05, 0x6c, 0x6f, 0x61, 0x64, 0x31, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x01, 0x52, 0x05, 0x6c, 0x6f, + 0x61, 0x64, 0x31, 0x12, 0x14, 0x0a, 0x05, 0x6c, 0x6f, 0x61, 0x64, 0x35, 0x18, 0x0b, 0x20, 0x01, + 0x28, 0x01, 0x52, 0x05, 0x6c, 0x6f, 0x61, 0x64, 0x35, 0x12, 0x16, 0x0a, 0x06, 0x6c, 0x6f, 0x61, + 0x64, 0x31, 0x35, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x01, 0x52, 0x06, 0x6c, 0x6f, 0x61, 0x64, 0x31, + 0x35, 0x12, 0x24, 0x0a, 0x0e, 0x74, 0x63, 0x70, 0x5f, 0x63, 0x6f, 0x6e, 0x6e, 0x5f, 0x63, 0x6f, + 0x75, 0x6e, 0x74, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0c, 0x74, 0x63, 0x70, 0x43, 0x6f, + 0x6e, 0x6e, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x24, 0x0a, 0x0e, 0x75, 0x64, 0x70, 0x5f, 0x63, + 0x6f, 0x6e, 0x6e, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x04, 0x52, + 0x0c, 0x75, 0x64, 0x70, 0x43, 0x6f, 0x6e, 0x6e, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x23, 0x0a, + 0x0d, 0x70, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x0f, + 0x20, 0x01, 0x28, 0x04, 0x52, 0x0c, 0x70, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x43, 0x6f, 0x75, + 0x6e, 0x74, 0x12, 0x42, 0x0a, 0x0c, 0x74, 0x65, 0x6d, 0x70, 0x65, 0x72, 0x61, 0x74, 0x75, 0x72, + 0x65, 0x73, 0x18, 0x10, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x2e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x5f, 0x53, 0x65, 0x6e, 0x73, 0x6f, 0x72, 0x54, 0x65, 0x6d, + 0x70, 0x65, 0x72, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x0c, 0x74, 0x65, 0x6d, 0x70, 0x65, 0x72, + 0x61, 0x74, 0x75, 0x72, 0x65, 0x73, 0x12, 0x10, 0x0a, 0x03, 0x67, 0x70, 0x75, 0x18, 0x11, 0x20, + 0x03, 0x28, 0x01, 0x52, 0x03, 0x67, 0x70, 0x75, 0x22, 0x4f, 0x0a, 0x17, 0x53, 0x74, 0x61, 0x74, + 0x65, 0x5f, 0x53, 0x65, 0x6e, 0x73, 0x6f, 0x72, 0x54, 0x65, 0x6d, 0x70, 0x65, 0x72, 0x61, 0x74, + 0x75, 0x72, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x74, 0x65, 0x6d, 0x70, 0x65, + 0x72, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x01, 0x52, 0x0b, 0x74, 0x65, + 0x6d, 0x70, 0x65, 0x72, 0x61, 0x74, 0x75, 0x72, 0x65, 0x22, 0x3e, 0x0a, 0x04, 0x54, 0x61, 0x73, + 0x6b, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x02, 0x69, + 0x64, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, + 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x03, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x22, 0x7a, 0x0a, 0x0a, 0x54, 0x61, 0x73, + 0x6b, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x04, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x64, + 0x65, 0x6c, 0x61, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x02, 0x52, 0x05, 0x64, 0x65, 0x6c, 0x61, + 0x79, 0x12, 0x12, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x04, 0x64, 0x61, 0x74, 0x61, 0x12, 0x1e, 0x0a, 0x0a, 0x73, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, + 0x66, 0x75, 0x6c, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, 0x73, 0x75, 0x63, 0x63, 0x65, + 0x73, 0x73, 0x66, 0x75, 0x6c, 0x22, 0x21, 0x0a, 0x07, 0x52, 0x65, 0x63, 0x65, 0x69, 0x70, 0x74, + 0x12, 0x16, 0x0a, 0x06, 0x70, 0x72, 0x6f, 0x63, 0x65, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, + 0x52, 0x06, 0x70, 0x72, 0x6f, 0x63, 0x65, 0x64, 0x22, 0x22, 0x0a, 0x0c, 0x49, 0x4f, 0x53, 0x74, + 0x72, 0x65, 0x61, 0x6d, 0x44, 0x61, 0x74, 0x61, 0x12, 0x12, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x22, 0x59, 0x0a, 0x05, + 0x47, 0x65, 0x6f, 0x49, 0x50, 0x12, 0x12, 0x0a, 0x04, 0x75, 0x73, 0x65, 0x36, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x08, 0x52, 0x04, 0x75, 0x73, 0x65, 0x36, 0x12, 0x19, 0x0a, 0x02, 0x69, 0x70, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x09, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x49, 0x50, + 0x52, 0x02, 0x69, 0x70, 0x12, 0x21, 0x0a, 0x0c, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x72, 0x79, 0x5f, + 0x63, 0x6f, 0x64, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x63, 0x6f, 0x75, 0x6e, + 0x74, 0x72, 0x79, 0x43, 0x6f, 0x64, 0x65, 0x22, 0x2c, 0x0a, 0x02, 0x49, 0x50, 0x12, 0x12, 0x0a, + 0x04, 0x69, 0x70, 0x76, 0x34, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x69, 0x70, 0x76, + 0x34, 0x12, 0x12, 0x0a, 0x04, 0x69, 0x70, 0x76, 0x36, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x04, 0x69, 0x70, 0x76, 0x36, 0x32, 0xbf, 0x02, 0x0a, 0x0c, 0x4e, 0x65, 0x7a, 0x68, 0x61, 0x53, + 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x33, 0x0a, 0x11, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, + 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x0c, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x1a, 0x0e, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x2e, 0x52, 0x65, 0x63, 0x65, 0x69, 0x70, 0x74, 0x22, 0x00, 0x12, 0x31, 0x0a, 0x10, 0x52, + 0x65, 0x70, 0x6f, 0x72, 0x74, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x49, 0x6e, 0x66, 0x6f, 0x12, + 0x0b, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x48, 0x6f, 0x73, 0x74, 0x1a, 0x0e, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x52, 0x65, 0x63, 0x65, 0x69, 0x70, 0x74, 0x22, 0x00, 0x12, 0x31, + 0x0a, 0x0a, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x54, 0x61, 0x73, 0x6b, 0x12, 0x11, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x54, 0x61, 0x73, 0x6b, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x1a, 0x0e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x52, 0x65, 0x63, 0x65, 0x69, 0x70, 0x74, 0x22, - 0x00, 0x12, 0x31, 0x0a, 0x10, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x53, 0x79, 0x73, 0x74, 0x65, - 0x6d, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x0b, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x48, 0x6f, - 0x73, 0x74, 0x1a, 0x0e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x52, 0x65, 0x63, 0x65, 0x69, - 0x70, 0x74, 0x22, 0x00, 0x12, 0x31, 0x0a, 0x0a, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x54, 0x61, - 0x73, 0x6b, 0x12, 0x11, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x54, 0x61, 0x73, 0x6b, 0x52, - 0x65, 0x73, 0x75, 0x6c, 0x74, 0x1a, 0x0e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x52, 0x65, - 0x63, 0x65, 0x69, 0x70, 0x74, 0x22, 0x00, 0x12, 0x2b, 0x0a, 0x0b, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x54, 0x61, 0x73, 0x6b, 0x12, 0x0b, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x48, - 0x6f, 0x73, 0x74, 0x1a, 0x0b, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x54, 0x61, 0x73, 0x6b, - 0x22, 0x00, 0x30, 0x01, 0x12, 0x3a, 0x0a, 0x08, 0x49, 0x4f, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, - 0x12, 0x13, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x49, 0x4f, 0x53, 0x74, 0x72, 0x65, 0x61, - 0x6d, 0x44, 0x61, 0x74, 0x61, 0x1a, 0x13, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x49, 0x4f, - 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x44, 0x61, 0x74, 0x61, 0x22, 0x00, 0x28, 0x01, 0x30, 0x01, - 0x12, 0x2b, 0x0a, 0x0b, 0x4c, 0x6f, 0x6f, 0x6b, 0x75, 0x70, 0x47, 0x65, 0x6f, 0x49, 0x50, 0x12, - 0x0c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x47, 0x65, 0x6f, 0x49, 0x50, 0x1a, 0x0c, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x47, 0x65, 0x6f, 0x49, 0x50, 0x22, 0x00, 0x42, 0x09, 0x5a, - 0x07, 0x2e, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x00, 0x12, 0x2b, 0x0a, 0x0b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x54, 0x61, 0x73, 0x6b, + 0x12, 0x0b, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x48, 0x6f, 0x73, 0x74, 0x1a, 0x0b, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x54, 0x61, 0x73, 0x6b, 0x22, 0x00, 0x30, 0x01, 0x12, 0x3a, + 0x0a, 0x08, 0x49, 0x4f, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x12, 0x13, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x2e, 0x49, 0x4f, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x44, 0x61, 0x74, 0x61, 0x1a, + 0x13, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x49, 0x4f, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, + 0x44, 0x61, 0x74, 0x61, 0x22, 0x00, 0x28, 0x01, 0x30, 0x01, 0x12, 0x2b, 0x0a, 0x0b, 0x52, 0x65, + 0x70, 0x6f, 0x72, 0x74, 0x47, 0x65, 0x6f, 0x49, 0x50, 0x12, 0x0c, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x2e, 0x47, 0x65, 0x6f, 0x49, 0x50, 0x1a, 0x0c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, + 0x47, 0x65, 0x6f, 0x49, 0x50, 0x22, 0x00, 0x42, 0x09, 0x5a, 0x07, 0x2e, 0x2f, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -807,7 +856,7 @@ func file_proto_nezha_proto_rawDescGZIP() []byte { return file_proto_nezha_proto_rawDescData } -var file_proto_nezha_proto_msgTypes = make([]protoimpl.MessageInfo, 8) +var file_proto_nezha_proto_msgTypes = make([]protoimpl.MessageInfo, 9) var file_proto_nezha_proto_goTypes = []interface{}{ (*Host)(nil), // 0: proto.Host (*State)(nil), // 1: proto.State @@ -817,26 +866,28 @@ var file_proto_nezha_proto_goTypes = []interface{}{ (*Receipt)(nil), // 5: proto.Receipt (*IOStreamData)(nil), // 6: proto.IOStreamData (*GeoIP)(nil), // 7: proto.GeoIP + (*IP)(nil), // 8: proto.IP } var file_proto_nezha_proto_depIdxs = []int32{ 2, // 0: proto.State.temperatures:type_name -> proto.State_SensorTemperature - 1, // 1: proto.NezhaService.ReportSystemState:input_type -> proto.State - 0, // 2: proto.NezhaService.ReportSystemInfo:input_type -> proto.Host - 4, // 3: proto.NezhaService.ReportTask:input_type -> proto.TaskResult - 0, // 4: proto.NezhaService.RequestTask:input_type -> proto.Host - 6, // 5: proto.NezhaService.IOStream:input_type -> proto.IOStreamData - 7, // 6: proto.NezhaService.LookupGeoIP:input_type -> proto.GeoIP - 5, // 7: proto.NezhaService.ReportSystemState:output_type -> proto.Receipt - 5, // 8: proto.NezhaService.ReportSystemInfo:output_type -> proto.Receipt - 5, // 9: proto.NezhaService.ReportTask:output_type -> proto.Receipt - 3, // 10: proto.NezhaService.RequestTask:output_type -> proto.Task - 6, // 11: proto.NezhaService.IOStream:output_type -> proto.IOStreamData - 7, // 12: proto.NezhaService.LookupGeoIP:output_type -> proto.GeoIP - 7, // [7:13] is the sub-list for method output_type - 1, // [1:7] is the sub-list for method input_type - 1, // [1:1] is the sub-list for extension type_name - 1, // [1:1] is the sub-list for extension extendee - 0, // [0:1] is the sub-list for field type_name + 8, // 1: proto.GeoIP.ip:type_name -> proto.IP + 1, // 2: proto.NezhaService.ReportSystemState:input_type -> proto.State + 0, // 3: proto.NezhaService.ReportSystemInfo:input_type -> proto.Host + 4, // 4: proto.NezhaService.ReportTask:input_type -> proto.TaskResult + 0, // 5: proto.NezhaService.RequestTask:input_type -> proto.Host + 6, // 6: proto.NezhaService.IOStream:input_type -> proto.IOStreamData + 7, // 7: proto.NezhaService.ReportGeoIP:input_type -> proto.GeoIP + 5, // 8: proto.NezhaService.ReportSystemState:output_type -> proto.Receipt + 5, // 9: proto.NezhaService.ReportSystemInfo:output_type -> proto.Receipt + 5, // 10: proto.NezhaService.ReportTask:output_type -> proto.Receipt + 3, // 11: proto.NezhaService.RequestTask:output_type -> proto.Task + 6, // 12: proto.NezhaService.IOStream:output_type -> proto.IOStreamData + 7, // 13: proto.NezhaService.ReportGeoIP:output_type -> proto.GeoIP + 8, // [8:14] is the sub-list for method output_type + 2, // [2:8] is the sub-list for method input_type + 2, // [2:2] is the sub-list for extension type_name + 2, // [2:2] is the sub-list for extension extendee + 0, // [0:2] is the sub-list for field type_name } func init() { file_proto_nezha_proto_init() } @@ -941,6 +992,18 @@ func file_proto_nezha_proto_init() { return nil } } + file_proto_nezha_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*IP); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } } type x struct{} out := protoimpl.TypeBuilder{ @@ -948,7 +1011,7 @@ func file_proto_nezha_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_proto_nezha_proto_rawDesc, NumEnums: 0, - NumMessages: 8, + NumMessages: 9, NumExtensions: 0, NumServices: 1, }, diff --git a/proto/nezha.proto b/proto/nezha.proto index 9566bd4..5f12b01 100644 --- a/proto/nezha.proto +++ b/proto/nezha.proto @@ -4,78 +4,78 @@ option go_package = "./proto"; package proto; service NezhaService { - rpc ReportSystemState(State)returns(Receipt){} - rpc ReportSystemInfo(Host)returns(Receipt){} - rpc ReportTask(TaskResult)returns(Receipt){} - rpc RequestTask(Host)returns(stream Task){} - rpc IOStream(stream IOStreamData)returns(stream IOStreamData){} - rpc LookupGeoIP(GeoIP)returns(GeoIP){} + rpc ReportSystemState(State) returns (Receipt) {} + rpc ReportSystemInfo(Host) returns (Receipt) {} + rpc ReportTask(TaskResult) returns (Receipt) {} + rpc RequestTask(Host) returns (stream Task) {} + rpc IOStream(stream IOStreamData) returns (stream IOStreamData) {} + rpc ReportGeoIP(GeoIP) returns (GeoIP) {} } message Host { - string platform = 1; - string platform_version = 2; - repeated string cpu = 3; - uint64 mem_total = 4; - uint64 disk_total = 5; - uint64 swap_total = 6; - string arch = 7; - string virtualization = 8; - uint64 boot_time = 9; - string ip = 10; - string country_code = 11; // deprecated - string version = 12; - repeated string gpu = 13; + string platform = 1; + string platform_version = 2; + repeated string cpu = 3; + uint64 mem_total = 4; + uint64 disk_total = 5; + uint64 swap_total = 6; + string arch = 7; + string virtualization = 8; + uint64 boot_time = 9; + string version = 10; + repeated string gpu = 11; } message State { - double cpu = 1; - uint64 mem_used = 3; - uint64 swap_used = 4; - uint64 disk_used = 5; - uint64 net_in_transfer = 6; - uint64 net_out_transfer = 7; - uint64 net_in_speed = 8; - uint64 net_out_speed = 9; - uint64 uptime = 10; - double load1 = 11; - double load5 = 12; - double load15 = 13; - uint64 tcp_conn_count = 14; - uint64 udp_conn_count = 15; - uint64 process_count = 16; - repeated State_SensorTemperature temperatures = 17; - repeated double gpu = 18; + double cpu = 1; + uint64 mem_used = 2; + uint64 swap_used = 3; + uint64 disk_used = 4; + uint64 net_in_transfer = 5; + uint64 net_out_transfer = 6; + uint64 net_in_speed = 7; + uint64 net_out_speed = 8; + uint64 uptime = 9; + double load1 = 10; + double load5 = 11; + double load15 = 12; + uint64 tcp_conn_count = 13; + uint64 udp_conn_count = 14; + uint64 process_count = 15; + repeated State_SensorTemperature temperatures = 16; + repeated double gpu = 17; } message State_SensorTemperature { - string name = 1; - double temperature = 2; + string name = 1; + double temperature = 2; } message Task { - uint64 id = 1; - uint64 type = 2; - string data = 3; + uint64 id = 1; + uint64 type = 2; + string data = 3; } message TaskResult { - uint64 id = 1; - uint64 type = 2; - float delay = 3; - string data = 4; - bool successful = 5; + uint64 id = 1; + uint64 type = 2; + float delay = 3; + string data = 4; + bool successful = 5; } -message Receipt{ - bool proced = 1; -} +message Receipt { bool proced = 1; } -message IOStreamData { - bytes data = 1; -} +message IOStreamData { bytes data = 1; } message GeoIP { - string ip = 1; - string country_code = 2; -} \ No newline at end of file + bool use6 = 1; + IP ip = 2; + string country_code = 3; +} + +message IP { + string ipv4 = 1; + string ipv6 = 2; +} diff --git a/proto/nezha_grpc.pb.go b/proto/nezha_grpc.pb.go index d8d76e1..b719f76 100644 --- a/proto/nezha_grpc.pb.go +++ b/proto/nezha_grpc.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: // - protoc-gen-go-grpc v1.5.1 -// - protoc v5.28.2 +// - protoc v5.28.3 // source: proto/nezha.proto package proto @@ -24,7 +24,7 @@ const ( NezhaService_ReportTask_FullMethodName = "/proto.NezhaService/ReportTask" NezhaService_RequestTask_FullMethodName = "/proto.NezhaService/RequestTask" NezhaService_IOStream_FullMethodName = "/proto.NezhaService/IOStream" - NezhaService_LookupGeoIP_FullMethodName = "/proto.NezhaService/LookupGeoIP" + NezhaService_ReportGeoIP_FullMethodName = "/proto.NezhaService/ReportGeoIP" ) // NezhaServiceClient is the client API for NezhaService service. @@ -36,7 +36,7 @@ type NezhaServiceClient interface { ReportTask(ctx context.Context, in *TaskResult, opts ...grpc.CallOption) (*Receipt, error) RequestTask(ctx context.Context, in *Host, opts ...grpc.CallOption) (grpc.ServerStreamingClient[Task], error) IOStream(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[IOStreamData, IOStreamData], error) - LookupGeoIP(ctx context.Context, in *GeoIP, opts ...grpc.CallOption) (*GeoIP, error) + ReportGeoIP(ctx context.Context, in *GeoIP, opts ...grpc.CallOption) (*GeoIP, error) } type nezhaServiceClient struct { @@ -109,10 +109,10 @@ func (c *nezhaServiceClient) IOStream(ctx context.Context, opts ...grpc.CallOpti // This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. type NezhaService_IOStreamClient = grpc.BidiStreamingClient[IOStreamData, IOStreamData] -func (c *nezhaServiceClient) LookupGeoIP(ctx context.Context, in *GeoIP, opts ...grpc.CallOption) (*GeoIP, error) { +func (c *nezhaServiceClient) ReportGeoIP(ctx context.Context, in *GeoIP, opts ...grpc.CallOption) (*GeoIP, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(GeoIP) - err := c.cc.Invoke(ctx, NezhaService_LookupGeoIP_FullMethodName, in, out, cOpts...) + err := c.cc.Invoke(ctx, NezhaService_ReportGeoIP_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } @@ -128,7 +128,7 @@ type NezhaServiceServer interface { ReportTask(context.Context, *TaskResult) (*Receipt, error) RequestTask(*Host, grpc.ServerStreamingServer[Task]) error IOStream(grpc.BidiStreamingServer[IOStreamData, IOStreamData]) error - LookupGeoIP(context.Context, *GeoIP) (*GeoIP, error) + ReportGeoIP(context.Context, *GeoIP) (*GeoIP, error) } // UnimplementedNezhaServiceServer should be embedded to have @@ -153,8 +153,8 @@ func (UnimplementedNezhaServiceServer) RequestTask(*Host, grpc.ServerStreamingSe func (UnimplementedNezhaServiceServer) IOStream(grpc.BidiStreamingServer[IOStreamData, IOStreamData]) error { return status.Errorf(codes.Unimplemented, "method IOStream not implemented") } -func (UnimplementedNezhaServiceServer) LookupGeoIP(context.Context, *GeoIP) (*GeoIP, error) { - return nil, status.Errorf(codes.Unimplemented, "method LookupGeoIP not implemented") +func (UnimplementedNezhaServiceServer) ReportGeoIP(context.Context, *GeoIP) (*GeoIP, error) { + return nil, status.Errorf(codes.Unimplemented, "method ReportGeoIP not implemented") } func (UnimplementedNezhaServiceServer) testEmbeddedByValue() {} @@ -248,20 +248,20 @@ func _NezhaService_IOStream_Handler(srv interface{}, stream grpc.ServerStream) e // This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. type NezhaService_IOStreamServer = grpc.BidiStreamingServer[IOStreamData, IOStreamData] -func _NezhaService_LookupGeoIP_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { +func _NezhaService_ReportGeoIP_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(GeoIP) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(NezhaServiceServer).LookupGeoIP(ctx, in) + return srv.(NezhaServiceServer).ReportGeoIP(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: NezhaService_LookupGeoIP_FullMethodName, + FullMethod: NezhaService_ReportGeoIP_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(NezhaServiceServer).LookupGeoIP(ctx, req.(*GeoIP)) + return srv.(NezhaServiceServer).ReportGeoIP(ctx, req.(*GeoIP)) } return interceptor(ctx, in, info, handler) } @@ -286,8 +286,8 @@ var NezhaService_ServiceDesc = grpc.ServiceDesc{ Handler: _NezhaService_ReportTask_Handler, }, { - MethodName: "LookupGeoIP", - Handler: _NezhaService_LookupGeoIP_Handler, + MethodName: "ReportGeoIP", + Handler: _NezhaService_ReportGeoIP_Handler, }, }, Streams: []grpc.StreamDesc{