func newTCPListenerClients(t etcdrunner.TestingT, etcd EtcdClient, discoverd discoverdClient) (*tcpListener, discoverdClient) { discoverd, etcd, cleanup := setup(t, etcd, discoverd) l := &tcpListener{ NewTCPListener("127.0.0.1", firstTCPPort, lastTCPPort, NewEtcdDataStore(etcd, "/router/tcp/"), discoverd), cleanup, } if err := l.Start(); err != nil { t.Fatal(err) } return l, discoverd }
func newHTTPListenerClients(t etcdrunner.TestingT, etcd EtcdClient, discoverd discoverdClient) (*httpListener, discoverdClient) { discoverd, etcd, cleanup := setup(t, etcd, discoverd) l := &httpListener{ NewHTTPListener("127.0.0.1:0", "127.0.0.1:0", nil, NewEtcdDataStore(etcd, "/router/http/"), discoverd), cleanup, } if err := l.Start(); err != nil { t.Fatal(err) } return l, discoverd }
func (s *S) newTCPListener(t etcdrunner.TestingT) *TCPListener { l := &TCPListener{ IP: "127.0.0.1", startPort: firstTCPPort, endPort: lastTCPPort, ds: NewPostgresDataStore("tcp", s.pgx), discoverd: s.discoverd, } if err := l.Start(); err != nil { t.Fatal(err) } return l }
func (s *S) newHTTPListener(t etcdrunner.TestingT) *HTTPListener { pair, err := tls.X509KeyPair(localhostCert, localhostKey) if err != nil { t.Fatal(err) } l := &HTTPListener{ Addr: "127.0.0.1:0", TLSAddr: "127.0.0.1:0", keypair: pair, ds: NewPostgresDataStore("http", s.pgx), discoverd: s.discoverd, } if err := l.Start(); err != nil { t.Fatal(err) } return l }