可以修改节点的DNS设置

This commit is contained in:
刘祥超
2020-11-14 09:41:58 +08:00
parent b46960e45a
commit 97f94afc3b
5 changed files with 233 additions and 0 deletions

View File

@@ -40,6 +40,19 @@ func (this *Node) DecodeStatus() (*nodeconfigs.NodeStatus, error) {
return status, nil
}
// 所有的DNS线路
func (this *Node) DNSRoutes() (map[int64]string, error) {
routes := map[int64]string{} // domainId => route
if len(this.DnsRoutes) == 0 || this.DnsRoutes == "null" {
return routes, nil
}
err := json.Unmarshal([]byte(this.DnsRoutes), &routes)
if err != nil {
return map[int64]string{}, err
}
return routes, nil
}
// DNS线路
func (this *Node) DNSRoute(dnsDomainId int64) (string, error) {
routes := map[int64]string{} // domainId => route