INNER CODE UNIT · Go

validateHostPort

kubernetes/dns · third_party/forked/skydns/main.go:268

func validateHostPort(hostPort string) error {
	host, port, err := net.SplitHostPort(hostPort)
	if err != nil {
		return err
	}
	if ip := net.ParseIP(host); ip == nil {
		return fmt.Errorf("bad IP address: %s", host)
	}

	if p, _ := strconv.Atoi(port); p < 1 || p > 65535 {
		return fmt.Errorf("bad port number %s", port)
	}
	return nil
}

func newEtcdV2Client(machines []string, certFile, keyFile, caFile, username, password string) (etcd.KeysAPI, error) {
	t, err := newHTTPSTransport(certFile, keyFile, caFile)
	if err != nil {

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…