diff --git a/internal/rpc/rpc_client.go b/internal/rpc/rpc_client.go
index bb5cfa40..acdd80ac 100644
--- a/internal/rpc/rpc_client.go
+++ b/internal/rpc/rpc_client.go
@@ -301,9 +301,14 @@ func (this *RPCClient) pickConn() *grpc.ClientConn {
// 检查连接状态
if len(this.conns) > 0 {
availableConns := []*grpc.ClientConn{}
- for _, conn := range this.conns {
- if conn.GetState() == connectivity.Ready {
- availableConns = append(availableConns, conn)
+ for _, state := range []connectivity.State{connectivity.Ready, connectivity.Idle, connectivity.Connecting} {
+ for _, conn := range this.conns {
+ if conn.GetState() == state {
+ availableConns = append(availableConns, conn)
+ }
+ }
+ if len(availableConns) > 0 {
+ break
}
}
diff --git a/internal/web/actions/default/dns/clusters/cluster.go b/internal/web/actions/default/dns/clusters/cluster.go
index 00ec14d6..87af4e6b 100644
--- a/internal/web/actions/default/dns/clusters/cluster.go
+++ b/internal/web/actions/default/dns/clusters/cluster.go
@@ -68,10 +68,13 @@ func (this *ClusterAction) RunGet(params struct {
nodeMaps := []maps.Map{}
for _, node := range nodesResp.Nodes {
nodeMaps = append(nodeMaps, maps.Map{
- "id": node.Id,
- "name": node.Name,
- "ipAddr": node.IpAddr,
- "route": node.Route,
+ "id": node.Id,
+ "name": node.Name,
+ "ipAddr": node.IpAddr,
+ "route": maps.Map{
+ "name": node.Route.Name,
+ "code": node.Route.Code,
+ },
"clusterId": node.ClusterId,
})
}
diff --git a/internal/web/actions/default/dns/domains/routesPopup.go b/internal/web/actions/default/dns/domains/routesPopup.go
index 406b297e..d41d8c69 100644
--- a/internal/web/actions/default/dns/domains/routesPopup.go
+++ b/internal/web/actions/default/dns/domains/routesPopup.go
@@ -3,6 +3,7 @@ package domains
import (
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
+ "github.com/iwind/TeaGo/maps"
)
type RoutesPopupAction struct {
@@ -21,10 +22,14 @@ func (this *RoutesPopupAction) RunGet(params struct {
this.ErrorPage(err)
return
}
- if len(routesResp.Routes) == 0 {
- routesResp.Routes = []string{}
+ routeMaps := []maps.Map{}
+ for _, route := range routesResp.Routes {
+ routeMaps = append(routeMaps, maps.Map{
+ "name": route.Name,
+ "code": route.Code,
+ })
}
- this.Data["routes"] = routesResp.Routes
+ this.Data["routes"] = routeMaps
this.Show()
}
diff --git a/internal/web/actions/default/dns/issues/updateNodePopup.go b/internal/web/actions/default/dns/issues/updateNodePopup.go
index d936cbcd..7a7e89f9 100644
--- a/internal/web/actions/default/dns/issues/updateNodePopup.go
+++ b/internal/web/actions/default/dns/issues/updateNodePopup.go
@@ -5,7 +5,7 @@ import (
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
"github.com/iwind/TeaGo/actions"
- "github.com/iwind/TeaGo/lists"
+ "github.com/iwind/TeaGo/maps"
"net"
)
@@ -33,12 +33,12 @@ func (this *UpdateNodePopupAction) RunGet(params struct {
return
}
this.Data["ipAddr"] = dnsInfo.IpAddr
- this.Data["route"] = dnsInfo.Route
+ this.Data["route"] = dnsInfo.Route.Code
this.Data["domainId"] = dnsInfo.DnsDomainId
this.Data["domainName"] = dnsInfo.DnsDomainName
// 读取所有线路
- routes := []string{}
+ routeMaps := []maps.Map{}
if dnsInfo.DnsDomainId > 0 {
routesResp, err := this.RPC().DNSDomainRPC().FindAllDNSDomainRoutes(this.AdminContext(), &pb.FindAllDNSDomainRoutesRequest{DnsDomainId: dnsInfo.DnsDomainId})
if err != nil {
@@ -46,13 +46,28 @@ func (this *UpdateNodePopupAction) RunGet(params struct {
return
}
if len(routesResp.Routes) > 0 {
- routes = routesResp.Routes
+ for _, route := range routesResp.Routes {
+ routeMaps = append(routeMaps, maps.Map{
+ "name": route.Name,
+ "code": route.Code,
+ })
+ }
}
}
- this.Data["routes"] = routes
+ this.Data["routes"] = routeMaps
- if len(routes) > 0 && !lists.ContainsString(routes, dnsInfo.Route) {
- this.Data["route"] = routes[0]
+ // 是否包含现有线路
+ if len(routeMaps) > 0 {
+ isRouteValid := false
+ for _, route := range routeMaps {
+ if route.GetString("code") == dnsInfo.Route.Code {
+ isRouteValid = true
+ break
+ }
+ }
+ if !isRouteValid {
+ this.Data["route"] = routeMaps[0].GetString("code")
+ }
}
this.Show()
diff --git a/internal/web/actions/default/dns/providers/createPopup.go b/internal/web/actions/default/dns/providers/createPopup.go
index afc7ddf7..aad78641 100644
--- a/internal/web/actions/default/dns/providers/createPopup.go
+++ b/internal/web/actions/default/dns/providers/createPopup.go
@@ -39,10 +39,18 @@ func (this *CreatePopupAction) RunPost(params struct {
Name string
Type string
- // dnspod
+ // DNSPod
ParamId string
ParamToken string
+ // AliDNS
+ ParamAccessKeyId string
+ ParamAccessKeySecret string
+
+ // DNS.COM
+ ParamApiKey string
+ ParamApiSecret string
+
Must *actions.Must
CSRF *actionutils.CSRF
}) {
@@ -63,6 +71,24 @@ func (this *CreatePopupAction) RunPost(params struct {
apiParams["id"] = params.ParamId
apiParams["token"] = params.ParamToken
+ case "alidns":
+ params.Must.
+ Field("paramAccessKeyId", params.ParamAccessKeyId).
+ Require("请输入AccessKeyId").
+ Field("paramAccessKeySecret", params.ParamAccessKeySecret).
+ Require("请输入AccessKeySecret")
+
+ apiParams["accessKeyId"] = params.ParamAccessKeyId
+ apiParams["accessKeySecret"] = params.ParamAccessKeySecret
+ case "dnscom":
+ params.Must.
+ Field("paramApiKey", params.ParamApiKey).
+ Require("请输入ApiKey").
+ Field("paramApiSecret", params.ParamApiSecret).
+ Require("请输入ApiSecret")
+
+ apiParams["apiKey"] = params.ParamApiKey
+ apiParams["apiSecret"] = params.ParamApiSecret
default:
this.Fail("暂时不支持此服务商'" + params.Type + "'")
}
diff --git a/internal/web/actions/default/dns/providers/updatePopup.go b/internal/web/actions/default/dns/providers/updatePopup.go
index a2a220bb..a2e743b7 100644
--- a/internal/web/actions/default/dns/providers/updatePopup.go
+++ b/internal/web/actions/default/dns/providers/updatePopup.go
@@ -72,10 +72,18 @@ func (this *UpdatePopupAction) RunPost(params struct {
Name string
Type string
- // dnspod
+ // DNSPod
ParamId string
ParamToken string
+ // AliDNS
+ ParamAccessKeyId string
+ ParamAccessKeySecret string
+
+ // DNS.COM
+ ParamApiKey string
+ ParamApiSecret string
+
Must *actions.Must
CSRF *actionutils.CSRF
}) {
@@ -98,6 +106,24 @@ func (this *UpdatePopupAction) RunPost(params struct {
apiParams["id"] = params.ParamId
apiParams["token"] = params.ParamToken
+ case "alidns":
+ params.Must.
+ Field("paramAccessKeyId", params.ParamAccessKeyId).
+ Require("请输入AccessKeyId").
+ Field("paramAccessKeySecret", params.ParamAccessKeySecret).
+ Require("请输入AccessKeySecret")
+
+ apiParams["accessKeyId"] = params.ParamAccessKeyId
+ apiParams["accessKeySecret"] = params.ParamAccessKeySecret
+ case "dnscom":
+ params.Must.
+ Field("paramApiKey", params.ParamApiKey).
+ Require("请输入ApiKey").
+ Field("paramApiSecret", params.ParamApiSecret).
+ Require("请输入ApiSecret")
+
+ apiParams["apiKey"] = params.ParamApiKey
+ apiParams["apiSecret"] = params.ParamApiSecret
default:
this.Fail("暂时不支持此服务商'" + params.Type + "'")
}
diff --git a/web/views/@default/dns/clusters/cluster.html b/web/views/@default/dns/clusters/cluster.html
index ea93dcd9..e480922d 100644
--- a/web/views/@default/dns/clusters/cluster.html
+++ b/web/views/@default/dns/clusters/cluster.html
@@ -69,7 +69,7 @@
暂时还没有支持的线路。
注意:有些DNS服务商会根据账号的会员级别等限制线路的使用。
没有可选的线路。
当前节点IP对应的线路。
获取方法参考:文档
获取方法参考:文档
+登录阿里云控制台 -- 在"访问控制"中创建和获取。
+登录阿里云控制台 -- 在"访问控制"中创建和获取。
+登录DNS.COM控制台 -- 在"账户中心" -- "API设置"中创建和获取。
+登录DNS.COM控制台 -- 在"账户中心" -- "API设置"中创建和获取。
获取方法参考:文档
获取方法参考:文档
+登录阿里云控制台 -- 在"访问控制"中创建和获取。
+登录阿里云控制台 -- 在"访问控制"中创建和获取。