GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - haccer/available: Domain availability checking for Golang

BranchesTags
Open more actions menu

Latest commit

 

History

32 Commits
32 Commits

Folders and files

NameName
Last commit message
Last commit date
.github/workflows
.github/workflows
 
 
.gitignore
.gitignore
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
available_test.go
available_test.go
 
 
bad.go
bad.go
 
 
check.go
check.go
 
 
go.mod
go.mod
 
 
go.sum
go.sum
 
 
rdap.go
rdap.go
 
 
whois.go
whois.go
 
 

Repository files navigation

Is 'domain.x' Available?

CI GitHub release Go Reference GitHub license

IN RDAP WE TRUST

My cheap way of checking whether a domain is available to be purchased or not. Used by subjack to confirm takeover targets are registrable.

Availability is checked with RDAP first (RFC 9083): the answer is carried by the HTTP status itself — 404 means the domain is not registered, 200 means it is. RDAP servers are discovered from the IANA bootstrap file and cached per TLD, so there is no per-TLD configuration to maintain and no registry response text to fingerprint. TLDs without RDAP fall back to a small whois client (RFC 3912) that discovers authoritative servers via IANA referral and matches a short list of generic "available" responses.

The only dependency is golang.org/x/net (for public suffix data). Requires Go 1.25 or newer.

Disclaimer

This package might not be able to check the availability of every possible domain TLD. Always double-check results manually before acting on them.

Installation

go get github.com/haccer/available

Usage

package main

import (
        "fmt"
        "time"

        "github.com/haccer/available"
)

func main() {
        // Domain uses a 10s timeout.
        if available.Domain("dreamdomain.io") {
                fmt.Println("[+] Success!")
        }

        // ...or supply your own timeout.
        available.DomainTimeout("dreamdomain.io", 5*time.Second)

        // SafeDomain also reports whether the TLD has no usable whois/RDAP
        // server ("bad" TLD), so you can skip or flag it.
        avail, badTLD := available.SafeDomain("dreamdomain.io")
        fmt.Println(avail, badTLD)
}

All functions are safe for concurrent use: subdomains are reduced to their registrable domain (eTLD+1) first, and the bootstrap data and whois servers are resolved once per TLD and cached.

Tests

The test suite runs entirely offline against local RDAP and whois fixtures:

go test -race ./...

About

Domain availability checking for Golang

Topics

availabilitydomaingogolangwhois

Resources

Readme
MIT license
Activity

Stars

47 stars

Watchers

1 watching

Forks

13 forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.