Documentation ¶
Index ¶
- Constants
- Variables
- func ParseName(host, domain string) (name string)
- func SwitchMsg(records []Record) (msg *dns.Msg, err error)
- type Record
- type RedisBackendStorage
- func (rbs *RedisBackendStorage) ApiGet(name string, qtype uint16) (records []Record, err error)
- func (rbs *RedisBackendStorage) ApiList() (records []Record, err error)
- func (rbs *RedisBackendStorage) ApiSet(records []Record) error
- func (rbs *RedisBackendStorage) Get(name string, qtype uint16) (msg *dns.Msg, err error)
- func (rbs *RedisBackendStorage) Keys() (keys []string, err error)
- func (rbs *RedisBackendStorage) List() (msgs []*dns.Msg, err error)
- func (rbs *RedisBackendStorage) ParseMsg(keys []string) (msgs []*dns.Msg, err error)
- func (rbs *RedisBackendStorage) Ping() bool
- func (rbs *RedisBackendStorage) Set(records []Record) error
- type Storage
Constants ¶
View Source
const (
RedisEmpty = "redis: nil"
)
Variables ¶
View Source
var ( // falied message RedisGetFailed = "redis backend storage get key: %s name: %s type: %d failed, %s" RedisSetFailed = "redis backend storage set key: %s failed, %s" JsonParseFailed = "redis backend storage json parse msg failed name: %s type %d, %s" ParseDnsMsgFailed = "redis backend storage parse dns.msg failed name: %s type: %d, %s" RecordParamsNullFailed = errors.New("record rtype or host or domain or value is Null") )
Functions ¶
Types ¶
type Record ¶
type Record struct { // domain json struct Rtype uint16 `json:"rtype"` // 记录类型 example: dns.TYPEA Host string `json:"host"` // 主机记录 host www Domain string `json:"domain"` // 域名 qianbao-inc.com prefix.Domain = dns.Name Line int `json:"line"` // 线路 实现智能DNS 开发环境/测试环境/预发环境/生产环境/联通/电信 Value string `json:"value"` // A -> 8.8.8.8 CNAME -> www.qianbao.com. Ttl uint32 `json:"ttl"` // ttl Port uint16 `json:"port"` // SRV }
type RedisBackendStorage ¶
func NewRedisBackendStorage ¶
func NewRedisBackendStorage(Addr, Password string, db int) *RedisBackendStorage
func (*RedisBackendStorage) ApiGet ¶
func (rbs *RedisBackendStorage) ApiGet(name string, qtype uint16) (records []Record, err error)
func (*RedisBackendStorage) ApiList ¶
func (rbs *RedisBackendStorage) ApiList() (records []Record, err error)
API Todo list rewrite
func (*RedisBackendStorage) ApiSet ¶
func (rbs *RedisBackendStorage) ApiSet(records []Record) error
func (*RedisBackendStorage) Keys ¶
func (rbs *RedisBackendStorage) Keys() (keys []string, err error)
func (*RedisBackendStorage) List ¶
func (rbs *RedisBackendStorage) List() (msgs []*dns.Msg, err error)
func (*RedisBackendStorage) ParseMsg ¶
func (rbs *RedisBackendStorage) ParseMsg(keys []string) (msgs []*dns.Msg, err error)
func (*RedisBackendStorage) Ping ¶
func (rbs *RedisBackendStorage) Ping() bool
func (*RedisBackendStorage) Set ¶
func (rbs *RedisBackendStorage) Set(records []Record) error
type Storage ¶
type Storage interface { List() (msgs []*dns.Msg, err error) ApiList() (records []Record, err error) // Get a msg for backend storage, if use handler please you msg.SetReply(reqMsg) Get(name string, qtype uint16) (msg *dns.Msg, err error) ApiGet(name string, qtype uint16) (records []Record, err error) Set(records []Record) error ApiSet(records []Record) error // test backend storage connect Ping() bool }
func GetStorage ¶
Click to show internal directories.
Click to hide internal directories.