mirror of
https://github.com/FiloSottile/mkcert.git
synced 2025-10-13 16:31:41 +08:00
Add support for URL SANs (#166)
This commit is contained in:

committed by
Filippo Valsorda

parent
0a679a8bcd
commit
c2b30c48f1
8
main.go
8
main.go
@@ -13,6 +13,7 @@ import (
|
||||
"log"
|
||||
"net"
|
||||
"net/mail"
|
||||
"net/url"
|
||||
"os"
|
||||
"os/exec"
|
||||
"path/filepath"
|
||||
@@ -195,13 +196,16 @@ func (m *mkcert) Run(args []string) {
|
||||
if email, err := mail.ParseAddress(name); err == nil && email.Address == name {
|
||||
continue
|
||||
}
|
||||
if uriName, err := url.Parse(name); err == nil && uriName.Scheme != "" && uriName.Host != "" {
|
||||
continue
|
||||
}
|
||||
punycode, err := idna.ToASCII(name)
|
||||
if err != nil {
|
||||
log.Fatalf("ERROR: %q is not a valid hostname, IP, or email: %s", name, err)
|
||||
log.Fatalf("ERROR: %q is not a valid hostname, IP, URL or email: %s", name, err)
|
||||
}
|
||||
args[i] = punycode
|
||||
if !hostnameRegexp.MatchString(punycode) {
|
||||
log.Fatalf("ERROR: %q is not a valid hostname, IP, or email", name)
|
||||
log.Fatalf("ERROR: %q is not a valid hostname, IP, URL or email", name)
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user