type DnsServer struct {
gorm.Model
Hostname string `json:"hostname" gorm:"comment:'主机名'"`
IpAddress string `json:"ipAddress" gorm:"comment:'IP地址'"`
DnsRole string `json:"dnsRole" gorm:"comment:'DNS角色'"`
Forwarders string `json:"forwarders" gorm:"comment:'转发地址'"`
Recursion string `json:"recursion" gorm:"comment:'是否递归'"`
RegionCode string `json:"regionCode" gorm:"comment:'区域编码'"`
Zones []DnsZone `json:"zones" gorm:"foreignkey:ServerID;comment:'DNS服务器的所有zone'"`
Remark string `json:"remark" gorm:"comment:'说明'"`
}
type DnsRecord struct {
gorm.Model
Domain string `json:"domain" gorm:"comment:'主机头,待查记录'"`
Ttl uint `json:"ttl" gorm:"comment:'Time To Live 暂存时间(秒)'"`
ResourceRecordType string `json:"resourceRecordType" gorm:"comment:'记录类型'"`
ResourceRecordData string `json:"resourceRecordData" gorm:"comment:'记录值'"`
ZoneID string `json:"zoneID" gorm:"comment:'域ID'"`
Owner string `json:"owner" gorm:"comment:'拥有者'"`
Business string `json:"business" gorm:"comment:'业务'"`
Remark string `json:"remark" gorm:"comment:'说明'"`
}
type DnsRegion struct {
gorm.Model
RegionName string `json:"regionName" gorm:"comment:'区域名'"`
RegionCode string `json:"regionCode" gorm:"comment:'区域码'"`
Country string `json:"country" gorm:"comment:'国家'"`
City string `json:"city" gorm:"comment:'城市'"`
Location string `json:"location" gorm:"comment:'地点'"`
Servers []DnsServer `json:"servers" gorm:"foreignkey:regionCode;association_foreignkey:RegionCode;comment:'DNS服务器'"`
Remark string `json:"remark" gorm:"comment:'说明'"`
}
type DnsZone struct {
gorm.Model
ZoneName string `json:"zoneName" gorm:"comment:'zone名'"`
ZoneType string `json:"zoneType" gorm:"comment:'zone类型,master|slave|forward'"`
AlsoNotify string `json:"alsoNotify" gorm:"comment:'通知slave同步消息'"`
AllowTransfer string `json:"allowTransfer" gorm:"comment:'发送的slave节点'"`
AllowUpdate string `json:"allowUpdate" gorm:"comment:'nsupdate更新,默认为本机'"`
Forwarders string `json:"forwarders" gorm:"comment:'zoneType为forward有效,为转发地址'"`
Masters string `json:"masters" gorm:"comment:'zoneType为salve有效,为master的地址'"`
IpAddress string `json:"ipAddress" gorm:"comment:'Zone所处的服务器IP地址'"`
ServerID uint `json:"serverID" gorm:"comment:'Zone所处的服务器ID'"`
Records []DnsRecord `json:"records" gorm:"foreignkey:ZoneID;comment:'zone所有的domain'"`
Remark string `json:"remark" gorm:"comment:'说明'"`
}
CREATE TABLE `dns_zones` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`created_at` datetime DEFAULT NULL,
`updated_at` datetime DEFAULT NULL,
`deleted_at` datetime DEFAULT NULL,
`zone_name` varchar(255) DEFAULT NULL COMMENT 'zone名',
`zone_type` varchar(255) DEFAULT NULL COMMENT 'zone类型,master|slave|forward',
`also_notify` varchar(255) DEFAULT NULL COMMENT '通知slave同步消息',
`allow_transfer` varchar(255) DEFAULT NULL COMMENT '发送的slave节点',
`allow_update` varchar(255) DEFAULT NULL COMMENT 'nsupdate更新,默认为本机',
`forwarders` varchar(255) DEFAULT NULL COMMENT 'zoneType为forward有效,为转发地址',
`masters` varchar(255) DEFAULT NULL COMMENT 'zoneType为salve有效,为master的地址',
`ip_address` varchar(255) DEFAULT NULL COMMENT 'Zone所处的服务器IP地址',
`server_id` int(10) unsigned DEFAULT NULL COMMENT 'Zone所处的服务器ID',
`remark` varchar(255) DEFAULT NULL COMMENT '说明',
PRIMARY KEY (`id`),
KEY `idx_dns_zones_deleted_at` (`deleted_at`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
CREATE TABLE `dns_servers` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`created_at` datetime DEFAULT NULL,
`updated_at` datetime DEFAULT NULL,
`deleted_at` datetime DEFAULT NULL,
`hostname` varchar(255) DEFAULT NULL COMMENT '主机名',
`ip_address` varchar(255) DEFAULT NULL COMMENT 'IP地址',
`dns_role` varchar(255) DEFAULT NULL COMMENT 'DNS角色',
`forwarders` varchar(255) DEFAULT NULL COMMENT '转发地址',
`recursion` varchar(255) DEFAULT NULL COMMENT '是否递归',
`region_code` varchar(255) DEFAULT NULL COMMENT '区域编码',
`remark` varchar(255) DEFAULT NULL COMMENT '说明',
PRIMARY KEY (`id`),
KEY `idx_dns_servers_deleted_at` (`deleted_at`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
CREATE TABLE `dns_regions` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`created_at` datetime DEFAULT NULL,
`updated_at` datetime DEFAULT NULL,
`deleted_at` datetime DEFAULT NULL,
`region_name` varchar(255) DEFAULT NULL COMMENT '区域名',
`region_code` varchar(255) DEFAULT NULL COMMENT '区域码',
`country` varchar(255) DEFAULT NULL COMMENT '国家',
`city` varchar(255) DEFAULT NULL COMMENT '城市',
`location` varchar(255) DEFAULT NULL COMMENT '地点',
`remark` varchar(255) DEFAULT NULL COMMENT '说明',
PRIMARY KEY (`id`),
KEY `idx_dns_regions_deleted_at` (`deleted_at`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
CREATE TABLE `dns_records` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`created_at` datetime DEFAULT NULL,
`updated_at` datetime DEFAULT NULL,
`deleted_at` datetime DEFAULT NULL,
`domain` varchar(255) DEFAULT NULL COMMENT '主机头,待查记录',
`ttl` int(10) unsigned DEFAULT NULL COMMENT 'Time To Live 暂存时间(秒)',
`resource_record_type` varchar(255) DEFAULT NULL COMMENT '记录类型',
`resource_record_data` varchar(255) DEFAULT NULL COMMENT '记录值',
`zone_id` varchar(255) DEFAULT NULL COMMENT '域ID',
`owner` varchar(255) DEFAULT NULL COMMENT '拥有者',
`business` varchar(255) DEFAULT NULL COMMENT '业务',
`remark` varchar(255) DEFAULT NULL COMMENT '说明',
PRIMARY KEY (`id`),
KEY `idx_dns_records_deleted_at` (`deleted_at`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
网友评论