节点自动升级功能之前的版本
This commit is contained in:
@@ -34,7 +34,7 @@ func init() {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *HTTPDNSClusterDAO) CreateCluster(tx *dbs.Tx, name string, serviceDomain string, defaultTTL int32, fallbackTimeoutMs int32, installDir string, tlsPolicyJSON []byte, isOn bool, isDefault bool) (int64, error) {
|
func (this *HTTPDNSClusterDAO) CreateCluster(tx *dbs.Tx, name string, serviceDomain string, defaultTTL int32, fallbackTimeoutMs int32, installDir string, tlsPolicyJSON []byte, isOn bool, isDefault bool, autoRemoteStart bool, accessLogIsOn bool) (int64, error) {
|
||||||
if isDefault {
|
if isDefault {
|
||||||
err := this.Query(tx).
|
err := this.Query(tx).
|
||||||
State(HTTPDNSClusterStateEnabled).
|
State(HTTPDNSClusterStateEnabled).
|
||||||
@@ -53,6 +53,8 @@ func (this *HTTPDNSClusterDAO) CreateCluster(tx *dbs.Tx, name string, serviceDom
|
|||||||
op.InstallDir = installDir
|
op.InstallDir = installDir
|
||||||
op.IsOn = isOn
|
op.IsOn = isOn
|
||||||
op.IsDefault = isDefault
|
op.IsDefault = isDefault
|
||||||
|
op.AutoRemoteStart = autoRemoteStart
|
||||||
|
op.AccessLogIsOn = accessLogIsOn
|
||||||
op.CreatedAt = time.Now().Unix()
|
op.CreatedAt = time.Now().Unix()
|
||||||
op.UpdatedAt = time.Now().Unix()
|
op.UpdatedAt = time.Now().Unix()
|
||||||
op.State = HTTPDNSClusterStateEnabled
|
op.State = HTTPDNSClusterStateEnabled
|
||||||
@@ -66,7 +68,7 @@ func (this *HTTPDNSClusterDAO) CreateCluster(tx *dbs.Tx, name string, serviceDom
|
|||||||
return types.Int64(op.Id), nil
|
return types.Int64(op.Id), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *HTTPDNSClusterDAO) UpdateCluster(tx *dbs.Tx, clusterId int64, name string, serviceDomain string, defaultTTL int32, fallbackTimeoutMs int32, installDir string, tlsPolicyJSON []byte, isOn bool, isDefault bool) error {
|
func (this *HTTPDNSClusterDAO) UpdateCluster(tx *dbs.Tx, clusterId int64, name string, serviceDomain string, defaultTTL int32, fallbackTimeoutMs int32, installDir string, tlsPolicyJSON []byte, isOn bool, isDefault bool, autoRemoteStart bool, accessLogIsOn bool) error {
|
||||||
if isDefault {
|
if isDefault {
|
||||||
err := this.Query(tx).
|
err := this.Query(tx).
|
||||||
State(HTTPDNSClusterStateEnabled).
|
State(HTTPDNSClusterStateEnabled).
|
||||||
@@ -87,6 +89,8 @@ func (this *HTTPDNSClusterDAO) UpdateCluster(tx *dbs.Tx, clusterId int64, name s
|
|||||||
op.InstallDir = installDir
|
op.InstallDir = installDir
|
||||||
op.IsOn = isOn
|
op.IsOn = isOn
|
||||||
op.IsDefault = isDefault
|
op.IsDefault = isDefault
|
||||||
|
op.AutoRemoteStart = autoRemoteStart
|
||||||
|
op.AccessLogIsOn = accessLogIsOn
|
||||||
op.UpdatedAt = time.Now().Unix()
|
op.UpdatedAt = time.Now().Unix()
|
||||||
if len(tlsPolicyJSON) > 0 {
|
if len(tlsPolicyJSON) > 0 {
|
||||||
op.TLSPolicy = tlsPolicyJSON
|
op.TLSPolicy = tlsPolicyJSON
|
||||||
|
|||||||
@@ -13,6 +13,8 @@ type HTTPDNSCluster struct {
|
|||||||
FallbackTimeoutMs int32 `field:"fallbackTimeoutMs"` // 降级超时
|
FallbackTimeoutMs int32 `field:"fallbackTimeoutMs"` // 降级超时
|
||||||
InstallDir string `field:"installDir"` // 安装目录
|
InstallDir string `field:"installDir"` // 安装目录
|
||||||
TLSPolicy dbs.JSON `field:"tlsPolicy"` // TLS策略
|
TLSPolicy dbs.JSON `field:"tlsPolicy"` // TLS策略
|
||||||
|
AutoRemoteStart bool `field:"autoRemoteStart"` // 自动远程启动
|
||||||
|
AccessLogIsOn bool `field:"accessLogIsOn"` // 访问日志是否开启
|
||||||
CreatedAt uint64 `field:"createdAt"` // 创建时间
|
CreatedAt uint64 `field:"createdAt"` // 创建时间
|
||||||
UpdatedAt uint64 `field:"updatedAt"` // 修改时间
|
UpdatedAt uint64 `field:"updatedAt"` // 修改时间
|
||||||
State uint8 `field:"state"` // 记录状态
|
State uint8 `field:"state"` // 记录状态
|
||||||
@@ -28,6 +30,8 @@ type HTTPDNSClusterOperator struct {
|
|||||||
FallbackTimeoutMs any // 降级超时
|
FallbackTimeoutMs any // 降级超时
|
||||||
InstallDir any // 安装目录
|
InstallDir any // 安装目录
|
||||||
TLSPolicy any // TLS策略
|
TLSPolicy any // TLS策略
|
||||||
|
AutoRemoteStart any // 自动远程启动
|
||||||
|
AccessLogIsOn any // 访问日志是否开启
|
||||||
CreatedAt any // 创建时间
|
CreatedAt any // 创建时间
|
||||||
UpdatedAt any // 修改时间
|
UpdatedAt any // 修改时间
|
||||||
State any // 记录状态
|
State any // 记录状态
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ type DeployManager struct {
|
|||||||
|
|
||||||
nodeFiles []*DeployFile
|
nodeFiles []*DeployFile
|
||||||
nsNodeFiles []*DeployFile
|
nsNodeFiles []*DeployFile
|
||||||
|
httpdnsNodeFiles []*DeployFile
|
||||||
|
|
||||||
locker sync.Mutex
|
locker sync.Mutex
|
||||||
}
|
}
|
||||||
@@ -28,6 +29,7 @@ func NewDeployManager() *DeployManager {
|
|||||||
}
|
}
|
||||||
manager.LoadNodeFiles()
|
manager.LoadNodeFiles()
|
||||||
manager.LoadNSNodeFiles()
|
manager.LoadNSNodeFiles()
|
||||||
|
manager.LoadHTTPDNSNodeFiles()
|
||||||
return manager
|
return manager
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -141,6 +143,61 @@ func (this *DeployManager) FindNSNodeFile(os string, arch string) *DeployFile {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// LoadHTTPDNSNodeFiles 加载所有HTTPDNS节点安装文件
|
||||||
|
func (this *DeployManager) LoadHTTPDNSNodeFiles() []*DeployFile {
|
||||||
|
this.locker.Lock()
|
||||||
|
defer this.locker.Unlock()
|
||||||
|
|
||||||
|
if len(this.httpdnsNodeFiles) > 0 {
|
||||||
|
return this.httpdnsNodeFiles
|
||||||
|
}
|
||||||
|
|
||||||
|
var keyMap = map[string]*DeployFile{} // key => File
|
||||||
|
|
||||||
|
var reg = regexp.MustCompile(`^edge-httpdns-(\w+)-(\w+)-v([0-9.]+)\.zip$`)
|
||||||
|
for _, file := range files.NewFile(this.dir).List() {
|
||||||
|
var name = file.Name()
|
||||||
|
if !reg.MatchString(name) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
var matches = reg.FindStringSubmatch(name)
|
||||||
|
var osName = matches[1]
|
||||||
|
var arch = matches[2]
|
||||||
|
var version = matches[3]
|
||||||
|
|
||||||
|
var key = osName + "_" + arch
|
||||||
|
oldFile, ok := keyMap[key]
|
||||||
|
if ok && stringutil.VersionCompare(oldFile.Version, version) > 0 {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
keyMap[key] = &DeployFile{
|
||||||
|
OS: osName,
|
||||||
|
Arch: arch,
|
||||||
|
Version: version,
|
||||||
|
Path: file.Path(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var result = []*DeployFile{}
|
||||||
|
for _, v := range keyMap {
|
||||||
|
result = append(result, v)
|
||||||
|
}
|
||||||
|
|
||||||
|
this.httpdnsNodeFiles = result
|
||||||
|
|
||||||
|
return result
|
||||||
|
}
|
||||||
|
|
||||||
|
// FindHTTPDNSNodeFile 查找特定平台的HTTPDNS节点安装文件
|
||||||
|
func (this *DeployManager) FindHTTPDNSNodeFile(os string, arch string) *DeployFile {
|
||||||
|
for _, file := range this.LoadHTTPDNSNodeFiles() {
|
||||||
|
if file.OS == os && file.Arch == arch {
|
||||||
|
return file
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
// Reload 重置缓存
|
// Reload 重置缓存
|
||||||
func (this *DeployManager) Reload() {
|
func (this *DeployManager) Reload() {
|
||||||
this.locker.Lock()
|
this.locker.Lock()
|
||||||
@@ -148,4 +205,5 @@ func (this *DeployManager) Reload() {
|
|||||||
|
|
||||||
this.nodeFiles = nil
|
this.nodeFiles = nil
|
||||||
this.nsNodeFiles = nil
|
this.nsNodeFiles = nil
|
||||||
|
this.httpdnsNodeFiles = nil
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,6 +23,8 @@ func toPBCluster(cluster *models.HTTPDNSCluster) *pb.HTTPDNSCluster {
|
|||||||
TlsPolicyJSON: cluster.TLSPolicy,
|
TlsPolicyJSON: cluster.TLSPolicy,
|
||||||
CreatedAt: int64(cluster.CreatedAt),
|
CreatedAt: int64(cluster.CreatedAt),
|
||||||
UpdatedAt: int64(cluster.UpdatedAt),
|
UpdatedAt: int64(cluster.UpdatedAt),
|
||||||
|
AutoRemoteStart: cluster.AutoRemoteStart,
|
||||||
|
AccessLogIsOn: cluster.AccessLogIsOn,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ func (this *HTTPDNSClusterService) CreateHTTPDNSCluster(ctx context.Context, req
|
|||||||
}
|
}
|
||||||
var clusterId int64
|
var clusterId int64
|
||||||
err = this.RunTx(func(tx *dbs.Tx) error {
|
err = this.RunTx(func(tx *dbs.Tx) error {
|
||||||
clusterId, err = models.SharedHTTPDNSClusterDAO.CreateCluster(tx, req.Name, req.ServiceDomain, req.DefaultTTL, req.FallbackTimeoutMs, req.InstallDir, req.TlsPolicyJSON, req.IsOn, req.IsDefault)
|
clusterId, err = models.SharedHTTPDNSClusterDAO.CreateCluster(tx, req.Name, req.ServiceDomain, req.DefaultTTL, req.FallbackTimeoutMs, req.InstallDir, req.TlsPolicyJSON, req.IsOn, req.IsDefault, req.AutoRemoteStart, req.AccessLogIsOn)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@@ -43,7 +43,7 @@ func (this *HTTPDNSClusterService) UpdateHTTPDNSCluster(ctx context.Context, req
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
err = this.RunTx(func(tx *dbs.Tx) error {
|
err = this.RunTx(func(tx *dbs.Tx) error {
|
||||||
err = models.SharedHTTPDNSClusterDAO.UpdateCluster(tx, req.ClusterId, req.Name, req.ServiceDomain, req.DefaultTTL, req.FallbackTimeoutMs, req.InstallDir, req.TlsPolicyJSON, req.IsOn, req.IsDefault)
|
err = models.SharedHTTPDNSClusterDAO.UpdateCluster(tx, req.ClusterId, req.Name, req.ServiceDomain, req.DefaultTTL, req.FallbackTimeoutMs, req.InstallDir, req.TlsPolicyJSON, req.IsOn, req.IsDefault, req.AutoRemoteStart, req.AccessLogIsOn)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,14 +4,19 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"errors"
|
"errors"
|
||||||
|
"io"
|
||||||
|
"path/filepath"
|
||||||
|
|
||||||
"github.com/TeaOSLab/EdgeAPI/internal/db/models"
|
"github.com/TeaOSLab/EdgeAPI/internal/db/models"
|
||||||
"github.com/TeaOSLab/EdgeAPI/internal/goman"
|
"github.com/TeaOSLab/EdgeAPI/internal/goman"
|
||||||
"github.com/TeaOSLab/EdgeAPI/internal/installers"
|
"github.com/TeaOSLab/EdgeAPI/internal/installers"
|
||||||
"github.com/TeaOSLab/EdgeAPI/internal/rpc/services"
|
"github.com/TeaOSLab/EdgeAPI/internal/rpc/services"
|
||||||
|
rpcutils "github.com/TeaOSLab/EdgeAPI/internal/rpc/utils"
|
||||||
"github.com/TeaOSLab/EdgeCommon/pkg/nodeconfigs"
|
"github.com/TeaOSLab/EdgeCommon/pkg/nodeconfigs"
|
||||||
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
|
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
|
||||||
"github.com/iwind/TeaGo/dbs"
|
"github.com/iwind/TeaGo/dbs"
|
||||||
"github.com/iwind/TeaGo/logs"
|
"github.com/iwind/TeaGo/logs"
|
||||||
|
stringutil "github.com/iwind/TeaGo/utils/string"
|
||||||
)
|
)
|
||||||
|
|
||||||
// HTTPDNSNodeService HTTPDNS节点服务
|
// HTTPDNSNodeService HTTPDNS节点服务
|
||||||
@@ -216,6 +221,59 @@ func (this *HTTPDNSNodeService) UpdateHTTPDNSNodeLogin(ctx context.Context, req
|
|||||||
return this.Success()
|
return this.Success()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// CheckHTTPDNSNodeLatestVersion 检查HTTPDNS节点新版本
|
||||||
|
func (this *HTTPDNSNodeService) CheckHTTPDNSNodeLatestVersion(ctx context.Context, req *pb.CheckHTTPDNSNodeLatestVersionRequest) (*pb.CheckHTTPDNSNodeLatestVersionResponse, error) {
|
||||||
|
_, _, _, err := rpcutils.ValidateRequest(ctx, rpcutils.UserTypeAdmin, rpcutils.UserTypeHTTPDNS)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
deployFiles := installers.SharedDeployManager.LoadHTTPDNSNodeFiles()
|
||||||
|
for _, file := range deployFiles {
|
||||||
|
if file.OS == req.Os && file.Arch == req.Arch && stringutil.VersionCompare(file.Version, req.CurrentVersion) > 0 {
|
||||||
|
return &pb.CheckHTTPDNSNodeLatestVersionResponse{
|
||||||
|
HasNewVersion: true,
|
||||||
|
NewVersion: file.Version,
|
||||||
|
}, nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return &pb.CheckHTTPDNSNodeLatestVersionResponse{HasNewVersion: false}, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// DownloadHTTPDNSNodeInstallationFile 下载最新HTTPDNS节点安装文件
|
||||||
|
func (this *HTTPDNSNodeService) DownloadHTTPDNSNodeInstallationFile(ctx context.Context, req *pb.DownloadHTTPDNSNodeInstallationFileRequest) (*pb.DownloadHTTPDNSNodeInstallationFileResponse, error) {
|
||||||
|
nodeId, err := this.ValidateHTTPDNSNode(ctx)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
var file = installers.SharedDeployManager.FindHTTPDNSNodeFile(req.Os, req.Arch)
|
||||||
|
if file == nil {
|
||||||
|
return &pb.DownloadHTTPDNSNodeInstallationFileResponse{}, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
sum, err := file.Sum()
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
data, offset, err := file.Read(req.ChunkOffset)
|
||||||
|
if err != nil && err != io.EOF {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
// 增加下载速度监控
|
||||||
|
installers.SharedUpgradeLimiter.UpdateNodeBytes(nodeconfigs.NodeRoleHTTPDNS, nodeId, int64(len(data)))
|
||||||
|
|
||||||
|
return &pb.DownloadHTTPDNSNodeInstallationFileResponse{
|
||||||
|
Sum: sum,
|
||||||
|
Offset: offset,
|
||||||
|
ChunkData: data,
|
||||||
|
Version: file.Version,
|
||||||
|
Filename: filepath.Base(file.Path),
|
||||||
|
}, nil
|
||||||
|
}
|
||||||
|
|
||||||
func shouldTriggerHTTPDNSInstall(installStatusJSON []byte) bool {
|
func shouldTriggerHTTPDNSInstall(installStatusJSON []byte) bool {
|
||||||
if len(installStatusJSON) == 0 {
|
if len(installStatusJSON) == 0 {
|
||||||
return false
|
return false
|
||||||
|
|||||||
@@ -11,7 +11,6 @@ import (
|
|||||||
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
|
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
|
||||||
"github.com/TeaOSLab/EdgeCommon/pkg/userconfigs"
|
"github.com/TeaOSLab/EdgeCommon/pkg/userconfigs"
|
||||||
"github.com/iwind/TeaGo/dbs"
|
"github.com/iwind/TeaGo/dbs"
|
||||||
"github.com/iwind/TeaGo/lists"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// FindUserPriceInfo 读取用户计费信息
|
// FindUserPriceInfo 读取用户计费信息
|
||||||
@@ -145,9 +144,6 @@ func (this *UserService) RegisterUser(ctx context.Context, req *pb.RegisterUserR
|
|||||||
}
|
}
|
||||||
|
|
||||||
features := registerConfig.Features
|
features := registerConfig.Features
|
||||||
if registerConfig.HTTPDNSIsOn && !lists.ContainsString(features, userconfigs.UserFeatureCodeHTTPDNS) {
|
|
||||||
features = append(features, userconfigs.UserFeatureCodeHTTPDNS)
|
|
||||||
}
|
|
||||||
|
|
||||||
// 创建用户
|
// 创建用户
|
||||||
userId, err := models.SharedUserDAO.CreateUser(tx, req.Username, req.Password, req.Fullname, req.Mobile, "", req.Email, "", req.Source, registerConfig.ClusterId, features, req.Ip, !registerConfig.RequireVerification)
|
userId, err := models.SharedUserDAO.CreateUser(tx, req.Username, req.Password, req.Fullname, req.Mobile, "", req.Email, "", req.Source, registerConfig.ClusterId, features, req.Ip, !registerConfig.RequireVerification)
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ func (this *CustomRecordsCreatePopupAction) RunGet(params struct {
|
|||||||
"lineCountry": "默认",
|
"lineCountry": "默认",
|
||||||
"ruleName": "",
|
"ruleName": "",
|
||||||
"weightEnabled": false,
|
"weightEnabled": false,
|
||||||
"ttl": 30,
|
"ttl": 60,
|
||||||
"isOn": true,
|
"isOn": true,
|
||||||
"recordItemsJson": `[{"type":"A","value":"","weight":100}]`,
|
"recordItemsJson": `[{"type":"A","value":"","weight":100}]`,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -47,6 +47,8 @@ func (this *ClusterSettingsAction) RunGet(params struct {
|
|||||||
"fallbackTimeout": cluster.GetInt("fallbackTimeout"),
|
"fallbackTimeout": cluster.GetInt("fallbackTimeout"),
|
||||||
"installDir": cluster.GetString("installDir"),
|
"installDir": cluster.GetString("installDir"),
|
||||||
"isOn": cluster.GetBool("isOn"),
|
"isOn": cluster.GetBool("isOn"),
|
||||||
|
"autoRemoteStart": cluster.GetBool("autoRemoteStart"),
|
||||||
|
"accessLogIsOn": cluster.GetBool("accessLogIsOn"),
|
||||||
}
|
}
|
||||||
if settings.GetInt("cacheTtl") <= 0 {
|
if settings.GetInt("cacheTtl") <= 0 {
|
||||||
settings["cacheTtl"] = 60
|
settings["cacheTtl"] = 60
|
||||||
@@ -110,6 +112,8 @@ func (this *ClusterSettingsAction) RunPost(params struct {
|
|||||||
FallbackTimeout int32
|
FallbackTimeout int32
|
||||||
InstallDir string
|
InstallDir string
|
||||||
IsOn bool
|
IsOn bool
|
||||||
|
AutoRemoteStart bool
|
||||||
|
AccessLogIsOn bool
|
||||||
|
|
||||||
Addresses []byte
|
Addresses []byte
|
||||||
SslPolicyJSON []byte
|
SslPolicyJSON []byte
|
||||||
@@ -183,6 +187,8 @@ func (this *ClusterSettingsAction) RunPost(params struct {
|
|||||||
TlsPolicyJSON: tlsPolicyJSON,
|
TlsPolicyJSON: tlsPolicyJSON,
|
||||||
IsOn: params.IsOn,
|
IsOn: params.IsOn,
|
||||||
IsDefault: false,
|
IsDefault: false,
|
||||||
|
AutoRemoteStart: params.AutoRemoteStart,
|
||||||
|
AccessLogIsOn: params.AccessLogIsOn,
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
this.ErrorPage(err)
|
this.ErrorPage(err)
|
||||||
|
|||||||
@@ -92,6 +92,8 @@ func findClusterMap(parent *actionutils.ParentAction, clusterID int64) (maps.Map
|
|||||||
"isOn": cluster.GetIsOn(),
|
"isOn": cluster.GetIsOn(),
|
||||||
"isDefault": cluster.GetIsDefault(),
|
"isDefault": cluster.GetIsDefault(),
|
||||||
"tlsPolicyJSON": cluster.GetTlsPolicyJSON(),
|
"tlsPolicyJSON": cluster.GetTlsPolicyJSON(),
|
||||||
|
"autoRemoteStart": cluster.GetAutoRemoteStart(),
|
||||||
|
"accessLogIsOn": cluster.GetAccessLogIsOn(),
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,7 +10,6 @@ import (
|
|||||||
"github.com/TeaOSLab/EdgeCommon/pkg/systemconfigs"
|
"github.com/TeaOSLab/EdgeCommon/pkg/systemconfigs"
|
||||||
"github.com/TeaOSLab/EdgeCommon/pkg/userconfigs"
|
"github.com/TeaOSLab/EdgeCommon/pkg/userconfigs"
|
||||||
"github.com/iwind/TeaGo/actions"
|
"github.com/iwind/TeaGo/actions"
|
||||||
"github.com/iwind/TeaGo/lists"
|
|
||||||
"github.com/iwind/TeaGo/maps"
|
"github.com/iwind/TeaGo/maps"
|
||||||
"github.com/xlzd/gotp"
|
"github.com/xlzd/gotp"
|
||||||
)
|
)
|
||||||
@@ -184,9 +183,6 @@ func (this *CreatePopupAction) RunPost(params struct {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
var featureCodes = config.Features
|
var featureCodes = config.Features
|
||||||
if config.HTTPDNSIsOn && !lists.ContainsString(featureCodes, userconfigs.UserFeatureCodeHTTPDNS) {
|
|
||||||
featureCodes = append(featureCodes, userconfigs.UserFeatureCodeHTTPDNS)
|
|
||||||
}
|
|
||||||
|
|
||||||
_, err = this.RPC().UserRPC().UpdateUserFeatures(this.AdminContext(), &pb.UpdateUserFeaturesRequest{
|
_, err = this.RPC().UserRPC().UpdateUserFeatures(this.AdminContext(), &pb.UpdateUserFeaturesRequest{
|
||||||
UserId: userId,
|
UserId: userId,
|
||||||
|
|||||||
@@ -7,6 +7,8 @@ import (
|
|||||||
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/users/userutils"
|
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/users/userutils"
|
||||||
"github.com/TeaOSLab/EdgeCommon/pkg/langs/codes"
|
"github.com/TeaOSLab/EdgeCommon/pkg/langs/codes"
|
||||||
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
|
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
|
||||||
|
"github.com/TeaOSLab/EdgeCommon/pkg/systemconfigs"
|
||||||
|
"github.com/TeaOSLab/EdgeCommon/pkg/userconfigs"
|
||||||
"github.com/iwind/TeaGo/actions"
|
"github.com/iwind/TeaGo/actions"
|
||||||
"github.com/iwind/TeaGo/maps"
|
"github.com/iwind/TeaGo/maps"
|
||||||
"github.com/xlzd/gotp"
|
"github.com/xlzd/gotp"
|
||||||
@@ -87,17 +89,13 @@ func (this *UpdateAction) RunGet(params struct {
|
|||||||
this.Data["clusterId"] = user.NodeCluster.Id
|
this.Data["clusterId"] = user.NodeCluster.Id
|
||||||
}
|
}
|
||||||
|
|
||||||
// 检查用户是否开通了 HTTPDNS 功能
|
// 检查全局是否启用了 HTTPDNS 功能
|
||||||
var hasHTTPDNSFeature = false
|
var hasHTTPDNSFeature = false
|
||||||
userFeaturesResp, err := this.RPC().UserRPC().FindUserFeatures(this.AdminContext(), &pb.FindUserFeaturesRequest{UserId: params.UserId})
|
sysResp, sysErr := this.RPC().SysSettingRPC().ReadSysSetting(this.AdminContext(), &pb.ReadSysSettingRequest{Code: systemconfigs.SettingCodeUserRegisterConfig})
|
||||||
if err != nil {
|
if sysErr == nil && len(sysResp.ValueJSON) > 0 {
|
||||||
this.ErrorPage(err)
|
var regConfig = userconfigs.DefaultUserRegisterConfig()
|
||||||
return
|
if json.Unmarshal(sysResp.ValueJSON, regConfig) == nil {
|
||||||
}
|
hasHTTPDNSFeature = regConfig.HTTPDNSIsOn
|
||||||
for _, f := range userFeaturesResp.Features {
|
|
||||||
if f.Code == "httpdns" {
|
|
||||||
hasHTTPDNSFeature = true
|
|
||||||
break
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.Data["hasHTTPDNSFeature"] = hasHTTPDNSFeature
|
this.Data["hasHTTPDNSFeature"] = hasHTTPDNSFeature
|
||||||
|
|||||||
@@ -74,7 +74,7 @@
|
|||||||
vm.record.lineContinent = vm.record.lineContinent || "默认";
|
vm.record.lineContinent = vm.record.lineContinent || "默认";
|
||||||
vm.record.lineCountry = vm.record.lineCountry || "默认";
|
vm.record.lineCountry = vm.record.lineCountry || "默认";
|
||||||
vm.record.ruleName = vm.record.ruleName || "";
|
vm.record.ruleName = vm.record.ruleName || "";
|
||||||
vm.record.ttl = vm.record.ttl || 30;
|
vm.record.ttl = vm.record.ttl || 60;
|
||||||
vm.record.weightEnabled = vm.normalizeBoolean(vm.record.weightEnabled, false);
|
vm.record.weightEnabled = vm.normalizeBoolean(vm.record.weightEnabled, false);
|
||||||
vm.record.isOn = vm.normalizeBoolean(vm.record.isOn, true);
|
vm.record.isOn = vm.normalizeBoolean(vm.record.isOn, true);
|
||||||
|
|
||||||
|
|||||||
@@ -20,8 +20,8 @@
|
|||||||
<td>配置内容</td>
|
<td>配置内容</td>
|
||||||
<td>
|
<td>
|
||||||
<source-code-box id="rpc-code" type="text/yaml">rpc.endpoints: [ {{apiEndpoints}} ]
|
<source-code-box id="rpc-code" type="text/yaml">rpc.endpoints: [ {{apiEndpoints}} ]
|
||||||
nodeId: "{{node.uniqueId}}"
|
nodeId: "{{node.uniqueId}}"
|
||||||
secret: "{{node.secret}}"</source-code-box>
|
secret: "{{node.secret}}"</source-code-box>
|
||||||
<p class="comment">每个节点的配置文件内容均不相同,不能混用。</p>
|
<p class="comment">每个节点的配置文件内容均不相同,不能混用。</p>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
@@ -81,8 +81,8 @@
|
|||||||
<td>配置内容</td>
|
<td>配置内容</td>
|
||||||
<td>
|
<td>
|
||||||
<source-code-box id="rpc-code" type="text/yaml">rpc.endpoints: [ {{apiEndpoints}} ]
|
<source-code-box id="rpc-code" type="text/yaml">rpc.endpoints: [ {{apiEndpoints}} ]
|
||||||
nodeId: "{{node.uniqueId}}"
|
nodeId: "{{node.uniqueId}}"
|
||||||
secret: "{{node.secret}}"</source-code-box>
|
secret: "{{node.secret}}"</source-code-box>
|
||||||
<p class="comment">每个节点的配置文件内容均不相同,不能混用。</p>
|
<p class="comment">每个节点的配置文件内容均不相同,不能混用。</p>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|||||||
@@ -45,7 +45,8 @@
|
|||||||
<td>默认解析 TTL</td>
|
<td>默认解析 TTL</td>
|
||||||
<td>
|
<td>
|
||||||
<div class="ui input right labeled">
|
<div class="ui input right labeled">
|
||||||
<input type="text" name="cacheTtl" maxlength="5" v-model="settings.cacheTtl" style="width: 6em" />
|
<input type="text" name="cacheTtl" maxlength="5" v-model="settings.cacheTtl"
|
||||||
|
style="width: 6em" />
|
||||||
<span class="ui label">秒</span>
|
<span class="ui label">秒</span>
|
||||||
</div>
|
</div>
|
||||||
<p class="comment">SDK 通过 HTTPDNS 解析域名时返回的默认 TTL。</p>
|
<p class="comment">SDK 通过 HTTPDNS 解析域名时返回的默认 TTL。</p>
|
||||||
@@ -55,12 +56,33 @@
|
|||||||
<td>降级超时容忍度</td>
|
<td>降级超时容忍度</td>
|
||||||
<td>
|
<td>
|
||||||
<div class="ui input right labeled">
|
<div class="ui input right labeled">
|
||||||
<input type="text" name="fallbackTimeout" maxlength="5" v-model="settings.fallbackTimeout" style="width: 6em" />
|
<input type="text" name="fallbackTimeout" maxlength="5" v-model="settings.fallbackTimeout"
|
||||||
|
style="width: 6em" />
|
||||||
<span class="ui label">毫秒</span>
|
<span class="ui label">毫秒</span>
|
||||||
</div>
|
</div>
|
||||||
<p class="comment">节点回源查询上游 DNS 时的最大等待时间。</p>
|
<p class="comment">节点回源查询上游 DNS 时的最大等待时间。</p>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>自动远程启动</td>
|
||||||
|
<td>
|
||||||
|
<div class="ui checkbox">
|
||||||
|
<input type="checkbox" name="autoRemoteStart" value="1" v-model="settings.autoRemoteStart" />
|
||||||
|
<label></label>
|
||||||
|
</div>
|
||||||
|
<p class="comment">当检测到节点离线时,自动尝试远程启动(前提是节点已经设置了SSH登录认证)。</p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>访问日志</td>
|
||||||
|
<td>
|
||||||
|
<div class="ui checkbox">
|
||||||
|
<input type="checkbox" name="accessLogIsOn" value="1" v-model="settings.accessLogIsOn" />
|
||||||
|
<label></label>
|
||||||
|
</div>
|
||||||
|
<p class="comment">启用后,HTTPDNS 节点将会记录客户端的请求访问日志。</p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>启用当前集群</td>
|
<td>启用当前集群</td>
|
||||||
<td>
|
<td>
|
||||||
@@ -77,12 +99,14 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<td class="title">绑定端口 *</td>
|
<td class="title">绑定端口 *</td>
|
||||||
<td>
|
<td>
|
||||||
<network-addresses-box :v-url="'/httpdns/addPortPopup'" :v-addresses="tlsConfig.listen" :v-protocol="'tls'" :v-support-range="true"></network-addresses-box>
|
<network-addresses-box :v-url="'/httpdns/addPortPopup'" :v-addresses="tlsConfig.listen"
|
||||||
|
:v-protocol="'tls'" :v-support-range="true"></network-addresses-box>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
<ssl-config-box v-show="activeSection == 'tls'" :v-ssl-policy="tlsConfig.sslPolicy" :v-protocol="'tls'"></ssl-config-box>
|
<ssl-config-box v-show="activeSection == 'tls'" :v-ssl-policy="tlsConfig.sslPolicy"
|
||||||
|
:v-protocol="'tls'"></ssl-config-box>
|
||||||
|
|
||||||
<submit-btn></submit-btn>
|
<submit-btn></submit-btn>
|
||||||
</form>
|
</form>
|
||||||
|
|||||||
@@ -36,6 +36,8 @@ type HTTPDNSCluster struct {
|
|||||||
TlsPolicyJSON []byte `protobuf:"bytes,9,opt,name=tlsPolicyJSON,proto3" json:"tlsPolicyJSON,omitempty"`
|
TlsPolicyJSON []byte `protobuf:"bytes,9,opt,name=tlsPolicyJSON,proto3" json:"tlsPolicyJSON,omitempty"`
|
||||||
CreatedAt int64 `protobuf:"varint,10,opt,name=createdAt,proto3" json:"createdAt,omitempty"`
|
CreatedAt int64 `protobuf:"varint,10,opt,name=createdAt,proto3" json:"createdAt,omitempty"`
|
||||||
UpdatedAt int64 `protobuf:"varint,11,opt,name=updatedAt,proto3" json:"updatedAt,omitempty"`
|
UpdatedAt int64 `protobuf:"varint,11,opt,name=updatedAt,proto3" json:"updatedAt,omitempty"`
|
||||||
|
AutoRemoteStart bool `protobuf:"varint,12,opt,name=autoRemoteStart,proto3" json:"autoRemoteStart,omitempty"`
|
||||||
|
AccessLogIsOn bool `protobuf:"varint,13,opt,name=accessLogIsOn,proto3" json:"accessLogIsOn,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *HTTPDNSCluster) Reset() {
|
func (x *HTTPDNSCluster) Reset() {
|
||||||
@@ -145,6 +147,20 @@ func (x *HTTPDNSCluster) GetUpdatedAt() int64 {
|
|||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (x *HTTPDNSCluster) GetAutoRemoteStart() bool {
|
||||||
|
if x != nil {
|
||||||
|
return x.AutoRemoteStart
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *HTTPDNSCluster) GetAccessLogIsOn() bool {
|
||||||
|
if x != nil {
|
||||||
|
return x.AccessLogIsOn
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
var File_models_model_httpdns_cluster_proto protoreflect.FileDescriptor
|
var File_models_model_httpdns_cluster_proto protoreflect.FileDescriptor
|
||||||
|
|
||||||
var file_models_model_httpdns_cluster_proto_rawDesc = []byte{
|
var file_models_model_httpdns_cluster_proto_rawDesc = []byte{
|
||||||
|
|||||||
@@ -33,6 +33,8 @@ type CreateHTTPDNSClusterRequest struct {
|
|||||||
TlsPolicyJSON []byte `protobuf:"bytes,6,opt,name=tlsPolicyJSON,proto3" json:"tlsPolicyJSON,omitempty"`
|
TlsPolicyJSON []byte `protobuf:"bytes,6,opt,name=tlsPolicyJSON,proto3" json:"tlsPolicyJSON,omitempty"`
|
||||||
IsOn bool `protobuf:"varint,7,opt,name=isOn,proto3" json:"isOn,omitempty"`
|
IsOn bool `protobuf:"varint,7,opt,name=isOn,proto3" json:"isOn,omitempty"`
|
||||||
IsDefault bool `protobuf:"varint,8,opt,name=isDefault,proto3" json:"isDefault,omitempty"`
|
IsDefault bool `protobuf:"varint,8,opt,name=isDefault,proto3" json:"isDefault,omitempty"`
|
||||||
|
AutoRemoteStart bool `protobuf:"varint,9,opt,name=autoRemoteStart,proto3" json:"autoRemoteStart,omitempty"`
|
||||||
|
AccessLogIsOn bool `protobuf:"varint,10,opt,name=accessLogIsOn,proto3" json:"accessLogIsOn,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *CreateHTTPDNSClusterRequest) Reset() {
|
func (x *CreateHTTPDNSClusterRequest) Reset() {
|
||||||
@@ -121,6 +123,20 @@ func (x *CreateHTTPDNSClusterRequest) GetIsDefault() bool {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (x *CreateHTTPDNSClusterRequest) GetAutoRemoteStart() bool {
|
||||||
|
if x != nil {
|
||||||
|
return x.AutoRemoteStart
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *CreateHTTPDNSClusterRequest) GetAccessLogIsOn() bool {
|
||||||
|
if x != nil {
|
||||||
|
return x.AccessLogIsOn
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
type CreateHTTPDNSClusterResponse struct {
|
type CreateHTTPDNSClusterResponse struct {
|
||||||
state protoimpl.MessageState
|
state protoimpl.MessageState
|
||||||
sizeCache protoimpl.SizeCache
|
sizeCache protoimpl.SizeCache
|
||||||
@@ -180,6 +196,8 @@ type UpdateHTTPDNSClusterRequest struct {
|
|||||||
TlsPolicyJSON []byte `protobuf:"bytes,7,opt,name=tlsPolicyJSON,proto3" json:"tlsPolicyJSON,omitempty"`
|
TlsPolicyJSON []byte `protobuf:"bytes,7,opt,name=tlsPolicyJSON,proto3" json:"tlsPolicyJSON,omitempty"`
|
||||||
IsOn bool `protobuf:"varint,8,opt,name=isOn,proto3" json:"isOn,omitempty"`
|
IsOn bool `protobuf:"varint,8,opt,name=isOn,proto3" json:"isOn,omitempty"`
|
||||||
IsDefault bool `protobuf:"varint,9,opt,name=isDefault,proto3" json:"isDefault,omitempty"`
|
IsDefault bool `protobuf:"varint,9,opt,name=isDefault,proto3" json:"isDefault,omitempty"`
|
||||||
|
AutoRemoteStart bool `protobuf:"varint,10,opt,name=autoRemoteStart,proto3" json:"autoRemoteStart,omitempty"`
|
||||||
|
AccessLogIsOn bool `protobuf:"varint,11,opt,name=accessLogIsOn,proto3" json:"accessLogIsOn,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *UpdateHTTPDNSClusterRequest) Reset() {
|
func (x *UpdateHTTPDNSClusterRequest) Reset() {
|
||||||
@@ -275,6 +293,20 @@ func (x *UpdateHTTPDNSClusterRequest) GetIsDefault() bool {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (x *UpdateHTTPDNSClusterRequest) GetAutoRemoteStart() bool {
|
||||||
|
if x != nil {
|
||||||
|
return x.AutoRemoteStart
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *UpdateHTTPDNSClusterRequest) GetAccessLogIsOn() bool {
|
||||||
|
if x != nil {
|
||||||
|
return x.AccessLogIsOn
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
type DeleteHTTPDNSClusterRequest struct {
|
type DeleteHTTPDNSClusterRequest struct {
|
||||||
state protoimpl.MessageState
|
state protoimpl.MessageState
|
||||||
sizeCache protoimpl.SizeCache
|
sizeCache protoimpl.SizeCache
|
||||||
|
|||||||
@@ -558,6 +558,256 @@ func (x *UpdateHTTPDNSNodeLoginRequest) GetNodeLogin() *NodeLogin {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 检查HTTPDNS节点新版本
|
||||||
|
type CheckHTTPDNSNodeLatestVersionRequest struct {
|
||||||
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
|
Os string `protobuf:"bytes,1,opt,name=os,proto3" json:"os,omitempty"`
|
||||||
|
Arch string `protobuf:"bytes,2,opt,name=arch,proto3" json:"arch,omitempty"`
|
||||||
|
CurrentVersion string `protobuf:"bytes,3,opt,name=currentVersion,proto3" json:"currentVersion,omitempty"`
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *CheckHTTPDNSNodeLatestVersionRequest) Reset() {
|
||||||
|
*x = CheckHTTPDNSNodeLatestVersionRequest{}
|
||||||
|
mi := &file_service_httpdns_node_proto_msgTypes[10]
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *CheckHTTPDNSNodeLatestVersionRequest) String() string {
|
||||||
|
return protoimpl.X.MessageStringOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*CheckHTTPDNSNodeLatestVersionRequest) ProtoMessage() {}
|
||||||
|
|
||||||
|
func (x *CheckHTTPDNSNodeLatestVersionRequest) ProtoReflect() protoreflect.Message {
|
||||||
|
mi := &file_service_httpdns_node_proto_msgTypes[10]
|
||||||
|
if x != nil {
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
if ms.LoadMessageInfo() == nil {
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
return ms
|
||||||
|
}
|
||||||
|
return mi.MessageOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Deprecated: Use CheckHTTPDNSNodeLatestVersionRequest.ProtoReflect.Descriptor instead.
|
||||||
|
func (*CheckHTTPDNSNodeLatestVersionRequest) Descriptor() ([]byte, []int) {
|
||||||
|
return file_service_httpdns_node_proto_rawDescGZIP(), []int{10}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *CheckHTTPDNSNodeLatestVersionRequest) GetOs() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.Os
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *CheckHTTPDNSNodeLatestVersionRequest) GetArch() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.Arch
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *CheckHTTPDNSNodeLatestVersionRequest) GetCurrentVersion() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.CurrentVersion
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
type CheckHTTPDNSNodeLatestVersionResponse struct {
|
||||||
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
|
HasNewVersion bool `protobuf:"varint,1,opt,name=hasNewVersion,proto3" json:"hasNewVersion,omitempty"`
|
||||||
|
NewVersion string `protobuf:"bytes,2,opt,name=newVersion,proto3" json:"newVersion,omitempty"`
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *CheckHTTPDNSNodeLatestVersionResponse) Reset() {
|
||||||
|
*x = CheckHTTPDNSNodeLatestVersionResponse{}
|
||||||
|
mi := &file_service_httpdns_node_proto_msgTypes[11]
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *CheckHTTPDNSNodeLatestVersionResponse) String() string {
|
||||||
|
return protoimpl.X.MessageStringOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*CheckHTTPDNSNodeLatestVersionResponse) ProtoMessage() {}
|
||||||
|
|
||||||
|
func (x *CheckHTTPDNSNodeLatestVersionResponse) ProtoReflect() protoreflect.Message {
|
||||||
|
mi := &file_service_httpdns_node_proto_msgTypes[11]
|
||||||
|
if x != nil {
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
if ms.LoadMessageInfo() == nil {
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
return ms
|
||||||
|
}
|
||||||
|
return mi.MessageOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Deprecated: Use CheckHTTPDNSNodeLatestVersionResponse.ProtoReflect.Descriptor instead.
|
||||||
|
func (*CheckHTTPDNSNodeLatestVersionResponse) Descriptor() ([]byte, []int) {
|
||||||
|
return file_service_httpdns_node_proto_rawDescGZIP(), []int{11}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *CheckHTTPDNSNodeLatestVersionResponse) GetHasNewVersion() bool {
|
||||||
|
if x != nil {
|
||||||
|
return x.HasNewVersion
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *CheckHTTPDNSNodeLatestVersionResponse) GetNewVersion() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.NewVersion
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
// 下载最新HTTPDNS节点安装文件
|
||||||
|
type DownloadHTTPDNSNodeInstallationFileRequest struct {
|
||||||
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
|
Os string `protobuf:"bytes,1,opt,name=os,proto3" json:"os,omitempty"`
|
||||||
|
Arch string `protobuf:"bytes,2,opt,name=arch,proto3" json:"arch,omitempty"`
|
||||||
|
ChunkOffset int64 `protobuf:"varint,3,opt,name=chunkOffset,proto3" json:"chunkOffset,omitempty"`
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *DownloadHTTPDNSNodeInstallationFileRequest) Reset() {
|
||||||
|
*x = DownloadHTTPDNSNodeInstallationFileRequest{}
|
||||||
|
mi := &file_service_httpdns_node_proto_msgTypes[12]
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *DownloadHTTPDNSNodeInstallationFileRequest) String() string {
|
||||||
|
return protoimpl.X.MessageStringOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*DownloadHTTPDNSNodeInstallationFileRequest) ProtoMessage() {}
|
||||||
|
|
||||||
|
func (x *DownloadHTTPDNSNodeInstallationFileRequest) ProtoReflect() protoreflect.Message {
|
||||||
|
mi := &file_service_httpdns_node_proto_msgTypes[12]
|
||||||
|
if x != nil {
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
if ms.LoadMessageInfo() == nil {
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
return ms
|
||||||
|
}
|
||||||
|
return mi.MessageOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Deprecated: Use DownloadHTTPDNSNodeInstallationFileRequest.ProtoReflect.Descriptor instead.
|
||||||
|
func (*DownloadHTTPDNSNodeInstallationFileRequest) Descriptor() ([]byte, []int) {
|
||||||
|
return file_service_httpdns_node_proto_rawDescGZIP(), []int{12}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *DownloadHTTPDNSNodeInstallationFileRequest) GetOs() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.Os
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *DownloadHTTPDNSNodeInstallationFileRequest) GetArch() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.Arch
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *DownloadHTTPDNSNodeInstallationFileRequest) GetChunkOffset() int64 {
|
||||||
|
if x != nil {
|
||||||
|
return x.ChunkOffset
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
type DownloadHTTPDNSNodeInstallationFileResponse struct {
|
||||||
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
|
ChunkData []byte `protobuf:"bytes,1,opt,name=chunkData,proto3" json:"chunkData,omitempty"`
|
||||||
|
Sum string `protobuf:"bytes,2,opt,name=sum,proto3" json:"sum,omitempty"`
|
||||||
|
Offset int64 `protobuf:"varint,3,opt,name=offset,proto3" json:"offset,omitempty"`
|
||||||
|
Version string `protobuf:"bytes,4,opt,name=version,proto3" json:"version,omitempty"`
|
||||||
|
Filename string `protobuf:"bytes,5,opt,name=filename,proto3" json:"filename,omitempty"`
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *DownloadHTTPDNSNodeInstallationFileResponse) Reset() {
|
||||||
|
*x = DownloadHTTPDNSNodeInstallationFileResponse{}
|
||||||
|
mi := &file_service_httpdns_node_proto_msgTypes[13]
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *DownloadHTTPDNSNodeInstallationFileResponse) String() string {
|
||||||
|
return protoimpl.X.MessageStringOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*DownloadHTTPDNSNodeInstallationFileResponse) ProtoMessage() {}
|
||||||
|
|
||||||
|
func (x *DownloadHTTPDNSNodeInstallationFileResponse) ProtoReflect() protoreflect.Message {
|
||||||
|
mi := &file_service_httpdns_node_proto_msgTypes[13]
|
||||||
|
if x != nil {
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
if ms.LoadMessageInfo() == nil {
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
return ms
|
||||||
|
}
|
||||||
|
return mi.MessageOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Deprecated: Use DownloadHTTPDNSNodeInstallationFileResponse.ProtoReflect.Descriptor instead.
|
||||||
|
func (*DownloadHTTPDNSNodeInstallationFileResponse) Descriptor() ([]byte, []int) {
|
||||||
|
return file_service_httpdns_node_proto_rawDescGZIP(), []int{13}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *DownloadHTTPDNSNodeInstallationFileResponse) GetChunkData() []byte {
|
||||||
|
if x != nil {
|
||||||
|
return x.ChunkData
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *DownloadHTTPDNSNodeInstallationFileResponse) GetSum() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.Sum
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *DownloadHTTPDNSNodeInstallationFileResponse) GetOffset() int64 {
|
||||||
|
if x != nil {
|
||||||
|
return x.Offset
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *DownloadHTTPDNSNodeInstallationFileResponse) GetVersion() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.Version
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *DownloadHTTPDNSNodeInstallationFileResponse) GetFilename() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.Filename
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
var File_service_httpdns_node_proto protoreflect.FileDescriptor
|
var File_service_httpdns_node_proto protoreflect.FileDescriptor
|
||||||
|
|
||||||
const file_service_httpdns_node_proto_rawDesc = "" +
|
const file_service_httpdns_node_proto_rawDesc = "" +
|
||||||
@@ -600,7 +850,26 @@ const file_service_httpdns_node_proto_rawDesc = "" +
|
|||||||
"\x11installStatusJSON\x18\x06 \x01(\fR\x11installStatusJSON\"d\n" +
|
"\x11installStatusJSON\x18\x06 \x01(\fR\x11installStatusJSON\"d\n" +
|
||||||
"\x1dUpdateHTTPDNSNodeLoginRequest\x12\x16\n" +
|
"\x1dUpdateHTTPDNSNodeLoginRequest\x12\x16\n" +
|
||||||
"\x06nodeId\x18\x01 \x01(\x03R\x06nodeId\x12+\n" +
|
"\x06nodeId\x18\x01 \x01(\x03R\x06nodeId\x12+\n" +
|
||||||
"\tnodeLogin\x18\x02 \x01(\v2\r.pb.NodeLoginR\tnodeLogin2\xa3\x04\n" +
|
"\tnodeLogin\x18\x02 \x01(\v2\r.pb.NodeLoginR\tnodeLogin\"r\n" +
|
||||||
|
"$CheckHTTPDNSNodeLatestVersionRequest\x12\x0e\n" +
|
||||||
|
"\x02os\x18\x01 \x01(\tR\x02os\x12\x12\n" +
|
||||||
|
"\x04arch\x18\x02 \x01(\tR\x04arch\x12&\n" +
|
||||||
|
"\x0ecurrentVersion\x18\x03 \x01(\tR\x0ecurrentVersion\"m\n" +
|
||||||
|
"%CheckHTTPDNSNodeLatestVersionResponse\x12$\n" +
|
||||||
|
"\rhasNewVersion\x18\x01 \x01(\bR\rhasNewVersion\x12\x1e\n" +
|
||||||
|
"\n" +
|
||||||
|
"newVersion\x18\x02 \x01(\tR\n" +
|
||||||
|
"newVersion\"r\n" +
|
||||||
|
"*DownloadHTTPDNSNodeInstallationFileRequest\x12\x0e\n" +
|
||||||
|
"\x02os\x18\x01 \x01(\tR\x02os\x12\x12\n" +
|
||||||
|
"\x04arch\x18\x02 \x01(\tR\x04arch\x12 \n" +
|
||||||
|
"\vchunkOffset\x18\x03 \x01(\x03R\vchunkOffset\"\xab\x01\n" +
|
||||||
|
"+DownloadHTTPDNSNodeInstallationFileResponse\x12\x1c\n" +
|
||||||
|
"\tchunkData\x18\x01 \x01(\fR\tchunkData\x12\x10\n" +
|
||||||
|
"\x03sum\x18\x02 \x01(\tR\x03sum\x12\x16\n" +
|
||||||
|
"\x06offset\x18\x03 \x01(\x03R\x06offset\x12\x18\n" +
|
||||||
|
"\aversion\x18\x04 \x01(\tR\aversion\x12\x1a\n" +
|
||||||
|
"\bfilename\x18\x05 \x01(\tR\bfilename2\xa2\x06\n" +
|
||||||
"\x12HTTPDNSNodeService\x12P\n" +
|
"\x12HTTPDNSNodeService\x12P\n" +
|
||||||
"\x11createHTTPDNSNode\x12\x1c.pb.CreateHTTPDNSNodeRequest\x1a\x1d.pb.CreateHTTPDNSNodeResponse\x12A\n" +
|
"\x11createHTTPDNSNode\x12\x1c.pb.CreateHTTPDNSNodeRequest\x1a\x1d.pb.CreateHTTPDNSNodeResponse\x12A\n" +
|
||||||
"\x11updateHTTPDNSNode\x12\x1c.pb.UpdateHTTPDNSNodeRequest\x1a\x0e.pb.RPCSuccess\x12A\n" +
|
"\x11updateHTTPDNSNode\x12\x1c.pb.UpdateHTTPDNSNodeRequest\x1a\x0e.pb.RPCSuccess\x12A\n" +
|
||||||
@@ -608,7 +877,9 @@ const file_service_httpdns_node_proto_rawDesc = "" +
|
|||||||
"\x0ffindHTTPDNSNode\x12\x1a.pb.FindHTTPDNSNodeRequest\x1a\x1b.pb.FindHTTPDNSNodeResponse\x12M\n" +
|
"\x0ffindHTTPDNSNode\x12\x1a.pb.FindHTTPDNSNodeRequest\x1a\x1b.pb.FindHTTPDNSNodeResponse\x12M\n" +
|
||||||
"\x10listHTTPDNSNodes\x12\x1b.pb.ListHTTPDNSNodesRequest\x1a\x1c.pb.ListHTTPDNSNodesResponse\x12M\n" +
|
"\x10listHTTPDNSNodes\x12\x1b.pb.ListHTTPDNSNodesRequest\x1a\x1c.pb.ListHTTPDNSNodesResponse\x12M\n" +
|
||||||
"\x17updateHTTPDNSNodeStatus\x12\".pb.UpdateHTTPDNSNodeStatusRequest\x1a\x0e.pb.RPCSuccess\x12K\n" +
|
"\x17updateHTTPDNSNodeStatus\x12\".pb.UpdateHTTPDNSNodeStatusRequest\x1a\x0e.pb.RPCSuccess\x12K\n" +
|
||||||
"\x16updateHTTPDNSNodeLogin\x12!.pb.UpdateHTTPDNSNodeLoginRequest\x1a\x0e.pb.RPCSuccessB\x06Z\x04./pbb\x06proto3"
|
"\x16updateHTTPDNSNodeLogin\x12!.pb.UpdateHTTPDNSNodeLoginRequest\x1a\x0e.pb.RPCSuccess\x12t\n" +
|
||||||
|
"\x1dcheckHTTPDNSNodeLatestVersion\x12(.pb.CheckHTTPDNSNodeLatestVersionRequest\x1a).pb.CheckHTTPDNSNodeLatestVersionResponse\x12\x86\x01\n" +
|
||||||
|
"#downloadHTTPDNSNodeInstallationFile\x12..pb.DownloadHTTPDNSNodeInstallationFileRequest\x1a/.pb.DownloadHTTPDNSNodeInstallationFileResponseB\x06Z\x04./pbb\x06proto3"
|
||||||
|
|
||||||
var (
|
var (
|
||||||
file_service_httpdns_node_proto_rawDescOnce sync.Once
|
file_service_httpdns_node_proto_rawDescOnce sync.Once
|
||||||
@@ -622,7 +893,7 @@ func file_service_httpdns_node_proto_rawDescGZIP() []byte {
|
|||||||
return file_service_httpdns_node_proto_rawDescData
|
return file_service_httpdns_node_proto_rawDescData
|
||||||
}
|
}
|
||||||
|
|
||||||
var file_service_httpdns_node_proto_msgTypes = make([]protoimpl.MessageInfo, 10)
|
var file_service_httpdns_node_proto_msgTypes = make([]protoimpl.MessageInfo, 14)
|
||||||
var file_service_httpdns_node_proto_goTypes = []any{
|
var file_service_httpdns_node_proto_goTypes = []any{
|
||||||
(*CreateHTTPDNSNodeRequest)(nil), // 0: pb.CreateHTTPDNSNodeRequest
|
(*CreateHTTPDNSNodeRequest)(nil), // 0: pb.CreateHTTPDNSNodeRequest
|
||||||
(*CreateHTTPDNSNodeResponse)(nil), // 1: pb.CreateHTTPDNSNodeResponse
|
(*CreateHTTPDNSNodeResponse)(nil), // 1: pb.CreateHTTPDNSNodeResponse
|
||||||
@@ -634,14 +905,18 @@ var file_service_httpdns_node_proto_goTypes = []any{
|
|||||||
(*ListHTTPDNSNodesResponse)(nil), // 7: pb.ListHTTPDNSNodesResponse
|
(*ListHTTPDNSNodesResponse)(nil), // 7: pb.ListHTTPDNSNodesResponse
|
||||||
(*UpdateHTTPDNSNodeStatusRequest)(nil), // 8: pb.UpdateHTTPDNSNodeStatusRequest
|
(*UpdateHTTPDNSNodeStatusRequest)(nil), // 8: pb.UpdateHTTPDNSNodeStatusRequest
|
||||||
(*UpdateHTTPDNSNodeLoginRequest)(nil), // 9: pb.UpdateHTTPDNSNodeLoginRequest
|
(*UpdateHTTPDNSNodeLoginRequest)(nil), // 9: pb.UpdateHTTPDNSNodeLoginRequest
|
||||||
(*HTTPDNSNode)(nil), // 10: pb.HTTPDNSNode
|
(*CheckHTTPDNSNodeLatestVersionRequest)(nil), // 10: pb.CheckHTTPDNSNodeLatestVersionRequest
|
||||||
(*NodeLogin)(nil), // 11: pb.NodeLogin
|
(*CheckHTTPDNSNodeLatestVersionResponse)(nil), // 11: pb.CheckHTTPDNSNodeLatestVersionResponse
|
||||||
(*RPCSuccess)(nil), // 12: pb.RPCSuccess
|
(*DownloadHTTPDNSNodeInstallationFileRequest)(nil), // 12: pb.DownloadHTTPDNSNodeInstallationFileRequest
|
||||||
|
(*DownloadHTTPDNSNodeInstallationFileResponse)(nil), // 13: pb.DownloadHTTPDNSNodeInstallationFileResponse
|
||||||
|
(*HTTPDNSNode)(nil), // 14: pb.HTTPDNSNode
|
||||||
|
(*NodeLogin)(nil), // 15: pb.NodeLogin
|
||||||
|
(*RPCSuccess)(nil), // 16: pb.RPCSuccess
|
||||||
}
|
}
|
||||||
var file_service_httpdns_node_proto_depIdxs = []int32{
|
var file_service_httpdns_node_proto_depIdxs = []int32{
|
||||||
10, // 0: pb.FindHTTPDNSNodeResponse.node:type_name -> pb.HTTPDNSNode
|
14, // 0: pb.FindHTTPDNSNodeResponse.node:type_name -> pb.HTTPDNSNode
|
||||||
10, // 1: pb.ListHTTPDNSNodesResponse.nodes:type_name -> pb.HTTPDNSNode
|
14, // 1: pb.ListHTTPDNSNodesResponse.nodes:type_name -> pb.HTTPDNSNode
|
||||||
11, // 2: pb.UpdateHTTPDNSNodeLoginRequest.nodeLogin:type_name -> pb.NodeLogin
|
15, // 2: pb.UpdateHTTPDNSNodeLoginRequest.nodeLogin:type_name -> pb.NodeLogin
|
||||||
0, // 3: pb.HTTPDNSNodeService.createHTTPDNSNode:input_type -> pb.CreateHTTPDNSNodeRequest
|
0, // 3: pb.HTTPDNSNodeService.createHTTPDNSNode:input_type -> pb.CreateHTTPDNSNodeRequest
|
||||||
2, // 4: pb.HTTPDNSNodeService.updateHTTPDNSNode:input_type -> pb.UpdateHTTPDNSNodeRequest
|
2, // 4: pb.HTTPDNSNodeService.updateHTTPDNSNode:input_type -> pb.UpdateHTTPDNSNodeRequest
|
||||||
3, // 5: pb.HTTPDNSNodeService.deleteHTTPDNSNode:input_type -> pb.DeleteHTTPDNSNodeRequest
|
3, // 5: pb.HTTPDNSNodeService.deleteHTTPDNSNode:input_type -> pb.DeleteHTTPDNSNodeRequest
|
||||||
@@ -649,15 +924,19 @@ var file_service_httpdns_node_proto_depIdxs = []int32{
|
|||||||
6, // 7: pb.HTTPDNSNodeService.listHTTPDNSNodes:input_type -> pb.ListHTTPDNSNodesRequest
|
6, // 7: pb.HTTPDNSNodeService.listHTTPDNSNodes:input_type -> pb.ListHTTPDNSNodesRequest
|
||||||
8, // 8: pb.HTTPDNSNodeService.updateHTTPDNSNodeStatus:input_type -> pb.UpdateHTTPDNSNodeStatusRequest
|
8, // 8: pb.HTTPDNSNodeService.updateHTTPDNSNodeStatus:input_type -> pb.UpdateHTTPDNSNodeStatusRequest
|
||||||
9, // 9: pb.HTTPDNSNodeService.updateHTTPDNSNodeLogin:input_type -> pb.UpdateHTTPDNSNodeLoginRequest
|
9, // 9: pb.HTTPDNSNodeService.updateHTTPDNSNodeLogin:input_type -> pb.UpdateHTTPDNSNodeLoginRequest
|
||||||
1, // 10: pb.HTTPDNSNodeService.createHTTPDNSNode:output_type -> pb.CreateHTTPDNSNodeResponse
|
10, // 10: pb.HTTPDNSNodeService.checkHTTPDNSNodeLatestVersion:input_type -> pb.CheckHTTPDNSNodeLatestVersionRequest
|
||||||
12, // 11: pb.HTTPDNSNodeService.updateHTTPDNSNode:output_type -> pb.RPCSuccess
|
12, // 11: pb.HTTPDNSNodeService.downloadHTTPDNSNodeInstallationFile:input_type -> pb.DownloadHTTPDNSNodeInstallationFileRequest
|
||||||
12, // 12: pb.HTTPDNSNodeService.deleteHTTPDNSNode:output_type -> pb.RPCSuccess
|
1, // 12: pb.HTTPDNSNodeService.createHTTPDNSNode:output_type -> pb.CreateHTTPDNSNodeResponse
|
||||||
5, // 13: pb.HTTPDNSNodeService.findHTTPDNSNode:output_type -> pb.FindHTTPDNSNodeResponse
|
16, // 13: pb.HTTPDNSNodeService.updateHTTPDNSNode:output_type -> pb.RPCSuccess
|
||||||
7, // 14: pb.HTTPDNSNodeService.listHTTPDNSNodes:output_type -> pb.ListHTTPDNSNodesResponse
|
16, // 14: pb.HTTPDNSNodeService.deleteHTTPDNSNode:output_type -> pb.RPCSuccess
|
||||||
12, // 15: pb.HTTPDNSNodeService.updateHTTPDNSNodeStatus:output_type -> pb.RPCSuccess
|
5, // 15: pb.HTTPDNSNodeService.findHTTPDNSNode:output_type -> pb.FindHTTPDNSNodeResponse
|
||||||
12, // 16: pb.HTTPDNSNodeService.updateHTTPDNSNodeLogin:output_type -> pb.RPCSuccess
|
7, // 16: pb.HTTPDNSNodeService.listHTTPDNSNodes:output_type -> pb.ListHTTPDNSNodesResponse
|
||||||
10, // [10:17] is the sub-list for method output_type
|
16, // 17: pb.HTTPDNSNodeService.updateHTTPDNSNodeStatus:output_type -> pb.RPCSuccess
|
||||||
3, // [3:10] is the sub-list for method input_type
|
16, // 18: pb.HTTPDNSNodeService.updateHTTPDNSNodeLogin:output_type -> pb.RPCSuccess
|
||||||
|
11, // 19: pb.HTTPDNSNodeService.checkHTTPDNSNodeLatestVersion:output_type -> pb.CheckHTTPDNSNodeLatestVersionResponse
|
||||||
|
13, // 20: pb.HTTPDNSNodeService.downloadHTTPDNSNodeInstallationFile:output_type -> pb.DownloadHTTPDNSNodeInstallationFileResponse
|
||||||
|
12, // [12:21] is the sub-list for method output_type
|
||||||
|
3, // [3:12] is the sub-list for method input_type
|
||||||
3, // [3:3] is the sub-list for extension type_name
|
3, // [3:3] is the sub-list for extension type_name
|
||||||
3, // [3:3] is the sub-list for extension extendee
|
3, // [3:3] is the sub-list for extension extendee
|
||||||
0, // [0:3] is the sub-list for field type_name
|
0, // [0:3] is the sub-list for field type_name
|
||||||
@@ -677,7 +956,7 @@ func file_service_httpdns_node_proto_init() {
|
|||||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||||
RawDescriptor: unsafe.Slice(unsafe.StringData(file_service_httpdns_node_proto_rawDesc), len(file_service_httpdns_node_proto_rawDesc)),
|
RawDescriptor: unsafe.Slice(unsafe.StringData(file_service_httpdns_node_proto_rawDesc), len(file_service_httpdns_node_proto_rawDesc)),
|
||||||
NumEnums: 0,
|
NumEnums: 0,
|
||||||
NumMessages: 10,
|
NumMessages: 14,
|
||||||
NumExtensions: 0,
|
NumExtensions: 0,
|
||||||
NumServices: 1,
|
NumServices: 1,
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -26,6 +26,8 @@ const (
|
|||||||
HTTPDNSNodeService_ListHTTPDNSNodes_FullMethodName = "/pb.HTTPDNSNodeService/listHTTPDNSNodes"
|
HTTPDNSNodeService_ListHTTPDNSNodes_FullMethodName = "/pb.HTTPDNSNodeService/listHTTPDNSNodes"
|
||||||
HTTPDNSNodeService_UpdateHTTPDNSNodeStatus_FullMethodName = "/pb.HTTPDNSNodeService/updateHTTPDNSNodeStatus"
|
HTTPDNSNodeService_UpdateHTTPDNSNodeStatus_FullMethodName = "/pb.HTTPDNSNodeService/updateHTTPDNSNodeStatus"
|
||||||
HTTPDNSNodeService_UpdateHTTPDNSNodeLogin_FullMethodName = "/pb.HTTPDNSNodeService/updateHTTPDNSNodeLogin"
|
HTTPDNSNodeService_UpdateHTTPDNSNodeLogin_FullMethodName = "/pb.HTTPDNSNodeService/updateHTTPDNSNodeLogin"
|
||||||
|
HTTPDNSNodeService_CheckHTTPDNSNodeLatestVersion_FullMethodName = "/pb.HTTPDNSNodeService/checkHTTPDNSNodeLatestVersion"
|
||||||
|
HTTPDNSNodeService_DownloadHTTPDNSNodeInstallationFile_FullMethodName = "/pb.HTTPDNSNodeService/downloadHTTPDNSNodeInstallationFile"
|
||||||
)
|
)
|
||||||
|
|
||||||
// HTTPDNSNodeServiceClient is the client API for HTTPDNSNodeService service.
|
// HTTPDNSNodeServiceClient is the client API for HTTPDNSNodeService service.
|
||||||
@@ -40,6 +42,10 @@ type HTTPDNSNodeServiceClient interface {
|
|||||||
UpdateHTTPDNSNodeStatus(ctx context.Context, in *UpdateHTTPDNSNodeStatusRequest, opts ...grpc.CallOption) (*RPCSuccess, error)
|
UpdateHTTPDNSNodeStatus(ctx context.Context, in *UpdateHTTPDNSNodeStatusRequest, opts ...grpc.CallOption) (*RPCSuccess, error)
|
||||||
// 修改HTTPDNS节点登录信息
|
// 修改HTTPDNS节点登录信息
|
||||||
UpdateHTTPDNSNodeLogin(ctx context.Context, in *UpdateHTTPDNSNodeLoginRequest, opts ...grpc.CallOption) (*RPCSuccess, error)
|
UpdateHTTPDNSNodeLogin(ctx context.Context, in *UpdateHTTPDNSNodeLoginRequest, opts ...grpc.CallOption) (*RPCSuccess, error)
|
||||||
|
// 检查HTTPDNS节点新版本
|
||||||
|
CheckHTTPDNSNodeLatestVersion(ctx context.Context, in *CheckHTTPDNSNodeLatestVersionRequest, opts ...grpc.CallOption) (*CheckHTTPDNSNodeLatestVersionResponse, error)
|
||||||
|
// 下载最新HTTPDNS节点安装文件
|
||||||
|
DownloadHTTPDNSNodeInstallationFile(ctx context.Context, in *DownloadHTTPDNSNodeInstallationFileRequest, opts ...grpc.CallOption) (*DownloadHTTPDNSNodeInstallationFileResponse, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
type hTTPDNSNodeServiceClient struct {
|
type hTTPDNSNodeServiceClient struct {
|
||||||
@@ -120,6 +126,26 @@ func (c *hTTPDNSNodeServiceClient) UpdateHTTPDNSNodeLogin(ctx context.Context, i
|
|||||||
return out, nil
|
return out, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c *hTTPDNSNodeServiceClient) CheckHTTPDNSNodeLatestVersion(ctx context.Context, in *CheckHTTPDNSNodeLatestVersionRequest, opts ...grpc.CallOption) (*CheckHTTPDNSNodeLatestVersionResponse, error) {
|
||||||
|
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||||
|
out := new(CheckHTTPDNSNodeLatestVersionResponse)
|
||||||
|
err := c.cc.Invoke(ctx, HTTPDNSNodeService_CheckHTTPDNSNodeLatestVersion_FullMethodName, in, out, cOpts...)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return out, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *hTTPDNSNodeServiceClient) DownloadHTTPDNSNodeInstallationFile(ctx context.Context, in *DownloadHTTPDNSNodeInstallationFileRequest, opts ...grpc.CallOption) (*DownloadHTTPDNSNodeInstallationFileResponse, error) {
|
||||||
|
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||||
|
out := new(DownloadHTTPDNSNodeInstallationFileResponse)
|
||||||
|
err := c.cc.Invoke(ctx, HTTPDNSNodeService_DownloadHTTPDNSNodeInstallationFile_FullMethodName, in, out, cOpts...)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return out, nil
|
||||||
|
}
|
||||||
|
|
||||||
// HTTPDNSNodeServiceServer is the server API for HTTPDNSNodeService service.
|
// HTTPDNSNodeServiceServer is the server API for HTTPDNSNodeService service.
|
||||||
// All implementations must embed UnimplementedHTTPDNSNodeServiceServer
|
// All implementations must embed UnimplementedHTTPDNSNodeServiceServer
|
||||||
// for forward compatibility.
|
// for forward compatibility.
|
||||||
@@ -132,6 +158,10 @@ type HTTPDNSNodeServiceServer interface {
|
|||||||
UpdateHTTPDNSNodeStatus(context.Context, *UpdateHTTPDNSNodeStatusRequest) (*RPCSuccess, error)
|
UpdateHTTPDNSNodeStatus(context.Context, *UpdateHTTPDNSNodeStatusRequest) (*RPCSuccess, error)
|
||||||
// 修改HTTPDNS节点登录信息
|
// 修改HTTPDNS节点登录信息
|
||||||
UpdateHTTPDNSNodeLogin(context.Context, *UpdateHTTPDNSNodeLoginRequest) (*RPCSuccess, error)
|
UpdateHTTPDNSNodeLogin(context.Context, *UpdateHTTPDNSNodeLoginRequest) (*RPCSuccess, error)
|
||||||
|
// 检查HTTPDNS节点新版本
|
||||||
|
CheckHTTPDNSNodeLatestVersion(context.Context, *CheckHTTPDNSNodeLatestVersionRequest) (*CheckHTTPDNSNodeLatestVersionResponse, error)
|
||||||
|
// 下载最新HTTPDNS节点安装文件
|
||||||
|
DownloadHTTPDNSNodeInstallationFile(context.Context, *DownloadHTTPDNSNodeInstallationFileRequest) (*DownloadHTTPDNSNodeInstallationFileResponse, error)
|
||||||
mustEmbedUnimplementedHTTPDNSNodeServiceServer()
|
mustEmbedUnimplementedHTTPDNSNodeServiceServer()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -163,6 +193,12 @@ func (UnimplementedHTTPDNSNodeServiceServer) UpdateHTTPDNSNodeStatus(context.Con
|
|||||||
func (UnimplementedHTTPDNSNodeServiceServer) UpdateHTTPDNSNodeLogin(context.Context, *UpdateHTTPDNSNodeLoginRequest) (*RPCSuccess, error) {
|
func (UnimplementedHTTPDNSNodeServiceServer) UpdateHTTPDNSNodeLogin(context.Context, *UpdateHTTPDNSNodeLoginRequest) (*RPCSuccess, error) {
|
||||||
return nil, status.Error(codes.Unimplemented, "method UpdateHTTPDNSNodeLogin not implemented")
|
return nil, status.Error(codes.Unimplemented, "method UpdateHTTPDNSNodeLogin not implemented")
|
||||||
}
|
}
|
||||||
|
func (UnimplementedHTTPDNSNodeServiceServer) CheckHTTPDNSNodeLatestVersion(context.Context, *CheckHTTPDNSNodeLatestVersionRequest) (*CheckHTTPDNSNodeLatestVersionResponse, error) {
|
||||||
|
return nil, status.Error(codes.Unimplemented, "method CheckHTTPDNSNodeLatestVersion not implemented")
|
||||||
|
}
|
||||||
|
func (UnimplementedHTTPDNSNodeServiceServer) DownloadHTTPDNSNodeInstallationFile(context.Context, *DownloadHTTPDNSNodeInstallationFileRequest) (*DownloadHTTPDNSNodeInstallationFileResponse, error) {
|
||||||
|
return nil, status.Error(codes.Unimplemented, "method DownloadHTTPDNSNodeInstallationFile not implemented")
|
||||||
|
}
|
||||||
func (UnimplementedHTTPDNSNodeServiceServer) mustEmbedUnimplementedHTTPDNSNodeServiceServer() {}
|
func (UnimplementedHTTPDNSNodeServiceServer) mustEmbedUnimplementedHTTPDNSNodeServiceServer() {}
|
||||||
func (UnimplementedHTTPDNSNodeServiceServer) testEmbeddedByValue() {}
|
func (UnimplementedHTTPDNSNodeServiceServer) testEmbeddedByValue() {}
|
||||||
|
|
||||||
@@ -310,6 +346,42 @@ func _HTTPDNSNodeService_UpdateHTTPDNSNodeLogin_Handler(srv interface{}, ctx con
|
|||||||
return interceptor(ctx, in, info, handler)
|
return interceptor(ctx, in, info, handler)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func _HTTPDNSNodeService_CheckHTTPDNSNodeLatestVersion_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||||
|
in := new(CheckHTTPDNSNodeLatestVersionRequest)
|
||||||
|
if err := dec(in); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if interceptor == nil {
|
||||||
|
return srv.(HTTPDNSNodeServiceServer).CheckHTTPDNSNodeLatestVersion(ctx, in)
|
||||||
|
}
|
||||||
|
info := &grpc.UnaryServerInfo{
|
||||||
|
Server: srv,
|
||||||
|
FullMethod: HTTPDNSNodeService_CheckHTTPDNSNodeLatestVersion_FullMethodName,
|
||||||
|
}
|
||||||
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||||
|
return srv.(HTTPDNSNodeServiceServer).CheckHTTPDNSNodeLatestVersion(ctx, req.(*CheckHTTPDNSNodeLatestVersionRequest))
|
||||||
|
}
|
||||||
|
return interceptor(ctx, in, info, handler)
|
||||||
|
}
|
||||||
|
|
||||||
|
func _HTTPDNSNodeService_DownloadHTTPDNSNodeInstallationFile_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||||
|
in := new(DownloadHTTPDNSNodeInstallationFileRequest)
|
||||||
|
if err := dec(in); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if interceptor == nil {
|
||||||
|
return srv.(HTTPDNSNodeServiceServer).DownloadHTTPDNSNodeInstallationFile(ctx, in)
|
||||||
|
}
|
||||||
|
info := &grpc.UnaryServerInfo{
|
||||||
|
Server: srv,
|
||||||
|
FullMethod: HTTPDNSNodeService_DownloadHTTPDNSNodeInstallationFile_FullMethodName,
|
||||||
|
}
|
||||||
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||||
|
return srv.(HTTPDNSNodeServiceServer).DownloadHTTPDNSNodeInstallationFile(ctx, req.(*DownloadHTTPDNSNodeInstallationFileRequest))
|
||||||
|
}
|
||||||
|
return interceptor(ctx, in, info, handler)
|
||||||
|
}
|
||||||
|
|
||||||
// HTTPDNSNodeService_ServiceDesc is the grpc.ServiceDesc for HTTPDNSNodeService service.
|
// HTTPDNSNodeService_ServiceDesc is the grpc.ServiceDesc for HTTPDNSNodeService service.
|
||||||
// It's only intended for direct use with grpc.RegisterService,
|
// It's only intended for direct use with grpc.RegisterService,
|
||||||
// and not to be introspected or modified (even as a copy)
|
// and not to be introspected or modified (even as a copy)
|
||||||
@@ -345,6 +417,14 @@ var HTTPDNSNodeService_ServiceDesc = grpc.ServiceDesc{
|
|||||||
MethodName: "updateHTTPDNSNodeLogin",
|
MethodName: "updateHTTPDNSNodeLogin",
|
||||||
Handler: _HTTPDNSNodeService_UpdateHTTPDNSNodeLogin_Handler,
|
Handler: _HTTPDNSNodeService_UpdateHTTPDNSNodeLogin_Handler,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
MethodName: "checkHTTPDNSNodeLatestVersion",
|
||||||
|
Handler: _HTTPDNSNodeService_CheckHTTPDNSNodeLatestVersion_Handler,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
MethodName: "downloadHTTPDNSNodeInstallationFile",
|
||||||
|
Handler: _HTTPDNSNodeService_DownloadHTTPDNSNodeInstallationFile_Handler,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
Streams: []grpc.StreamDesc{},
|
Streams: []grpc.StreamDesc{},
|
||||||
Metadata: "service_httpdns_node.proto",
|
Metadata: "service_httpdns_node.proto",
|
||||||
|
|||||||
@@ -15,4 +15,6 @@ message HTTPDNSCluster {
|
|||||||
bytes tlsPolicyJSON = 9;
|
bytes tlsPolicyJSON = 9;
|
||||||
int64 createdAt = 10;
|
int64 createdAt = 10;
|
||||||
int64 updatedAt = 11;
|
int64 updatedAt = 11;
|
||||||
|
bool autoRemoteStart = 12;
|
||||||
|
bool accessLogIsOn = 13;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,6 +27,8 @@ message CreateHTTPDNSClusterRequest {
|
|||||||
bytes tlsPolicyJSON = 6;
|
bytes tlsPolicyJSON = 6;
|
||||||
bool isOn = 7;
|
bool isOn = 7;
|
||||||
bool isDefault = 8;
|
bool isDefault = 8;
|
||||||
|
bool autoRemoteStart = 9;
|
||||||
|
bool accessLogIsOn = 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
message CreateHTTPDNSClusterResponse {
|
message CreateHTTPDNSClusterResponse {
|
||||||
@@ -43,6 +45,8 @@ message UpdateHTTPDNSClusterRequest {
|
|||||||
bytes tlsPolicyJSON = 7;
|
bytes tlsPolicyJSON = 7;
|
||||||
bool isOn = 8;
|
bool isOn = 8;
|
||||||
bool isDefault = 9;
|
bool isDefault = 9;
|
||||||
|
bool autoRemoteStart = 10;
|
||||||
|
bool accessLogIsOn = 11;
|
||||||
}
|
}
|
||||||
|
|
||||||
message DeleteHTTPDNSClusterRequest {
|
message DeleteHTTPDNSClusterRequest {
|
||||||
|
|||||||
@@ -16,6 +16,12 @@ service HTTPDNSNodeService {
|
|||||||
rpc updateHTTPDNSNodeStatus (UpdateHTTPDNSNodeStatusRequest) returns (RPCSuccess);
|
rpc updateHTTPDNSNodeStatus (UpdateHTTPDNSNodeStatusRequest) returns (RPCSuccess);
|
||||||
// 修改HTTPDNS节点登录信息
|
// 修改HTTPDNS节点登录信息
|
||||||
rpc updateHTTPDNSNodeLogin (UpdateHTTPDNSNodeLoginRequest) returns (RPCSuccess);
|
rpc updateHTTPDNSNodeLogin (UpdateHTTPDNSNodeLoginRequest) returns (RPCSuccess);
|
||||||
|
|
||||||
|
// 检查HTTPDNS节点新版本
|
||||||
|
rpc checkHTTPDNSNodeLatestVersion (CheckHTTPDNSNodeLatestVersionRequest) returns (CheckHTTPDNSNodeLatestVersionResponse);
|
||||||
|
|
||||||
|
// 下载最新HTTPDNS节点安装文件
|
||||||
|
rpc downloadHTTPDNSNodeInstallationFile (DownloadHTTPDNSNodeInstallationFileRequest) returns (DownloadHTTPDNSNodeInstallationFileResponse);
|
||||||
}
|
}
|
||||||
|
|
||||||
message CreateHTTPDNSNodeRequest {
|
message CreateHTTPDNSNodeRequest {
|
||||||
@@ -70,3 +76,30 @@ message UpdateHTTPDNSNodeLoginRequest {
|
|||||||
int64 nodeId = 1;
|
int64 nodeId = 1;
|
||||||
NodeLogin nodeLogin = 2;
|
NodeLogin nodeLogin = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 检查HTTPDNS节点新版本
|
||||||
|
message CheckHTTPDNSNodeLatestVersionRequest {
|
||||||
|
string os = 1;
|
||||||
|
string arch = 2;
|
||||||
|
string currentVersion = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
message CheckHTTPDNSNodeLatestVersionResponse {
|
||||||
|
bool hasNewVersion = 1;
|
||||||
|
string newVersion = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 下载最新HTTPDNS节点安装文件
|
||||||
|
message DownloadHTTPDNSNodeInstallationFileRequest {
|
||||||
|
string os = 1;
|
||||||
|
string arch = 2;
|
||||||
|
int64 chunkOffset = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
message DownloadHTTPDNSNodeInstallationFileResponse {
|
||||||
|
bytes chunkData = 1;
|
||||||
|
string sum = 2;
|
||||||
|
int64 offset = 3;
|
||||||
|
string version = 4;
|
||||||
|
string filename = 5;
|
||||||
|
}
|
||||||
|
|||||||
@@ -213,12 +213,7 @@ func FindAllUserFeatures() []*UserFeature {
|
|||||||
Description: "用户可以购买和管理套餐。",
|
Description: "用户可以购买和管理套餐。",
|
||||||
SupportPlan: false,
|
SupportPlan: false,
|
||||||
},
|
},
|
||||||
{
|
// HTTPDNS 功能已改为通过用户设置页面全局开关控制,不再作为单独的功能选项
|
||||||
Name: "HTTPDNS",
|
|
||||||
Code: UserFeatureCodeHTTPDNS,
|
|
||||||
Description: "用户可以使用 HTTPDNS 应用管理、访问日志和解析测试。",
|
|
||||||
SupportPlan: false,
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
# Android SDK 集成文档(Edge HTTPDNS)
|
# HTTPDNS SDK 集成文档(Android)
|
||||||
|
|
||||||
## 1. 版本与依赖
|
## 1. 版本与依赖
|
||||||
|
|
||||||
@@ -94,7 +94,11 @@ func (a *AppCmd) runStart() {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
cmd := exec.Command(os.Args[0])
|
exe, _ := os.Executable()
|
||||||
|
if len(exe) == 0 {
|
||||||
|
exe = os.Args[0]
|
||||||
|
}
|
||||||
|
cmd := exec.Command(exe)
|
||||||
cmd.Env = append(os.Environ(), "EdgeBackground=on")
|
cmd.Env = append(os.Environ(), "EdgeBackground=on")
|
||||||
err := cmd.Start()
|
err := cmd.Start()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@@ -16,6 +16,9 @@ import (
|
|||||||
"github.com/iwind/gosock/pkg/gosock"
|
"github.com/iwind/gosock/pkg/gosock"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var DaemonIsOn = false
|
||||||
|
var DaemonPid = 0
|
||||||
|
|
||||||
type HTTPDNSNode struct {
|
type HTTPDNSNode struct {
|
||||||
sock *gosock.Sock
|
sock *gosock.Sock
|
||||||
|
|
||||||
@@ -31,6 +34,12 @@ func NewHTTPDNSNode() *HTTPDNSNode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (n *HTTPDNSNode) Run() {
|
func (n *HTTPDNSNode) Run() {
|
||||||
|
_, ok := os.LookupEnv("EdgeDaemon")
|
||||||
|
if ok {
|
||||||
|
DaemonIsOn = true
|
||||||
|
DaemonPid = os.Getppid()
|
||||||
|
}
|
||||||
|
|
||||||
err := n.listenSock()
|
err := n.listenSock()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Println("[HTTPDNS_NODE]" + err.Error())
|
log.Println("[HTTPDNS_NODE]" + err.Error())
|
||||||
@@ -54,7 +63,7 @@ func (n *HTTPDNSNode) Daemon() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
cmd := exec.Command(exe)
|
cmd := exec.Command(exe)
|
||||||
cmd.Env = append(os.Environ(), "EdgeBackground=on")
|
cmd.Env = append(os.Environ(), "EdgeBackground=on", "EdgeDaemon=on")
|
||||||
if runtime.GOOS != "windows" {
|
if runtime.GOOS != "windows" {
|
||||||
cmd.Stdout = os.Stdout
|
cmd.Stdout = os.Stdout
|
||||||
cmd.Stderr = os.Stderr
|
cmd.Stderr = os.Stderr
|
||||||
@@ -147,6 +156,8 @@ func (n *HTTPDNSNode) start() {
|
|||||||
go statusManager.Start()
|
go statusManager.Start()
|
||||||
go taskManager.Start()
|
go taskManager.Start()
|
||||||
go resolveServer.Start()
|
go resolveServer.Start()
|
||||||
|
|
||||||
|
go NewUpgradeManager().Loop()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (n *HTTPDNSNode) stop() {
|
func (n *HTTPDNSNode) stop() {
|
||||||
|
|||||||
280
EdgeHttpDNS/internal/nodes/upgrade_manager.go
Normal file
280
EdgeHttpDNS/internal/nodes/upgrade_manager.go
Normal file
@@ -0,0 +1,280 @@
|
|||||||
|
package nodes
|
||||||
|
|
||||||
|
import (
|
||||||
|
"crypto/md5"
|
||||||
|
"fmt"
|
||||||
|
"log"
|
||||||
|
"os"
|
||||||
|
"os/exec"
|
||||||
|
"path/filepath"
|
||||||
|
"runtime"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
|
||||||
|
teaconst "github.com/TeaOSLab/EdgeHttpDNS/internal/const"
|
||||||
|
"github.com/TeaOSLab/EdgeHttpDNS/internal/rpc"
|
||||||
|
"github.com/TeaOSLab/EdgeHttpDNS/internal/utils"
|
||||||
|
"github.com/iwind/TeaGo/Tea"
|
||||||
|
stringutil "github.com/iwind/TeaGo/utils/string"
|
||||||
|
"github.com/iwind/gosock/pkg/gosock"
|
||||||
|
)
|
||||||
|
|
||||||
|
// UpgradeManager 节点升级管理器
|
||||||
|
type UpgradeManager struct {
|
||||||
|
isInstalling bool
|
||||||
|
lastFile string
|
||||||
|
exe string
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewUpgradeManager 获取新对象
|
||||||
|
func NewUpgradeManager() *UpgradeManager {
|
||||||
|
return &UpgradeManager{}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Loop 启动升级检查循环(每1分钟)
|
||||||
|
func (this *UpgradeManager) Loop() {
|
||||||
|
rpcClient, err := rpc.SharedRPC()
|
||||||
|
if err != nil {
|
||||||
|
log.Println("[UPGRADE_MANAGER]" + err.Error())
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
var ticker = time.NewTicker(1 * time.Minute)
|
||||||
|
for range ticker.C {
|
||||||
|
resp, err := rpcClient.HTTPDNSNodeRPC.CheckHTTPDNSNodeLatestVersion(rpcClient.Context(), &pb.CheckHTTPDNSNodeLatestVersionRequest{
|
||||||
|
Os: runtime.GOOS,
|
||||||
|
Arch: runtime.GOARCH,
|
||||||
|
CurrentVersion: teaconst.Version,
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
log.Println("[UPGRADE_MANAGER]check version failed: " + err.Error())
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
if resp.HasNewVersion {
|
||||||
|
this.Start()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Start 启动升级
|
||||||
|
func (this *UpgradeManager) Start() {
|
||||||
|
// 必须放在文件解压之前读取可执行文件路径,防止解压之后,当前的可执行文件路径发生改变
|
||||||
|
exe, err := os.Executable()
|
||||||
|
if err != nil {
|
||||||
|
log.Println("[UPGRADE_MANAGER]can not find current executable file name")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
this.exe = exe
|
||||||
|
|
||||||
|
// 测试环境下不更新
|
||||||
|
if Tea.IsTesting() {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if this.isInstalling {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
this.isInstalling = true
|
||||||
|
|
||||||
|
// 还原安装状态
|
||||||
|
defer func() {
|
||||||
|
this.isInstalling = false
|
||||||
|
}()
|
||||||
|
|
||||||
|
log.Println("[UPGRADE_MANAGER]upgrading httpdns node ...")
|
||||||
|
err = this.install()
|
||||||
|
if err != nil {
|
||||||
|
log.Println("[UPGRADE_MANAGER]download failed: " + err.Error())
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
log.Println("[UPGRADE_MANAGER]upgrade successfully")
|
||||||
|
|
||||||
|
go func() {
|
||||||
|
err = this.restart()
|
||||||
|
if err != nil {
|
||||||
|
log.Println("[UPGRADE_MANAGER]" + err.Error())
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *UpgradeManager) install() error {
|
||||||
|
// 检查是否有已下载但未安装成功的
|
||||||
|
if len(this.lastFile) > 0 {
|
||||||
|
_, err := os.Stat(this.lastFile)
|
||||||
|
if err == nil {
|
||||||
|
err = this.unzip(this.lastFile)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
this.lastFile = ""
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 创建临时文件
|
||||||
|
dir := Tea.Root + "/tmp"
|
||||||
|
_, err := os.Stat(dir)
|
||||||
|
if err != nil {
|
||||||
|
if os.IsNotExist(err) {
|
||||||
|
err = os.Mkdir(dir, 0777)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
log.Println("[UPGRADE_MANAGER]downloading new node ...")
|
||||||
|
|
||||||
|
path := dir + "/" + teaconst.ProcessName + ".tmp"
|
||||||
|
fp, err := os.OpenFile(path, os.O_CREATE|os.O_WRONLY|os.O_TRUNC, 0777)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
isClosed := false
|
||||||
|
defer func() {
|
||||||
|
if !isClosed {
|
||||||
|
_ = fp.Close()
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
|
||||||
|
client, err := rpc.SharedRPC()
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
var offset int64
|
||||||
|
var h = md5.New()
|
||||||
|
var sum = ""
|
||||||
|
var filename = ""
|
||||||
|
for {
|
||||||
|
resp, err := client.HTTPDNSNodeRPC.DownloadHTTPDNSNodeInstallationFile(client.Context(), &pb.DownloadHTTPDNSNodeInstallationFileRequest{
|
||||||
|
Os: runtime.GOOS,
|
||||||
|
Arch: runtime.GOARCH,
|
||||||
|
ChunkOffset: offset,
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if len(resp.Sum) == 0 {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
sum = resp.Sum
|
||||||
|
filename = resp.Filename
|
||||||
|
if stringutil.VersionCompare(resp.Version, teaconst.Version) <= 0 {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
if len(resp.ChunkData) == 0 {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
|
||||||
|
// 写入文件
|
||||||
|
_, err = fp.Write(resp.ChunkData)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
_, err = h.Write(resp.ChunkData)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
offset = resp.Offset
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(filename) == 0 {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
isClosed = true
|
||||||
|
err = fp.Close()
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
if fmt.Sprintf("%x", h.Sum(nil)) != sum {
|
||||||
|
_ = os.Remove(path)
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// 改成zip
|
||||||
|
zipPath := dir + "/" + filename
|
||||||
|
err = os.Rename(path, zipPath)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
this.lastFile = zipPath
|
||||||
|
|
||||||
|
// 解压
|
||||||
|
err = this.unzip(zipPath)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// 解压
|
||||||
|
func (this *UpgradeManager) unzip(zipPath string) error {
|
||||||
|
var isOk = false
|
||||||
|
defer func() {
|
||||||
|
if isOk {
|
||||||
|
// 只有解压并覆盖成功后才会删除
|
||||||
|
_ = os.Remove(zipPath)
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
|
||||||
|
// 解压
|
||||||
|
var target = Tea.Root
|
||||||
|
if Tea.IsTesting() {
|
||||||
|
// 测试环境下只解压在tmp目录
|
||||||
|
target = Tea.Root + "/tmp"
|
||||||
|
}
|
||||||
|
|
||||||
|
// 先改先前的可执行文件
|
||||||
|
err := os.Rename(target+"/bin/"+teaconst.ProcessName, target+"/bin/."+teaconst.ProcessName+".dist")
|
||||||
|
hasBackup := err == nil
|
||||||
|
defer func() {
|
||||||
|
if !isOk && hasBackup {
|
||||||
|
// 失败时还原
|
||||||
|
_ = os.Rename(target+"/bin/."+teaconst.ProcessName+".dist", target+"/bin/"+teaconst.ProcessName)
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
|
||||||
|
unzip := utils.NewUnzip(zipPath, target, teaconst.ProcessName+"/")
|
||||||
|
err = unzip.Run()
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
isOk = true
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// 重启
|
||||||
|
func (this *UpgradeManager) restart() error {
|
||||||
|
// 关闭当前sock,防止无法重启
|
||||||
|
_ = gosock.NewTmpSock(teaconst.ProcessName).Close()
|
||||||
|
|
||||||
|
// 重新启动
|
||||||
|
if DaemonIsOn && DaemonPid == os.Getppid() {
|
||||||
|
os.Exit(0)
|
||||||
|
} else {
|
||||||
|
// 启动
|
||||||
|
var exe = filepath.Dir(this.exe) + "/" + teaconst.ProcessName
|
||||||
|
|
||||||
|
log.Println("[UPGRADE_MANAGER]restarting ...", exe)
|
||||||
|
cmd := exec.Command(exe, "start")
|
||||||
|
err := cmd.Start()
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
// 退出当前进程
|
||||||
|
time.Sleep(1 * time.Second)
|
||||||
|
os.Exit(0)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
98
EdgeHttpDNS/internal/utils/unzip.go
Normal file
98
EdgeHttpDNS/internal/utils/unzip.go
Normal file
@@ -0,0 +1,98 @@
|
|||||||
|
package utils
|
||||||
|
|
||||||
|
import (
|
||||||
|
"archive/zip"
|
||||||
|
"errors"
|
||||||
|
"io"
|
||||||
|
"os"
|
||||||
|
"strings"
|
||||||
|
)
|
||||||
|
|
||||||
|
type Unzip struct {
|
||||||
|
zipFile string
|
||||||
|
targetDir string
|
||||||
|
stripPrefix string
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewUnzip(zipFile string, targetDir string, stripPrefix string) *Unzip {
|
||||||
|
return &Unzip{
|
||||||
|
zipFile: zipFile,
|
||||||
|
targetDir: targetDir,
|
||||||
|
stripPrefix: stripPrefix,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *Unzip) Run() error {
|
||||||
|
if len(this.zipFile) == 0 {
|
||||||
|
return errors.New("zip file should not be empty")
|
||||||
|
}
|
||||||
|
if len(this.targetDir) == 0 {
|
||||||
|
return errors.New("target dir should not be empty")
|
||||||
|
}
|
||||||
|
|
||||||
|
reader, err := zip.OpenReader(this.zipFile)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
defer func() {
|
||||||
|
_ = reader.Close()
|
||||||
|
}()
|
||||||
|
|
||||||
|
for _, file := range reader.File {
|
||||||
|
info := file.FileInfo()
|
||||||
|
filename := file.Name
|
||||||
|
if len(this.stripPrefix) > 0 {
|
||||||
|
filename = strings.TrimPrefix(filename, this.stripPrefix)
|
||||||
|
}
|
||||||
|
target := this.targetDir + "/" + filename
|
||||||
|
|
||||||
|
// 目录
|
||||||
|
if info.IsDir() {
|
||||||
|
stat, err := os.Stat(target)
|
||||||
|
if err != nil {
|
||||||
|
if !os.IsNotExist(err) {
|
||||||
|
return err
|
||||||
|
} else {
|
||||||
|
err = os.MkdirAll(target, info.Mode())
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if !stat.IsDir() {
|
||||||
|
err = os.MkdirAll(target, info.Mode())
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
// 文件
|
||||||
|
err := func(file *zip.File, target string) error {
|
||||||
|
fileReader, err := file.Open()
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
defer func() {
|
||||||
|
_ = fileReader.Close()
|
||||||
|
}()
|
||||||
|
|
||||||
|
fileWriter, err := os.OpenFile(target, os.O_CREATE|os.O_WRONLY|os.O_TRUNC, file.FileInfo().Mode())
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
defer func() {
|
||||||
|
_ = fileWriter.Close()
|
||||||
|
}()
|
||||||
|
|
||||||
|
_, err = io.Copy(fileWriter, fileReader)
|
||||||
|
return err
|
||||||
|
}(file, target)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
@@ -430,7 +430,7 @@ func (this *userMustAuth) modules(userId int64, isVerified bool, isIdentified bo
|
|||||||
"code": "httpdns",
|
"code": "httpdns",
|
||||||
"name": "HTTPDNS",
|
"name": "HTTPDNS",
|
||||||
"icon": "shield alternate",
|
"icon": "shield alternate",
|
||||||
"isOn": lists.ContainsString(featureCodes, userconfigs.UserFeatureCodeHTTPDNS),
|
"isOn": registerConfig != nil && registerConfig.HTTPDNSIsOn,
|
||||||
"subItems": []maps.Map{
|
"subItems": []maps.Map{
|
||||||
{
|
{
|
||||||
"name": "应用管理",
|
"name": "应用管理",
|
||||||
|
|||||||
Reference in New Issue
Block a user