func startGateway(cmd *cobra.Command, args []string) { endpoints := gatewayEndpoints if gatewayDNSCluster != "" { eps, err := client.NewSRVDiscover().Discover(gatewayDNSCluster) if err != nil { fmt.Fprintln(os.Stderr, err) os.Exit(1) } plog.Infof("discovered the cluster %s from %s", eps, gatewayDNSCluster) } l, err := net.Listen("tcp", gatewayListenAddr) if err != nil { fmt.Fprintln(os.Stderr, err) os.Exit(1) } tp := tcpproxy.TCPProxy{ Listener: l, Endpoints: endpoints, MonitorInterval: getewayRetryDelay, } tp.Run() }
func startGateway(cmd *cobra.Command, args []string) { l, err := net.Listen("tcp", gatewayListenAddr) if err != nil { fmt.Fprintln(os.Stderr, err) os.Exit(1) } tp := tcpproxy.TCPProxy{ Listener: l, Endpoints: gatewayEndpoints, MonitorInterval: getewayRetryDelay, } tp.Run() }
func startGateway(cmd *cobra.Command, args []string) { endpoints := gatewayEndpoints if gatewayDNSCluster != "" { eps, err := client.NewSRVDiscover().Discover(gatewayDNSCluster) if err != nil { fmt.Fprintln(os.Stderr, err) os.Exit(1) } plog.Infof("discovered the cluster %s from %s", eps, gatewayDNSCluster) // confirm TLS connections are good if !gatewayInsecureDiscovery { tlsInfo := transport.TLSInfo{ TrustedCAFile: gatewayCA, ServerName: gatewayDNSCluster, } plog.Infof("validating discovered endpoints %v", eps) endpoints, err = transport.ValidateSecureEndpoints(tlsInfo, eps) if err != nil { plog.Warningf("%v", err) } plog.Infof("using discovered endpoints %v", endpoints) } } if len(endpoints) == 0 { plog.Fatalf("no endpoints found") } l, err := net.Listen("tcp", gatewayListenAddr) if err != nil { fmt.Fprintln(os.Stderr, err) os.Exit(1) } tp := tcpproxy.TCPProxy{ Listener: l, Endpoints: endpoints, MonitorInterval: getewayRetryDelay, } tp.Run() }