Giter VIP home page Giter VIP logo

whois-api-go's Introduction

whois-api-go license whois-api-go made-with-Go whois-api-go test

Overview

The client library for Whois API in Go language.

The minimum go version is 1.17.

Installation

The library is distributed as a Go module

go get github.com/whois-api-llc/whois-api-go

Examples

Full API documentation available here

You can find all examples in example directory.

Create a new client

To start making requests you need the API Key. You can find it on your profile page on whoisxmlapi.com. Using the API Key you can create Client.

Most users will be fine with NewBasicClient function.

client := whoisxmlapigo.NewBasicClient(apikey)

If you want to set custom http.Client to use proxy then you can use NewClient function.

transport := &http.Transport{Proxy: http.ProxyURL(proxyUrl)}

client := whoisxmlapigo.NewClient(apiKey, whoisxmlapigo.ClientParams{
    HTTPClient: &http.Client{
        Transport: transport,
        Timeout:   20 * time.Second,
    },
})

Make basic requests

Whois API provides the registration details of a domain name.

// Make request to get WHOIS record for domain
rec, _, err := client.WhoisService.Data(ctx, "whoisxmlapi.com")
if err != nil {
    log.Fatal(err)
}

log.Println(rec.DomainName, rec.Audit.UpdatedDate)

// Make request to get raw WHOIS API data
resp, err := client.WhoisService.RawData(ctx, "whoisxmlapi.com")
if err != nil {
    log.Fatal(err)
}

log.Println(string(resp.Body))

whois-api-go's People

Contributors

whoisxmlapi avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

whois-api-go's Issues

Models don't match all schemas

ex:

{
  "WhoisRecord": {
    "domainName": "172.64.129.13",
    "parseCode": 8,
    "audit": {
      "createdDate": "2023-03-29 20:10:10 UTC",
      "updatedDate": "2023-03-29 20:10:10 UTC"
    },
    "registrarName": "ARIN",
    "registrarIANAID": "778",
    "registryData": {
      "createdDate": "2015-02-25",
      "updatedDate": "2021-05-26",
      "registrant": {
        "organization": "Cloudflare, Inc.",
        "street1": "101 Townsend Street",
        "city": "San Francisco",
        "state": "CA",
        "postalCode": "94107",
        "country": "UNITED STATES",
        "countryCode": "US",
        "rawText": "OrgName:        Cloudflare, Inc.\nOrgId:          CLOUD14\nAddress:        101 Townsend Street\nCity:           San Francisco\nStateProv:      CA\nPostalCode:     94107\nCountry:        US\n"
      },
      "administrativeContact": {
        "organization": "Abuse",
        "email": "[email protected]",
        "telephone": "16503198930"
      },
      "technicalContact": {
        "organization": "Admin",
        "email": "[email protected]",
        "telephone": "16503198930"
      },
      "zoneContact": {
        "organization": "Cloudflare-NOC",
        "email": "[email protected]",
        "telephone": "16503198930"
      },
      "domainName": "172.64.129.13",
      "rawText": "#\n# ARIN WHOIS data and services are subject to the Terms of Use\n# available at: https://www.arin.net/resources/registry/whois/tou/\n#\n# If you see inaccuracies in the results, please report at\n# https://www.arin.net/resources/registry/whois/inaccuracy_reporting/\n#\n# Copyright 1997-2023, American Registry for Internet Numbers, Ltd.\n#\n\n\nNetRange:       172.64.0.0 - 172.71.255.255\nCIDR:           172.64.0.0/13\nNetName:        CLOUDFLARENET\nNetHandle:      NET-172-64-0-0-1\nParent:         NET172 (NET-172-0-0-0-0)\nNetType:        Direct Allocation\nOriginAS:       AS13335\nOrganization:   Cloudflare, Inc. (CLOUD14)\nRegDate:        2015-02-25\nUpdated:        2021-05-26\nComment:        All Cloudflare abuse reporting can be done via https://www.cloudflare.com/abuse\nRef:            https://rdap.arin.net/registry/ip/172.64.0.0\n\n\n\nOrgName:        Cloudflare, Inc.\nOrgId:          CLOUD14\nAddress:        101 Townsend Street\nCity:           San Francisco\nStateProv:      CA\nPostalCode:     94107\nCountry:        US\nRegDate:        2010-07-09\nUpdated:        2021-07-01\nRef:            https://rdap.arin.net/registry/entity/CLOUD14\n\n\nOrgNOCHandle: CLOUD146-ARIN\nOrgNOCName:   Cloudflare-NOC\nOrgNOCPhone:  +1-650-319-8930 \nOrgNOCEmail:  [email protected]\nOrgNOCRef:    https://rdap.arin.net/registry/entity/CLOUD146-ARIN\n\nOrgRoutingHandle: CLOUD146-ARIN\nOrgRoutingName:   Cloudflare-NOC\nOrgRoutingPhone:  +1-650-319-8930 \nOrgRoutingEmail:  [email protected]\nOrgRoutingRef:    https://rdap.arin.net/registry/entity/CLOUD146-ARIN\n\nOrgAbuseHandle: ABUSE2916-ARIN\nOrgAbuseName:   Abuse\nOrgAbusePhone:  +1-650-319-8930 \nOrgAbuseEmail:  [email protected]\nOrgAbuseRef:    https://rdap.arin.net/registry/entity/ABUSE2916-ARIN\n\nOrgTechHandle: ADMIN2521-ARIN\nOrgTechName:   Admin\nOrgTechPhone:  +1-650-319-8930 \nOrgTechEmail:  [email protected]\nOrgTechRef:    https://rdap.arin.net/registry/entity/ADMIN2521-ARIN\n\nRAbuseHandle: ABUSE2916-ARIN\nRAbuseName:   Abuse\nRAbusePhone:  +1-650-319-8930 \nRAbuseEmail:  [email protected]\nRAbuseRef:    https://rdap.arin.net/registry/entity/ABUSE2916-ARIN\n\nRNOCHandle: NOC11962-ARIN\nRNOCName:   NOC\nRNOCPhone:  +1-650-319-8930 \nRNOCEmail:  [email protected]\nRNOCRef:    https://rdap.arin.net/registry/entity/NOC11962-ARIN\n\nRTechHandle: ADMIN2521-ARIN\nRTechName:   Admin\nRTechPhone:  +1-650-319-8930 \nRTechEmail:  [email protected]\nRTechRef:    https://rdap.arin.net/registry/entity/ADMIN2521-ARIN\n\n\n#\n# ARIN WHOIS data and services are subject to the Terms of Use\n# available at: https://www.arin.net/resources/registry/whois/tou/\n#\n# If you see inaccuracies in the results, please report at\n# https://www.arin.net/resources/registry/whois/inaccuracy_reporting/\n#\n# Copyright 1997-2023, American Registry for Internet Numbers, Ltd.\n#",
      "parseCode": 1065,
      "header": "#\n# ARIN WHOIS data and services are subject to the Terms of Use\n# available at: https://www.arin.net/resources/registry/whois/tou/\n#\n# If you see inaccuracies in the results, please report at\n# https://www.arin.net/resources/registry/whois/inaccuracy_reporting/\n#\n# Copyright 1997-2023, American Registry for Internet Numbers, Ltd.\n#\n",
      "strippedText": "NetRange:       172.64.0.0 - 172.71.255.255\nCIDR:           172.64.0.0/13\nNetName:        CLOUDFLARENET\nNetHandle:      NET-172-64-0-0-1\nParent:         NET172 (NET-172-0-0-0-0)\nNetType:        Direct Allocation\nOriginAS:       AS13335\nOrganization:   Cloudflare, Inc. (CLOUD14)\nRegDate:        2015-02-25\nUpdated:        2021-05-26\nComment:        All Cloudflare abuse reporting can be done via https://www.cloudflare.com/abuse\nRef:            https://rdap.arin.net/registry/ip/172.64.0.0\nOrgName:        Cloudflare, Inc.\nOrgId:          CLOUD14\nAddress:        101 Townsend Street\nCity:           San Francisco\nStateProv:      CA\nPostalCode:     94107\nCountry:        US\nRegDate:        2010-07-09\nUpdated:        2021-07-01\nRef:            https://rdap.arin.net/registry/entity/CLOUD14\nOrgNOCHandle: CLOUD146-ARIN\nOrgNOCName:   Cloudflare-NOC\nOrgNOCPhone:  +1-650-319-8930\nOrgNOCEmail:  [email protected]\nOrgNOCRef:    https://rdap.arin.net/registry/entity/CLOUD146-ARIN\nOrgRoutingHandle: CLOUD146-ARIN\nOrgRoutingName:   Cloudflare-NOC\nOrgRoutingPhone:  +1-650-319-8930\nOrgRoutingEmail:  [email protected]\nOrgRoutingRef:    https://rdap.arin.net/registry/entity/CLOUD146-ARIN\nOrgAbuseHandle: ABUSE2916-ARIN\nOrgAbuseName:   Abuse\nOrgAbusePhone:  +1-650-319-8930\nOrgAbuseEmail:  [email protected]\nOrgAbuseRef:    https://rdap.arin.net/registry/entity/ABUSE2916-ARIN\nOrgTechHandle: ADMIN2521-ARIN\nOrgTechName:   Admin\nOrgTechPhone:  +1-650-319-8930\nOrgTechEmail:  [email protected]\nOrgTechRef:    https://rdap.arin.net/registry/entity/ADMIN2521-ARIN\nRAbuseHandle: ABUSE2916-ARIN\nRAbuseName:   Abuse\nRAbusePhone:  +1-650-319-8930\nRAbuseEmail:  [email protected]\nRAbuseRef:    https://rdap.arin.net/registry/entity/ABUSE2916-ARIN\nRNOCHandle: NOC11962-ARIN\nRNOCName:   NOC\nRNOCPhone:  +1-650-319-8930\nRNOCEmail:  [email protected]\nRNOCRef:    https://rdap.arin.net/registry/entity/NOC11962-ARIN\nRTechHandle: ADMIN2521-ARIN\nRTechName:   Admin\nRTechPhone:  +1-650-319-8930\nRTechEmail:  [email protected]\nRTechRef:    https://rdap.arin.net/registry/entity/ADMIN2521-ARIN\n#\n# ARIN WHOIS data and services are subject to the Terms of Use\n# available at: https://www.arin.net/resources/registry/whois/tou/\n#\n# If you see inaccuracies in the results, please report at\n# https://www.arin.net/resources/registry/whois/inaccuracy_reporting/\n#\n# Copyright 1997-2023, American Registry for Internet Numbers, Ltd.\n#\n",
      "audit": {
        "createdDate": "2023-03-29 20:10:10 UTC",
        "updatedDate": "2023-03-29 20:10:10 UTC"
      },
      "customField1Name": "netRange",
      "customField1Value": "172.64.0.0 - 172.71.255.255",
      "registrarName": "ARIN",
      "registrarIANAID": "778",
      "createdDateNormalized": "2015-02-25 00:00:00 UTC",
      "updatedDateNormalized": "2021-05-26 00:00:00 UTC",
      "customField2Name": "netName",
      "customField3Name": "ASN",
      "customField2Value": "CLOUDFLARENET",
      "customField3Value": "AS13335"
    },
    "contactEmail": "[email protected]",
    "domainNameExt": ".13",
    "estimatedDomainAge": 2954
  }
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.