mirror of
https://github.com/Buriburizaem0n/nezha_domains.git
synced 2026-02-04 04:30:05 +00:00
<add>domain support
This commit is contained in:
@@ -12,9 +12,6 @@
|
|||||||
"installDockerComposeSwitch": true,
|
"installDockerComposeSwitch": true,
|
||||||
"version": "latest",
|
"version": "latest",
|
||||||
"dockerDashComposeVersion": "latest"
|
"dockerDashComposeVersion": "latest"
|
||||||
},
|
|
||||||
"ghcr.io/devcontainers/features/go:1": {
|
|
||||||
"version": "1.24.0"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -151,6 +151,12 @@ func routers(r *gin.Engine, frontendDist fs.FS) {
|
|||||||
|
|
||||||
auth.PATCH("/setting", adminHandler(updateConfig))
|
auth.PATCH("/setting", adminHandler(updateConfig))
|
||||||
|
|
||||||
|
auth.GET("/domains", commonHandler(GetDomainList))
|
||||||
|
auth.POST("/domains", commonHandler(AddDomain))
|
||||||
|
auth.POST("/domains/:id/verify", commonHandler(VerifyDomain))
|
||||||
|
auth.PUT("/domains/:id", commonHandler(UpdateDomain))
|
||||||
|
auth.DELETE("/domains/:id", commonHandler(DeleteDomain))
|
||||||
|
|
||||||
r.NoRoute(fallbackToFrontend(frontendDist))
|
r.NoRoute(fallbackToFrontend(frontendDist))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
120
cmd/dashboard/controller/domain.go
Normal file
120
cmd/dashboard/controller/domain.go
Normal file
@@ -0,0 +1,120 @@
|
|||||||
|
// cmd/dashboard/controller/domain.go
|
||||||
|
package controller
|
||||||
|
|
||||||
|
import (
|
||||||
|
"encoding/json"
|
||||||
|
"strconv"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"github.com/gin-gonic/gin"
|
||||||
|
"github.com/nezhahq/nezha/model"
|
||||||
|
"github.com/nezhahq/nezha/service/singleton"
|
||||||
|
)
|
||||||
|
|
||||||
|
// DomainAPIResponse 是用于API返回的结构体,可以包含一些后端计算好的字段
|
||||||
|
type DomainAPIResponse struct {
|
||||||
|
model.Domain
|
||||||
|
ExpiresInDays *int `json:"expires_in_days"` // 剩余天数,使用指针以区分0和null
|
||||||
|
}
|
||||||
|
|
||||||
|
// UpdateDomain 更新域名
|
||||||
|
func UpdateDomain(c *gin.Context) (any, error) {
|
||||||
|
domainID, err := strconv.ParseUint(c.Param("id"), 10, 64)
|
||||||
|
if err != nil {
|
||||||
|
return nil, newGormError("无效的域名ID")
|
||||||
|
}
|
||||||
|
var req model.DomainUpdateRequest // 使用新的请求体
|
||||||
|
if err := c.ShouldBindJSON(&req); err != nil {
|
||||||
|
return nil, newGormError("无效的请求: %s", err.Error())
|
||||||
|
}
|
||||||
|
|
||||||
|
return singleton.UpdateDomain(domainID, req)
|
||||||
|
}
|
||||||
|
|
||||||
|
func GetDomainList(c *gin.Context) (any, error) {
|
||||||
|
scope := c.DefaultQuery("scope", "admin")
|
||||||
|
domains, err := singleton.GetDomains(scope)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
var response []DomainAPIResponse
|
||||||
|
for _, d := range domains {
|
||||||
|
apiDomain := DomainAPIResponse{
|
||||||
|
Domain: d,
|
||||||
|
}
|
||||||
|
if d.BillingData != nil {
|
||||||
|
var billing model.BillingDataMod
|
||||||
|
if json.Unmarshal(d.BillingData, &billing) == nil && billing.EndDate != "" {
|
||||||
|
if endDate, err := time.Parse(time.RFC3339, billing.EndDate); err == nil {
|
||||||
|
daysLeft := int(time.Until(endDate).Hours() / 24)
|
||||||
|
apiDomain.ExpiresInDays = &daysLeft
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
response = append(response, apiDomain)
|
||||||
|
}
|
||||||
|
|
||||||
|
return response, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func AddDomain(c *gin.Context) (any, error) {
|
||||||
|
var req model.DomainAPIRequest // 使用 model/domain.go 中定义的请求体
|
||||||
|
if err := c.ShouldBindJSON(&req); err != nil {
|
||||||
|
return nil, newGormError("无效的请求: %s", err.Error())
|
||||||
|
}
|
||||||
|
return singleton.AddDomain(req.Domain)
|
||||||
|
}
|
||||||
|
|
||||||
|
func VerifyDomain(c *gin.Context) (any, error) {
|
||||||
|
domainID, err := strconv.ParseUint(c.Param("id"), 10, 64)
|
||||||
|
if err != nil {
|
||||||
|
return nil, newGormError("无效的域名ID")
|
||||||
|
}
|
||||||
|
|
||||||
|
success, err := singleton.VerifyDomain(domainID)
|
||||||
|
if err != nil {
|
||||||
|
return nil, newGormError("验证过程中发生错误: %s", err.Error())
|
||||||
|
}
|
||||||
|
|
||||||
|
var message string
|
||||||
|
if success {
|
||||||
|
message = "验证成功,域名状态已更新"
|
||||||
|
} else {
|
||||||
|
message = "验证失败,未找到匹配的 TXT 记录"
|
||||||
|
}
|
||||||
|
|
||||||
|
// 对于这种包含非数据字段(如message)的特殊成功响应,
|
||||||
|
// 我们可以直接返回一个 map,commonHandler 会将其包装
|
||||||
|
return gin.H{
|
||||||
|
"success": success,
|
||||||
|
"message": message,
|
||||||
|
}, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func DeleteDomain(c *gin.Context) (any, error) {
|
||||||
|
domainID, err := strconv.ParseUint(c.Param("id"), 10, 64)
|
||||||
|
if err != nil {
|
||||||
|
return nil, nil // ID无效,直接返回成功,不做任何事
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := singleton.DeleteDomain(domainID); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
// 对于DELETE成功,通常不返回data,返回nil即可
|
||||||
|
return nil, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func UpdateDomainInfo(c *gin.Context) (any, error) {
|
||||||
|
domainID, err := strconv.ParseUint(c.Param("id"), 10, 64)
|
||||||
|
if err != nil {
|
||||||
|
return nil, newGormError("无效的域名ID")
|
||||||
|
}
|
||||||
|
|
||||||
|
var req model.DomainUpdateRequest
|
||||||
|
if err := c.ShouldBindJSON(&req); err != nil {
|
||||||
|
return nil, newGormError("无效的请求: %s", err.Error())
|
||||||
|
}
|
||||||
|
|
||||||
|
return singleton.UpdateDomain(domainID, req)
|
||||||
|
}
|
||||||
14
data/config.yaml
Normal file
14
data/config.yaml
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
admin_template: admin-dist
|
||||||
|
agent_secret_key: 92N3w30z9Gx6LEz43WeDPx84866jOyRU
|
||||||
|
avg_ping_count: 2
|
||||||
|
cover: 1
|
||||||
|
https: {}
|
||||||
|
ip_change_notification_group_id: 0
|
||||||
|
jwt_secret_key: zqrwGyKuNp43XVWyDWiwNxyd2JVwSrCon297MwSR80Dhp15DDg5zvyQtQHzsEm5kH3Y2gwIy8ljrrp7Vywqu8IktVlqdSx4gEgcqVsq4Ye4fZy6LkaOQzOtJLDochWpmWtOObrqID62U8ajRGgPtMUTkk15ydmIxQmqtVChcbEJWt3zCXm1p1FJBJ0o3dfmJ97vy3uheDs3n7AUNUrGmQforYgir4ZZRnGip525rkTHZUAvvBkzgK21c682A3PXOfQMxNTIr9t9ABVsEEqzFbx7eMXzWGvTDqWVWAZklY2Y6KLAmdgGWzIYcU4iDyvdpTKiQxlqGLlRzyJ9cGYoEWyQd36E1AxKgTBUCdr56CMM8szJDBjRFfT1cUGE9lsqnax4PndYE0Jc6finUHbYeuRB53vrJZl3iPmYAqyjTjkjwmK2kVcSwENMLF9TSjh3C3lWu8I3nlaBmHEPY3InwVzNV6DsFjb2xqmGzQLxoP0bmtAXtpCyGwyfvqaoviVYmagBBtvstX1DTV70Jjh8exlFrktABNDseaVdJssJrgO33d2CHrYjH7aCqM2DM14taciKFg0bFN4nplPTfYCBcJFR4yXcM0jIJvQb8yKmQOMvZU7meR4qpnXRx0jF7JR9DpzhbBeWp65WC5KLTMUfZO6JFsiQ2TL7JYr65UVdFjm6lxQRY5ySQOrCpVeG3V9jlvWBdu4AMj1VrmYF7jIHSLJYAQbcjsgqgZ5z01BaiXi5RmndQ9yFFClXuIPvOkrzJAhOYTKU2Jk8QdtG2MOhu0l3SgkZhvuE291ESbOnxlKTD9eM9W9p6sqdZERJ0M7tZ1BGH5CkXZNsTsoUCdOwTJc01NMlZnECISfwCgiFWZzJpCEOFpMTDJDDexBw2ueG0Aha93K6CDddpRlFJCmz4QcMQQxD3KTUMPIHbDxCGk92MnoN6hUX8DQUkvn0kjQCvlGnsSN7jrqxt9TM1KDB9lxN6B2y1UEiD3HU9dOaRg1r9rtuk0ADDp7sWBWlGIYd8
|
||||||
|
jwt_timeout: 1
|
||||||
|
language: en_US
|
||||||
|
listen_port: 8008
|
||||||
|
location: Asia/Shanghai
|
||||||
|
site_name: ""
|
||||||
|
user_template: user-dist
|
||||||
|
debug: true
|
||||||
BIN
data/sqlite.db
Normal file
BIN
data/sqlite.db
Normal file
Binary file not shown.
9
go.mod
9
go.mod
@@ -28,6 +28,7 @@ require (
|
|||||||
github.com/robfig/cron/v3 v3.0.1
|
github.com/robfig/cron/v3 v3.0.1
|
||||||
github.com/swaggo/files v1.0.1
|
github.com/swaggo/files v1.0.1
|
||||||
github.com/swaggo/gin-swagger v1.6.0
|
github.com/swaggo/gin-swagger v1.6.0
|
||||||
|
github.com/swaggo/swag v1.16.4
|
||||||
github.com/tidwall/gjson v1.18.0
|
github.com/tidwall/gjson v1.18.0
|
||||||
golang.org/x/crypto v0.37.0
|
golang.org/x/crypto v0.37.0
|
||||||
golang.org/x/exp v0.0.0-20250408133849-7e4ce0ab07d0
|
golang.org/x/exp v0.0.0-20250408133849-7e4ce0ab07d0
|
||||||
@@ -36,12 +37,14 @@ require (
|
|||||||
golang.org/x/sync v0.13.0
|
golang.org/x/sync v0.13.0
|
||||||
google.golang.org/grpc v1.72.0
|
google.golang.org/grpc v1.72.0
|
||||||
google.golang.org/protobuf v1.36.6
|
google.golang.org/protobuf v1.36.6
|
||||||
|
gorm.io/datatypes v1.2.6
|
||||||
gorm.io/driver/sqlite v1.5.7
|
gorm.io/driver/sqlite v1.5.7
|
||||||
gorm.io/gorm v1.26.0
|
gorm.io/gorm v1.30.0
|
||||||
sigs.k8s.io/yaml v1.4.0
|
sigs.k8s.io/yaml v1.4.0
|
||||||
)
|
)
|
||||||
|
|
||||||
require (
|
require (
|
||||||
|
filippo.io/edwards25519 v1.1.0 // indirect
|
||||||
github.com/KyleBanks/depth v1.2.1 // indirect
|
github.com/KyleBanks/depth v1.2.1 // indirect
|
||||||
github.com/bytedance/sonic v1.13.2 // indirect
|
github.com/bytedance/sonic v1.13.2 // indirect
|
||||||
github.com/bytedance/sonic/loader v0.2.4 // indirect
|
github.com/bytedance/sonic/loader v0.2.4 // indirect
|
||||||
@@ -57,7 +60,9 @@ require (
|
|||||||
github.com/go-playground/locales v0.14.1 // indirect
|
github.com/go-playground/locales v0.14.1 // indirect
|
||||||
github.com/go-playground/universal-translator v0.18.1 // indirect
|
github.com/go-playground/universal-translator v0.18.1 // indirect
|
||||||
github.com/go-playground/validator/v10 v10.26.0 // indirect
|
github.com/go-playground/validator/v10 v10.26.0 // indirect
|
||||||
|
github.com/go-sql-driver/mysql v1.8.1 // indirect
|
||||||
github.com/golang-jwt/jwt/v4 v4.5.2 // indirect
|
github.com/golang-jwt/jwt/v4 v4.5.2 // indirect
|
||||||
|
github.com/google/uuid v1.6.0 // indirect
|
||||||
github.com/jinzhu/inflection v1.0.0 // indirect
|
github.com/jinzhu/inflection v1.0.0 // indirect
|
||||||
github.com/jinzhu/now v1.1.5 // indirect
|
github.com/jinzhu/now v1.1.5 // indirect
|
||||||
github.com/josharian/intern v1.0.0 // indirect
|
github.com/josharian/intern v1.0.0 // indirect
|
||||||
@@ -74,7 +79,6 @@ require (
|
|||||||
github.com/pelletier/go-toml/v2 v2.2.4 // indirect
|
github.com/pelletier/go-toml/v2 v2.2.4 // indirect
|
||||||
github.com/pkg/errors v0.9.1 // indirect
|
github.com/pkg/errors v0.9.1 // indirect
|
||||||
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
|
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
|
||||||
github.com/swaggo/swag v1.16.4 // indirect
|
|
||||||
github.com/tidwall/match v1.1.1 // indirect
|
github.com/tidwall/match v1.1.1 // indirect
|
||||||
github.com/tidwall/pretty v1.2.1 // indirect
|
github.com/tidwall/pretty v1.2.1 // indirect
|
||||||
github.com/tidwall/sjson v1.2.5 // indirect
|
github.com/tidwall/sjson v1.2.5 // indirect
|
||||||
@@ -89,4 +93,5 @@ require (
|
|||||||
golang.org/x/tools v0.32.0 // indirect
|
golang.org/x/tools v0.32.0 // indirect
|
||||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20250428153025-10db94c68c34 // indirect
|
google.golang.org/genproto/googleapis/rpc v0.0.0-20250428153025-10db94c68c34 // indirect
|
||||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||||
|
gorm.io/driver/mysql v1.5.6 // indirect
|
||||||
)
|
)
|
||||||
|
|||||||
32
go.sum
32
go.sum
@@ -1,3 +1,5 @@
|
|||||||
|
filippo.io/edwards25519 v1.1.0 h1:FNf4tywRC1HmFuKW5xopWpigGjJKiJSV0Cqo0cJWDaA=
|
||||||
|
filippo.io/edwards25519 v1.1.0/go.mod h1:BxyFTGdWcka3PhytdK4V28tE5sGfRvvvRV7EaN4VDT4=
|
||||||
github.com/KyleBanks/depth v1.2.1 h1:5h8fQADFrWtarTdtDudMmGsC7GPbOAu6RVB3ffsVFHc=
|
github.com/KyleBanks/depth v1.2.1 h1:5h8fQADFrWtarTdtDudMmGsC7GPbOAu6RVB3ffsVFHc=
|
||||||
github.com/KyleBanks/depth v1.2.1/go.mod h1:jzSb9d0L43HxTQfT+oSA1EEp2q+ne2uh6XgeJcm8brE=
|
github.com/KyleBanks/depth v1.2.1/go.mod h1:jzSb9d0L43HxTQfT+oSA1EEp2q+ne2uh6XgeJcm8brE=
|
||||||
github.com/appleboy/gin-jwt/v2 v2.10.3 h1:KNcPC+XPRNpuoBh+j+rgs5bQxN+SwG/0tHbIqpRoBGc=
|
github.com/appleboy/gin-jwt/v2 v2.10.3 h1:KNcPC+XPRNpuoBh+j+rgs5bQxN+SwG/0tHbIqpRoBGc=
|
||||||
@@ -50,12 +52,19 @@ github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJn
|
|||||||
github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY=
|
github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY=
|
||||||
github.com/go-playground/validator/v10 v10.26.0 h1:SP05Nqhjcvz81uJaRfEV0YBSSSGMc/iMaVtFbr3Sw2k=
|
github.com/go-playground/validator/v10 v10.26.0 h1:SP05Nqhjcvz81uJaRfEV0YBSSSGMc/iMaVtFbr3Sw2k=
|
||||||
github.com/go-playground/validator/v10 v10.26.0/go.mod h1:I5QpIEbmr8On7W0TktmJAumgzX4CA1XNl4ZmDuVHKKo=
|
github.com/go-playground/validator/v10 v10.26.0/go.mod h1:I5QpIEbmr8On7W0TktmJAumgzX4CA1XNl4ZmDuVHKKo=
|
||||||
|
github.com/go-sql-driver/mysql v1.7.0/go.mod h1:OXbVy3sEdcQ2Doequ6Z5BW6fXNQTmx+9S1MCJN5yJMI=
|
||||||
|
github.com/go-sql-driver/mysql v1.8.1 h1:LedoTUt/eveggdHS9qUFC1EFSa8bU2+1pZjSRpvNJ1Y=
|
||||||
|
github.com/go-sql-driver/mysql v1.8.1/go.mod h1:wEBSXgmK//2ZFJyE+qWnIsVGmvmEKlqwuVSjsCm7DZg=
|
||||||
github.com/go-viper/mapstructure/v2 v2.4.0 h1:EBsztssimR/CONLSZZ04E8qAkxNYq4Qp9LvH92wZUgs=
|
github.com/go-viper/mapstructure/v2 v2.4.0 h1:EBsztssimR/CONLSZZ04E8qAkxNYq4Qp9LvH92wZUgs=
|
||||||
github.com/go-viper/mapstructure/v2 v2.4.0/go.mod h1:oJDH3BJKyqBA2TXFhDsKDGDTlndYOZ6rGS0BRZIxGhM=
|
github.com/go-viper/mapstructure/v2 v2.4.0/go.mod h1:oJDH3BJKyqBA2TXFhDsKDGDTlndYOZ6rGS0BRZIxGhM=
|
||||||
github.com/goccy/go-json v0.10.5 h1:Fq85nIqj+gXn/S5ahsiTlK3TmC85qgirsdTP/+DeaC4=
|
github.com/goccy/go-json v0.10.5 h1:Fq85nIqj+gXn/S5ahsiTlK3TmC85qgirsdTP/+DeaC4=
|
||||||
github.com/goccy/go-json v0.10.5/go.mod h1:oq7eo15ShAhp70Anwd5lgX2pLfOS3QCiwU/PULtXL6M=
|
github.com/goccy/go-json v0.10.5/go.mod h1:oq7eo15ShAhp70Anwd5lgX2pLfOS3QCiwU/PULtXL6M=
|
||||||
github.com/golang-jwt/jwt/v4 v4.5.2 h1:YtQM7lnr8iZ+j5q71MGKkNw9Mn7AjHM68uc9g5fXeUI=
|
github.com/golang-jwt/jwt/v4 v4.5.2 h1:YtQM7lnr8iZ+j5q71MGKkNw9Mn7AjHM68uc9g5fXeUI=
|
||||||
github.com/golang-jwt/jwt/v4 v4.5.2/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0=
|
github.com/golang-jwt/jwt/v4 v4.5.2/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0=
|
||||||
|
github.com/golang-sql/civil v0.0.0-20220223132316-b832511892a9 h1:au07oEsX2xN0ktxqI+Sida1w446QrXBRJ0nee3SNZlA=
|
||||||
|
github.com/golang-sql/civil v0.0.0-20220223132316-b832511892a9/go.mod h1:8vg3r2VgvsThLBIFL93Qb5yWzgyZWhEmBwUJWevAkK0=
|
||||||
|
github.com/golang-sql/sqlexp v0.1.0 h1:ZCD6MBpcuOVfGVqsEmY5/4FtYiKz6tSyUv9LPEDei6A=
|
||||||
|
github.com/golang-sql/sqlexp v0.1.0/go.mod h1:J4ad9Vo8ZCWQ2GMrC4UCQy1JpCbwU9m3EOqtpKwwwHI=
|
||||||
github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek=
|
github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek=
|
||||||
github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps=
|
github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps=
|
||||||
github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
|
github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
|
||||||
@@ -68,6 +77,14 @@ github.com/gorilla/websocket v1.5.3 h1:saDtZ6Pbx/0u+bgYQ3q96pZgCzfhKXGPqt7kZ72aN
|
|||||||
github.com/gorilla/websocket v1.5.3/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
|
github.com/gorilla/websocket v1.5.3/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
|
||||||
github.com/hashicorp/go-uuid v1.0.3 h1:2gKiV6YVmrJ1i2CKKa9obLvRieoRGviZFL26PcT/Co8=
|
github.com/hashicorp/go-uuid v1.0.3 h1:2gKiV6YVmrJ1i2CKKa9obLvRieoRGviZFL26PcT/Co8=
|
||||||
github.com/hashicorp/go-uuid v1.0.3/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro=
|
github.com/hashicorp/go-uuid v1.0.3/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro=
|
||||||
|
github.com/jackc/pgpassfile v1.0.0 h1:/6Hmqy13Ss2zCq62VdNG8tM1wchn8zjSGOBJ6icpsIM=
|
||||||
|
github.com/jackc/pgpassfile v1.0.0/go.mod h1:CEx0iS5ambNFdcRtxPj5JhEz+xB6uRky5eyVu/W2HEg=
|
||||||
|
github.com/jackc/pgservicefile v0.0.0-20231201235250-de7065d80cb9 h1:L0QtFUgDarD7Fpv9jeVMgy/+Ec0mtnmYuImjTz6dtDA=
|
||||||
|
github.com/jackc/pgservicefile v0.0.0-20231201235250-de7065d80cb9/go.mod h1:5TJZWKEWniPve33vlWYSoGYefn3gLQRzjfDlhSJ9ZKM=
|
||||||
|
github.com/jackc/pgx/v5 v5.5.5 h1:amBjrZVmksIdNjxGW/IiIMzxMKZFelXbUoPNb+8sjQw=
|
||||||
|
github.com/jackc/pgx/v5 v5.5.5/go.mod h1:ez9gk+OAat140fv9ErkZDYFWmXLfV+++K0uAOiwgm1A=
|
||||||
|
github.com/jackc/puddle/v2 v2.2.1 h1:RhxXJtFG022u4ibrCSMSiu5aOq1i77R3OHKNJj77OAk=
|
||||||
|
github.com/jackc/puddle/v2 v2.2.1/go.mod h1:vriiEXHvEE654aYKXXjOvZM39qJ0q+azkZFrfEOc3H4=
|
||||||
github.com/jinzhu/copier v0.4.0 h1:w3ciUoD19shMCRargcpm0cm91ytaBhDvuRpz1ODO/U8=
|
github.com/jinzhu/copier v0.4.0 h1:w3ciUoD19shMCRargcpm0cm91ytaBhDvuRpz1ODO/U8=
|
||||||
github.com/jinzhu/copier v0.4.0/go.mod h1:DfbEm0FYsaqBcKcFuvmOZb218JkPGtvSHsKg8S8hyyg=
|
github.com/jinzhu/copier v0.4.0/go.mod h1:DfbEm0FYsaqBcKcFuvmOZb218JkPGtvSHsKg8S8hyyg=
|
||||||
github.com/jinzhu/inflection v1.0.0 h1:K317FqzuhWc8YvSVlFMCCUb36O/S9MCKRDI7QkRKD/E=
|
github.com/jinzhu/inflection v1.0.0 h1:K317FqzuhWc8YvSVlFMCCUb36O/S9MCKRDI7QkRKD/E=
|
||||||
@@ -110,6 +127,8 @@ github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWE
|
|||||||
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
|
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
|
||||||
github.com/mattn/go-sqlite3 v1.14.24 h1:tpSp2G2KyMnnQu99ngJ47EIkWVmliIizyZBfPrBWDRM=
|
github.com/mattn/go-sqlite3 v1.14.24 h1:tpSp2G2KyMnnQu99ngJ47EIkWVmliIizyZBfPrBWDRM=
|
||||||
github.com/mattn/go-sqlite3 v1.14.24/go.mod h1:Uh1q+B4BYcTPb+yiD3kU8Ct7aC0hY9fxUwlHK0RXw+Y=
|
github.com/mattn/go-sqlite3 v1.14.24/go.mod h1:Uh1q+B4BYcTPb+yiD3kU8Ct7aC0hY9fxUwlHK0RXw+Y=
|
||||||
|
github.com/microsoft/go-mssqldb v1.7.2 h1:CHkFJiObW7ItKTJfHo1QX7QBBD1iV+mn1eOyRP3b/PA=
|
||||||
|
github.com/microsoft/go-mssqldb v1.7.2/go.mod h1:kOvZKUdrhhFQmxLZqbwUV0rHkNkZpthMITIb2Ko1IoA=
|
||||||
github.com/miekg/dns v1.1.65 h1:0+tIPHzUW0GCge7IiK3guGP57VAw7hoPDfApjkMD1Fc=
|
github.com/miekg/dns v1.1.65 h1:0+tIPHzUW0GCge7IiK3guGP57VAw7hoPDfApjkMD1Fc=
|
||||||
github.com/miekg/dns v1.1.65/go.mod h1:Dzw9769uoKVaLuODMDZz9M6ynFU6Em65csPuoi8G0ck=
|
github.com/miekg/dns v1.1.65/go.mod h1:Dzw9769uoKVaLuODMDZz9M6ynFU6Em65csPuoi8G0ck=
|
||||||
github.com/mitchellh/copystructure v1.2.0 h1:vpKXTN4ewci03Vljg/q9QvCGUDttBOGBIa15WveJJGw=
|
github.com/mitchellh/copystructure v1.2.0 h1:vpKXTN4ewci03Vljg/q9QvCGUDttBOGBIa15WveJJGw=
|
||||||
@@ -248,10 +267,19 @@ gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
|||||||
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||||
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
||||||
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||||
|
gorm.io/datatypes v1.2.6 h1:KafLdXvFUhzNeL2ncm03Gl3eTLONQfNKZ+wJ+9Y4Nck=
|
||||||
|
gorm.io/datatypes v1.2.6/go.mod h1:M2iO+6S3hhi4nAyYe444Pcb0dcIiOMJ7QHaUXxyiNZY=
|
||||||
|
gorm.io/driver/mysql v1.5.6 h1:Ld4mkIickM+EliaQZQx3uOJDJHtrd70MxAUqWqlx3Y8=
|
||||||
|
gorm.io/driver/mysql v1.5.6/go.mod h1:sEtPWMiqiN1N1cMXoXmBbd8C6/l+TESwriotuRRpkDM=
|
||||||
|
gorm.io/driver/postgres v1.5.0 h1:u2FXTy14l45qc3UeCJ7QaAXZmZfDDv0YrthvmRq1l0U=
|
||||||
|
gorm.io/driver/postgres v1.5.0/go.mod h1:FUZXzO+5Uqg5zzwzv4KK49R8lvGIyscBOqYrtI1Ce9A=
|
||||||
gorm.io/driver/sqlite v1.5.7 h1:8NvsrhP0ifM7LX9G4zPB97NwovUakUxc+2V2uuf3Z1I=
|
gorm.io/driver/sqlite v1.5.7 h1:8NvsrhP0ifM7LX9G4zPB97NwovUakUxc+2V2uuf3Z1I=
|
||||||
gorm.io/driver/sqlite v1.5.7/go.mod h1:U+J8craQU6Fzkcvu8oLeAQmi50TkwPEhHDEjQZXDah4=
|
gorm.io/driver/sqlite v1.5.7/go.mod h1:U+J8craQU6Fzkcvu8oLeAQmi50TkwPEhHDEjQZXDah4=
|
||||||
gorm.io/gorm v1.26.0 h1:9lqQVPG5aNNS6AyHdRiwScAVnXHg/L/Srzx55G5fOgs=
|
gorm.io/driver/sqlserver v1.6.0 h1:VZOBQVsVhkHU/NzNhRJKoANt5pZGQAS1Bwc6m6dgfnc=
|
||||||
gorm.io/gorm v1.26.0/go.mod h1:8Z33v652h4//uMA76KjeDH8mJXPm1QNCYrMeatR0DOE=
|
gorm.io/driver/sqlserver v1.6.0/go.mod h1:WQzt4IJo/WHKnckU9jXBLMJIVNMVeTu25dnOzehntWw=
|
||||||
|
gorm.io/gorm v1.25.7/go.mod h1:hbnx/Oo0ChWMn1BIhpy1oYozzpM15i4YPuHDmfYtwg8=
|
||||||
|
gorm.io/gorm v1.30.0 h1:qbT5aPv1UH8gI99OsRlvDToLxW5zR7FzS9acZDOZcgs=
|
||||||
|
gorm.io/gorm v1.30.0/go.mod h1:8Z33v652h4//uMA76KjeDH8mJXPm1QNCYrMeatR0DOE=
|
||||||
nullprogram.com/x/optparse v1.0.0/go.mod h1:KdyPE+Igbe0jQUrVfMqDMeJQIJZEuyV7pjYmp6pbG50=
|
nullprogram.com/x/optparse v1.0.0/go.mod h1:KdyPE+Igbe0jQUrVfMqDMeJQIJZEuyV7pjYmp6pbG50=
|
||||||
sigs.k8s.io/yaml v1.4.0 h1:Mk1wCc2gy/F0THH0TAp1QYyJNzRm2KCLy3o5ASXVI5E=
|
sigs.k8s.io/yaml v1.4.0 h1:Mk1wCc2gy/F0THH0TAp1QYyJNzRm2KCLy3o5ASXVI5E=
|
||||||
sigs.k8s.io/yaml v1.4.0/go.mod h1:Ejl7/uTz7PSA4eKMyQCUTnhZYNmLIl+5c2lQPGR2BPY=
|
sigs.k8s.io/yaml v1.4.0/go.mod h1:Ejl7/uTz7PSA4eKMyQCUTnhZYNmLIl+5c2lQPGR2BPY=
|
||||||
|
|||||||
47
model/domain.go
Normal file
47
model/domain.go
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
// src/model/domain.go (已修正)
|
||||||
|
|
||||||
|
package model
|
||||||
|
|
||||||
|
import (
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"gorm.io/datatypes"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Domain 是数据库中 domains 表的 GORM 模型
|
||||||
|
type Domain struct {
|
||||||
|
ID uint64 `gorm:"primaryKey"`
|
||||||
|
Domain string
|
||||||
|
Status string `gorm:"size:20;default:'pending'"`
|
||||||
|
VerifyToken string
|
||||||
|
IsPublic bool `gorm:"default:true"`
|
||||||
|
BillingData datatypes.JSON `gorm:"type:json"`
|
||||||
|
CreatedAt time.Time
|
||||||
|
UpdatedAt time.Time
|
||||||
|
}
|
||||||
|
|
||||||
|
// BillingDataMod 定义了 BillingData 字段中 JSON 对象的结构
|
||||||
|
type BillingDataMod struct {
|
||||||
|
Registrar string `json:"registrar"`
|
||||||
|
RegisteredDate string `json:"registeredDate"`
|
||||||
|
EndDate string `json:"endDate"`
|
||||||
|
RenewalPrice string `json:"renewalPrice"`
|
||||||
|
AutoRenewal string `json:"autoRenewal"`
|
||||||
|
Notes string `json:"notes"`
|
||||||
|
// =======================================================
|
||||||
|
// vvvvvvvvvvv 在这里加回缺失的字段 vvvvvvvvvvv
|
||||||
|
Cycle string `json:"cycle"` // 续费周期,例如 "年" 或 "月"
|
||||||
|
Amount string `json:"amount"` // 续费金额 (虽然 cron 中没用,但保留以保持结构完整)
|
||||||
|
// ^^^^^^^^^^^ 在这里加回缺失的字段 ^^^^^^^^^^^
|
||||||
|
// =======================================================
|
||||||
|
}
|
||||||
|
|
||||||
|
// DomainUpdateRequest 用于更新域名的请求体
|
||||||
|
type DomainUpdateRequest struct {
|
||||||
|
IsPublic bool `json:"is_public"`
|
||||||
|
BillingData datatypes.JSON `json:"billing_data"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type DomainAPIRequest struct {
|
||||||
|
Domain string `json:"domain" binding:"required"`
|
||||||
|
}
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||||
// versions:
|
// versions:
|
||||||
// protoc-gen-go v1.34.2
|
// protoc-gen-go v1.36.9
|
||||||
// protoc v5.29.3
|
// protoc v3.21.12
|
||||||
// source: proto/nezha.proto
|
// source: proto/nezha.proto
|
||||||
|
|
||||||
package proto
|
package proto
|
||||||
@@ -11,6 +11,7 @@ import (
|
|||||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||||
reflect "reflect"
|
reflect "reflect"
|
||||||
sync "sync"
|
sync "sync"
|
||||||
|
unsafe "unsafe"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@@ -21,10 +22,7 @@ const (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type Host struct {
|
type Host struct {
|
||||||
state protoimpl.MessageState
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
sizeCache protoimpl.SizeCache
|
|
||||||
unknownFields protoimpl.UnknownFields
|
|
||||||
|
|
||||||
Platform string `protobuf:"bytes,1,opt,name=platform,proto3" json:"platform,omitempty"`
|
Platform string `protobuf:"bytes,1,opt,name=platform,proto3" json:"platform,omitempty"`
|
||||||
PlatformVersion string `protobuf:"bytes,2,opt,name=platform_version,json=platformVersion,proto3" json:"platform_version,omitempty"`
|
PlatformVersion string `protobuf:"bytes,2,opt,name=platform_version,json=platformVersion,proto3" json:"platform_version,omitempty"`
|
||||||
Cpu []string `protobuf:"bytes,3,rep,name=cpu,proto3" json:"cpu,omitempty"`
|
Cpu []string `protobuf:"bytes,3,rep,name=cpu,proto3" json:"cpu,omitempty"`
|
||||||
@@ -36,15 +34,15 @@ type Host struct {
|
|||||||
BootTime uint64 `protobuf:"varint,9,opt,name=boot_time,json=bootTime,proto3" json:"boot_time,omitempty"`
|
BootTime uint64 `protobuf:"varint,9,opt,name=boot_time,json=bootTime,proto3" json:"boot_time,omitempty"`
|
||||||
Version string `protobuf:"bytes,10,opt,name=version,proto3" json:"version,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"`
|
Gpu []string `protobuf:"bytes,11,rep,name=gpu,proto3" json:"gpu,omitempty"`
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *Host) Reset() {
|
func (x *Host) Reset() {
|
||||||
*x = Host{}
|
*x = Host{}
|
||||||
if protoimpl.UnsafeEnabled {
|
|
||||||
mi := &file_proto_nezha_proto_msgTypes[0]
|
mi := &file_proto_nezha_proto_msgTypes[0]
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
ms.StoreMessageInfo(mi)
|
ms.StoreMessageInfo(mi)
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *Host) String() string {
|
func (x *Host) String() string {
|
||||||
@@ -55,7 +53,7 @@ func (*Host) ProtoMessage() {}
|
|||||||
|
|
||||||
func (x *Host) ProtoReflect() protoreflect.Message {
|
func (x *Host) ProtoReflect() protoreflect.Message {
|
||||||
mi := &file_proto_nezha_proto_msgTypes[0]
|
mi := &file_proto_nezha_proto_msgTypes[0]
|
||||||
if protoimpl.UnsafeEnabled && x != nil {
|
if x != nil {
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
if ms.LoadMessageInfo() == nil {
|
if ms.LoadMessageInfo() == nil {
|
||||||
ms.StoreMessageInfo(mi)
|
ms.StoreMessageInfo(mi)
|
||||||
@@ -148,10 +146,7 @@ func (x *Host) GetGpu() []string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type State struct {
|
type State struct {
|
||||||
state protoimpl.MessageState
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
sizeCache protoimpl.SizeCache
|
|
||||||
unknownFields protoimpl.UnknownFields
|
|
||||||
|
|
||||||
Cpu float64 `protobuf:"fixed64,1,opt,name=cpu,proto3" json:"cpu,omitempty"`
|
Cpu float64 `protobuf:"fixed64,1,opt,name=cpu,proto3" json:"cpu,omitempty"`
|
||||||
MemUsed uint64 `protobuf:"varint,2,opt,name=mem_used,json=memUsed,proto3" json:"mem_used,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"`
|
SwapUsed uint64 `protobuf:"varint,3,opt,name=swap_used,json=swapUsed,proto3" json:"swap_used,omitempty"`
|
||||||
@@ -169,15 +164,15 @@ type State struct {
|
|||||||
ProcessCount uint64 `protobuf:"varint,15,opt,name=process_count,json=processCount,proto3" json:"process_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"`
|
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"`
|
Gpu []float64 `protobuf:"fixed64,17,rep,packed,name=gpu,proto3" json:"gpu,omitempty"`
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *State) Reset() {
|
func (x *State) Reset() {
|
||||||
*x = State{}
|
*x = State{}
|
||||||
if protoimpl.UnsafeEnabled {
|
|
||||||
mi := &file_proto_nezha_proto_msgTypes[1]
|
mi := &file_proto_nezha_proto_msgTypes[1]
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
ms.StoreMessageInfo(mi)
|
ms.StoreMessageInfo(mi)
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *State) String() string {
|
func (x *State) String() string {
|
||||||
@@ -188,7 +183,7 @@ func (*State) ProtoMessage() {}
|
|||||||
|
|
||||||
func (x *State) ProtoReflect() protoreflect.Message {
|
func (x *State) ProtoReflect() protoreflect.Message {
|
||||||
mi := &file_proto_nezha_proto_msgTypes[1]
|
mi := &file_proto_nezha_proto_msgTypes[1]
|
||||||
if protoimpl.UnsafeEnabled && x != nil {
|
if x != nil {
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
if ms.LoadMessageInfo() == nil {
|
if ms.LoadMessageInfo() == nil {
|
||||||
ms.StoreMessageInfo(mi)
|
ms.StoreMessageInfo(mi)
|
||||||
@@ -323,21 +318,18 @@ func (x *State) GetGpu() []float64 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type State_SensorTemperature struct {
|
type State_SensorTemperature struct {
|
||||||
state protoimpl.MessageState
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
sizeCache protoimpl.SizeCache
|
|
||||||
unknownFields protoimpl.UnknownFields
|
|
||||||
|
|
||||||
Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
|
Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
|
||||||
Temperature float64 `protobuf:"fixed64,2,opt,name=temperature,proto3" json:"temperature,omitempty"`
|
Temperature float64 `protobuf:"fixed64,2,opt,name=temperature,proto3" json:"temperature,omitempty"`
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *State_SensorTemperature) Reset() {
|
func (x *State_SensorTemperature) Reset() {
|
||||||
*x = State_SensorTemperature{}
|
*x = State_SensorTemperature{}
|
||||||
if protoimpl.UnsafeEnabled {
|
|
||||||
mi := &file_proto_nezha_proto_msgTypes[2]
|
mi := &file_proto_nezha_proto_msgTypes[2]
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
ms.StoreMessageInfo(mi)
|
ms.StoreMessageInfo(mi)
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *State_SensorTemperature) String() string {
|
func (x *State_SensorTemperature) String() string {
|
||||||
@@ -348,7 +340,7 @@ func (*State_SensorTemperature) ProtoMessage() {}
|
|||||||
|
|
||||||
func (x *State_SensorTemperature) ProtoReflect() protoreflect.Message {
|
func (x *State_SensorTemperature) ProtoReflect() protoreflect.Message {
|
||||||
mi := &file_proto_nezha_proto_msgTypes[2]
|
mi := &file_proto_nezha_proto_msgTypes[2]
|
||||||
if protoimpl.UnsafeEnabled && x != nil {
|
if x != nil {
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
if ms.LoadMessageInfo() == nil {
|
if ms.LoadMessageInfo() == nil {
|
||||||
ms.StoreMessageInfo(mi)
|
ms.StoreMessageInfo(mi)
|
||||||
@@ -378,22 +370,19 @@ func (x *State_SensorTemperature) GetTemperature() float64 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type Task struct {
|
type Task struct {
|
||||||
state protoimpl.MessageState
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
sizeCache protoimpl.SizeCache
|
|
||||||
unknownFields protoimpl.UnknownFields
|
|
||||||
|
|
||||||
Id uint64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
|
Id uint64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
|
||||||
Type uint64 `protobuf:"varint,2,opt,name=type,proto3" json:"type,omitempty"`
|
Type uint64 `protobuf:"varint,2,opt,name=type,proto3" json:"type,omitempty"`
|
||||||
Data string `protobuf:"bytes,3,opt,name=data,proto3" json:"data,omitempty"`
|
Data string `protobuf:"bytes,3,opt,name=data,proto3" json:"data,omitempty"`
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *Task) Reset() {
|
func (x *Task) Reset() {
|
||||||
*x = Task{}
|
*x = Task{}
|
||||||
if protoimpl.UnsafeEnabled {
|
|
||||||
mi := &file_proto_nezha_proto_msgTypes[3]
|
mi := &file_proto_nezha_proto_msgTypes[3]
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
ms.StoreMessageInfo(mi)
|
ms.StoreMessageInfo(mi)
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *Task) String() string {
|
func (x *Task) String() string {
|
||||||
@@ -404,7 +393,7 @@ func (*Task) ProtoMessage() {}
|
|||||||
|
|
||||||
func (x *Task) ProtoReflect() protoreflect.Message {
|
func (x *Task) ProtoReflect() protoreflect.Message {
|
||||||
mi := &file_proto_nezha_proto_msgTypes[3]
|
mi := &file_proto_nezha_proto_msgTypes[3]
|
||||||
if protoimpl.UnsafeEnabled && x != nil {
|
if x != nil {
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
if ms.LoadMessageInfo() == nil {
|
if ms.LoadMessageInfo() == nil {
|
||||||
ms.StoreMessageInfo(mi)
|
ms.StoreMessageInfo(mi)
|
||||||
@@ -441,24 +430,21 @@ func (x *Task) GetData() string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type TaskResult struct {
|
type TaskResult struct {
|
||||||
state protoimpl.MessageState
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
sizeCache protoimpl.SizeCache
|
|
||||||
unknownFields protoimpl.UnknownFields
|
|
||||||
|
|
||||||
Id uint64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
|
Id uint64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
|
||||||
Type uint64 `protobuf:"varint,2,opt,name=type,proto3" json:"type,omitempty"`
|
Type uint64 `protobuf:"varint,2,opt,name=type,proto3" json:"type,omitempty"`
|
||||||
Delay float32 `protobuf:"fixed32,3,opt,name=delay,proto3" json:"delay,omitempty"`
|
Delay float32 `protobuf:"fixed32,3,opt,name=delay,proto3" json:"delay,omitempty"`
|
||||||
Data string `protobuf:"bytes,4,opt,name=data,proto3" json:"data,omitempty"`
|
Data string `protobuf:"bytes,4,opt,name=data,proto3" json:"data,omitempty"`
|
||||||
Successful bool `protobuf:"varint,5,opt,name=successful,proto3" json:"successful,omitempty"`
|
Successful bool `protobuf:"varint,5,opt,name=successful,proto3" json:"successful,omitempty"`
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *TaskResult) Reset() {
|
func (x *TaskResult) Reset() {
|
||||||
*x = TaskResult{}
|
*x = TaskResult{}
|
||||||
if protoimpl.UnsafeEnabled {
|
|
||||||
mi := &file_proto_nezha_proto_msgTypes[4]
|
mi := &file_proto_nezha_proto_msgTypes[4]
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
ms.StoreMessageInfo(mi)
|
ms.StoreMessageInfo(mi)
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *TaskResult) String() string {
|
func (x *TaskResult) String() string {
|
||||||
@@ -469,7 +455,7 @@ func (*TaskResult) ProtoMessage() {}
|
|||||||
|
|
||||||
func (x *TaskResult) ProtoReflect() protoreflect.Message {
|
func (x *TaskResult) ProtoReflect() protoreflect.Message {
|
||||||
mi := &file_proto_nezha_proto_msgTypes[4]
|
mi := &file_proto_nezha_proto_msgTypes[4]
|
||||||
if protoimpl.UnsafeEnabled && x != nil {
|
if x != nil {
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
if ms.LoadMessageInfo() == nil {
|
if ms.LoadMessageInfo() == nil {
|
||||||
ms.StoreMessageInfo(mi)
|
ms.StoreMessageInfo(mi)
|
||||||
@@ -520,20 +506,17 @@ func (x *TaskResult) GetSuccessful() bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type Receipt struct {
|
type Receipt struct {
|
||||||
state protoimpl.MessageState
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
sizeCache protoimpl.SizeCache
|
|
||||||
unknownFields protoimpl.UnknownFields
|
|
||||||
|
|
||||||
Proced bool `protobuf:"varint,1,opt,name=proced,proto3" json:"proced,omitempty"`
|
Proced bool `protobuf:"varint,1,opt,name=proced,proto3" json:"proced,omitempty"`
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *Receipt) Reset() {
|
func (x *Receipt) Reset() {
|
||||||
*x = Receipt{}
|
*x = Receipt{}
|
||||||
if protoimpl.UnsafeEnabled {
|
|
||||||
mi := &file_proto_nezha_proto_msgTypes[5]
|
mi := &file_proto_nezha_proto_msgTypes[5]
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
ms.StoreMessageInfo(mi)
|
ms.StoreMessageInfo(mi)
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *Receipt) String() string {
|
func (x *Receipt) String() string {
|
||||||
@@ -544,7 +527,7 @@ func (*Receipt) ProtoMessage() {}
|
|||||||
|
|
||||||
func (x *Receipt) ProtoReflect() protoreflect.Message {
|
func (x *Receipt) ProtoReflect() protoreflect.Message {
|
||||||
mi := &file_proto_nezha_proto_msgTypes[5]
|
mi := &file_proto_nezha_proto_msgTypes[5]
|
||||||
if protoimpl.UnsafeEnabled && x != nil {
|
if x != nil {
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
if ms.LoadMessageInfo() == nil {
|
if ms.LoadMessageInfo() == nil {
|
||||||
ms.StoreMessageInfo(mi)
|
ms.StoreMessageInfo(mi)
|
||||||
@@ -567,20 +550,17 @@ func (x *Receipt) GetProced() bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type Uint64Receipt struct {
|
type Uint64Receipt struct {
|
||||||
state protoimpl.MessageState
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
sizeCache protoimpl.SizeCache
|
|
||||||
unknownFields protoimpl.UnknownFields
|
|
||||||
|
|
||||||
Data uint64 `protobuf:"varint,1,opt,name=data,proto3" json:"data,omitempty"`
|
Data uint64 `protobuf:"varint,1,opt,name=data,proto3" json:"data,omitempty"`
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *Uint64Receipt) Reset() {
|
func (x *Uint64Receipt) Reset() {
|
||||||
*x = Uint64Receipt{}
|
*x = Uint64Receipt{}
|
||||||
if protoimpl.UnsafeEnabled {
|
|
||||||
mi := &file_proto_nezha_proto_msgTypes[6]
|
mi := &file_proto_nezha_proto_msgTypes[6]
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
ms.StoreMessageInfo(mi)
|
ms.StoreMessageInfo(mi)
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *Uint64Receipt) String() string {
|
func (x *Uint64Receipt) String() string {
|
||||||
@@ -591,7 +571,7 @@ func (*Uint64Receipt) ProtoMessage() {}
|
|||||||
|
|
||||||
func (x *Uint64Receipt) ProtoReflect() protoreflect.Message {
|
func (x *Uint64Receipt) ProtoReflect() protoreflect.Message {
|
||||||
mi := &file_proto_nezha_proto_msgTypes[6]
|
mi := &file_proto_nezha_proto_msgTypes[6]
|
||||||
if protoimpl.UnsafeEnabled && x != nil {
|
if x != nil {
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
if ms.LoadMessageInfo() == nil {
|
if ms.LoadMessageInfo() == nil {
|
||||||
ms.StoreMessageInfo(mi)
|
ms.StoreMessageInfo(mi)
|
||||||
@@ -614,20 +594,17 @@ func (x *Uint64Receipt) GetData() uint64 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type IOStreamData struct {
|
type IOStreamData struct {
|
||||||
state protoimpl.MessageState
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
sizeCache protoimpl.SizeCache
|
|
||||||
unknownFields protoimpl.UnknownFields
|
|
||||||
|
|
||||||
Data []byte `protobuf:"bytes,1,opt,name=data,proto3" json:"data,omitempty"`
|
Data []byte `protobuf:"bytes,1,opt,name=data,proto3" json:"data,omitempty"`
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *IOStreamData) Reset() {
|
func (x *IOStreamData) Reset() {
|
||||||
*x = IOStreamData{}
|
*x = IOStreamData{}
|
||||||
if protoimpl.UnsafeEnabled {
|
|
||||||
mi := &file_proto_nezha_proto_msgTypes[7]
|
mi := &file_proto_nezha_proto_msgTypes[7]
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
ms.StoreMessageInfo(mi)
|
ms.StoreMessageInfo(mi)
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *IOStreamData) String() string {
|
func (x *IOStreamData) String() string {
|
||||||
@@ -638,7 +615,7 @@ func (*IOStreamData) ProtoMessage() {}
|
|||||||
|
|
||||||
func (x *IOStreamData) ProtoReflect() protoreflect.Message {
|
func (x *IOStreamData) ProtoReflect() protoreflect.Message {
|
||||||
mi := &file_proto_nezha_proto_msgTypes[7]
|
mi := &file_proto_nezha_proto_msgTypes[7]
|
||||||
if protoimpl.UnsafeEnabled && x != nil {
|
if x != nil {
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
if ms.LoadMessageInfo() == nil {
|
if ms.LoadMessageInfo() == nil {
|
||||||
ms.StoreMessageInfo(mi)
|
ms.StoreMessageInfo(mi)
|
||||||
@@ -661,23 +638,20 @@ func (x *IOStreamData) GetData() []byte {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type GeoIP struct {
|
type GeoIP struct {
|
||||||
state protoimpl.MessageState
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
sizeCache protoimpl.SizeCache
|
|
||||||
unknownFields protoimpl.UnknownFields
|
|
||||||
|
|
||||||
Use6 bool `protobuf:"varint,1,opt,name=use6,proto3" json:"use6,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"`
|
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"`
|
CountryCode string `protobuf:"bytes,3,opt,name=country_code,json=countryCode,proto3" json:"country_code,omitempty"`
|
||||||
DashboardBootTime uint64 `protobuf:"varint,4,opt,name=dashboard_boot_time,json=dashboardBootTime,proto3" json:"dashboard_boot_time,omitempty"`
|
DashboardBootTime uint64 `protobuf:"varint,4,opt,name=dashboard_boot_time,json=dashboardBootTime,proto3" json:"dashboard_boot_time,omitempty"`
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *GeoIP) Reset() {
|
func (x *GeoIP) Reset() {
|
||||||
*x = GeoIP{}
|
*x = GeoIP{}
|
||||||
if protoimpl.UnsafeEnabled {
|
|
||||||
mi := &file_proto_nezha_proto_msgTypes[8]
|
mi := &file_proto_nezha_proto_msgTypes[8]
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
ms.StoreMessageInfo(mi)
|
ms.StoreMessageInfo(mi)
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *GeoIP) String() string {
|
func (x *GeoIP) String() string {
|
||||||
@@ -688,7 +662,7 @@ func (*GeoIP) ProtoMessage() {}
|
|||||||
|
|
||||||
func (x *GeoIP) ProtoReflect() protoreflect.Message {
|
func (x *GeoIP) ProtoReflect() protoreflect.Message {
|
||||||
mi := &file_proto_nezha_proto_msgTypes[8]
|
mi := &file_proto_nezha_proto_msgTypes[8]
|
||||||
if protoimpl.UnsafeEnabled && x != nil {
|
if x != nil {
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
if ms.LoadMessageInfo() == nil {
|
if ms.LoadMessageInfo() == nil {
|
||||||
ms.StoreMessageInfo(mi)
|
ms.StoreMessageInfo(mi)
|
||||||
@@ -732,21 +706,18 @@ func (x *GeoIP) GetDashboardBootTime() uint64 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type IP struct {
|
type IP struct {
|
||||||
state protoimpl.MessageState
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
sizeCache protoimpl.SizeCache
|
|
||||||
unknownFields protoimpl.UnknownFields
|
|
||||||
|
|
||||||
Ipv4 string `protobuf:"bytes,1,opt,name=ipv4,proto3" json:"ipv4,omitempty"`
|
Ipv4 string `protobuf:"bytes,1,opt,name=ipv4,proto3" json:"ipv4,omitempty"`
|
||||||
Ipv6 string `protobuf:"bytes,2,opt,name=ipv6,proto3" json:"ipv6,omitempty"`
|
Ipv6 string `protobuf:"bytes,2,opt,name=ipv6,proto3" json:"ipv6,omitempty"`
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *IP) Reset() {
|
func (x *IP) Reset() {
|
||||||
*x = IP{}
|
*x = IP{}
|
||||||
if protoimpl.UnsafeEnabled {
|
|
||||||
mi := &file_proto_nezha_proto_msgTypes[9]
|
mi := &file_proto_nezha_proto_msgTypes[9]
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
ms.StoreMessageInfo(mi)
|
ms.StoreMessageInfo(mi)
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *IP) String() string {
|
func (x *IP) String() string {
|
||||||
@@ -757,7 +728,7 @@ func (*IP) ProtoMessage() {}
|
|||||||
|
|
||||||
func (x *IP) ProtoReflect() protoreflect.Message {
|
func (x *IP) ProtoReflect() protoreflect.Message {
|
||||||
mi := &file_proto_nezha_proto_msgTypes[9]
|
mi := &file_proto_nezha_proto_msgTypes[9]
|
||||||
if protoimpl.UnsafeEnabled && x != nil {
|
if x != nil {
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
if ms.LoadMessageInfo() == nil {
|
if ms.LoadMessageInfo() == nil {
|
||||||
ms.StoreMessageInfo(mi)
|
ms.StoreMessageInfo(mi)
|
||||||
@@ -788,132 +759,90 @@ func (x *IP) GetIpv6() string {
|
|||||||
|
|
||||||
var File_proto_nezha_proto protoreflect.FileDescriptor
|
var File_proto_nezha_proto protoreflect.FileDescriptor
|
||||||
|
|
||||||
var file_proto_nezha_proto_rawDesc = []byte{
|
const file_proto_nezha_proto_rawDesc = "" +
|
||||||
0x0a, 0x11, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x6e, 0x65, 0x7a, 0x68, 0x61, 0x2e, 0x70, 0x72,
|
"\n" +
|
||||||
0x6f, 0x74, 0x6f, 0x12, 0x05, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xbf, 0x02, 0x0a, 0x04, 0x48,
|
"\x11proto/nezha.proto\x12\x05proto\"\xbf\x02\n" +
|
||||||
0x6f, 0x73, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x18,
|
"\x04Host\x12\x1a\n" +
|
||||||
0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x12,
|
"\bplatform\x18\x01 \x01(\tR\bplatform\x12)\n" +
|
||||||
0x29, 0x0a, 0x10, 0x70, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x5f, 0x76, 0x65, 0x72, 0x73,
|
"\x10platform_version\x18\x02 \x01(\tR\x0fplatformVersion\x12\x10\n" +
|
||||||
0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x70, 0x6c, 0x61, 0x74, 0x66,
|
"\x03cpu\x18\x03 \x03(\tR\x03cpu\x12\x1b\n" +
|
||||||
0x6f, 0x72, 0x6d, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x10, 0x0a, 0x03, 0x63, 0x70,
|
"\tmem_total\x18\x04 \x01(\x04R\bmemTotal\x12\x1d\n" +
|
||||||
0x75, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x03, 0x63, 0x70, 0x75, 0x12, 0x1b, 0x0a, 0x09,
|
"\n" +
|
||||||
0x6d, 0x65, 0x6d, 0x5f, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x18, 0x04, 0x20, 0x01, 0x28, 0x04, 0x52,
|
"disk_total\x18\x05 \x01(\x04R\tdiskTotal\x12\x1d\n" +
|
||||||
0x08, 0x6d, 0x65, 0x6d, 0x54, 0x6f, 0x74, 0x61, 0x6c, 0x12, 0x1d, 0x0a, 0x0a, 0x64, 0x69, 0x73,
|
"\n" +
|
||||||
0x6b, 0x5f, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x18, 0x05, 0x20, 0x01, 0x28, 0x04, 0x52, 0x09, 0x64,
|
"swap_total\x18\x06 \x01(\x04R\tswapTotal\x12\x12\n" +
|
||||||
0x69, 0x73, 0x6b, 0x54, 0x6f, 0x74, 0x61, 0x6c, 0x12, 0x1d, 0x0a, 0x0a, 0x73, 0x77, 0x61, 0x70,
|
"\x04arch\x18\a \x01(\tR\x04arch\x12&\n" +
|
||||||
0x5f, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x18, 0x06, 0x20, 0x01, 0x28, 0x04, 0x52, 0x09, 0x73, 0x77,
|
"\x0evirtualization\x18\b \x01(\tR\x0evirtualization\x12\x1b\n" +
|
||||||
0x61, 0x70, 0x54, 0x6f, 0x74, 0x61, 0x6c, 0x12, 0x12, 0x0a, 0x04, 0x61, 0x72, 0x63, 0x68, 0x18,
|
"\tboot_time\x18\t \x01(\x04R\bbootTime\x12\x18\n" +
|
||||||
0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x61, 0x72, 0x63, 0x68, 0x12, 0x26, 0x0a, 0x0e, 0x76,
|
"\aversion\x18\n" +
|
||||||
0x69, 0x72, 0x74, 0x75, 0x61, 0x6c, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x08, 0x20,
|
" \x01(\tR\aversion\x12\x10\n" +
|
||||||
0x01, 0x28, 0x09, 0x52, 0x0e, 0x76, 0x69, 0x72, 0x74, 0x75, 0x61, 0x6c, 0x69, 0x7a, 0x61, 0x74,
|
"\x03gpu\x18\v \x03(\tR\x03gpu\"\xa9\x04\n" +
|
||||||
0x69, 0x6f, 0x6e, 0x12, 0x1b, 0x0a, 0x09, 0x62, 0x6f, 0x6f, 0x74, 0x5f, 0x74, 0x69, 0x6d, 0x65,
|
"\x05State\x12\x10\n" +
|
||||||
0x18, 0x09, 0x20, 0x01, 0x28, 0x04, 0x52, 0x08, 0x62, 0x6f, 0x6f, 0x74, 0x54, 0x69, 0x6d, 0x65,
|
"\x03cpu\x18\x01 \x01(\x01R\x03cpu\x12\x19\n" +
|
||||||
0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x0a, 0x20, 0x01, 0x28,
|
"\bmem_used\x18\x02 \x01(\x04R\amemUsed\x12\x1b\n" +
|
||||||
0x09, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x10, 0x0a, 0x03, 0x67, 0x70,
|
"\tswap_used\x18\x03 \x01(\x04R\bswapUsed\x12\x1b\n" +
|
||||||
0x75, 0x18, 0x0b, 0x20, 0x03, 0x28, 0x09, 0x52, 0x03, 0x67, 0x70, 0x75, 0x22, 0xa9, 0x04, 0x0a,
|
"\tdisk_used\x18\x04 \x01(\x04R\bdiskUsed\x12&\n" +
|
||||||
0x05, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x63, 0x70, 0x75, 0x18, 0x01, 0x20,
|
"\x0fnet_in_transfer\x18\x05 \x01(\x04R\rnetInTransfer\x12(\n" +
|
||||||
0x01, 0x28, 0x01, 0x52, 0x03, 0x63, 0x70, 0x75, 0x12, 0x19, 0x0a, 0x08, 0x6d, 0x65, 0x6d, 0x5f,
|
"\x10net_out_transfer\x18\x06 \x01(\x04R\x0enetOutTransfer\x12 \n" +
|
||||||
0x75, 0x73, 0x65, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x07, 0x6d, 0x65, 0x6d, 0x55,
|
"\fnet_in_speed\x18\a \x01(\x04R\n" +
|
||||||
0x73, 0x65, 0x64, 0x12, 0x1b, 0x0a, 0x09, 0x73, 0x77, 0x61, 0x70, 0x5f, 0x75, 0x73, 0x65, 0x64,
|
"netInSpeed\x12\"\n" +
|
||||||
0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x52, 0x08, 0x73, 0x77, 0x61, 0x70, 0x55, 0x73, 0x65, 0x64,
|
"\rnet_out_speed\x18\b \x01(\x04R\vnetOutSpeed\x12\x16\n" +
|
||||||
0x12, 0x1b, 0x0a, 0x09, 0x64, 0x69, 0x73, 0x6b, 0x5f, 0x75, 0x73, 0x65, 0x64, 0x18, 0x04, 0x20,
|
"\x06uptime\x18\t \x01(\x04R\x06uptime\x12\x14\n" +
|
||||||
0x01, 0x28, 0x04, 0x52, 0x08, 0x64, 0x69, 0x73, 0x6b, 0x55, 0x73, 0x65, 0x64, 0x12, 0x26, 0x0a,
|
"\x05load1\x18\n" +
|
||||||
0x0f, 0x6e, 0x65, 0x74, 0x5f, 0x69, 0x6e, 0x5f, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x65, 0x72,
|
" \x01(\x01R\x05load1\x12\x14\n" +
|
||||||
0x18, 0x05, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0d, 0x6e, 0x65, 0x74, 0x49, 0x6e, 0x54, 0x72, 0x61,
|
"\x05load5\x18\v \x01(\x01R\x05load5\x12\x16\n" +
|
||||||
0x6e, 0x73, 0x66, 0x65, 0x72, 0x12, 0x28, 0x0a, 0x10, 0x6e, 0x65, 0x74, 0x5f, 0x6f, 0x75, 0x74,
|
"\x06load15\x18\f \x01(\x01R\x06load15\x12$\n" +
|
||||||
0x5f, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x65, 0x72, 0x18, 0x06, 0x20, 0x01, 0x28, 0x04, 0x52,
|
"\x0etcp_conn_count\x18\r \x01(\x04R\ftcpConnCount\x12$\n" +
|
||||||
0x0e, 0x6e, 0x65, 0x74, 0x4f, 0x75, 0x74, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x65, 0x72, 0x12,
|
"\x0eudp_conn_count\x18\x0e \x01(\x04R\fudpConnCount\x12#\n" +
|
||||||
0x20, 0x0a, 0x0c, 0x6e, 0x65, 0x74, 0x5f, 0x69, 0x6e, 0x5f, 0x73, 0x70, 0x65, 0x65, 0x64, 0x18,
|
"\rprocess_count\x18\x0f \x01(\x04R\fprocessCount\x12B\n" +
|
||||||
0x07, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0a, 0x6e, 0x65, 0x74, 0x49, 0x6e, 0x53, 0x70, 0x65, 0x65,
|
"\ftemperatures\x18\x10 \x03(\v2\x1e.proto.State_SensorTemperatureR\ftemperatures\x12\x10\n" +
|
||||||
0x64, 0x12, 0x22, 0x0a, 0x0d, 0x6e, 0x65, 0x74, 0x5f, 0x6f, 0x75, 0x74, 0x5f, 0x73, 0x70, 0x65,
|
"\x03gpu\x18\x11 \x03(\x01R\x03gpu\"O\n" +
|
||||||
0x65, 0x64, 0x18, 0x08, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0b, 0x6e, 0x65, 0x74, 0x4f, 0x75, 0x74,
|
"\x17State_SensorTemperature\x12\x12\n" +
|
||||||
0x53, 0x70, 0x65, 0x65, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x75, 0x70, 0x74, 0x69, 0x6d, 0x65, 0x18,
|
"\x04name\x18\x01 \x01(\tR\x04name\x12 \n" +
|
||||||
0x09, 0x20, 0x01, 0x28, 0x04, 0x52, 0x06, 0x75, 0x70, 0x74, 0x69, 0x6d, 0x65, 0x12, 0x14, 0x0a,
|
"\vtemperature\x18\x02 \x01(\x01R\vtemperature\">\n" +
|
||||||
0x05, 0x6c, 0x6f, 0x61, 0x64, 0x31, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x01, 0x52, 0x05, 0x6c, 0x6f,
|
"\x04Task\x12\x0e\n" +
|
||||||
0x61, 0x64, 0x31, 0x12, 0x14, 0x0a, 0x05, 0x6c, 0x6f, 0x61, 0x64, 0x35, 0x18, 0x0b, 0x20, 0x01,
|
"\x02id\x18\x01 \x01(\x04R\x02id\x12\x12\n" +
|
||||||
0x28, 0x01, 0x52, 0x05, 0x6c, 0x6f, 0x61, 0x64, 0x35, 0x12, 0x16, 0x0a, 0x06, 0x6c, 0x6f, 0x61,
|
"\x04type\x18\x02 \x01(\x04R\x04type\x12\x12\n" +
|
||||||
0x64, 0x31, 0x35, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x01, 0x52, 0x06, 0x6c, 0x6f, 0x61, 0x64, 0x31,
|
"\x04data\x18\x03 \x01(\tR\x04data\"z\n" +
|
||||||
0x35, 0x12, 0x24, 0x0a, 0x0e, 0x74, 0x63, 0x70, 0x5f, 0x63, 0x6f, 0x6e, 0x6e, 0x5f, 0x63, 0x6f,
|
"\n" +
|
||||||
0x75, 0x6e, 0x74, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0c, 0x74, 0x63, 0x70, 0x43, 0x6f,
|
"TaskResult\x12\x0e\n" +
|
||||||
0x6e, 0x6e, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x24, 0x0a, 0x0e, 0x75, 0x64, 0x70, 0x5f, 0x63,
|
"\x02id\x18\x01 \x01(\x04R\x02id\x12\x12\n" +
|
||||||
0x6f, 0x6e, 0x6e, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x04, 0x52,
|
"\x04type\x18\x02 \x01(\x04R\x04type\x12\x14\n" +
|
||||||
0x0c, 0x75, 0x64, 0x70, 0x43, 0x6f, 0x6e, 0x6e, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x23, 0x0a,
|
"\x05delay\x18\x03 \x01(\x02R\x05delay\x12\x12\n" +
|
||||||
0x0d, 0x70, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x0f,
|
"\x04data\x18\x04 \x01(\tR\x04data\x12\x1e\n" +
|
||||||
0x20, 0x01, 0x28, 0x04, 0x52, 0x0c, 0x70, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x43, 0x6f, 0x75,
|
"\n" +
|
||||||
0x6e, 0x74, 0x12, 0x42, 0x0a, 0x0c, 0x74, 0x65, 0x6d, 0x70, 0x65, 0x72, 0x61, 0x74, 0x75, 0x72,
|
"successful\x18\x05 \x01(\bR\n" +
|
||||||
0x65, 0x73, 0x18, 0x10, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f,
|
"successful\"!\n" +
|
||||||
0x2e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x5f, 0x53, 0x65, 0x6e, 0x73, 0x6f, 0x72, 0x54, 0x65, 0x6d,
|
"\aReceipt\x12\x16\n" +
|
||||||
0x70, 0x65, 0x72, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x0c, 0x74, 0x65, 0x6d, 0x70, 0x65, 0x72,
|
"\x06proced\x18\x01 \x01(\bR\x06proced\"#\n" +
|
||||||
0x61, 0x74, 0x75, 0x72, 0x65, 0x73, 0x12, 0x10, 0x0a, 0x03, 0x67, 0x70, 0x75, 0x18, 0x11, 0x20,
|
"\rUint64Receipt\x12\x12\n" +
|
||||||
0x03, 0x28, 0x01, 0x52, 0x03, 0x67, 0x70, 0x75, 0x22, 0x4f, 0x0a, 0x17, 0x53, 0x74, 0x61, 0x74,
|
"\x04data\x18\x01 \x01(\x04R\x04data\"\"\n" +
|
||||||
0x65, 0x5f, 0x53, 0x65, 0x6e, 0x73, 0x6f, 0x72, 0x54, 0x65, 0x6d, 0x70, 0x65, 0x72, 0x61, 0x74,
|
"\fIOStreamData\x12\x12\n" +
|
||||||
0x75, 0x72, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28,
|
"\x04data\x18\x01 \x01(\fR\x04data\"\x89\x01\n" +
|
||||||
0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x74, 0x65, 0x6d, 0x70, 0x65,
|
"\x05GeoIP\x12\x12\n" +
|
||||||
0x72, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x01, 0x52, 0x0b, 0x74, 0x65,
|
"\x04use6\x18\x01 \x01(\bR\x04use6\x12\x19\n" +
|
||||||
0x6d, 0x70, 0x65, 0x72, 0x61, 0x74, 0x75, 0x72, 0x65, 0x22, 0x3e, 0x0a, 0x04, 0x54, 0x61, 0x73,
|
"\x02ip\x18\x02 \x01(\v2\t.proto.IPR\x02ip\x12!\n" +
|
||||||
0x6b, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x02, 0x69,
|
"\fcountry_code\x18\x03 \x01(\tR\vcountryCode\x12.\n" +
|
||||||
0x64, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52,
|
"\x13dashboard_boot_time\x18\x04 \x01(\x04R\x11dashboardBootTime\",\n" +
|
||||||
0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x03, 0x20,
|
"\x02IP\x12\x12\n" +
|
||||||
0x01, 0x28, 0x09, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x22, 0x7a, 0x0a, 0x0a, 0x54, 0x61, 0x73,
|
"\x04ipv4\x18\x01 \x01(\tR\x04ipv4\x12\x12\n" +
|
||||||
0x6b, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20,
|
"\x04ipv6\x18\x02 \x01(\tR\x04ipv62\xd2\x02\n" +
|
||||||
0x01, 0x28, 0x04, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18,
|
"\fNezhaService\x127\n" +
|
||||||
0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x64,
|
"\x11ReportSystemState\x12\f.proto.State\x1a\x0e.proto.Receipt\"\x00(\x010\x01\x121\n" +
|
||||||
0x65, 0x6c, 0x61, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x02, 0x52, 0x05, 0x64, 0x65, 0x6c, 0x61,
|
"\x10ReportSystemInfo\x12\v.proto.Host\x1a\x0e.proto.Receipt\"\x00\x123\n" +
|
||||||
0x79, 0x12, 0x12, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52,
|
"\vRequestTask\x12\x11.proto.TaskResult\x1a\v.proto.Task\"\x00(\x010\x01\x12:\n" +
|
||||||
0x04, 0x64, 0x61, 0x74, 0x61, 0x12, 0x1e, 0x0a, 0x0a, 0x73, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73,
|
"\bIOStream\x12\x13.proto.IOStreamData\x1a\x13.proto.IOStreamData\"\x00(\x010\x01\x12+\n" +
|
||||||
0x66, 0x75, 0x6c, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, 0x73, 0x75, 0x63, 0x63, 0x65,
|
"\vReportGeoIP\x12\f.proto.GeoIP\x1a\f.proto.GeoIP\"\x00\x128\n" +
|
||||||
0x73, 0x73, 0x66, 0x75, 0x6c, 0x22, 0x21, 0x0a, 0x07, 0x52, 0x65, 0x63, 0x65, 0x69, 0x70, 0x74,
|
"\x11ReportSystemInfo2\x12\v.proto.Host\x1a\x14.proto.Uint64Receipt\"\x00B\tZ\a./protob\x06proto3"
|
||||||
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, 0x23, 0x0a, 0x0d, 0x55, 0x69, 0x6e, 0x74,
|
|
||||||
0x36, 0x34, 0x52, 0x65, 0x63, 0x65, 0x69, 0x70, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x64, 0x61, 0x74,
|
|
||||||
0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 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, 0x89, 0x01, 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, 0x12, 0x2e, 0x0a,
|
|
||||||
0x13, 0x64, 0x61, 0x73, 0x68, 0x62, 0x6f, 0x61, 0x72, 0x64, 0x5f, 0x62, 0x6f, 0x6f, 0x74, 0x5f,
|
|
||||||
0x74, 0x69, 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x04, 0x52, 0x11, 0x64, 0x61, 0x73, 0x68,
|
|
||||||
0x62, 0x6f, 0x61, 0x72, 0x64, 0x42, 0x6f, 0x6f, 0x74, 0x54, 0x69, 0x6d, 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, 0xd2, 0x02, 0x0a, 0x0c,
|
|
||||||
0x4e, 0x65, 0x7a, 0x68, 0x61, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x37, 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, 0x28, 0x01, 0x30, 0x01, 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, 0x33, 0x0a, 0x0b, 0x52, 0x65, 0x71, 0x75,
|
|
||||||
0x65, 0x73, 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, 0x0b, 0x2e, 0x70, 0x72, 0x6f,
|
|
||||||
0x74, 0x6f, 0x2e, 0x54, 0x61, 0x73, 0x6b, 0x22, 0x00, 0x28, 0x01, 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, 0x12, 0x38, 0x0a, 0x11, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74,
|
|
||||||
0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x49, 0x6e, 0x66, 0x6f, 0x32, 0x12, 0x0b, 0x2e, 0x70, 0x72,
|
|
||||||
0x6f, 0x74, 0x6f, 0x2e, 0x48, 0x6f, 0x73, 0x74, 0x1a, 0x14, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f,
|
|
||||||
0x2e, 0x55, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x52, 0x65, 0x63, 0x65, 0x69, 0x70, 0x74, 0x22, 0x00,
|
|
||||||
0x42, 0x09, 0x5a, 0x07, 0x2e, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x06, 0x70, 0x72, 0x6f,
|
|
||||||
0x74, 0x6f, 0x33,
|
|
||||||
}
|
|
||||||
|
|
||||||
var (
|
var (
|
||||||
file_proto_nezha_proto_rawDescOnce sync.Once
|
file_proto_nezha_proto_rawDescOnce sync.Once
|
||||||
file_proto_nezha_proto_rawDescData = file_proto_nezha_proto_rawDesc
|
file_proto_nezha_proto_rawDescData []byte
|
||||||
)
|
)
|
||||||
|
|
||||||
func file_proto_nezha_proto_rawDescGZIP() []byte {
|
func file_proto_nezha_proto_rawDescGZIP() []byte {
|
||||||
file_proto_nezha_proto_rawDescOnce.Do(func() {
|
file_proto_nezha_proto_rawDescOnce.Do(func() {
|
||||||
file_proto_nezha_proto_rawDescData = protoimpl.X.CompressGZIP(file_proto_nezha_proto_rawDescData)
|
file_proto_nezha_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_proto_nezha_proto_rawDesc), len(file_proto_nezha_proto_rawDesc)))
|
||||||
})
|
})
|
||||||
return file_proto_nezha_proto_rawDescData
|
return file_proto_nezha_proto_rawDescData
|
||||||
}
|
}
|
||||||
@@ -958,133 +887,11 @@ func file_proto_nezha_proto_init() {
|
|||||||
if File_proto_nezha_proto != nil {
|
if File_proto_nezha_proto != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if !protoimpl.UnsafeEnabled {
|
|
||||||
file_proto_nezha_proto_msgTypes[0].Exporter = func(v any, i int) any {
|
|
||||||
switch v := v.(*Host); i {
|
|
||||||
case 0:
|
|
||||||
return &v.state
|
|
||||||
case 1:
|
|
||||||
return &v.sizeCache
|
|
||||||
case 2:
|
|
||||||
return &v.unknownFields
|
|
||||||
default:
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
}
|
|
||||||
file_proto_nezha_proto_msgTypes[1].Exporter = func(v any, i int) any {
|
|
||||||
switch v := v.(*State); i {
|
|
||||||
case 0:
|
|
||||||
return &v.state
|
|
||||||
case 1:
|
|
||||||
return &v.sizeCache
|
|
||||||
case 2:
|
|
||||||
return &v.unknownFields
|
|
||||||
default:
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
}
|
|
||||||
file_proto_nezha_proto_msgTypes[2].Exporter = func(v any, i int) any {
|
|
||||||
switch v := v.(*State_SensorTemperature); i {
|
|
||||||
case 0:
|
|
||||||
return &v.state
|
|
||||||
case 1:
|
|
||||||
return &v.sizeCache
|
|
||||||
case 2:
|
|
||||||
return &v.unknownFields
|
|
||||||
default:
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
}
|
|
||||||
file_proto_nezha_proto_msgTypes[3].Exporter = func(v any, i int) any {
|
|
||||||
switch v := v.(*Task); i {
|
|
||||||
case 0:
|
|
||||||
return &v.state
|
|
||||||
case 1:
|
|
||||||
return &v.sizeCache
|
|
||||||
case 2:
|
|
||||||
return &v.unknownFields
|
|
||||||
default:
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
}
|
|
||||||
file_proto_nezha_proto_msgTypes[4].Exporter = func(v any, i int) any {
|
|
||||||
switch v := v.(*TaskResult); i {
|
|
||||||
case 0:
|
|
||||||
return &v.state
|
|
||||||
case 1:
|
|
||||||
return &v.sizeCache
|
|
||||||
case 2:
|
|
||||||
return &v.unknownFields
|
|
||||||
default:
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
}
|
|
||||||
file_proto_nezha_proto_msgTypes[5].Exporter = func(v any, i int) any {
|
|
||||||
switch v := v.(*Receipt); i {
|
|
||||||
case 0:
|
|
||||||
return &v.state
|
|
||||||
case 1:
|
|
||||||
return &v.sizeCache
|
|
||||||
case 2:
|
|
||||||
return &v.unknownFields
|
|
||||||
default:
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
}
|
|
||||||
file_proto_nezha_proto_msgTypes[6].Exporter = func(v any, i int) any {
|
|
||||||
switch v := v.(*Uint64Receipt); i {
|
|
||||||
case 0:
|
|
||||||
return &v.state
|
|
||||||
case 1:
|
|
||||||
return &v.sizeCache
|
|
||||||
case 2:
|
|
||||||
return &v.unknownFields
|
|
||||||
default:
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
}
|
|
||||||
file_proto_nezha_proto_msgTypes[7].Exporter = func(v any, i int) any {
|
|
||||||
switch v := v.(*IOStreamData); i {
|
|
||||||
case 0:
|
|
||||||
return &v.state
|
|
||||||
case 1:
|
|
||||||
return &v.sizeCache
|
|
||||||
case 2:
|
|
||||||
return &v.unknownFields
|
|
||||||
default:
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
}
|
|
||||||
file_proto_nezha_proto_msgTypes[8].Exporter = func(v any, i int) any {
|
|
||||||
switch v := v.(*GeoIP); i {
|
|
||||||
case 0:
|
|
||||||
return &v.state
|
|
||||||
case 1:
|
|
||||||
return &v.sizeCache
|
|
||||||
case 2:
|
|
||||||
return &v.unknownFields
|
|
||||||
default:
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
}
|
|
||||||
file_proto_nezha_proto_msgTypes[9].Exporter = func(v any, i int) any {
|
|
||||||
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{}
|
type x struct{}
|
||||||
out := protoimpl.TypeBuilder{
|
out := protoimpl.TypeBuilder{
|
||||||
File: protoimpl.DescBuilder{
|
File: protoimpl.DescBuilder{
|
||||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||||
RawDescriptor: file_proto_nezha_proto_rawDesc,
|
RawDescriptor: unsafe.Slice(unsafe.StringData(file_proto_nezha_proto_rawDesc), len(file_proto_nezha_proto_rawDesc)),
|
||||||
NumEnums: 0,
|
NumEnums: 0,
|
||||||
NumMessages: 10,
|
NumMessages: 10,
|
||||||
NumExtensions: 0,
|
NumExtensions: 0,
|
||||||
@@ -1095,7 +902,6 @@ func file_proto_nezha_proto_init() {
|
|||||||
MessageInfos: file_proto_nezha_proto_msgTypes,
|
MessageInfos: file_proto_nezha_proto_msgTypes,
|
||||||
}.Build()
|
}.Build()
|
||||||
File_proto_nezha_proto = out.File
|
File_proto_nezha_proto = out.File
|
||||||
file_proto_nezha_proto_rawDesc = nil
|
|
||||||
file_proto_nezha_proto_goTypes = nil
|
file_proto_nezha_proto_goTypes = nil
|
||||||
file_proto_nezha_proto_depIdxs = nil
|
file_proto_nezha_proto_depIdxs = nil
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
|
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
|
||||||
// versions:
|
// versions:
|
||||||
// - protoc-gen-go-grpc v1.3.0
|
// - protoc-gen-go-grpc v1.5.1
|
||||||
// - protoc v5.29.3
|
// - protoc v3.21.12
|
||||||
// source: proto/nezha.proto
|
// source: proto/nezha.proto
|
||||||
|
|
||||||
package proto
|
package proto
|
||||||
@@ -15,8 +15,8 @@ import (
|
|||||||
|
|
||||||
// This is a compile-time assertion to ensure that this generated file
|
// This is a compile-time assertion to ensure that this generated file
|
||||||
// is compatible with the grpc package it is being compiled against.
|
// is compatible with the grpc package it is being compiled against.
|
||||||
// Requires gRPC-Go v1.32.0 or later.
|
// Requires gRPC-Go v1.64.0 or later.
|
||||||
const _ = grpc.SupportPackageIsVersion7
|
const _ = grpc.SupportPackageIsVersion9
|
||||||
|
|
||||||
const (
|
const (
|
||||||
NezhaService_ReportSystemState_FullMethodName = "/proto.NezhaService/ReportSystemState"
|
NezhaService_ReportSystemState_FullMethodName = "/proto.NezhaService/ReportSystemState"
|
||||||
@@ -31,10 +31,10 @@ const (
|
|||||||
//
|
//
|
||||||
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
|
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
|
||||||
type NezhaServiceClient interface {
|
type NezhaServiceClient interface {
|
||||||
ReportSystemState(ctx context.Context, opts ...grpc.CallOption) (NezhaService_ReportSystemStateClient, error)
|
ReportSystemState(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[State, Receipt], error)
|
||||||
ReportSystemInfo(ctx context.Context, in *Host, opts ...grpc.CallOption) (*Receipt, error)
|
ReportSystemInfo(ctx context.Context, in *Host, opts ...grpc.CallOption) (*Receipt, error)
|
||||||
RequestTask(ctx context.Context, opts ...grpc.CallOption) (NezhaService_RequestTaskClient, error)
|
RequestTask(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[TaskResult, Task], error)
|
||||||
IOStream(ctx context.Context, opts ...grpc.CallOption) (NezhaService_IOStreamClient, error)
|
IOStream(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[IOStreamData, IOStreamData], error)
|
||||||
ReportGeoIP(ctx context.Context, in *GeoIP, opts ...grpc.CallOption) (*GeoIP, error)
|
ReportGeoIP(ctx context.Context, in *GeoIP, opts ...grpc.CallOption) (*GeoIP, error)
|
||||||
ReportSystemInfo2(ctx context.Context, in *Host, opts ...grpc.CallOption) (*Uint64Receipt, error)
|
ReportSystemInfo2(ctx context.Context, in *Host, opts ...grpc.CallOption) (*Uint64Receipt, error)
|
||||||
}
|
}
|
||||||
@@ -47,111 +47,59 @@ func NewNezhaServiceClient(cc grpc.ClientConnInterface) NezhaServiceClient {
|
|||||||
return &nezhaServiceClient{cc}
|
return &nezhaServiceClient{cc}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *nezhaServiceClient) ReportSystemState(ctx context.Context, opts ...grpc.CallOption) (NezhaService_ReportSystemStateClient, error) {
|
func (c *nezhaServiceClient) ReportSystemState(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[State, Receipt], error) {
|
||||||
stream, err := c.cc.NewStream(ctx, &NezhaService_ServiceDesc.Streams[0], NezhaService_ReportSystemState_FullMethodName, opts...)
|
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||||
|
stream, err := c.cc.NewStream(ctx, &NezhaService_ServiceDesc.Streams[0], NezhaService_ReportSystemState_FullMethodName, cOpts...)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
x := &nezhaServiceReportSystemStateClient{stream}
|
x := &grpc.GenericClientStream[State, Receipt]{ClientStream: stream}
|
||||||
return x, nil
|
return x, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
type NezhaService_ReportSystemStateClient interface {
|
// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
|
||||||
Send(*State) error
|
type NezhaService_ReportSystemStateClient = grpc.BidiStreamingClient[State, Receipt]
|
||||||
Recv() (*Receipt, error)
|
|
||||||
grpc.ClientStream
|
|
||||||
}
|
|
||||||
|
|
||||||
type nezhaServiceReportSystemStateClient struct {
|
|
||||||
grpc.ClientStream
|
|
||||||
}
|
|
||||||
|
|
||||||
func (x *nezhaServiceReportSystemStateClient) Send(m *State) error {
|
|
||||||
return x.ClientStream.SendMsg(m)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (x *nezhaServiceReportSystemStateClient) Recv() (*Receipt, error) {
|
|
||||||
m := new(Receipt)
|
|
||||||
if err := x.ClientStream.RecvMsg(m); err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return m, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *nezhaServiceClient) ReportSystemInfo(ctx context.Context, in *Host, opts ...grpc.CallOption) (*Receipt, error) {
|
func (c *nezhaServiceClient) ReportSystemInfo(ctx context.Context, in *Host, opts ...grpc.CallOption) (*Receipt, error) {
|
||||||
|
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||||
out := new(Receipt)
|
out := new(Receipt)
|
||||||
err := c.cc.Invoke(ctx, NezhaService_ReportSystemInfo_FullMethodName, in, out, opts...)
|
err := c.cc.Invoke(ctx, NezhaService_ReportSystemInfo_FullMethodName, in, out, cOpts...)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
return out, nil
|
return out, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *nezhaServiceClient) RequestTask(ctx context.Context, opts ...grpc.CallOption) (NezhaService_RequestTaskClient, error) {
|
func (c *nezhaServiceClient) RequestTask(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[TaskResult, Task], error) {
|
||||||
stream, err := c.cc.NewStream(ctx, &NezhaService_ServiceDesc.Streams[1], NezhaService_RequestTask_FullMethodName, opts...)
|
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||||
|
stream, err := c.cc.NewStream(ctx, &NezhaService_ServiceDesc.Streams[1], NezhaService_RequestTask_FullMethodName, cOpts...)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
x := &nezhaServiceRequestTaskClient{stream}
|
x := &grpc.GenericClientStream[TaskResult, Task]{ClientStream: stream}
|
||||||
return x, nil
|
return x, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
type NezhaService_RequestTaskClient interface {
|
// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
|
||||||
Send(*TaskResult) error
|
type NezhaService_RequestTaskClient = grpc.BidiStreamingClient[TaskResult, Task]
|
||||||
Recv() (*Task, error)
|
|
||||||
grpc.ClientStream
|
|
||||||
}
|
|
||||||
|
|
||||||
type nezhaServiceRequestTaskClient struct {
|
func (c *nezhaServiceClient) IOStream(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[IOStreamData, IOStreamData], error) {
|
||||||
grpc.ClientStream
|
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||||
}
|
stream, err := c.cc.NewStream(ctx, &NezhaService_ServiceDesc.Streams[2], NezhaService_IOStream_FullMethodName, cOpts...)
|
||||||
|
|
||||||
func (x *nezhaServiceRequestTaskClient) Send(m *TaskResult) error {
|
|
||||||
return x.ClientStream.SendMsg(m)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (x *nezhaServiceRequestTaskClient) Recv() (*Task, error) {
|
|
||||||
m := new(Task)
|
|
||||||
if err := x.ClientStream.RecvMsg(m); err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return m, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *nezhaServiceClient) IOStream(ctx context.Context, opts ...grpc.CallOption) (NezhaService_IOStreamClient, error) {
|
|
||||||
stream, err := c.cc.NewStream(ctx, &NezhaService_ServiceDesc.Streams[2], NezhaService_IOStream_FullMethodName, opts...)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
x := &nezhaServiceIOStreamClient{stream}
|
x := &grpc.GenericClientStream[IOStreamData, IOStreamData]{ClientStream: stream}
|
||||||
return x, nil
|
return x, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
type NezhaService_IOStreamClient interface {
|
// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
|
||||||
Send(*IOStreamData) error
|
type NezhaService_IOStreamClient = grpc.BidiStreamingClient[IOStreamData, IOStreamData]
|
||||||
Recv() (*IOStreamData, error)
|
|
||||||
grpc.ClientStream
|
|
||||||
}
|
|
||||||
|
|
||||||
type nezhaServiceIOStreamClient struct {
|
|
||||||
grpc.ClientStream
|
|
||||||
}
|
|
||||||
|
|
||||||
func (x *nezhaServiceIOStreamClient) Send(m *IOStreamData) error {
|
|
||||||
return x.ClientStream.SendMsg(m)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (x *nezhaServiceIOStreamClient) Recv() (*IOStreamData, error) {
|
|
||||||
m := new(IOStreamData)
|
|
||||||
if err := x.ClientStream.RecvMsg(m); err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return m, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *nezhaServiceClient) ReportGeoIP(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)
|
out := new(GeoIP)
|
||||||
err := c.cc.Invoke(ctx, NezhaService_ReportGeoIP_FullMethodName, in, out, opts...)
|
err := c.cc.Invoke(ctx, NezhaService_ReportGeoIP_FullMethodName, in, out, cOpts...)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@@ -159,8 +107,9 @@ func (c *nezhaServiceClient) ReportGeoIP(ctx context.Context, in *GeoIP, opts ..
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *nezhaServiceClient) ReportSystemInfo2(ctx context.Context, in *Host, opts ...grpc.CallOption) (*Uint64Receipt, error) {
|
func (c *nezhaServiceClient) ReportSystemInfo2(ctx context.Context, in *Host, opts ...grpc.CallOption) (*Uint64Receipt, error) {
|
||||||
|
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||||
out := new(Uint64Receipt)
|
out := new(Uint64Receipt)
|
||||||
err := c.cc.Invoke(ctx, NezhaService_ReportSystemInfo2_FullMethodName, in, out, opts...)
|
err := c.cc.Invoke(ctx, NezhaService_ReportSystemInfo2_FullMethodName, in, out, cOpts...)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@@ -169,30 +118,33 @@ func (c *nezhaServiceClient) ReportSystemInfo2(ctx context.Context, in *Host, op
|
|||||||
|
|
||||||
// NezhaServiceServer is the server API for NezhaService service.
|
// NezhaServiceServer is the server API for NezhaService service.
|
||||||
// All implementations should embed UnimplementedNezhaServiceServer
|
// All implementations should embed UnimplementedNezhaServiceServer
|
||||||
// for forward compatibility
|
// for forward compatibility.
|
||||||
type NezhaServiceServer interface {
|
type NezhaServiceServer interface {
|
||||||
ReportSystemState(NezhaService_ReportSystemStateServer) error
|
ReportSystemState(grpc.BidiStreamingServer[State, Receipt]) error
|
||||||
ReportSystemInfo(context.Context, *Host) (*Receipt, error)
|
ReportSystemInfo(context.Context, *Host) (*Receipt, error)
|
||||||
RequestTask(NezhaService_RequestTaskServer) error
|
RequestTask(grpc.BidiStreamingServer[TaskResult, Task]) error
|
||||||
IOStream(NezhaService_IOStreamServer) error
|
IOStream(grpc.BidiStreamingServer[IOStreamData, IOStreamData]) error
|
||||||
ReportGeoIP(context.Context, *GeoIP) (*GeoIP, error)
|
ReportGeoIP(context.Context, *GeoIP) (*GeoIP, error)
|
||||||
ReportSystemInfo2(context.Context, *Host) (*Uint64Receipt, error)
|
ReportSystemInfo2(context.Context, *Host) (*Uint64Receipt, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
// UnimplementedNezhaServiceServer should be embedded to have forward compatible implementations.
|
// UnimplementedNezhaServiceServer should be embedded to have
|
||||||
type UnimplementedNezhaServiceServer struct {
|
// forward compatible implementations.
|
||||||
}
|
//
|
||||||
|
// NOTE: this should be embedded by value instead of pointer to avoid a nil
|
||||||
|
// pointer dereference when methods are called.
|
||||||
|
type UnimplementedNezhaServiceServer struct{}
|
||||||
|
|
||||||
func (UnimplementedNezhaServiceServer) ReportSystemState(NezhaService_ReportSystemStateServer) error {
|
func (UnimplementedNezhaServiceServer) ReportSystemState(grpc.BidiStreamingServer[State, Receipt]) error {
|
||||||
return status.Errorf(codes.Unimplemented, "method ReportSystemState not implemented")
|
return status.Errorf(codes.Unimplemented, "method ReportSystemState not implemented")
|
||||||
}
|
}
|
||||||
func (UnimplementedNezhaServiceServer) ReportSystemInfo(context.Context, *Host) (*Receipt, error) {
|
func (UnimplementedNezhaServiceServer) ReportSystemInfo(context.Context, *Host) (*Receipt, error) {
|
||||||
return nil, status.Errorf(codes.Unimplemented, "method ReportSystemInfo not implemented")
|
return nil, status.Errorf(codes.Unimplemented, "method ReportSystemInfo not implemented")
|
||||||
}
|
}
|
||||||
func (UnimplementedNezhaServiceServer) RequestTask(NezhaService_RequestTaskServer) error {
|
func (UnimplementedNezhaServiceServer) RequestTask(grpc.BidiStreamingServer[TaskResult, Task]) error {
|
||||||
return status.Errorf(codes.Unimplemented, "method RequestTask not implemented")
|
return status.Errorf(codes.Unimplemented, "method RequestTask not implemented")
|
||||||
}
|
}
|
||||||
func (UnimplementedNezhaServiceServer) IOStream(NezhaService_IOStreamServer) error {
|
func (UnimplementedNezhaServiceServer) IOStream(grpc.BidiStreamingServer[IOStreamData, IOStreamData]) error {
|
||||||
return status.Errorf(codes.Unimplemented, "method IOStream not implemented")
|
return status.Errorf(codes.Unimplemented, "method IOStream not implemented")
|
||||||
}
|
}
|
||||||
func (UnimplementedNezhaServiceServer) ReportGeoIP(context.Context, *GeoIP) (*GeoIP, error) {
|
func (UnimplementedNezhaServiceServer) ReportGeoIP(context.Context, *GeoIP) (*GeoIP, error) {
|
||||||
@@ -201,6 +153,7 @@ func (UnimplementedNezhaServiceServer) ReportGeoIP(context.Context, *GeoIP) (*Ge
|
|||||||
func (UnimplementedNezhaServiceServer) ReportSystemInfo2(context.Context, *Host) (*Uint64Receipt, error) {
|
func (UnimplementedNezhaServiceServer) ReportSystemInfo2(context.Context, *Host) (*Uint64Receipt, error) {
|
||||||
return nil, status.Errorf(codes.Unimplemented, "method ReportSystemInfo2 not implemented")
|
return nil, status.Errorf(codes.Unimplemented, "method ReportSystemInfo2 not implemented")
|
||||||
}
|
}
|
||||||
|
func (UnimplementedNezhaServiceServer) testEmbeddedByValue() {}
|
||||||
|
|
||||||
// UnsafeNezhaServiceServer may be embedded to opt out of forward compatibility for this service.
|
// UnsafeNezhaServiceServer may be embedded to opt out of forward compatibility for this service.
|
||||||
// Use of this interface is not recommended, as added methods to NezhaServiceServer will
|
// Use of this interface is not recommended, as added methods to NezhaServiceServer will
|
||||||
@@ -210,34 +163,22 @@ type UnsafeNezhaServiceServer interface {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func RegisterNezhaServiceServer(s grpc.ServiceRegistrar, srv NezhaServiceServer) {
|
func RegisterNezhaServiceServer(s grpc.ServiceRegistrar, srv NezhaServiceServer) {
|
||||||
|
// If the following call pancis, it indicates UnimplementedNezhaServiceServer was
|
||||||
|
// embedded by pointer and is nil. This will cause panics if an
|
||||||
|
// unimplemented method is ever invoked, so we test this at initialization
|
||||||
|
// time to prevent it from happening at runtime later due to I/O.
|
||||||
|
if t, ok := srv.(interface{ testEmbeddedByValue() }); ok {
|
||||||
|
t.testEmbeddedByValue()
|
||||||
|
}
|
||||||
s.RegisterService(&NezhaService_ServiceDesc, srv)
|
s.RegisterService(&NezhaService_ServiceDesc, srv)
|
||||||
}
|
}
|
||||||
|
|
||||||
func _NezhaService_ReportSystemState_Handler(srv interface{}, stream grpc.ServerStream) error {
|
func _NezhaService_ReportSystemState_Handler(srv interface{}, stream grpc.ServerStream) error {
|
||||||
return srv.(NezhaServiceServer).ReportSystemState(&nezhaServiceReportSystemStateServer{stream})
|
return srv.(NezhaServiceServer).ReportSystemState(&grpc.GenericServerStream[State, Receipt]{ServerStream: stream})
|
||||||
}
|
}
|
||||||
|
|
||||||
type NezhaService_ReportSystemStateServer interface {
|
// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
|
||||||
Send(*Receipt) error
|
type NezhaService_ReportSystemStateServer = grpc.BidiStreamingServer[State, Receipt]
|
||||||
Recv() (*State, error)
|
|
||||||
grpc.ServerStream
|
|
||||||
}
|
|
||||||
|
|
||||||
type nezhaServiceReportSystemStateServer struct {
|
|
||||||
grpc.ServerStream
|
|
||||||
}
|
|
||||||
|
|
||||||
func (x *nezhaServiceReportSystemStateServer) Send(m *Receipt) error {
|
|
||||||
return x.ServerStream.SendMsg(m)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (x *nezhaServiceReportSystemStateServer) Recv() (*State, error) {
|
|
||||||
m := new(State)
|
|
||||||
if err := x.ServerStream.RecvMsg(m); err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return m, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func _NezhaService_ReportSystemInfo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
func _NezhaService_ReportSystemInfo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||||
in := new(Host)
|
in := new(Host)
|
||||||
@@ -258,56 +199,18 @@ func _NezhaService_ReportSystemInfo_Handler(srv interface{}, ctx context.Context
|
|||||||
}
|
}
|
||||||
|
|
||||||
func _NezhaService_RequestTask_Handler(srv interface{}, stream grpc.ServerStream) error {
|
func _NezhaService_RequestTask_Handler(srv interface{}, stream grpc.ServerStream) error {
|
||||||
return srv.(NezhaServiceServer).RequestTask(&nezhaServiceRequestTaskServer{stream})
|
return srv.(NezhaServiceServer).RequestTask(&grpc.GenericServerStream[TaskResult, Task]{ServerStream: stream})
|
||||||
}
|
}
|
||||||
|
|
||||||
type NezhaService_RequestTaskServer interface {
|
// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
|
||||||
Send(*Task) error
|
type NezhaService_RequestTaskServer = grpc.BidiStreamingServer[TaskResult, Task]
|
||||||
Recv() (*TaskResult, error)
|
|
||||||
grpc.ServerStream
|
|
||||||
}
|
|
||||||
|
|
||||||
type nezhaServiceRequestTaskServer struct {
|
|
||||||
grpc.ServerStream
|
|
||||||
}
|
|
||||||
|
|
||||||
func (x *nezhaServiceRequestTaskServer) Send(m *Task) error {
|
|
||||||
return x.ServerStream.SendMsg(m)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (x *nezhaServiceRequestTaskServer) Recv() (*TaskResult, error) {
|
|
||||||
m := new(TaskResult)
|
|
||||||
if err := x.ServerStream.RecvMsg(m); err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return m, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func _NezhaService_IOStream_Handler(srv interface{}, stream grpc.ServerStream) error {
|
func _NezhaService_IOStream_Handler(srv interface{}, stream grpc.ServerStream) error {
|
||||||
return srv.(NezhaServiceServer).IOStream(&nezhaServiceIOStreamServer{stream})
|
return srv.(NezhaServiceServer).IOStream(&grpc.GenericServerStream[IOStreamData, IOStreamData]{ServerStream: stream})
|
||||||
}
|
}
|
||||||
|
|
||||||
type NezhaService_IOStreamServer interface {
|
// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
|
||||||
Send(*IOStreamData) error
|
type NezhaService_IOStreamServer = grpc.BidiStreamingServer[IOStreamData, IOStreamData]
|
||||||
Recv() (*IOStreamData, error)
|
|
||||||
grpc.ServerStream
|
|
||||||
}
|
|
||||||
|
|
||||||
type nezhaServiceIOStreamServer struct {
|
|
||||||
grpc.ServerStream
|
|
||||||
}
|
|
||||||
|
|
||||||
func (x *nezhaServiceIOStreamServer) Send(m *IOStreamData) error {
|
|
||||||
return x.ServerStream.SendMsg(m)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (x *nezhaServiceIOStreamServer) Recv() (*IOStreamData, error) {
|
|
||||||
m := new(IOStreamData)
|
|
||||||
if err := x.ServerStream.RecvMsg(m); err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return m, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func _NezhaService_ReportGeoIP_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)
|
in := new(GeoIP)
|
||||||
|
|||||||
194
service/singleton/domain.go
Normal file
194
service/singleton/domain.go
Normal file
@@ -0,0 +1,194 @@
|
|||||||
|
// service/singleton/domain.go
|
||||||
|
package singleton
|
||||||
|
|
||||||
|
import (
|
||||||
|
"crypto/rand"
|
||||||
|
"encoding/hex"
|
||||||
|
"encoding/json"
|
||||||
|
"errors"
|
||||||
|
"fmt"
|
||||||
|
"log"
|
||||||
|
"net"
|
||||||
|
"strings"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"github.com/nezhahq/nezha/model"
|
||||||
|
"gorm.io/datatypes"
|
||||||
|
)
|
||||||
|
|
||||||
|
// GetDomains 获取所有域名记录
|
||||||
|
func GetDomains(scope string) ([]model.Domain, error) {
|
||||||
|
var domains []model.Domain
|
||||||
|
query := DB
|
||||||
|
|
||||||
|
if scope == "public" {
|
||||||
|
// 如果是公开访问,只返回已验证且公开的域名
|
||||||
|
query = query.Where("status IN (?, ?) AND is_public = ?", "verified", "expired", true)
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := query.Find(&domains).Error; err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return domains, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetDomainByID 根据ID获取单个域名记录
|
||||||
|
func GetDomainByID(id uint64) (*model.Domain, error) {
|
||||||
|
var domain model.Domain
|
||||||
|
if err := DB.First(&domain, id).Error; err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return &domain, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// AddDomain 添加一个新的域名,并自动生成验证Token
|
||||||
|
func AddDomain(domainName string) (*model.Domain, error) {
|
||||||
|
b := make([]byte, 16)
|
||||||
|
if _, err := rand.Read(b); err != nil {
|
||||||
|
return nil, fmt.Errorf("无法生成随机Token: %w", err)
|
||||||
|
}
|
||||||
|
token := "nezha-verify-" + hex.EncodeToString(b)
|
||||||
|
|
||||||
|
newDomain := &model.Domain{
|
||||||
|
Domain: strings.ToLower(domainName),
|
||||||
|
VerifyToken: token,
|
||||||
|
Status: "pending",
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := DB.Create(newDomain).Error; err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return newDomain, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// VerifyDomain 验证域名的 TXT 记录是否正确
|
||||||
|
func VerifyDomain(id uint64) (bool, error) {
|
||||||
|
domain, err := GetDomainByID(id) // 直接调用 GetDomainByID
|
||||||
|
if err != nil {
|
||||||
|
return false, err
|
||||||
|
}
|
||||||
|
if domain.Status == "verified" {
|
||||||
|
return true, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
txtRecords, err := net.LookupTXT(domain.Domain)
|
||||||
|
if err != nil {
|
||||||
|
var dnsErr *net.DNSError
|
||||||
|
if errors.As(err, &dnsErr) && dnsErr.IsNotFound {
|
||||||
|
return false, nil
|
||||||
|
}
|
||||||
|
return false, fmt.Errorf("DNS查询失败: %w", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, record := range txtRecords {
|
||||||
|
if record == domain.VerifyToken {
|
||||||
|
domain.Status = "verified"
|
||||||
|
return true, DB.Save(domain).Error
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// UpdateDomainConfig 更新指定域名的配置信息
|
||||||
|
func UpdateDomainConfig(id uint64, billingData datatypes.JSON) (*model.Domain, error) {
|
||||||
|
domain, err := GetDomainByID(id) // 直接调用 GetDomainByID
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
domain.BillingData = billingData
|
||||||
|
if err := DB.Save(domain).Error; err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return domain, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// UpdateDomain 更新域名信息 (重命名并增强)
|
||||||
|
func UpdateDomain(id uint64, req model.DomainUpdateRequest) (*model.Domain, error) { // 使用新的请求体
|
||||||
|
domain, err := GetDomainByID(id)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
domain.IsPublic = req.IsPublic
|
||||||
|
domain.BillingData = req.BillingData
|
||||||
|
if err := DB.Save(domain).Error; err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return domain, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeleteDomain 删除一个域名记录
|
||||||
|
func DeleteDomain(id uint64) error {
|
||||||
|
return DB.Delete(&model.Domain{}, id).Error
|
||||||
|
}
|
||||||
|
|
||||||
|
// CronJobForDomainStatus 检查域名到期和自动续费的定时任务
|
||||||
|
func CronJobForDomainStatus() {
|
||||||
|
log.Println("NEZHA>> Cron::开始执行域名状态检查任务")
|
||||||
|
var domains []model.Domain
|
||||||
|
if err := DB.Where("status = ?", "verified").Find(&domains).Error; err != nil {
|
||||||
|
log.Printf("NEZHA>> Cron::Error fetching domains: %v", err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
now := time.Now()
|
||||||
|
|
||||||
|
for i := range domains {
|
||||||
|
d := domains[i]
|
||||||
|
if d.BillingData == nil {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
var billing model.BillingDataMod
|
||||||
|
if err := json.Unmarshal(d.BillingData, &billing); err != nil {
|
||||||
|
log.Printf("NEZHA>> Cron::Error parsing billing data for domain %s: %v", d.Domain, err)
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
if billing.EndDate == "" {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
endDate, err := time.Parse(time.RFC3339, billing.EndDate)
|
||||||
|
if err != nil {
|
||||||
|
log.Printf("NEZHA>> Cron::Error parsing end date for domain %s: %v", d.Domain, err)
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
if now.After(endDate) {
|
||||||
|
if billing.AutoRenewal == "1" {
|
||||||
|
var newEndDate time.Time
|
||||||
|
renewalYears := 0
|
||||||
|
renewalMonths := 0
|
||||||
|
switch billing.Cycle {
|
||||||
|
case "年":
|
||||||
|
renewalYears = 1
|
||||||
|
case "月":
|
||||||
|
renewalMonths = 1
|
||||||
|
default:
|
||||||
|
log.Printf("NEZHA>> Cron::未知续费周期 '%s' for domain %s", billing.Cycle, d.Domain)
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
newEndDate = endDate.AddDate(renewalYears, renewalMonths, 0)
|
||||||
|
billing.EndDate = newEndDate.Format(time.RFC3339)
|
||||||
|
newBillingData, _ := json.Marshal(billing)
|
||||||
|
d.BillingData = newBillingData
|
||||||
|
log.Printf("NEZHA>> Cron::域名 %s 已自动续费至 %s", d.Domain, billing.EndDate)
|
||||||
|
if err := DB.Save(&d).Error; err != nil {
|
||||||
|
log.Printf("NEZHA>> Cron::Error saving auto-renewed domain %s: %v", d.Domain, err)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
d.Status = "expired"
|
||||||
|
log.Printf("NEZHA>> Cron::域名 %s 已过期", d.Domain)
|
||||||
|
if err := DB.Save(&d).Error; err != nil {
|
||||||
|
log.Printf("NEZHA>> Cron::Error marking domain %s as expired: %v", d.Domain, err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
log.Println("NEZHA>> Cron::域名状态检查任务执行完毕")
|
||||||
|
}
|
||||||
@@ -89,7 +89,7 @@ func InitDBFromPath(path string) error {
|
|||||||
model.Notification{}, model.AlertRule{}, model.Service{}, model.NotificationGroupNotification{},
|
model.Notification{}, model.AlertRule{}, model.Service{}, model.NotificationGroupNotification{},
|
||||||
model.ServiceHistory{}, model.Cron{}, model.Transfer{}, model.ServerGroupServer{},
|
model.ServiceHistory{}, model.Cron{}, model.Transfer{}, model.ServerGroupServer{},
|
||||||
model.NAT{}, model.DDNSProfile{}, model.NotificationGroupNotification{},
|
model.NAT{}, model.DDNSProfile{}, model.NotificationGroupNotification{},
|
||||||
model.WAF{}, model.Oauth2Bind{})
|
model.WAF{}, model.Oauth2Bind{}, model.Domain{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user