Update public_routes.go, tapRunner.go, and proxy.go

This commit is contained in:
RamiBerm
2021-07-11 14:01:07 +03:00
parent 65ba0952b4
commit 3db6d5a5ea
3 changed files with 13 additions and 5 deletions

View File

@@ -21,5 +21,4 @@ func EntriesRoutes(fiberApp *fiber.App) {
routeGroup.Get("/tapStatus", controllers.GetTappingStatus) // get tapping status
routeGroup.Get("/analyzeStatus", controllers.AnalyzeInformation)
}

View File

@@ -3,6 +3,7 @@ package cmd
import (
"context"
"fmt"
"net/http"
"os"
"os/signal"
"regexp"
@@ -74,7 +75,6 @@ func RunMizuTap(podRegexQuery *regexp.Regexp, tappingOptions *MizuTapOptions) {
go portForwardApiPod(ctx, kubernetesProvider, cancel, tappingOptions) // TODO convert this to job for built in pod ttl or have the running app handle this
go watchPodsForTapping(ctx, kubernetesProvider, cancel, podRegexQuery, tappingOptions)
go syncApiStatus(ctx, cancel, tappingOptions)
//go spamHealthcheck(ctx, tappingOptions)
//block until exit signal or error
waitForFinish(ctx, cancel)
@@ -248,8 +248,18 @@ func portForwardApiPod(ctx context.Context, kubernetesProvider *kubernetes.Provi
cancel()
}
}()
fmt.Printf("Mizu is available at http://%s\n", kubernetes.GetMizuCollectorProxiesHostAndPath(tappingOptions.GuiPort, mizu.ResourcesNamespace, mizu.AggregatorPodName))
mizuProxiedUrl := kubernetes.GetMizuCollectorProxiesHostAndPath(tappingOptions.GuiPort, mizu.ResourcesNamespace, mizu.AggregatorPodName)
fmt.Printf("Mizu is available at http://%s\n", mizuProxiedUrl)
time.Sleep(time.Second * 5) // Waiting to be sure the proxy is ready
if tappingOptions.Analyze {
if _, err := http.Get(fmt.Sprintf("http://%s/api/uploadEntries?dest=%s", mizuProxiedUrl, tappingOptions.AnalyzeDestination)); err != nil {
fmt.Println(err)
} else {
fmt.Printf(mizu.Purple, "Traffic is uploading to UP9 cloud for further analsys")
fmt.Println()
}
}
isPodReady = true
}

View File

@@ -29,7 +29,6 @@ func StartProxy(kubernetesProvider *Provider, mizuPort uint16, mizuNamespace str
//work around to make static resources available to the dashboard (all .svgs will not load without this)
mux.Handle("/static/", getRerouteHttpHandler(proxyHandler, mizuProxiedUrl))
//l, err := server.Listen("127.0.0.1", int(mizuPort))
l, err := net.Listen("tcp", fmt.Sprintf("%s:%d", "127.0.0.1", int(mizuPort)))
if err != nil {
return err