Documentation
¶
Index ¶
- Constants
- Variables
- func FoundByKey(key, rawtext string) string
- func IsCommentLine(line string) bool
- func WhoisNotFound(rawtext string) bool
- type AMParser
- type AMTLDParser
- type ARParser
- type ARTLDParser
- type ASParser
- type ASTLDParser
- type ATTLDParser
- type AUParser
- type AUTLDParser
- type BEParser
- type BETLDParser
- type BRParser
- type BRTLDParser
- type CZTLDParser
- type Contact
- type Contacts
- type EUParser
- type EUTLDParser
- type FIParser
- type FITLDParser
- type FRParser
- type FRTLDParser
- type IParser
- type IRParser
- type IRTLDParser
- type ITLDParser
- type ITTLDParser
- type NLParser
- type NLTLDParser
- type NicHdlParser
- type NicHdlTLDParser
- type PLParser
- type PLTLDParser
- type ParsedWhois
- type Parser
- type RUParser
- type RUTLDParser
- type Registrar
- type SKTLDParser
- type TKMLGQParser
- type TKMLGQTLDParser
- type TLDParser
- type TWParser
- type TWTLDParser
- type UATLDParser
- type UKParser
- type UKTLDParser
- type Whois
Constants ¶
const ( CZTimeFmt1 = "02.01.2006 15:04:05" CZTimeFmt2 = "02.01.2006" )
const ( CONTACTS = "contacts" REGISTRAR = "registrar" REGISTRANT = "registrant" ADMIN = "admin" TECH = "tech" BILLING = "billing" )
const (
ATTimeFmt = "20060102 15:04:05"
)
const (
// WhoisTimeFmt is time format for CreatedDate, UpdatedDate and ExpiredDate
WhoisTimeFmt = "2006-01-02T15:04:05+00:00"
)
Variables ¶
var ARMap map[string]string = map[string]string{
"name": "c/registrant/name",
}
var ATMap map[string]string = map[string]string{
"registrant": "c/registrant/id",
"tech-c": "c/tech/id",
}
var AUMap map[string]string = map[string]string{
"Registrant Contact Name": "c/registrant/name",
"Registrant": "c/registrant/organization",
"Tech Contact Name": "c/tech/name",
}
var BRMap map[string]string = map[string]string{
"owner": "c/registrant/name",
}
var CZMap map[string]string = map[string]string{
"Registrant": "c/registrant/id",
"registered": "created_date",
"registrant": "c/registrant/id",
"tech-c": "c/tech/id",
}
var FRMap map[string]string = map[string]string{
"created": "created_date",
"last-update": "updated_date",
"Expiry Date": "expired_date",
"registrar": "reg/name",
}
var IRMap map[string]string = map[string]string{
"expire-date": "expired_date",
"last-updated": "updated_date",
}
var RUMap map[string]string = map[string]string{
"admin-contact": "reg/url",
"state": "statuses",
"org": "c/registrant/organization",
}
var SKMap map[string]string = map[string]string{
"EPP Status": "statuses",
"Email": "reg/abuse_contact_email",
"Phone": "reg/abuse_contact_phone",
"Registrant": "c/registrant/id",
"Admin Contact": "c/admin/id",
"Tech Contact": "c/tech/id",
}
var TKMLGQMap = map[string]string{
"Domain registered": "created_date",
"Record will expire on": "expired_date",
}
var UAMap map[string]string = map[string]string{
"abuse-email": "reg/abuse_contact_email",
"abuse-phone": "reg/abuse_contact_phone",
"url": "reg/url",
}
var UKMap = map[string]string{
"URL": "reg/url",
}
Functions ¶
func FoundByKey ¶
FoundByKey return value of key from rawtext E.g., FoundByKey("whois server", "whois server: whois.nic.aaa") = whois.nic.aaa
func IsCommentLine ¶
func WhoisNotFound ¶
WhoisNotFound check keywords in rawtext
Types ¶
type AMTLDParser ¶
type AMTLDParser struct {
// contains filtered or unexported fields
}
func NewAMTLDParser ¶
func NewAMTLDParser() *AMTLDParser
func (*AMTLDParser) GetName ¶
func (amw *AMTLDParser) GetName() string
func (*AMTLDParser) GetParsedWhois ¶
func (amw *AMTLDParser) GetParsedWhois(rawtext string) (*ParsedWhois, error)
type ARTLDParser ¶
type ARTLDParser struct {
// contains filtered or unexported fields
}
func NewARTLDParser ¶
func NewARTLDParser() *ARTLDParser
func (*ARTLDParser) GetName ¶
func (arw *ARTLDParser) GetName() string
func (*ARTLDParser) GetParsedWhois ¶
func (arw *ARTLDParser) GetParsedWhois(rawtext string) (*ParsedWhois, error)
type ASTLDParser ¶
type ASTLDParser struct {
// contains filtered or unexported fields
}
func NewASTLDParser ¶
func NewASTLDParser() *ASTLDParser
func (*ASTLDParser) GetName ¶
func (asw *ASTLDParser) GetName() string
func (*ASTLDParser) GetParsedWhois ¶
func (asw *ASTLDParser) GetParsedWhois(rawtext string) (*ParsedWhois, error)
type ATTLDParser ¶
type ATTLDParser struct {
// contains filtered or unexported fields
}
func NewATTLDParser ¶
func NewATTLDParser() *ATTLDParser
func (*ATTLDParser) GetName ¶
func (atw *ATTLDParser) GetName() string
func (*ATTLDParser) GetParsedWhois ¶
func (atw *ATTLDParser) GetParsedWhois(rawtext string) (*ParsedWhois, error)
type AUTLDParser ¶
type AUTLDParser struct {
// contains filtered or unexported fields
}
func NewAUTLDParser ¶
func NewAUTLDParser() *AUTLDParser
func (*AUTLDParser) GetName ¶
func (auw *AUTLDParser) GetName() string
func (*AUTLDParser) GetParsedWhois ¶
func (auw *AUTLDParser) GetParsedWhois(rawtext string) (*ParsedWhois, error)
type BETLDParser ¶
type BETLDParser struct {
// contains filtered or unexported fields
}
func NewBETLDParser ¶
func NewBETLDParser() *BETLDParser
func (*BETLDParser) GetName ¶
func (bew *BETLDParser) GetName() string
func (*BETLDParser) GetParsedWhois ¶
func (bew *BETLDParser) GetParsedWhois(rawtext string) (*ParsedWhois, error)
type BRTLDParser ¶
type BRTLDParser struct {
// contains filtered or unexported fields
}
func NewBRTLDParser ¶
func NewBRTLDParser() *BRTLDParser
func (*BRTLDParser) GetName ¶
func (brw *BRTLDParser) GetName() string
func (*BRTLDParser) GetParsedWhois ¶
func (brw *BRTLDParser) GetParsedWhois(rawtext string) (*ParsedWhois, error)
type CZTLDParser ¶
type CZTLDParser struct {
// contains filtered or unexported fields
}
func NewCZTLDParser ¶
func NewCZTLDParser() *CZTLDParser
func (*CZTLDParser) GetName ¶
func (czw *CZTLDParser) GetName() string
func (*CZTLDParser) GetParsedWhois ¶
func (czw *CZTLDParser) GetParsedWhois(rawtext string) (*ParsedWhois, error)
type Contact ¶
type Contact struct { ID string `json:"id,omitempty"` Name string `json:"name,omitempty"` Email string `json:"email,omitempty"` Organization string `json:"organization,omitempty"` Country string `json:"country,omitempty"` City string `json:"city,omitempty"` Street []string `json:"street,omitempty"` State string `json:"state,omitempty"` Postal string `json:"postal,omitempty"` Phone string `json:"phone,omitempty"` PhoneExt string `json:"phone_ext,omitempty"` Fax string `json:"fax,omitempty"` FaxExt string `json:"fax_ext,omitempty"` }
type Contacts ¶
type Contacts struct { Registrant *Contact `json:"registrant,omitempty"` // nil if information not found Admin *Contact `json:"admin,omitempty"` // nil if information not found Tech *Contact `json:"tech,omitempty"` // nil if information not found Billing *Contact `json:"billing,omitempty"` // nil if information not found }
type EUTLDParser ¶
type EUTLDParser struct {
// contains filtered or unexported fields
}
func NewEUTLDParser ¶
func NewEUTLDParser() *EUTLDParser
func (*EUTLDParser) GetName ¶
func (euw *EUTLDParser) GetName() string
func (*EUTLDParser) GetParsedWhois ¶
func (euw *EUTLDParser) GetParsedWhois(rawtext string) (*ParsedWhois, error)
type FITLDParser ¶
type FITLDParser struct {
// contains filtered or unexported fields
}
func NewFITLDParser ¶
func NewFITLDParser() *FITLDParser
func (*FITLDParser) GetName ¶
func (fiw *FITLDParser) GetName() string
func (*FITLDParser) GetParsedWhois ¶
func (fiw *FITLDParser) GetParsedWhois(rawtext string) (*ParsedWhois, error)
type FRTLDParser ¶
type FRTLDParser struct {
// contains filtered or unexported fields
}
func NewFRTLDParser ¶
func NewFRTLDParser() *FRTLDParser
func (*FRTLDParser) GetName ¶
func (frw *FRTLDParser) GetName() string
func (*FRTLDParser) GetParsedWhois ¶
func (frw *FRTLDParser) GetParsedWhois(rawtext string) (*ParsedWhois, error)
type IParser ¶
type IParser interface {
Do(string, func(string) bool, ...map[string]string) (*ParsedWhois, error)
}
IParser is used to parse whois information when input is domain
type IRTLDParser ¶
type IRTLDParser struct {
// contains filtered or unexported fields
}
func NewIRTLDParser ¶
func NewIRTLDParser() *IRTLDParser
func (*IRTLDParser) GetName ¶
func (irw *IRTLDParser) GetName() string
func (*IRTLDParser) GetParsedWhois ¶
func (irw *IRTLDParser) GetParsedWhois(rawtext string) (*ParsedWhois, error)
type ITLDParser ¶
type ITLDParser interface { GetParsedWhois(string) (*ParsedWhois, error) GetName() string }
ITLDParser might have differenet parsing behavior depends on parameters sent to IParser.Do
func NewTLDDomainParser ¶
func NewTLDDomainParser(whoisServer string) ITLDParser
NewTLDDomainParser return different parser for different TLD If adding new parser for specific TLDs, new case match should be added to this function
parser := NewTLDDomainParser(whois_server) parsedWhois, err := parser.GetParsedWhois(rawtext)
type ITTLDParser ¶
type ITTLDParser struct {
// contains filtered or unexported fields
}
func NewITTLDParser ¶
func NewITTLDParser() *ITTLDParser
func (*ITTLDParser) GetName ¶
func (itw *ITTLDParser) GetName() string
func (*ITTLDParser) GetParsedWhois ¶
func (itw *ITTLDParser) GetParsedWhois(rawtext string) (*ParsedWhois, error)
type NLTLDParser ¶
type NLTLDParser struct {
// contains filtered or unexported fields
}
func NewNLTLDParser ¶
func NewNLTLDParser() *NLTLDParser
func (*NLTLDParser) GetName ¶
func (nlw *NLTLDParser) GetName() string
func (*NLTLDParser) GetParsedWhois ¶
func (nlw *NLTLDParser) GetParsedWhois(rawtext string) (*ParsedWhois, error)
type NicHdlParser ¶
type NicHdlParser struct {
// contains filtered or unexported fields
}
NicHdlParser implements parser for nic-hdl format rawtext
func NewNicHdlParser ¶
func NewNicHdlParser(contactKeyMap map[string]string) *NicHdlParser
func (*NicHdlParser) Do ¶
func (nh *NicHdlParser) Do(rawtext string, stopFunc func(string) bool, specKeyMaps ...map[string]string) (*ParsedWhois, error)
Do parse rawtext with DefaultKeyMap, stop parsing if stopFunc is given and return true If specKeyMaps is given, it will parse
type NicHdlTLDParser ¶
type NicHdlTLDParser struct {
// contains filtered or unexported fields
}
NicHdlTLDParser implements nic-hdl parser which invoke Parser.Do with different parameters
func NewNicHdlTLDParser ¶
func NewNicHdlTLDParser() *NicHdlTLDParser
func (*NicHdlTLDParser) GetName ¶
func (nhtld *NicHdlTLDParser) GetName() string
GetName return name of TLDParser for logging
func (*NicHdlTLDParser) GetParsedWhois ¶
func (nhtld *NicHdlTLDParser) GetParsedWhois(rawtext string) (*ParsedWhois, error)
GetParsedWhois invoke Do in parser to parse rawtext
type PLTLDParser ¶
type PLTLDParser struct {
// contains filtered or unexported fields
}
func NewPLTLDParser ¶
func NewPLTLDParser() *PLTLDParser
func (*PLTLDParser) GetName ¶
func (plw *PLTLDParser) GetName() string
func (*PLTLDParser) GetParsedWhois ¶
func (plw *PLTLDParser) GetParsedWhois(rawtext string) (*ParsedWhois, error)
type ParsedWhois ¶
type ParsedWhois struct { DomainName string `json:"domain,omitempty"` Registrar *Registrar `json:"registrar,omitempty"` NameServers []string `json:"name_servers,omitempty"` CreatedDate string `json:"created_date,omitempty"` // in WhoisTimeFmt format CreatedDateRaw string `json:"-"` // if it's not valid time format UpdatedDate string `json:"updated_date,omitempty"` // in WhoisTimeFmt format UpdatedDateRaw string `json:"-"` // if it's not valid time format ExpiredDate string `json:"expired_date,omitempty"` // in WhoisTimeFmt format ExpiredDateRaw string `json:"-"` // if it's not valid time format Statuses []string `json:"statuses,omitempty"` Dnssec string `json:"dnssec,omitempty"` Contacts *Contacts `json:"contacts,omitempty"` }
ParsedWhois stores parsed result of whois rawtext
type Parser ¶
type Parser struct{}
Parser implements default parser if tlds not match other parsers with specific parsing method
type RUTLDParser ¶
type RUTLDParser struct {
// contains filtered or unexported fields
}
func NewRUTLDParser ¶
func NewRUTLDParser() *RUTLDParser
func (*RUTLDParser) GetName ¶
func (ruw *RUTLDParser) GetName() string
func (*RUTLDParser) GetParsedWhois ¶
func (ruw *RUTLDParser) GetParsedWhois(rawtext string) (*ParsedWhois, error)
type Registrar ¶
type Registrar struct { IanaID string `json:"iana_id,omitempty"` Name string `json:"name,omitempty"` AbuseContactEmail string `json:"abuse_contact_email,omitempty"` AbuseContactPhone string `json:"abuse_contact_phone,omitempty"` WhoisServer string `json:"whois_server,omitempty"` // whois server parsed from rawtext URL string `json:"url,omitempty"` }
type SKTLDParser ¶
type SKTLDParser struct {
// contains filtered or unexported fields
}
func NewSKTLDParser ¶
func NewSKTLDParser() *SKTLDParser
func (*SKTLDParser) GetName ¶
func (skw *SKTLDParser) GetName() string
func (*SKTLDParser) GetParsedWhois ¶
func (skw *SKTLDParser) GetParsedWhois(rawtext string) (*ParsedWhois, error)
type TKMLGQParser ¶
type TKMLGQParser struct{}
type TKMLGQTLDParser ¶
type TKMLGQTLDParser struct {
// contains filtered or unexported fields
}
func NewTKMLGQTLDParser ¶
func NewTKMLGQTLDParser() *TKMLGQTLDParser
func (*TKMLGQTLDParser) GetName ¶
func (tkmlgqw *TKMLGQTLDParser) GetName() string
func (*TKMLGQTLDParser) GetParsedWhois ¶
func (tkmlgqw *TKMLGQTLDParser) GetParsedWhois(rawtext string) (*ParsedWhois, error)
type TLDParser ¶
type TLDParser struct {
// contains filtered or unexported fields
}
TLDParser implements default TLD parser which invoke Parser.Do with different parameters
func NewTLDParser ¶
func NewTLDParser() *TLDParser
func (*TLDParser) GetParsedWhois ¶
func (wtld *TLDParser) GetParsedWhois(rawtext string) (*ParsedWhois, error)
GetParsedWhois invoke Do in parser to parse rawtext
type TWTLDParser ¶
type TWTLDParser struct {
// contains filtered or unexported fields
}
func NewTWTLDParser ¶
func NewTWTLDParser() *TWTLDParser
func (*TWTLDParser) GetName ¶
func (tww *TWTLDParser) GetName() string
func (*TWTLDParser) GetParsedWhois ¶
func (tww *TWTLDParser) GetParsedWhois(rawtext string) (*ParsedWhois, error)
type UATLDParser ¶
type UATLDParser struct {
// contains filtered or unexported fields
}
func NewUATLDParser ¶
func NewUATLDParser() *UATLDParser
func (*UATLDParser) GetName ¶
func (uaw *UATLDParser) GetName() string
func (*UATLDParser) GetParsedWhois ¶
func (uaw *UATLDParser) GetParsedWhois(rawtext string) (*ParsedWhois, error)
type UKTLDParser ¶
type UKTLDParser struct {
// contains filtered or unexported fields
}
func NewUKTLDParser ¶
func NewUKTLDParser() *UKTLDParser
func (*UKTLDParser) GetName ¶
func (ukw *UKTLDParser) GetName() string
func (*UKTLDParser) GetParsedWhois ¶
func (ukw *UKTLDParser) GetParsedWhois(rawtext string) (*ParsedWhois, error)
type Whois ¶
type Whois struct { ParsedWhois *ParsedWhois `json:"parsed,omitempty"` WhoisServer string `json:"whois_server,omitempty"` // whois server which response the rawtext RawText string `json:"rawtext,omitempty"` IsAvailable *bool `json:"available,omitempty"` }
Whois stores parsed result and rawtext from whois server
func NewWhois ¶
func NewWhois(pw *ParsedWhois, rawtext, whoisServer string) *Whois