httpdns

package
v0.6.10 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidHTTPDNSAdapterParams = errors.New("invalid httpdns adapter params")
	ErrInvalidDefaultName          = errors.New("invalid default name")
	ErrAdapterUninitialized        = errors.New("uninitialized adapter")
)

Functions

func Init

func Init(conf []Config, defaultAdapter string) error

Init 初始化设置,在框架初始化时调用

Types

type BaiduDNSData

type BaiduDNSData struct {
	IP  []string `json:"ip"`
	TTL int64    `json:"ttl"`
}

type BaiduHTTPDNS

type BaiduHTTPDNS struct {
	Endpoint string `json:"endpoint"`
	Account  string `json:"account"`
	Secret   string `json:"secret"`
}

func (*BaiduHTTPDNS) LookupIPAddr

func (httpdns *BaiduHTTPDNS) LookupIPAddr(ctx context.Context, host string) ([]netip.Addr, error)

type BaiduHTTPDNSResp

type BaiduHTTPDNSResp struct {
	Clientip  string                  `json:"clientip"`
	Data      map[string]BaiduDNSData `json:"data"`
	Msg       string                  `json:"msg"`
	Timestamp int64                   `json:"timestamp"`
}

type Config

type Config struct {
	Name    string            `json:"name" toml:"name"`
	Adapter string            `json:"adapter" toml:"adapter"`
	Option  map[string]string `json:"option" toml:"option"`
}

type HTTPDNS

type HTTPDNS interface {
	LookupIPAddr(context.Context, string) ([]netip.Addr, error)
}

func Instance

func Instance(name string) (HTTPDNS, error)

Instance 获取分布式锁实例

type Manager

type Manager struct {
	sync.Map
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

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