Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

twitch.tv markes as available #5

Open
PatchRequest opened this issue Jan 29, 2024 · 6 comments
Open

twitch.tv markes as available #5

PatchRequest opened this issue Jan 29, 2024 · 6 comments

Comments

@PatchRequest
Copy link

PatchRequest commented Jan 29, 2024

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
Copy link
Author

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

@haccer
Copy link
Owner

haccer commented Jan 30, 2024

Hi @CementryMage - I'm looking into this

@haccer haccer closed this as completed in 85f2932 Jan 30, 2024
@haccer
Copy link
Owner

haccer commented Jan 30, 2024

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!

@PatchRequest
Copy link
Author

Thanks for the fix!

@PatchRequest
Copy link
Author

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

@haccer
Copy link
Owner

haccer commented Feb 15, 2024

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 haccer reopened this Feb 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants