mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
Revert "Merge pull request #6365 from heyitsanthony/fix-dns-bind"
This reverts commit af5ab7b3515cf023af7af94bc6e9063945802be0, reversing changes made to da6a0f0594f352539349013336614e08033a7eb3.
This commit is contained in:
parent
840f4d48c8
commit
fa2e9c2449
@ -17,7 +17,6 @@ package embed
|
||||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"net"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"strings"
|
||||
@ -254,13 +253,6 @@ func (cfg *configYAML) configFromFile(path string) error {
|
||||
}
|
||||
|
||||
func (cfg *Config) Validate() error {
|
||||
if err := checkBindURLs(cfg.LPUrls); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := checkBindURLs(cfg.LCUrls); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// Check if conflicting flags are passed.
|
||||
nSet := 0
|
||||
for _, v := range []bool{cfg.Durl != "", cfg.InitialCluster != "", cfg.DNSCluster != ""} {
|
||||
@ -354,22 +346,3 @@ func (cfg Config) IsDefaultHost() (string, error) {
|
||||
}
|
||||
return "", defaultHostStatus
|
||||
}
|
||||
|
||||
// checkBindURLs returns an error if any URL uses a domain name.
|
||||
func checkBindURLs(urls []url.URL) error {
|
||||
for _, url := range urls {
|
||||
if url.Scheme == "unix" || url.Scheme == "unixs" {
|
||||
continue
|
||||
}
|
||||
host := strings.Split(url.Host, ":")[0]
|
||||
if host == "localhost" {
|
||||
// special case for local address
|
||||
// TODO: support /etc/hosts ?
|
||||
continue
|
||||
}
|
||||
if net.ParseIP(host) == nil {
|
||||
return fmt.Errorf("expected IP in URL for binding (%s)", url.String())
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
@ -40,8 +40,6 @@ func TestEmbedEtcd(t *testing.T) {
|
||||
{wpeers: 1, wclients: 1},
|
||||
{wpeers: 2, wclients: 1},
|
||||
{wpeers: 1, wclients: 2},
|
||||
{werr: "expected IP"},
|
||||
{werr: "expected IP"},
|
||||
}
|
||||
|
||||
urls := newEmbedURLs(10)
|
||||
@ -60,10 +58,6 @@ func TestEmbedEtcd(t *testing.T) {
|
||||
setupEmbedCfg(&tests[5].cfg, []url.URL{urls[4]}, []url.URL{urls[5], urls[6]})
|
||||
setupEmbedCfg(&tests[6].cfg, []url.URL{urls[7], urls[8]}, []url.URL{urls[9]})
|
||||
|
||||
dnsURL, _ := url.Parse("http://whatever.test:12345")
|
||||
tests[7].cfg.LCUrls = []url.URL{*dnsURL}
|
||||
tests[8].cfg.LPUrls = []url.URL{*dnsURL}
|
||||
|
||||
dir := path.Join(os.TempDir(), fmt.Sprintf("embed-etcd"))
|
||||
os.RemoveAll(dir)
|
||||
defer os.RemoveAll(dir)
|
||||
|
Loading…
x
Reference in New Issue
Block a user