aboutsummaryrefslogtreecommitdiff
path: root/punycode.go
diff options
context:
space:
mode:
authorAdnan Maolood <[email protected]>2021-02-21 09:43:23 -0500
committerAdnan Maolood <[email protected]>2021-02-21 09:43:23 -0500
commit2ece48b0193d50a75ef92e956563cd60df7fca4f (patch)
tree6adce70c2ac6909fd1fbce8a9ddc2efecf4791ca /punycode.go
parentclient: Copy only what is needed from the Request (diff)
downloadgo-gemini-2ece48b0193d50a75ef92e956563cd60df7fca4f.tar.xz
go-gemini-2ece48b0193d50a75ef92e956563cd60df7fca4f.zip
Move punycode functions to client.go
Diffstat (limited to 'punycode.go')
-rw-r--r--punycode.go28
1 files changed, 0 insertions, 28 deletions
diff --git a/punycode.go b/punycode.go
deleted file mode 100644
index 58f84e5..0000000
--- a/punycode.go
+++ /dev/null
@@ -1,28 +0,0 @@
-package gemini
-
-import (
- "net"
- "unicode/utf8"
-
- "golang.org/x/net/idna"
-)
-
-func isASCII(s string) bool {
- for i := 0; i < len(s); i++ {
- if s[i] >= utf8.RuneSelf {
- return false
- }
- }
- return true
-}
-
-// punycodeHostname returns the punycoded version of hostname.
-func punycodeHostname(hostname string) (string, error) {
- if net.ParseIP(hostname) != nil {
- return hostname, nil
- }
- if isASCII(hostname) {
- return hostname, nil
- }
- return idna.Lookup.ToASCII(hostname)
-}