Documentation ¶
Index ¶
- Variables
- func Author() string
- func GetRelURL(res map[string]interface{}) (string, bool)
- func InitRDAP(configFile string)
- func InitWhois(configFile string)
- func IsASN(resource string) bool
- func License() string
- func NewServerMap() *serverMap
- func RDAP(domain string) (result map[string]interface{}, err error)
- func Version() string
- func Whois(domain string, servers ...string) (result string, err error)
- type ASNRange
- type Client
- func (c *Client) SetDialer(dialer proxy.Dialer) *Client
- func (c *Client) SetDisableReferral(disabled bool) *Client
- func (c *Client) SetDisableStats(disabled bool) *Client
- func (c *Client) SetTimeout(timeout time.Duration) *Client
- func (c *Client) Whois(domain string, servers ...string) (result string, err error)
- type RDAPBootstrap
- type RDAPClient
- type RDAPData
- type RdapConfig
- type RdapMap
- type ServerConfig
Constants ¶
This section is empty.
Variables ¶
var ( // ErrDomainEmpty is domain is an empty string ErrDomainEmpty = errors.New("whois: domain is empty") // ErrWhoisServerNotFound is no whois server found ErrWhoisServerNotFound = errors.New("whois: no whois server found for domain") )
var DefaultClient = NewClient()
DefaultClient is default whois client
var DefaultRDAPClient = NewRDAPClient()
DefaultRDAPClient is default RDAP client
Functions ¶
func InitRDAP ¶ added in v0.5.0
func InitRDAP(configFile string)
InitRDAP sync.Once的作用是确保在多线程环境下一个操作只被执行一次
func IsASN ¶
IsASN function is used to check if the given resource is an Autonomous System Number (ASN).
func NewServerMap ¶ added in v0.4.1
func NewServerMap() *serverMap
NewServerMap creates a new serverMap instance
Types ¶
type ASNRange ¶ added in v0.5.0
ASNRange 表示ASN范围和对应的URL
func NewASNRange ¶ added in v0.5.0
通过ASN范围字符串创建ASNRange实例
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is whois client
func (*Client) SetDisableReferral ¶
SetDisableReferral if set to true, will not query the referral server.
func (*Client) SetDisableStats ¶
SetDisableStats set disable stats
func (*Client) SetTimeout ¶
SetTimeout set query timeout
type RDAPBootstrap ¶ added in v0.5.0
type RDAPBootstrap struct { IPv4 RDAPData `json:"ipv4"` IPv6 RDAPData `json:"ipv6"` ASN RDAPData `json:"asn"` DNS RDAPData `json:"dns"` }
RDAPBootstrap 定义一个结构体来映射原始JSON数据的最外层
type RDAPClient ¶ added in v0.5.0
type RDAPClient struct {
// contains filtered or unexported fields
}
RDAPClient is RDAP client
func NewRDAPClient ¶ added in v0.5.0
func NewRDAPClient() *RDAPClient
NewRDAPClient returns new RDAP client
func (*RDAPClient) RDAP ¶ added in v0.5.0
func (c *RDAPClient) RDAP(q string) (map[string]interface{}, error)
func (*RDAPClient) SetDisableReferral ¶ added in v0.5.0
func (c *RDAPClient) SetDisableReferral(disabled bool) *RDAPClient
SetDisableReferral if set to true, will not query the referral server.
type RDAPData ¶ added in v0.5.0
type RDAPData struct { Description string `json:"description"` Publication string `json:"publication"` Services [][][]string `json:"services"` Version string `json:"version"` }
RDAPData 结构体用于映射IPv4、IPv6、dns、asn的数据
type RdapConfig ¶ added in v0.5.0
type RdapMap ¶ added in v0.5.0
func NewRdapMap ¶ added in v0.5.0
func NewRdapMap() *RdapMap
NewRdapMap creates a new rdapMap instance
func (*RdapMap) GetRdapServer ¶ added in v0.5.0
func (*RdapMap) LoadBootstrap ¶ added in v0.5.0
func (rm *RdapMap) LoadBootstrap(bootstrap RDAPBootstrap) error
LoadBootstrap loads the server map from Bootstrap
func (*RdapMap) LoadFromFile ¶ added in v0.5.0
LoadFromFile loads the server map from a JSON file