-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
itmeng
committed
Apr 9, 2021
0 parents
commit 32b661c
Showing
15 changed files
with
2,087 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# OS and IDE | ||
.idea/ | ||
.vscode/ | ||
.DS_Store | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
# whois | ||
|
||
whois query and parse tools, support `domain` and `ipv4` and `ipv6`. | ||
|
||
# install | ||
|
||
```shell | ||
go get github.com/yanmengfei/whois | ||
``` | ||
|
||
# example | ||
|
||
```go | ||
package main | ||
|
||
import ( | ||
"fmt" | ||
"github.com/yanmengfei/whois" | ||
"github.com/yanmengfei/whois/domain" | ||
"github.com/yanmengfei/whois/ip" | ||
) | ||
|
||
func main() { | ||
// query ip whois | ||
var ipKey = "114.114.114.114" | ||
if ipWhois, err := ip.Query(&whois.QueryOptions{Key: ipKey}); err != nil { | ||
fmt.Println(err.Error()) | ||
} else { | ||
fmt.Println("=== Query ip whois for", ipKey) | ||
fmt.Println("Inetnum:", ipWhois.Inetnum) | ||
fmt.Println("Server:", ipWhois.Server) | ||
fmt.Println("Source:", ipWhois.Source) | ||
fmt.Println("Country:", ipWhois.Country) | ||
fmt.Println("Created:", ipWhois.Created) | ||
fmt.Println("Updated:", ipWhois.Updated) | ||
} | ||
|
||
// query domain whois | ||
var domainKey = "itmeng.top" | ||
if domainWhois, err := domain.Query(&whois.QueryOptions{Key: domainKey}); err != nil { | ||
fmt.Println(err.Error()) | ||
} else { | ||
fmt.Println("=== Query domain whois for", domainKey) | ||
fmt.Println("Server:", domainWhois.Server) | ||
fmt.Println("Created:", domainWhois.Created) | ||
fmt.Println("Updated:", domainWhois.Updated) | ||
fmt.Println("Expiry:", domainWhois.Expiry) | ||
fmt.Println("Status:", domainWhois.Status) | ||
fmt.Println("Dnssec:", domainWhois.Dnssec) | ||
fmt.Println("NameServer:", domainWhois.NameServer) | ||
fmt.Println("Administrative:", domainWhois.Administrative) | ||
fmt.Println("Registrant:", domainWhois.Registrant) | ||
fmt.Println("Registrar:", domainWhois.Registrar) | ||
} | ||
|
||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,158 @@ | ||
package domain | ||
|
||
// keyRule is the key rule mapper for parser | ||
var keyRule = map[string]string{ | ||
"id": "domain_id", | ||
"roid": "domain_id", | ||
"domain id": "domain_id", | ||
"domain": "domain_name", | ||
"domain name": "domain_name", | ||
"status": "domain_status", | ||
"state": "domain_status", | ||
"domain status": "domain_status", | ||
"registration status": "domain_status", | ||
"query status": "domain_status", | ||
"dnssec": "domain_dnssec", | ||
"domain dnssec": "domain_dnssec", | ||
"registrar dnssec": "domain_dnssec", | ||
"signing key": "domain_dnssec", | ||
"domain signed": "domain_dnssec", | ||
"whois": "whois_server", | ||
"whois server": "whois_server", | ||
"registrar whois server": "whois_server", | ||
"dns": "name_servers", | ||
"nserver": "name_servers", | ||
"name server": "name_servers", | ||
"name servers": "name_servers", | ||
"nameserver": "name_servers", | ||
"nameservers": "name_servers", | ||
"name servers information": "name_servers", | ||
"host name": "name_servers", | ||
"domain nameservers": "name_servers", | ||
"domain name servers": "name_servers", | ||
"domain servers in listed order": "name_servers", | ||
"created": "created_date", | ||
"registered": "created_date", | ||
"created on": "created_date", | ||
"create date": "created_date", | ||
"created date": "created_date", | ||
"creation date": "created_date", | ||
"domain registration date": "created_date", | ||
"registration date": "created_date", | ||
"domain create date": "created_date", | ||
"domain name commencement date": "created_date", | ||
"registered date": "created_date", | ||
"registered on": "created_date", | ||
"registration time": "created_date", | ||
"first registration date": "created_date", | ||
"domain record activated": "created_date", | ||
"record created on": "created_date", | ||
"domain registered": "created_date", | ||
"modified": "updated_date", | ||
"changed": "updated_date", | ||
"update date": "updated_date", | ||
"updated date": "updated_date", | ||
"updated on": "updated_date", | ||
"last update": "updated_date", | ||
"last updated": "updated_date", | ||
"last updated on": "updated_date", | ||
"last modified": "updated_date", | ||
"last updated date": "updated_date", | ||
"domain last updated date": "updated_date", | ||
"domain record last updated": "updated_date", | ||
"domain datelastmodified": "updated_date", | ||
"modification date": "updated_date", | ||
"expire": "expired_date", | ||
"expires": "expired_date", | ||
"expires on": "expired_date", | ||
"paid till": "expired_date", | ||
"expire date": "expired_date", | ||
"expired date": "expired_date", | ||
"expiration date": "expired_date", | ||
"expiration on": "expired_date", | ||
"registrar registration expiration date": "expired_date", | ||
"domain expiration date": "expired_date", | ||
"expiry date": "expired_date", | ||
"expiration time": "expired_date", | ||
"domain expire": "expired_date", | ||
"domain expires": "expired_date", | ||
"record expires on": "expired_date", | ||
"record will expire on": "expired_date", | ||
"referral url": "referral_url", | ||
"registrar url": "referral_url", | ||
"registrar www": "referral_url", | ||
"registrar web": "referral_url", | ||
"registrar website": "referral_url", | ||
"registration service url": "referral_url", | ||
"registrant c": "registrant_id", | ||
"registrant id": "registrant_id", | ||
"registrant iana id": "registrant_id", | ||
"registrant contact id": "registrant_id", | ||
"registrant register number": "registrant_id", | ||
"registrant id number": "registrant_id", | ||
"registrant nic hdl": "registrant_id", | ||
"registrant org id": "registrant_id", | ||
"registrant name": "registrant_name", | ||
"registrant person": "registrant_name", | ||
"registrant contact": "registrant_name", | ||
"registrant contact name": "registrant_name", | ||
"registrant given name": "registrant_name", | ||
"registrant holder name": "registrant_name", | ||
"registrant holder english name": "registrant_name", | ||
"registrant service provider": "registrant_name", | ||
"registrant org": "registrant_organization", | ||
"registrant organization": "registrant_organization", | ||
"registrant contact organization": "registrant_organization", | ||
"registrant organisation": "registrant_organization", | ||
"registrant contact organisation": "registrant_organization", | ||
"registrant company name": "registrant_organization", | ||
"registrant company english name": "registrant_organization", | ||
"registrant address": "registrant_street", | ||
"registrant address1": "registrant_street", | ||
"registrant street": "registrant_street", | ||
"registrant street1": "registrant_street", | ||
"registrant contact address": "registrant_street", | ||
"registrant contact address1": "registrant_street", | ||
"registrant contact street": "registrant_street", | ||
"registrant contact street1": "registrant_street", | ||
"registrant s address": "registrant_street", | ||
"registrant s address1": "registrant_street", | ||
"registrant postal address": "registrant_street", | ||
"registrant postal address1": "registrant_street", | ||
"registrant city": "registrant_city", | ||
"registrant contact city": "registrant_city", | ||
"registrant state province": "registrant_state_province", | ||
"registrant contact state province": "registrant_state_province", | ||
"registrant zipcode": "registrant_postal_code", | ||
"registrant zip code": "registrant_postal_code", | ||
"registrant postal code": "registrant_postal_code", | ||
"registrant contact postal code": "registrant_postal_code", | ||
"registrant country": "registrant_country", | ||
"registrant country economy": "registrant_country", | ||
"registrant contact country": "registrant_country", | ||
"registrant phone": "registrant_phone", | ||
"registrant phone number": "registrant_phone", | ||
"registrant contact phone": "registrant_phone", | ||
"registrant contact phone number": "registrant_phone", | ||
"registrant abuse contact phone": "registrant_phone", | ||
"registrant phone ext": "registrant_phone_ext", | ||
"registrant contact phone ext": "registrant_phone_ext", | ||
"registrant fax": "registrant_fax", | ||
"registrant fax no": "registrant_fax", | ||
"registrant fax number": "registrant_fax", | ||
"registrant facsimile": "registrant_fax", | ||
"registrant facsimile number": "registrant_fax", | ||
"registrant contact fax": "registrant_fax", | ||
"registrant contact fax number": "registrant_fax", | ||
"registrant contact facsimile": "registrant_fax", | ||
"registrant contact facsimile number": "registrant_fax", | ||
"registrant fax ext": "registrant_fax_ext", | ||
"registrant contact fax ext": "registrant_fax_ext", | ||
"registrant mail": "registrant_email", | ||
"registrant email": "registrant_email", | ||
"registrant e mail": "registrant_email", | ||
"registrant contact mail": "registrant_email", | ||
"registrant contact email": "registrant_email", | ||
"registrant contact e mail": "registrant_email", | ||
"registrant abuse contact email": "registrant_email", | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package domain | ||
|
||
type WhoisInfo struct { | ||
Domain string | ||
Server string | ||
Created string | ||
Updated string | ||
Expiry string | ||
Status []string | ||
Dnssec bool | ||
NameServer []string | ||
Administrative Contact | ||
Registrar Contact | ||
Registrant Contact | ||
} | ||
|
||
type Contact struct { | ||
Organization string | ||
Name string | ||
Address string | ||
Email string | ||
Phone string | ||
} |
Oops, something went wrong.