domain

package
v0.0.0-...-013418f Latest Latest
Warning

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

Go to latest
Published: May 3, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CZTimeFmt1 = "02.01.2006 15:04:05"
	CZTimeFmt2 = "02.01.2006"
)
View Source
const (
	CONTACTS = "contacts"

	REGISTRAR = "registrar"

	REGISTRANT = "registrant"
	ADMIN      = "admin"
	TECH       = "tech"
	BILLING    = "billing"
)
View Source
const (
	ATTimeFmt = "20060102 15:04:05"
)
View Source
const (
	// WhoisTimeFmt is time format for CreatedDate, UpdatedDate and ExpiredDate
	WhoisTimeFmt = "2006-01-02T15:04:05+00:00"
)

Variables

View Source
var ARMap map[string]string = map[string]string{
	"name": "c/registrant/name",
}
View Source
var ATMap map[string]string = map[string]string{
	"registrant": "c/registrant/id",
	"tech-c":     "c/tech/id",
}
View Source
var AUMap map[string]string = map[string]string{
	"Registrant Contact Name": "c/registrant/name",
	"Registrant":              "c/registrant/organization",
	"Tech Contact Name":       "c/tech/name",
}
View Source
var BRMap map[string]string = map[string]string{
	"owner": "c/registrant/name",
}
View Source
var CZMap map[string]string = map[string]string{
	"Registrant": "c/registrant/id",
	"registered": "created_date",
	"registrant": "c/registrant/id",
	"tech-c":     "c/tech/id",
}
View Source
var FRMap map[string]string = map[string]string{
	"created":     "created_date",
	"last-update": "updated_date",
	"Expiry Date": "expired_date",
	"registrar":   "reg/name",
}
View Source
var IRMap map[string]string = map[string]string{
	"expire-date":  "expired_date",
	"last-updated": "updated_date",
}
View Source
var RUMap map[string]string = map[string]string{
	"admin-contact": "reg/url",
	"state":         "statuses",
	"org":           "c/registrant/organization",
}
View Source
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",
}
View Source
var TKMLGQMap = map[string]string{
	"Domain registered":     "created_date",
	"Record will expire on": "expired_date",
}
View Source
var UAMap map[string]string = map[string]string{
	"abuse-email": "reg/abuse_contact_email",
	"abuse-phone": "reg/abuse_contact_phone",
	"url":         "reg/url",
}
View Source
var UKMap = map[string]string{
	"URL": "reg/url",
}

Functions

func FoundByKey

func FoundByKey(key, rawtext string) string

FoundByKey return value of key from rawtext E.g., FoundByKey("whois server", "whois server: whois.nic.aaa") = whois.nic.aaa

func IsCommentLine

func IsCommentLine(line string) bool

func WhoisNotFound

func WhoisNotFound(rawtext string) bool

WhoisNotFound check keywords in rawtext

Types

type AMParser

type AMParser struct{}

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 ARParser

type ARParser struct{}

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 ASParser

type ASParser struct{}

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 AUParser

type AUParser struct{}

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 BEParser

type BEParser struct{}

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 BRParser

type BRParser struct{}

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 EUParser

type EUParser struct{}

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 FIParser

type FIParser struct{}

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 FRParser

type FRParser struct{}

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 IRParser

type IRParser struct{}

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 NLParser

type NLParser struct{}

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 PLParser

type PLParser struct{}

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

func NewParser

func NewParser() *Parser

func (*Parser) Do

func (wb *Parser) 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 RUParser

type RUParser struct{}

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) GetName

func (wtld *TLDParser) GetName() string

GetName return name of TLDParser for logging

func (*TLDParser) GetParsedWhois

func (wtld *TLDParser) GetParsedWhois(rawtext string) (*ParsedWhois, error)

GetParsedWhois invoke Do in parser to parse rawtext

type TWParser

type TWParser struct{}

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 UKParser

type UKParser struct{}

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

Jump to

Keyboard shortcuts

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