diff --git a/integration/init_test.go b/integration/init_test.go index 3f9b535..67f294f 100644 --- a/integration/init_test.go +++ b/integration/init_test.go @@ -12,7 +12,7 @@ import ( "testing" ) -const RouteRegistrarPackage = "code.cloudfoundry.org/route-registrar/" +const routeRegistrarPackage = "code.cloudfoundry.org/route-registrar/" var ( routeRegistrarBinPath string @@ -29,7 +29,7 @@ func TestIntegration(test *testing.T) { } var _ = SynchronizedBeforeSuite(func() []byte { - path, err := gexec.Build(RouteRegistrarPackage, "-race") + path, err := gexec.Build(routeRegistrarPackage, "-race") Expect(err).ShouldNot(HaveOccurred()) return []byte(path) diff --git a/integration/tcp_route_registration_test.go b/integration/tcp_route_registration_test.go index 4a38615..a933806 100644 --- a/integration/tcp_route_registration_test.go +++ b/integration/tcp_route_registration_test.go @@ -10,7 +10,7 @@ import ( "strconv" "time" - tls_helpers "code.cloudfoundry.org/cf-routing-test-helpers/tls" + tlsHelpers "code.cloudfoundry.org/cf-routing-test-helpers/tls" "code.cloudfoundry.org/route-registrar/config" "github.com/onsi/gomega/gbytes" @@ -31,14 +31,14 @@ var _ = Describe("TCP Route Registration", func() { ) BeforeEach(func() { - routingAPICAFileName, routingAPICAPrivateKey := tls_helpers.GenerateCa() - _, _, serverTLSConfig := tls_helpers.GenerateCertAndKey(routingAPICAFileName, routingAPICAPrivateKey) - routingAPIClientCertPath, routingAPIClientPrivateKeyPath, _ := tls_helpers.GenerateCertAndKey(routingAPICAFileName, routingAPICAPrivateKey) + routingAPICAFileName, routingAPICAPrivateKey := tlsHelpers.GenerateCa() + _, _, serverTLSConfig := tlsHelpers.GenerateCertAndKey(routingAPICAFileName, routingAPICAPrivateKey) + routingAPIClientCertPath, routingAPIClientPrivateKeyPath, _ := tlsHelpers.GenerateCertAndKey(routingAPICAFileName, routingAPICAPrivateKey) routingAPIServer = ghttp.NewUnstartedServer() routingAPIServer.HTTPTestServer.TLS = &tls.Config{} - routingAPIServer.HTTPTestServer.TLS.RootCAs = tls_helpers.CertPool(routingAPICAFileName) - routingAPIServer.HTTPTestServer.TLS.ClientCAs = tls_helpers.CertPool(routingAPICAFileName) + routingAPIServer.HTTPTestServer.TLS.RootCAs = tlsHelpers.CertPool(routingAPICAFileName) + routingAPIServer.HTTPTestServer.TLS.ClientCAs = tlsHelpers.CertPool(routingAPICAFileName) routingAPIServer.HTTPTestServer.TLS.ClientAuth = tls.RequireAndVerifyClientCert routingAPIServer.HTTPTestServer.TLS.CipherSuites = []uint16{tls.TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256} routingAPIServer.HTTPTestServer.TLS.Certificates = []tls.Certificate{serverTLSConfig} @@ -58,7 +58,9 @@ var _ = Describe("TCP Route Registration", func() { ghttp.VerifyJSON(`[{ "router_group_guid":"router-group-guid", "backend_port":1234, + "backend_tls_port": -1, "backend_ip":"127.0.0.1", + "instance_id": "", "port":5678, "modification_tag":{ "guid":"", diff --git a/routingapi/api.go b/routingapi/api.go index c3739d5..db715c3 100644 --- a/routingapi/api.go +++ b/routingapi/api.go @@ -82,12 +82,17 @@ func (r *RoutingAPI) makeTcpRouteMapping(route config.Route) (models.TcpRouteMap r.logger.Info("Creating mapping", lager.Data{}) + hostTLSPort := -1 + if route.TLSPort != nil { + hostTLSPort = *route.TLSPort + } + return models.NewTcpRouteMapping( routerGroupGUID, uint16(*route.ExternalPort), route.Host, uint16(*route.Port), - 0, + hostTLSPort, "", nilIfEmpty(&route.ServerCertDomainSAN), calculateTTL(route.RegistrationInterval, r.routingAPIMaxTTL),