Documentation
¶
Index ¶
Constants ¶
const (
// EmailRegex regular expression for email parsing, a bit hacky
EmailRegex = `(?:[a-z0-9!#$%&'*+/=?^_` + "`{|}~-]+(?:\\.[a-z0-9!#$%&'*+/=?^_`" + `{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9]))\.){3}(?:(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9])|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])`
)
Variables ¶
var DefaultParser = Parser{ // contains filtered or unexported fields }
DefaultParser is used in case if no parser for TLD is found
Functions ¶
func GetErrCodeDescription ¶
GetErrCodeDescription returns error code description
func RegisterParser ¶
RegisterParser is used to register parsers in catalog which is used to select parser for specific domain
Types ¶
type ErrCode ¶
type ErrCode int
ErrCode contains the numeric error code
const ( // ErrCodeNoError is returned when no request errors encountered ErrCodeNoError ErrCode = 0 // ErrCodeNoSuchDomain is returned when we've got "no such domain" error ErrCodeNoSuchDomain ErrCode = 1 // ErrCodeRequestRateLimit is returned when the request rate limit reached ErrCodeRequestRateLimit ErrCode = 2 // ErrCodeMalformedRequest is returned when a malformed request sent ErrCodeMalformedRequest ErrCode = 3 // ErrCodeTldHasNoServer is returned when the requested TLD has no whois server ErrCodeTldHasNoServer ErrCode = 4 // ErrCodeEmptyWhois is returned when the whois text is empty ErrCodeEmptyWhois ErrCode = 5 // ErrCodeNoErrorRegex is returned when the error checking regular expressions // are not set for current parser ErrCodeNoErrorRegex ErrCode = 6 )
type ParseErrorRegex ¶
type ParseErrorRegex struct { NoSuchDomain *regexp.Regexp RateLimit *regexp.Regexp MalformedRequest *regexp.Regexp }
ParseErrorRegex contains regular expressions for different kinds of errors
type Parser ¶
type Parser struct {
// contains filtered or unexported fields
}
Parser represents a structure with regular expressions for specific whois sections
type Record ¶
type Record struct { ErrCode ErrCode `json:"error_code,omitempty"` Registrar *Registrar `json:"registrar,omitempty"` Registrant *Registrant `json:"registrant,omitempty"` Admin *Registrant `json:"admin,omitempty"` Tech *Registrant `json:"tech,omitempty"` Bill *Registrant `json:"bill,omitempty"` }
Record is a structure that contains parsed info for particular whois sections
type Registrant ¶
type Registrant struct { ID string `json:"id,omitempty"` Name string `json:"name,omitempty"` Organization string `json:"organization,omitempty"` Street string `json:"street,omitempty"` StreetExt string `json:"street_ext,omitempty"` City string `json:"city,omitempty"` Province string `json:"province,omitempty"` PostalCode string `json:"postal_code,omitempty"` Country string `json:"country,omitempty"` Phone string `json:"phone,omitempty"` PhoneExt string `json:"phone_ext,omitempty"` Fax string `json:"fax,omitempty"` FaxExt string `json:"fax_ext,omitempty"` Email string `json:"email,omitempty"` }
Registrant is a structure that stores parsed registrant info. Registrant is registered by the registrar.
type RegistrantRegex ¶
type RegistrantRegex struct { Address *regexp.Regexp ID *regexp.Regexp Name *regexp.Regexp Organization *regexp.Regexp Street *regexp.Regexp StreetExt *regexp.Regexp City *regexp.Regexp Province *regexp.Regexp PostalCode *regexp.Regexp Country *regexp.Regexp Phone *regexp.Regexp PhoneExt *regexp.Regexp Fax *regexp.Regexp FaxExt *regexp.Regexp Email *regexp.Regexp }
RegistrantRegex struct with regular expressions used to parse Registrant
type Registrar ¶
type Registrar struct { CreatedDate string `json:"created_date,omitempty"` DomainDNSSEC string `json:"domain_dnssec,omitempty"` DomainID string `json:"domain_id,omitempty"` DomainName string `json:"domain_name,omitempty"` DomainStatus string `json:"domain_status,omitempty"` ExpirationDate string `json:"expiration_date,omitempty"` NameServers string `json:"name_servers,omitempty"` ReferralURL string `json:"referral_url,omitempty"` RegistrarID string `json:"registrar_id,omitempty"` RegistrarName string `json:"registrar_name,omitempty"` UpdatedDate string `json:"updated_date,omitempty"` WhoisServer string `json:"whois_server,omitempty"` Emails string `json:"emails,omitempty"` }
Registrar is a structure that stores parsed registrar info. Registrar registers the registrant.
type RegistrarRegex ¶
type RegistrarRegex struct { CreatedDate *regexp.Regexp DomainDNSSEC *regexp.Regexp DomainID *regexp.Regexp DomainName *regexp.Regexp DomainStatus *regexp.Regexp Emails *regexp.Regexp ExpirationDate *regexp.Regexp NameServers *regexp.Regexp ReferralURL *regexp.Regexp RegistrarID *regexp.Regexp RegistrarName *regexp.Regexp UpdatedDate *regexp.Regexp WhoisServer *regexp.Regexp }
RegistrarRegex struct with regular expressions used to parse Registrar
Source Files
¶
- constants.go
- err_code.go
- iparser.go
- parse_error_regex.go
- parser.go
- parser_ar.go
- parser_au.go
- parser_biz.go
- parser_br.go
- parser_by.go
- parser_ca.go
- parser_cl.go
- parser_club.go
- parser_cn.go
- parser_co.go
- parser_co_jp.go
- parser_com.go
- parser_de.go
- parser_edu.go
- parser_eu.go
- parser_fr.go
- parser_id.go
- parser_il.go
- parser_in.go
- parser_info.go
- parser_io.go
- parser_ir.go
- parser_it.go
- parser_jp.go
- parser_kz.go
- parser_me.go
- parser_mx.go
- parser_net.go
- parser_nl.go
- parser_online.go
- parser_org.go
- parser_pl.go
- parser_pro.go
- parser_ru.go
- parser_su.go
- parser_th.go
- parser_tr.go
- parser_tv.go
- parser_tw.go
- parser_ua.go
- parser_uk.go
- parser_us.go
- parser_xnPlai.go
- parser_xyz.go
- parser_za.go
- record.go
- registrant.go
- registrar.go