-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
[dns, http]: support IDNA domains #1192
base: master
Are you sure you want to change the base?
Conversation
Signed-off-by: Julien Pivotto <[email protected]>
Signed-off-by: InsanePrawn <[email protected]>
@@ -142,3 +144,18 @@ func ipHash(ip net.IP) float64 { | |||
} | |||
return float64(h.Sum32()) | |||
} | |||
|
|||
func internationalizeDNSDomain(logger log.Logger, domain string) string { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would be happier if there was a test for this function.
Basically test these cases:
- IPv4 address
- IPv6 address
- regular domain name
- domain name with non-ASCII characters in UTF form ("www.académie-française.fr")
- domain name with non-ASCII characters in ASCII form (punycode) ("www.xn--acadmie-franaise-npb1a.fr")
@@ -60,6 +61,7 @@ func chooseProtocol(ctx context.Context, IPProtocol string, fallbackIPProtocol b | |||
fallbackProtocol = "ip6" | |||
} | |||
|
|||
target = internationalizeDNSDomain(logger, target) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
below the target
string is used is several places to log results.
Question: do I really want to see the actual target that was used (www.xn--acadmie-franaise-npb1a.fr
) or do I want to see the target as entered by the user (www.académie-française.fr
)? The first one is useful for debugging, the second one might be less surprising. Maybe this needs documenting?
based on #640, added support to the HTTP prober.
Works on my machine now(TM)