Documentation ¶
Index ¶
- Constants
- func DetermineWhoisServerForIP(ip net.IP) string
- func SaveToFile(filepath string, cache *KVCache) error
- type KVCache
- type QueryRecord
- type QueryResult
- func Domain(domainOrHost string, cache *KVCache) (result QueryResult, err error)
- func IP(ip net.IP, cache *KVCache) (result QueryResult, err error)
- func NewQueryResult(in []byte) QueryResult
- func Parse(raw []byte, format string) (parsed QueryResult)
- func URL(url string, cache *KVCache) (result QueryResult, err error)
Constants ¶
const ( // RipeServer used for ip/net queries RipeServer = "whois.ripe.net:43" // ApnicServer ... ApnicServer = "whois.apnic.net:43" // ArinServer ... ArinServer = "whois.arin.net:43" // AfrinicServer ... AfrinicServer = "whois.afrinic.net:43" // LacnicServer ... LacnicServer = "whois.lacnic.net:43" // IanaServer ... IanaServer = "whois.iana.org:43" // DenicServer ... DenicServer = "whois.denic.de:43" )
const ( // FormatDenic ... FormatDenic = "denic" // FormatIana ... FormatIana = "iana" // FormatRipe ... FormatRipe = "ripe" // FormatApnic ... FormatApnic = "apnic" // FormatAfrinic ... FormatAfrinic = "afrinic" // FormatLacnic ... FormatLacnic = "lacnic" // FormatArin ... FormatArin = "arin" // FormatIcaan ... FormatIcaan = "icaan" )
const ( // RecordTypeTechC record type for technical RecordTypeTechC = 1 // RecordTypeAdminC record type for admins RecordTypeAdminC = 2 // RecordTypeOwner record type for owner RecordTypeOwner = 3 // RecordTypeNetwork record type for a network RecordTypeNetwork = 4 // RecordTypeDomain record type for a domain RecordTypeDomain = 5 // RecordTypeOther for all other records RecordTypeOther = 256 )
Variables ¶
This section is empty.
Functions ¶
func DetermineWhoisServerForIP ¶
DetermineWhoisServerForIP returns the whois server responsible for the given ip network.
func SaveToFile ¶
SaveToFile saves the current cache into a file.
Types ¶
type KVCache ¶
type KVCache struct {
// contains filtered or unexported fields
}
KVCache a simple key Value structure with ttl.
func LoadFromFile ¶
LoadFromFile restores the cache from a previous saved file.
func (*KVCache) Add ¶
func (c *KVCache) Add(key string, value QueryResult) bool
Add appends an additional key to the current KVCache. If the entry already exist the value and lastUpdate will be updated. Returns true if the key did not exist before otherwise false.
type QueryRecord ¶
type QueryRecord struct {
// contains filtered or unexported fields
}
QueryRecord containing parsed record data and additional meta data
func NewQueryRecord ¶
func NewQueryRecord(data map[string]string, recordType int) QueryRecord
NewQueryRecord creates and returns a new QueryRecord
func (QueryRecord) Data ¶
func (r QueryRecord) Data() map[string]string
Data returns the parsed data map
func (QueryRecord) RecordType ¶
func (r QueryRecord) RecordType() int
RecordType returns the record type
type QueryResult ¶
type QueryResult struct {
// contains filtered or unexported fields
}
QueryResult contains raw and parsed information of a whois query
func Domain ¶
func Domain(domainOrHost string, cache *KVCache) (result QueryResult, err error)
Domain performs a whois query for the given domain or hostname.
func IP ¶
func IP(ip net.IP, cache *KVCache) (result QueryResult, err error)
IP performs a whois query for the given net.IP.
func NewQueryResult ¶
func NewQueryResult(in []byte) QueryResult
NewQueryResult creates and returns a new QueryResult
func Parse ¶
func Parse(raw []byte, format string) (parsed QueryResult)
Parse the given raw data using a format specific parse function
func URL ¶
func URL(url string, cache *KVCache) (result QueryResult, err error)
URL returns a whois from the domain name of an url.
func (QueryResult) RawOutput ¶
func (q QueryResult) RawOutput() []byte
RawOutput returns the raw output
func (QueryResult) Records ¶
func (q QueryResult) Records() []QueryRecord
Records returns a list of all parsed records.
func (QueryResult) Target ¶
func (q QueryResult) Target() string
Target returns the queried target (hostname or IP)