mirror of
https://github.com/kubeshark/kubeshark.git
synced 2025-07-18 10:21:56 +00:00
Update main.go
This commit is contained in:
parent
bd71e9a122
commit
c4048e5c8e
@ -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 standalone = flag.Bool("standalone", false, "Run in standalone tapper and API mode")
|
||||||
var aggregatorAddress = flag.String("aggregator-address", "", "Address of mizu collector for tapping")
|
var aggregatorAddress = flag.String("aggregator-address", "", "Address of mizu collector for tapping")
|
||||||
|
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
hostMode := os.Getenv(shared.HostModeEnvVar) == "1"
|
hostMode := os.Getenv(shared.HostModeEnvVar) == "1"
|
||||||
tapOpts := &tap.TapOpts{HostMode: hostMode}
|
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")
|
panic("One of the flags --tap, --api or --standalone must be provided")
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -84,7 +83,6 @@ func main() {
|
|||||||
func hostApi(socketHarOutputChannel chan<- *tap.OutputChannelItem) {
|
func hostApi(socketHarOutputChannel chan<- *tap.OutputChannelItem) {
|
||||||
app := fiber.New()
|
app := fiber.New()
|
||||||
|
|
||||||
|
|
||||||
middleware.FiberMiddleware(app) // Register Fiber's middleware for app.
|
middleware.FiberMiddleware(app) // Register Fiber's middleware for app.
|
||||||
app.Static("/", "./site")
|
app.Static("/", "./site")
|
||||||
|
|
||||||
@ -102,7 +100,6 @@ func hostApi(socketHarOutputChannel chan<- *tap.OutputChannelItem) {
|
|||||||
utils.StartServer(app)
|
utils.StartServer(app)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
func getTapTargets() []string {
|
func getTapTargets() []string {
|
||||||
nodeName := os.Getenv(shared.NodeNameEnvVar)
|
nodeName := os.Getenv(shared.NodeNameEnvVar)
|
||||||
var tappedAddressesPerNodeDict map[string][]string
|
var tappedAddressesPerNodeDict map[string][]string
|
||||||
@ -129,7 +126,7 @@ func getTrafficFilteringOptions() *shared.TrafficFilteringOptions {
|
|||||||
|
|
||||||
var userAgentsToFilter = []string{"kube-probe", "prometheus"}
|
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 {
|
for message := range inChannel {
|
||||||
if message.ConnectionInfo.IsOutgoing && api.CheckIsServiceIP(message.ConnectionInfo.ServerIP) {
|
if message.ConnectionInfo.IsOutgoing && api.CheckIsServiceIP(message.ConnectionInfo.ServerIP) {
|
||||||
continue
|
continue
|
||||||
|
Loading…
Reference in New Issue
Block a user