dns

package
v1.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 19, 2023 License: BSD-3-Clause Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DNSDomainStateEnabled  = 1 // 已启用
	DNSDomainStateDisabled = 0 // 已禁用
)
View Source
const (
	DNSProviderStateEnabled  = 1 // 已启用
	DNSProviderStateDisabled = 0 // 已禁用
)
View Source
const (
	DNSTaskField_Id         dbs.FieldName = "id"         // ID
	DNSTaskField_ClusterId  dbs.FieldName = "clusterId"  // 集群ID
	DNSTaskField_ServerId   dbs.FieldName = "serverId"   // 服务ID
	DNSTaskField_NodeId     dbs.FieldName = "nodeId"     // 节点ID
	DNSTaskField_DomainId   dbs.FieldName = "domainId"   // 域名ID
	DNSTaskField_RecordName dbs.FieldName = "recordName" // 记录名
	DNSTaskField_Type       dbs.FieldName = "type"       // 任务类型
	DNSTaskField_UpdatedAt  dbs.FieldName = "updatedAt"  // 更新时间
	DNSTaskField_IsDone     dbs.FieldName = "isDone"     // 是否已完成
	DNSTaskField_IsOk       dbs.FieldName = "isOk"       // 是否成功
	DNSTaskField_Error      dbs.FieldName = "error"      // 错误信息
	DNSTaskField_Version    dbs.FieldName = "version"    // 版本
	DNSTaskField_CountFails dbs.FieldName = "countFails" // 尝试失败次数
)

Variables

View Source
var DNSTasksNotifier = make(chan bool, 2)

Functions

This section is empty.

Types

type DNSDomain

type DNSDomain struct {
	Id            uint32   `field:"id"`            // ID
	AdminId       uint32   `field:"adminId"`       // 管理员ID
	UserId        uint32   `field:"userId"`        // 用户ID
	ProviderId    uint32   `field:"providerId"`    // 服务商ID
	IsOn          bool     `field:"isOn"`          // 是否可用
	Name          string   `field:"name"`          // 域名
	CreatedAt     uint64   `field:"createdAt"`     // 创建时间
	DataUpdatedAt uint64   `field:"dataUpdatedAt"` // 数据更新时间
	DataError     string   `field:"dataError"`     // 数据更新错误
	Data          string   `field:"data"`          // 原始数据信息
	Records       dbs.JSON `field:"records"`       // 所有解析记录
	Routes        dbs.JSON `field:"routes"`        // 线路数据
	IsUp          bool     `field:"isUp"`          // 是否在线
	State         uint8    `field:"state"`         // 状态
	IsDeleted     bool     `field:"isDeleted"`     // 是否已删除
}

DNSDomain 管理的域名

func (*DNSDomain) ContainsRouteCode

func (this *DNSDomain) ContainsRouteCode(route string) (bool, error)

ContainsRouteCode 检查是否包含某个线路

func (*DNSDomain) DecodeRecords

func (this *DNSDomain) DecodeRecords() ([]*dnstypes.Record, error)

DecodeRecords 获取所有的记录

func (*DNSDomain) DecodeRoutes

func (this *DNSDomain) DecodeRoutes() ([]*dnstypes.Route, error)

DecodeRoutes 获取所有的线路

type DNSDomainDAO

type DNSDomainDAO dbs.DAO
var SharedDNSDomainDAO *DNSDomainDAO

func NewDNSDomainDAO

func NewDNSDomainDAO() *DNSDomainDAO

func (*DNSDomainDAO) CountAllEnabledDomainsWithProviderId

func (this *DNSDomainDAO) CountAllEnabledDomainsWithProviderId(tx *dbs.Tx, providerId int64, isDeleted bool, isUp bool) (int64, error)

CountAllEnabledDomainsWithProviderId 计算某个服务商下的域名数量

func (*DNSDomainDAO) CreateDomain

func (this *DNSDomainDAO) CreateDomain(tx *dbs.Tx, adminId int64, userId int64, providerId int64, name string) (int64, error)

CreateDomain 创建域名

func (*DNSDomainDAO) DisableDNSDomain

func (this *DNSDomainDAO) DisableDNSDomain(tx *dbs.Tx, id int64) error

DisableDNSDomain 禁用条目

func (*DNSDomainDAO) EnableDNSDomain

func (this *DNSDomainDAO) EnableDNSDomain(tx *dbs.Tx, id int64) error

EnableDNSDomain 启用条目

func (*DNSDomainDAO) ExistAvailableDomains

func (this *DNSDomainDAO) ExistAvailableDomains(tx *dbs.Tx) (bool, error)

ExistAvailableDomains 判断是否有域名可选

func (*DNSDomainDAO) ExistDomainRecord

func (this *DNSDomainDAO) ExistDomainRecord(tx *dbs.Tx, domainId int64, recordName string, recordType string, recordRoute string, recordValue string) (bool, error)

ExistDomainRecord 检查域名解析记录是否存在

func (*DNSDomainDAO) FindAllEnabledDomainsWithProviderId

func (this *DNSDomainDAO) FindAllEnabledDomainsWithProviderId(tx *dbs.Tx, providerId int64) (result []*DNSDomain, err error)

FindAllEnabledDomainsWithProviderId 查询一个服务商下面的所有域名

func (*DNSDomainDAO) FindDNSDomainName

func (this *DNSDomainDAO) FindDNSDomainName(tx *dbs.Tx, id int64) (string, error)

FindDNSDomainName 根据主键查找名称

func (*DNSDomainDAO) FindDomainRouteName

func (this *DNSDomainDAO) FindDomainRouteName(tx *dbs.Tx, domainId int64, routeCode string) (string, error)

FindDomainRouteName 查找线路名称

func (*DNSDomainDAO) FindDomainRoutes

func (this *DNSDomainDAO) FindDomainRoutes(tx *dbs.Tx, domainId int64) ([]*dnstypes.Route, error)

FindDomainRoutes 查找域名线路

func (*DNSDomainDAO) FindEnabledDNSDomain

func (this *DNSDomainDAO) FindEnabledDNSDomain(tx *dbs.Tx, domainId int64, cacheMap *utils.CacheMap) (*DNSDomain, error)

FindEnabledDNSDomain 查找启用中的条目

func (*DNSDomainDAO) FindEnabledDomainWithName

func (this *DNSDomainDAO) FindEnabledDomainWithName(tx *dbs.Tx, providerId int64, domainName string) (*DNSDomain, error)

FindEnabledDomainWithName 根据名称查找某个域名

func (*DNSDomainDAO) ListDomains added in v0.5.3

func (this *DNSDomainDAO) ListDomains(tx *dbs.Tx, providerId int64, isDeleted bool, isUp bool, offset int64, size int64) (result []*DNSDomain, err error)

ListDomains 列出单页域名

func (*DNSDomainDAO) UpdateDomain

func (this *DNSDomainDAO) UpdateDomain(tx *dbs.Tx, domainId int64, name string, isOn bool) error

UpdateDomain 修改域名

func (*DNSDomainDAO) UpdateDomainData

func (this *DNSDomainDAO) UpdateDomainData(tx *dbs.Tx, domainId int64, data string) error

UpdateDomainData 更新域名数据

func (*DNSDomainDAO) UpdateDomainIsDeleted

func (this *DNSDomainDAO) UpdateDomainIsDeleted(tx *dbs.Tx, domainId int64, isDeleted bool) error

UpdateDomainIsDeleted 设置域名为删除

func (*DNSDomainDAO) UpdateDomainIsUp

func (this *DNSDomainDAO) UpdateDomainIsUp(tx *dbs.Tx, domainId int64, isUp bool) error

UpdateDomainIsUp 设置是否在线

func (*DNSDomainDAO) UpdateDomainRecords

func (this *DNSDomainDAO) UpdateDomainRecords(tx *dbs.Tx, domainId int64, recordsJSON []byte) error

UpdateDomainRecords 更新域名解析记录

func (*DNSDomainDAO) UpdateDomainRoutes

func (this *DNSDomainDAO) UpdateDomainRoutes(tx *dbs.Tx, domainId int64, routesJSON []byte) error

UpdateDomainRoutes 更新线路

type DNSDomainOperator

type DNSDomainOperator struct {
	Id            interface{} // ID
	AdminId       interface{} // 管理员ID
	UserId        interface{} // 用户ID
	ProviderId    interface{} // 服务商ID
	IsOn          interface{} // 是否可用
	Name          interface{} // 域名
	CreatedAt     interface{} // 创建时间
	DataUpdatedAt interface{} // 数据更新时间
	DataError     interface{} // 数据更新错误
	Data          interface{} // 原始数据信息
	Records       interface{} // 所有解析记录
	Routes        interface{} // 线路数据
	IsUp          interface{} // 是否在线
	State         interface{} // 状态
	IsDeleted     interface{} // 是否已删除
}

func NewDNSDomainOperator

func NewDNSDomainOperator() *DNSDomainOperator

type DNSProvider

type DNSProvider struct {
	Id            uint32   `field:"id"`            // ID
	Name          string   `field:"name"`          // 名称
	AdminId       uint32   `field:"adminId"`       // 管理员ID
	UserId        uint32   `field:"userId"`        // 用户ID
	Type          string   `field:"type"`          // 供应商类型
	ApiParams     dbs.JSON `field:"apiParams"`     // API参数
	CreatedAt     uint64   `field:"createdAt"`     // 创建时间
	State         uint8    `field:"state"`         // 状态
	DataUpdatedAt uint64   `field:"dataUpdatedAt"` // 数据同步时间
}

DNSProvider DNS服务商

func (*DNSProvider) DecodeAPIParams

func (this *DNSProvider) DecodeAPIParams() (maps.Map, error)

DecodeAPIParams 获取API参数

type DNSProviderDAO

type DNSProviderDAO dbs.DAO
var SharedDNSProviderDAO *DNSProviderDAO

func NewDNSProviderDAO

func NewDNSProviderDAO() *DNSProviderDAO

func (*DNSProviderDAO) CountAllEnabledDNSProviders

func (this *DNSProviderDAO) CountAllEnabledDNSProviders(tx *dbs.Tx, adminId int64, userId int64, keyword string, domain string, providerType string) (int64, error)

CountAllEnabledDNSProviders 计算服务商数量

func (*DNSProviderDAO) CreateDNSProvider

func (this *DNSProviderDAO) CreateDNSProvider(tx *dbs.Tx, adminId int64, userId int64, providerType string, name string, apiParamsJSON []byte) (int64, error)

CreateDNSProvider 创建服务商

func (*DNSProviderDAO) DisableDNSProvider

func (this *DNSProviderDAO) DisableDNSProvider(tx *dbs.Tx, id int64) error

DisableDNSProvider 禁用条目

func (*DNSProviderDAO) EnableDNSProvider

func (this *DNSProviderDAO) EnableDNSProvider(tx *dbs.Tx, id int64) error

EnableDNSProvider 启用条目

func (*DNSProviderDAO) FindAllEnabledDNSProviders

func (this *DNSProviderDAO) FindAllEnabledDNSProviders(tx *dbs.Tx, adminId int64, userId int64) (result []*DNSProvider, err error)

FindAllEnabledDNSProviders 列出所有服务商

func (*DNSProviderDAO) FindAllEnabledDNSProvidersWithType

func (this *DNSProviderDAO) FindAllEnabledDNSProvidersWithType(tx *dbs.Tx, providerType string) (result []*DNSProvider, err error)

FindAllEnabledDNSProvidersWithType 查询某个类型下的所有服务商

func (*DNSProviderDAO) FindEnabledDNSProvider

func (this *DNSProviderDAO) FindEnabledDNSProvider(tx *dbs.Tx, id int64) (*DNSProvider, error)

FindEnabledDNSProvider 查找启用中的条目

func (*DNSProviderDAO) ListEnabledDNSProviders

func (this *DNSProviderDAO) ListEnabledDNSProviders(tx *dbs.Tx, adminId int64, userId int64, keyword string, domain string, providerType string, offset int64, size int64) (result []*DNSProvider, err error)

ListEnabledDNSProviders 列出单页服务商

func (*DNSProviderDAO) UpdateDNSProvider

func (this *DNSProviderDAO) UpdateDNSProvider(tx *dbs.Tx, dnsProviderId int64, name string, apiParamsJSON []byte) error

UpdateDNSProvider 修改服务商

func (*DNSProviderDAO) UpdateProviderDataUpdatedTime

func (this *DNSProviderDAO) UpdateProviderDataUpdatedTime(tx *dbs.Tx, providerId int64) error

UpdateProviderDataUpdatedTime 更新数据更新时间

type DNSProviderOperator

type DNSProviderOperator struct {
	Id            interface{} // ID
	Name          interface{} // 名称
	AdminId       interface{} // 管理员ID
	UserId        interface{} // 用户ID
	Type          interface{} // 供应商类型
	ApiParams     interface{} // API参数
	CreatedAt     interface{} // 创建时间
	State         interface{} // 状态
	DataUpdatedAt interface{} // 数据同步时间
}

func NewDNSProviderOperator

func NewDNSProviderOperator() *DNSProviderOperator

type DNSTask

type DNSTask struct {
	Id         uint64 `field:"id"`         // ID
	ClusterId  uint32 `field:"clusterId"`  // 集群ID
	ServerId   uint32 `field:"serverId"`   // 服务ID
	NodeId     uint32 `field:"nodeId"`     // 节点ID
	DomainId   uint32 `field:"domainId"`   // 域名ID
	RecordName string `field:"recordName"` // 记录名
	Type       string `field:"type"`       // 任务类型
	UpdatedAt  uint64 `field:"updatedAt"`  // 更新时间
	IsDone     bool   `field:"isDone"`     // 是否已完成
	IsOk       bool   `field:"isOk"`       // 是否成功
	Error      string `field:"error"`      // 错误信息
	Version    uint64 `field:"version"`    // 版本
	CountFails uint32 `field:"countFails"` // 尝试失败次数
}

DNSTask DNS更新任务

type DNSTaskDAO

type DNSTaskDAO dbs.DAO
var SharedDNSTaskDAO *DNSTaskDAO

func NewDNSTaskDAO

func NewDNSTaskDAO() *DNSTaskDAO

func (*DNSTaskDAO) CreateClusterRemoveTask

func (this *DNSTaskDAO) CreateClusterRemoveTask(tx *dbs.Tx, clusterId int64, domainId int64, recordName string) error

CreateClusterRemoveTask 生成集群删除域名任务

func (*DNSTaskDAO) CreateClusterTask

func (this *DNSTaskDAO) CreateClusterTask(tx *dbs.Tx, clusterId int64, taskType DNSTaskType) error

CreateClusterTask 生成集群变更任务

func (*DNSTaskDAO) CreateDNSTask

func (this *DNSTaskDAO) CreateDNSTask(tx *dbs.Tx, clusterId int64, serverId int64, nodeId int64, domainId int64, recordName string, taskType string) error

CreateDNSTask 生成任务

func (*DNSTaskDAO) CreateDomainTask

func (this *DNSTaskDAO) CreateDomainTask(tx *dbs.Tx, domainId int64, taskType DNSTaskType) error

CreateDomainTask 生成域名更新任务

func (*DNSTaskDAO) CreateNodeTask

func (this *DNSTaskDAO) CreateNodeTask(tx *dbs.Tx, clusterId int64, nodeId int64, taskType DNSTaskType) error

CreateNodeTask 生成节点任务

func (*DNSTaskDAO) CreateServerTask

func (this *DNSTaskDAO) CreateServerTask(tx *dbs.Tx, clusterId int64, serverId int64, taskType DNSTaskType) error

CreateServerTask 生成服务任务

func (*DNSTaskDAO) DeleteAllDNSTasks added in v1.2.1

func (this *DNSTaskDAO) DeleteAllDNSTasks(tx *dbs.Tx) error

DeleteAllDNSTasks 删除所有任务

func (*DNSTaskDAO) DeleteDNSTask

func (this *DNSTaskDAO) DeleteDNSTask(tx *dbs.Tx, taskId int64) error

DeleteDNSTask 删除任务

func (*DNSTaskDAO) DeleteDNSTasksWithClusterId added in v0.5.3

func (this *DNSTaskDAO) DeleteDNSTasksWithClusterId(tx *dbs.Tx, clusterId int64) error

DeleteDNSTasksWithClusterId 删除集群相关任务

func (*DNSTaskDAO) ExistDoingTasks

func (this *DNSTaskDAO) ExistDoingTasks(tx *dbs.Tx) (bool, error)

ExistDoingTasks 检查是否有正在执行的任务

func (*DNSTaskDAO) ExistErrorTasks

func (this *DNSTaskDAO) ExistErrorTasks(tx *dbs.Tx) (bool, error)

ExistErrorTasks 检查是否有错误的任务

func (*DNSTaskDAO) FindAllDoingOrErrorTasks

func (this *DNSTaskDAO) FindAllDoingOrErrorTasks(tx *dbs.Tx, nodeClusterId int64) (result []*DNSTask, err error)

FindAllDoingOrErrorTasks 查找正在执行的和错误的任务

func (*DNSTaskDAO) FindAllDoingTasks

func (this *DNSTaskDAO) FindAllDoingTasks(tx *dbs.Tx) (result []*DNSTask, err error)

FindAllDoingTasks 查找所有正在执行的任务

func (*DNSTaskDAO) GenerateVersion added in v1.2.1

func (this *DNSTaskDAO) GenerateVersion() int64

GenerateVersion 生成最新的版本号

func (*DNSTaskDAO) UpdateClusterDNSTasksDone added in v1.2.1

func (this *DNSTaskDAO) UpdateClusterDNSTasksDone(tx *dbs.Tx, clusterId int64, maxVersion int64) error

UpdateClusterDNSTasksDone 设置所有集群任务完成

func (*DNSTaskDAO) UpdateDNSTaskDone

func (this *DNSTaskDAO) UpdateDNSTaskDone(tx *dbs.Tx, taskId int64, taskVersion int64) error

UpdateDNSTaskDone 设置任务完成

func (*DNSTaskDAO) UpdateDNSTaskError

func (this *DNSTaskDAO) UpdateDNSTaskError(tx *dbs.Tx, taskId int64, err string) error

UpdateDNSTaskError 设置任务错误

type DNSTaskOperator

type DNSTaskOperator struct {
	Id         any // ID
	ClusterId  any // 集群ID
	ServerId   any // 服务ID
	NodeId     any // 节点ID
	DomainId   any // 域名ID
	RecordName any // 记录名
	Type       any // 任务类型
	UpdatedAt  any // 更新时间
	IsDone     any // 是否已完成
	IsOk       any // 是否成功
	Error      any // 错误信息
	Version    any // 版本
	CountFails any // 尝试失败次数
}

func NewDNSTaskOperator

func NewDNSTaskOperator() *DNSTaskOperator

type DNSTaskType

type DNSTaskType = string
const (
	DNSTaskTypeClusterChange       DNSTaskType = "clusterChange"       // 集群节点、服务发生变化
	DNSTaskTypeClusterNodesChange  DNSTaskType = "clusterNodesChange"  // 集群中节点发生变化
	DNSTaskTypeClusterRemoveDomain DNSTaskType = "clusterRemoveDomain" // 从集群中移除域名
	DNSTaskTypeNodeChange          DNSTaskType = "nodeChange"
	DNSTaskTypeServerChange        DNSTaskType = "serverChange"
	DNSTaskTypeDomainChange        DNSTaskType = "domainChange"
)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL