mirror of
https://github.com/kubeshark/kubeshark.git
synced 2025-09-08 14:01:51 +00:00
Remove allExtensionPorts
since it's no longer needed
This commit is contained in:
@@ -38,7 +38,6 @@ var harsDir = flag.String("hars-dir", "", "Directory to read hars from")
|
||||
|
||||
var extensions []*tapApi.Extension // global
|
||||
var extensionsMap map[string]*tapApi.Extension // global
|
||||
var allExtensionPorts []string // global
|
||||
|
||||
func main() {
|
||||
flag.Parse()
|
||||
@@ -54,7 +53,7 @@ func main() {
|
||||
api.StartResolving(*namespace)
|
||||
|
||||
filteredOutputItemsChannel := make(chan *tapApi.OutputChannelItem)
|
||||
tap.StartPassiveTapper(tapOpts, filteredOutputItemsChannel, extensions, allExtensionPorts)
|
||||
tap.StartPassiveTapper(tapOpts, filteredOutputItemsChannel, extensions)
|
||||
|
||||
// go filterHarItems(harOutputChannel, filteredOutputItemsChannel, getTrafficFilteringOptions())
|
||||
go api.StartReadingEntries(filteredOutputItemsChannel, nil, extensionsMap)
|
||||
@@ -74,7 +73,7 @@ func main() {
|
||||
|
||||
// harOutputChannel, outboundLinkOutputChannel := tap.StartPassiveTapper(tapOpts)
|
||||
filteredOutputItemsChannel := make(chan *tapApi.OutputChannelItem)
|
||||
tap.StartPassiveTapper(tapOpts, filteredOutputItemsChannel, extensions, allExtensionPorts)
|
||||
tap.StartPassiveTapper(tapOpts, filteredOutputItemsChannel, extensions)
|
||||
socketConnection, err := shared.ConnectToSocketServer(*apiServerAddress, shared.DEFAULT_SOCKET_RETRIES, shared.DEFAULT_SOCKET_RETRY_SLEEP_TIME, false)
|
||||
if err != nil {
|
||||
panic(fmt.Sprintf("Error connecting to socket server at %s %v", *apiServerAddress, err))
|
||||
@@ -109,21 +108,6 @@ func main() {
|
||||
rlog.Info("Exiting")
|
||||
}
|
||||
|
||||
func mergeUnique(slice []string, merge []string) []string {
|
||||
for _, i := range merge {
|
||||
add := true
|
||||
for _, ele := range slice {
|
||||
if ele == i {
|
||||
add = false
|
||||
}
|
||||
}
|
||||
if add {
|
||||
slice = append(slice, i)
|
||||
}
|
||||
}
|
||||
return slice
|
||||
}
|
||||
|
||||
func loadExtensions() {
|
||||
appPorts := parseEnvVar(shared.AppPortsEnvVar)
|
||||
|
||||
@@ -156,7 +140,6 @@ func loadExtensions() {
|
||||
extension.Protocol.Ports = ports
|
||||
}
|
||||
extensionsMap[extension.Protocol.Name] = extension
|
||||
allExtensionPorts = mergeUnique(allExtensionPorts, extension.Protocol.Ports)
|
||||
}
|
||||
|
||||
sort.Slice(extensions, func(i, j int) bool {
|
||||
@@ -168,7 +151,6 @@ func loadExtensions() {
|
||||
}
|
||||
|
||||
controllers.InitExtensionsMap(extensionsMap)
|
||||
log.Printf("All extension ports: %v\n", allExtensionPorts)
|
||||
}
|
||||
|
||||
func hostApi(socketHarOutputChannel chan<- *tapApi.OutputChannelItem) {
|
||||
|
@@ -162,7 +162,7 @@ func (c *Context) GetCaptureInfo() gopacket.CaptureInfo {
|
||||
return c.CaptureInfo
|
||||
}
|
||||
|
||||
func StartPassiveTapper(opts *TapOpts, outputItems chan *api.OutputChannelItem, extensionsRef []*api.Extension, allExtensionPorts []string) {
|
||||
func StartPassiveTapper(opts *TapOpts, outputItems chan *api.OutputChannelItem, extensionsRef []*api.Extension) {
|
||||
hostMode = opts.HostMode
|
||||
extensions = extensionsRef
|
||||
|
||||
@@ -170,7 +170,7 @@ func StartPassiveTapper(opts *TapOpts, outputItems chan *api.OutputChannelItem,
|
||||
startMemoryProfiler()
|
||||
}
|
||||
|
||||
go startPassiveTapper(outputItems, allExtensionPorts)
|
||||
go startPassiveTapper(outputItems)
|
||||
}
|
||||
|
||||
func startMemoryProfiler() {
|
||||
@@ -204,7 +204,7 @@ func startMemoryProfiler() {
|
||||
}()
|
||||
}
|
||||
|
||||
func startPassiveTapper(outputItems chan *api.OutputChannelItem, allExtensionPorts []string) {
|
||||
func startPassiveTapper(outputItems chan *api.OutputChannelItem) {
|
||||
log.SetFlags(log.LstdFlags | log.LUTC | log.Lshortfile)
|
||||
|
||||
defer util.Run()()
|
||||
@@ -226,8 +226,6 @@ func startPassiveTapper(outputItems chan *api.OutputChannelItem, allExtensionPor
|
||||
ownIps = localhostIPs
|
||||
}
|
||||
|
||||
log.Printf("App Ports: %v", allExtensionPorts)
|
||||
|
||||
var handle *pcap.Handle
|
||||
var err error
|
||||
if *fname != "" {
|
||||
@@ -297,8 +295,7 @@ func startPassiveTapper(outputItems chan *api.OutputChannelItem, allExtensionPor
|
||||
}
|
||||
|
||||
streamFactory := &tcpStreamFactory{
|
||||
AllExtensionPorts: allExtensionPorts,
|
||||
Emitter: emitter,
|
||||
Emitter: emitter,
|
||||
}
|
||||
streamPool := reassembly.NewStreamPool(streamFactory)
|
||||
assembler := reassembly.NewAssembler(streamPool)
|
||||
|
@@ -20,7 +20,6 @@ import (
|
||||
type tcpStreamFactory struct {
|
||||
wg sync.WaitGroup
|
||||
outboundLinkWriter *OutboundLinkWriter
|
||||
AllExtensionPorts []string
|
||||
Emitter api.Emitter
|
||||
}
|
||||
|
||||
@@ -29,7 +28,6 @@ func (factory *tcpStreamFactory) New(net, transport gopacket.Flow, tcp *layers.T
|
||||
fsmOptions := reassembly.TCPSimpleFSMOptions{
|
||||
SupportMissingEstablishment: *allowmissinginit,
|
||||
}
|
||||
rlog.Debugf("Current App Ports: %v", factory.AllExtensionPorts)
|
||||
srcIp := net.Src().String()
|
||||
dstIp := net.Dst().String()
|
||||
srcPort := transport.Src().String()
|
||||
|
Reference in New Issue
Block a user