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

getIp / isIp function #2044

Closed
scripthunter7 opened this issue May 14, 2024 · 2 comments
Closed

getIp / isIp function #2044

scripthunter7 opened this issue May 14, 2024 · 2 comments

Comments

@scripthunter7
Copy link

scripthunter7 commented May 14, 2024

I've noticed that the library exports several helpful functions, such as getDomain and getHostname. Following this pattern, I would suggest adding getIp or export the isIp function

@remusao
Copy link
Owner

remusao commented May 23, 2024

Hi @scripthunter7,

Thanks for reaching out and for your suggestion. I am not super warm to the idea of exposing isIp because I see it more as an internal implementation detail and I do not want tldts to be used as a validation library (I think there are more robust solutions to this use-case in specialized packages).

tldts's goal is to parse public suffixes from hostnames and as a convenience also supports detecting special cases like IPs but I think it's best to keep the public API restricted to the core mission of the library if possible.

Do you have a specific use-case where having tldts expose isIP would help you?

Best,

@scripthunter7
Copy link
Author

scripthunter7 commented May 30, 2024

Hi @remusao,

We working with some host-like rules in our parser, and at the moment when I opened this issue I thought it would be good to use tldts as a single library here as it covers the topic quite well. But I double-checked it, and it seems that not everything is validated in isIp (e.g. 999 can be in the IP, etc.) - so I agree with you, it's more of an internal, speed-oriented implementation, and maybe it really wouldn't be a good idea to export it in its current form.

Thanks for your reply and thanks for making this great library!

I'm closing the issue

@scripthunter7 scripthunter7 closed this as not planned Won't fix, can't repro, duplicate, stale May 30, 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