Update main.go

This commit is contained in:
RamiBerm 2021-07-13 16:56:02 +03:00
parent bd71e9a122
commit c4048e5c8e

View File

@ -25,13 +25,12 @@ var aggregator = flag.Bool("aggregator", false, "Run in aggregator mode with API
var standalone = flag.Bool("standalone", false, "Run in standalone tapper and API mode")
var aggregatorAddress = flag.String("aggregator-address", "", "Address of mizu collector for tapping")
func main() {
flag.Parse()
hostMode := os.Getenv(shared.HostModeEnvVar) == "1"
tapOpts := &tap.TapOpts{HostMode: hostMode}
if !*shouldTap && !*aggregator && !*standalone{
if !*shouldTap && !*aggregator && !*standalone {
panic("One of the flags --tap, --api or --standalone must be provided")
}
@ -84,7 +83,6 @@ func main() {
func hostApi(socketHarOutputChannel chan<- *tap.OutputChannelItem) {
app := fiber.New()
middleware.FiberMiddleware(app) // Register Fiber's middleware for app.
app.Static("/", "./site")
@ -102,7 +100,6 @@ func hostApi(socketHarOutputChannel chan<- *tap.OutputChannelItem) {
utils.StartServer(app)
}
func getTapTargets() []string {
nodeName := os.Getenv(shared.NodeNameEnvVar)
var tappedAddressesPerNodeDict map[string][]string
@ -129,7 +126,7 @@ func getTrafficFilteringOptions() *shared.TrafficFilteringOptions {
var userAgentsToFilter = []string{"kube-probe", "prometheus"}
func filterHarItems(inChannel <- chan *tap.OutputChannelItem, outChannel chan *tap.OutputChannelItem, filterOptions *shared.TrafficFilteringOptions) {
func filterHarItems(inChannel <-chan *tap.OutputChannelItem, outChannel chan *tap.OutputChannelItem, filterOptions *shared.TrafficFilteringOptions) {
for message := range inChannel {
if message.ConnectionInfo.IsOutgoing && api.CheckIsServiceIP(message.ConnectionInfo.ServerIP) {
continue