parsers

package
v0.5.2 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNotFoundDomain domain is not found
	ErrNotFoundDomain = errors.New("whoisparser: domain is not found")
	// ErrReservedDomain domain is reserved
	ErrReservedDomain = errors.New("whoisparser: domain is reserved to register")
	// ErrPremiumDomain domain is available to register at premium price
	ErrPremiumDomain = errors.New("whoisparser: domain is available at premium price")
	// ErrBlockedDomain domain is blocked due to brand protection
	ErrBlockedDomain = errors.New("whoisparser: domain is blocked due to brand protection")
	// ErrDomainDataInvalid domain whois data is invalid
	ErrDomainDataInvalid = errors.New("whoisparser: domain whois data is invalid")
	// ErrDomainLimitExceed domain whois query is limited
	ErrDomainLimitExceed = errors.New("whoisparser: domain whois query limit exceeded")
)

Functions

func Prepare

func Prepare(text, ext string) (string, bool)

Prepare do prepare the whois info for parsing

Types

type ASNInfo

type ASNInfo struct {
	ASN          string   `json:"AS Number"`     // ASN is the Autonomous System Number.
	ASName       string   `json:"Network Name"`  // ASName is the name of the network.
	ASStatus     []string `json:"Status"`        // ASStatus is the status of the ASN.
	CreationDate string   `json:"Creation Date"` // CreationDate is the creation date of the ASN.
	UpdatedDate  string   `json:"Updated Date"`  // UpdatedDate is the updated date of the ASN.
}

ASNInfo represents the information about an Autonomous System Number (ASN).

func ParseRDAPResponseforASN

func ParseRDAPResponseforASN(result map[string]interface{}) (ASNInfo, error)

ParseRDAPResponseforASN function is used to parse the RDAP response for an ASN.

type Contact

type Contact struct {
	ID           string `json:"id,omitempty"`
	Name         string `json:"name,omitempty"`
	Organization string `json:"organization,omitempty"`
	Street       string `json:"street,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"`
	ReferralURL  string `json:"referral_url,omitempty"`
}

Contact storing domain contact info

type Domain

type Domain struct {
	ID                   string     `json:"id,omitempty"`
	Domain               string     `json:"domain,omitempty"`
	Punycode             string     `json:"punycode,omitempty"`
	Name                 string     `json:"name,omitempty"`
	Extension            string     `json:"extension,omitempty"`
	WhoisServer          string     `json:"whois_server,omitempty"`
	Status               []string   `json:"status,omitempty"`
	NameServers          []string   `json:"name_servers,omitempty"`
	DNSSec               bool       `json:"dnssec,omitempty"`
	CreatedDate          string     `json:"created_date,omitempty"`
	CreatedDateInTime    *time.Time `json:"created_date_in_time,omitempty"`
	UpdatedDate          string     `json:"updated_date,omitempty"`
	UpdatedDateInTime    *time.Time `json:"updated_date_in_time,omitempty"`
	ExpirationDate       string     `json:"expiration_date,omitempty"`
	ExpirationDateInTime *time.Time `json:"expiration_date_in_time,omitempty"`
}

Domain storing domain name info

type DomainInfo

type DomainInfo struct {
	ID                   string     `json:"id,omitempty"`
	Domain               string     `json:"domain"`         // DomainName is the name of the domain.
	Status               []string   `json:"status"`         // DomainStatus is the status of the domain.
	NameServers          []string   `json:"name_servers"`   // NameServer is the name server of the domain.
	DNSSec               string     `json:"dnssec"`         // DNSSec is the DNSSEC of the domain.
	DNSSecDSData         string     `json:"dnssec_ds_data"` // DNSSecDSData is the DNSSEC DS Data of the domain.
	CreatedDate          string     `json:"created_date"`   // CreationDate is the creation date of the domain.
	CreatedDateInTime    *time.Time `json:"created_date_in_time,omitempty"`
	UpdatedDate          string     `json:"updated_date"` // UpdatedDate is the updated date of the domain.
	UpdatedDateInTime    *time.Time `json:"updated_date_in_time,omitempty"`
	ExpirationDate       string     `json:"expiration_date"` // RegistryExpiryDate is the expiry date of the domain.
	ExpirationDateInTime *time.Time `json:"expiration_date_in_time,omitempty"`
	Registrar            string     `json:"registrar"`              // Registrar is the registrar of the domain.
	RegistrarIANAID      string     `json:"registrar_iana_id"`      // RegistrarIANAID is the IANA ID of the registrar.
	LastUpdateOfRDAPDB   string     `json:"last_updated_of_rdapdb"` // LastUpdateOfRDAPDB is the last update of the database.
}

DomainInfo represents the information about a domain.

func ParseRDAPResponseForDomain

func ParseRDAPResponseForDomain(result map[string]interface{}) (DomainInfo, error)

ParseRDAPResponseForDomain function is used to parse the RDAP response for a given domain.

type IPInfo

type IPInfo struct {
	IP           string   `json:"IP Network"`    // IP is the IP network.
	Range        string   `json:"Address Range"` // Range is the address range of the IP network.
	NetName      string   `json:"Network Name"`  // NetName is the name of the network.
	CIDR         string   `json:"CIDR"`          // CIDR is the CIDR of the IP network.
	Networktype  string   `json:"Network Type"`  // Networktype is the type of the network.
	Country      string   `json:"Country"`       // Country is the country of the IP network.
	IPStatus     []string `json:"Status"`        // IPStatus is the status of the IP network.
	CreationDate string   `json:"Creation Date"` // CreationDate is the creation date of the IP network.
	UpdatedDate  string   `json:"Updated Date"`  // UpdatedDate is the updated date of the IP network.
}

IPInfo represents the information about an IP network.

func ParseRDAPResponseforIP

func ParseRDAPResponseforIP(result map[string]interface{}) (IPInfo, error)

ParseRDAPResponseforIP function is used to parse the WHOIS response for an IP address.

type RDAPInfo

type RDAPInfo struct {
	Type string `json:"type,omitempty"`
	Data any    `json:"info,omitempty"`
}

RDAPInfo 下面全是rdap的返回结构

func ParseRDAPResponse

func ParseRDAPResponse(result map[string]interface{}) (RDAPInfo, error)

type WhoisInfo

type WhoisInfo struct {
	Domain         *Domain  `json:"domain,omitempty"`
	Registrar      *Contact `json:"registrar,omitempty"`
	Registrant     *Contact `json:"registrant,omitempty"`
	Administrative *Contact `json:"administrative,omitempty"`
	Technical      *Contact `json:"technical,omitempty"`
	Billing        *Contact `json:"billing,omitempty"`
}

WhoisInfo storing domain whois info

func Parse

func Parse(text string) (whoisInfo WhoisInfo, err error)

Parse returns parsed whois info

Jump to

Keyboard shortcuts

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