available icon indicating copy to clipboard operation
available copied to clipboard

twitch.tv markes as available

Open PatchRequest opened this issue 1 year ago • 6 comments

Hi, when i run the following code:

package main

import (
	"fmt"

	"github.com/haccer/available"
)

func main() {
	fmt.Println(available.Domain("twitch.tv"))
}

It return true, which is obviously wrong.

How can we fix this? :D

PatchRequest avatar Jan 29 '24 18:01 PatchRequest

I looked into it a little an it looks like the response from the whois lib is No match for "TWITCH.TV". Weird

PatchRequest avatar Jan 29 '24 18:01 PatchRequest

Hi @CementryMage - I'm looking into this

haccer avatar Jan 30 '24 21:01 haccer

It looks like this is an issue with https://github.com/domainr/whois, which I use to make whois requests. All .tv is appearing to be available:

% go run test.go
true
No match for "APPLE.TV".

I've fixed the issue to use whois.nic.tv as the whois server:

func getWhois(tld string, domain string) (response string) {
	req, err := whois.NewRequest(domain)
	if err != nil {
		return
	}

	if tld == "tv" {
		req.Host = "whois.nic.tv"
		req.Body = []byte(fmt.Sprintf("%s\r\n", req.Query))
	}

	resp, err := whois.DefaultClient.Fetch(req)
	if err != nil {
		return
	}

	return fmt.Sprintf("%s", resp)
}

Thank you for reporting this issue!

haccer avatar Jan 30 '24 22:01 haccer

Thanks for the fix!

PatchRequest avatar Feb 14 '24 22:02 PatchRequest

i did not dig deeper but i saw similar behavior with .ca and .lt if i remember it correctly

PatchRequest avatar Feb 14 '24 22:02 PatchRequest

Thanks for the letting me know @PatchRequest, I'm going to reopen this issue then.

I'll begin updating available and going through each TLD to make sure all the whois servers are correct.

haccer avatar Feb 15 '24 03:02 haccer