mirror of
https://github.com/coredns/coredns.git
synced 2025-12-08 03:15:41 -05:00
Use IsDomainName (#119)
Liberal as it as it still has its use. Reject invalid domain names in the config. Unrelated: clear up the README as well. And fix travis script.
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package parse
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net"
|
||||
"os"
|
||||
"path/filepath"
|
||||
@@ -320,6 +321,14 @@ func standardAddress(str string) (address, error) {
|
||||
// no error check here; return err at end of function
|
||||
}
|
||||
|
||||
if len(host) > 255 {
|
||||
return address{}, fmt.Errorf("specified address is too long: %d > 255", len(host))
|
||||
}
|
||||
_, d := dns.IsDomainName(host)
|
||||
if !d {
|
||||
return address{}, fmt.Errorf("host is not a valid domain: %s", host)
|
||||
}
|
||||
|
||||
// see if we can set port based off scheme
|
||||
if port == "" {
|
||||
port = "53"
|
||||
|
||||
Reference in New Issue
Block a user