db

package
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: Aug 13, 2023 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Domain

type Domain struct {
	ID         int64
	ClientHost string          // 客户端地址(生效范围)。<br />如果全局生效,则该字段为空。
	Name       string          // 主机记录。由于可能存在泛域名,所以为了便于使用索引,存储时将采用反转格式,如:example.com
	Value      string          // 记录值
	Ttl        int32           // TTL
	DnsType    string          // 记录类型。<br />A | AAAA
	DenyGlobal bool            // 是否拒绝全局解析
	Status     string          // 状态。<br />ENABLE-启用
	CreateTime types.LocalTime // 创建时间
	UpdateTime types.LocalTime // 修改时间
}

Domain 解析记录表.

func (Domain) ClientHostVal added in v0.0.6

func (d Domain) ClientHostVal() string

func (Domain) DenyGlobalVal

func (d Domain) DenyGlobalVal() bool

func (Domain) NameVal

func (d Domain) NameVal() string

type Forward

type Forward struct {
	ID         int64
	ClientHost string          // 客户端地址(生效范围)。<br />如果全局生效,则该字段为空。
	Name       string          // 需要转发解析的域名
	DnsSvr     []string        // 转发目标DNS服务器
	DenyGlobal bool            // 是否拒绝全局解析
	Status     string          // 状态。<br />ENABLE-启用
	CreateTime types.LocalTime // 创建时间
	UpdateTime types.LocalTime // 修改时间
}

Forward 转发配置.

func (Forward) ClientHostVal added in v0.0.6

func (f Forward) ClientHostVal() string

func (Forward) DenyGlobalVal

func (f Forward) DenyGlobalVal() bool

func (Forward) NameVal

func (f Forward) NameVal() string

type History

type History struct {
	ID int64
	// 需要转发解析的域名
	Name string
	// 解析记录,用于导出使用
	History []string
}

History 转发解析历史.

type RecordFilter

type RecordFilter interface {
	ClientHostVal() string
	NameVal() string
	DenyGlobalVal() bool
}

type Store

type Store interface {
	// FindForwardByHostAndName 查询客户端对应的转发配置,当 host 为 “” 时表示查询全局配置.
	FindForwardByHostAndName(host, name string) []Forward

	// FindDomainByHostAndName 查询 qname 的解析记录。如果 host 不为空,则查询host下的解析,如果为空则只查询全局解析
	FindDomainByHostAndName(host, qname string) []Domain

	// SavaHistory 保存历史
	SavaHistory(name string, newHis []string) error

	// FindHistoryByHost 查询客户端对应的解析历史,当 host 为 “” 时表示查询全局配置.
	// 其中返回值的二个值表示需要排除的网段
	FindHistoryByHost(host string) ([]string, []string)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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