mirror of
https://github.com/kubeshark/kubeshark.git
synced 2025-08-01 16:57:28 +00:00
Move HTTP files into tap/extensions/lib
for now
This commit is contained in:
parent
648a4d21f3
commit
2c7e857075
10
Makefile
10
Makefile
@ -23,7 +23,7 @@ export SEM_VER?=0.0.0
|
||||
|
||||
ui: ## Build UI.
|
||||
@(cd ui; npm i ; npm run build; )
|
||||
@ls -l ui/build
|
||||
@ls -l ui/build
|
||||
|
||||
cli: ## Build CLI.
|
||||
@echo "building cli"; cd cli && $(MAKE) build
|
||||
@ -31,6 +31,7 @@ cli: ## Build CLI.
|
||||
agent: ## Build agent.
|
||||
@(echo "building mizu agent .." )
|
||||
@(cd agent; go build -o build/mizuagent main.go)
|
||||
${MAKE} extensions
|
||||
@ls -l agent/build
|
||||
|
||||
docker: ## Build and publish agent docker image.
|
||||
@ -65,6 +66,11 @@ clean-cli: ## Clean CLI.
|
||||
clean-docker:
|
||||
@(echo "DOCKER cleanup - NOT IMPLEMENTED YET " )
|
||||
|
||||
http:
|
||||
extensions: extension-http
|
||||
|
||||
extension-http:
|
||||
cd tap/extensions/http && \
|
||||
go build -buildmode=plugin -o ../http.so .
|
||||
cd ../../..
|
||||
mkdir -p agent/build/extensions
|
||||
cp tap/extensions/http.so agent/build/extensions
|
||||
|
@ -1,12 +1,7 @@
|
||||
module github.com/up9inc/mizu/tap
|
||||
module github.com/up9inc/mizu/tap/extensions/http
|
||||
|
||||
go 1.16
|
||||
|
||||
require (
|
||||
github.com/bradleyfalzon/tlsx v0.0.0-20170624122154-28fd0e59bac4
|
||||
github.com/google/martian v2.1.0+incompatible
|
||||
github.com/orcaman/concurrent-map v0.0.0-20210501183033-44dafcb38ecc
|
||||
github.com/romana/rlog v0.0.0-20171115192701-f018bc92e7d7
|
||||
golang.org/x/net v0.0.0-20210813160813-60bc85c4be6d
|
||||
golang.org/x/text v0.3.7 // indirect
|
||||
)
|
||||
require github.com/up9inc/mizu/tap/extensions/http/lib v0.0.0-00010101000000-000000000000
|
||||
|
||||
replace github.com/up9inc/mizu/tap/extensions/http/lib => ./lib
|
||||
|
12
tap/extensions/http/lib/go.mod
Normal file
12
tap/extensions/http/lib/go.mod
Normal file
@ -0,0 +1,12 @@
|
||||
module github.com/up9inc/mizu/tap/extensions/http/lib
|
||||
|
||||
go 1.16
|
||||
|
||||
require (
|
||||
github.com/bradleyfalzon/tlsx v0.0.0-20170624122154-28fd0e59bac4
|
||||
github.com/google/martian v2.1.0+incompatible
|
||||
github.com/orcaman/concurrent-map v0.0.0-20210501183033-44dafcb38ecc
|
||||
github.com/romana/rlog v0.0.0-20171115192701-f018bc92e7d7
|
||||
golang.org/x/net v0.0.0-20210813160813-60bc85c4be6d
|
||||
golang.org/x/text v0.3.7 // indirect
|
||||
)
|
17
tap/extensions/http/lib/go.sum
Normal file
17
tap/extensions/http/lib/go.sum
Normal file
@ -0,0 +1,17 @@
|
||||
github.com/bradleyfalzon/tlsx v0.0.0-20170624122154-28fd0e59bac4 h1:NJOOlc6ZJjix0A1rAU+nxruZtR8KboG1848yqpIUo4M=
|
||||
github.com/bradleyfalzon/tlsx v0.0.0-20170624122154-28fd0e59bac4/go.mod h1:DQPxZS994Ld1Y8uwnJT+dRL04XPD0cElP/pHH/zEBHM=
|
||||
github.com/google/martian v2.1.0+incompatible h1:/CP5g8u/VJHijgedC/Legn3BAbAaWPgecwXBIDzw5no=
|
||||
github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs=
|
||||
github.com/orcaman/concurrent-map v0.0.0-20210501183033-44dafcb38ecc h1:Ak86L+yDSOzKFa7WM5bf5itSOo1e3Xh8bm5YCMUXIjQ=
|
||||
github.com/orcaman/concurrent-map v0.0.0-20210501183033-44dafcb38ecc/go.mod h1:Lu3tH6HLW3feq74c2GC+jIMS/K2CFcDWnWD9XkenwhI=
|
||||
github.com/romana/rlog v0.0.0-20171115192701-f018bc92e7d7 h1:jkvpcEatpwuMF5O5LVxTnehj6YZ/aEZN4NWD/Xml4pI=
|
||||
github.com/romana/rlog v0.0.0-20171115192701-f018bc92e7d7/go.mod h1:KTrHyWpO1sevuXPZwyeZc72ddWRFqNSKDFl7uVWKpg0=
|
||||
golang.org/x/net v0.0.0-20210813160813-60bc85c4be6d h1:LO7XpTYMwTqxjLcGWPijK3vRXg1aWdlNOVOHRq45d7c=
|
||||
golang.org/x/net v0.0.0-20210813160813-60bc85c4be6d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
|
||||
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
||||
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||
golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk=
|
||||
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
|
||||
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
@ -1,4 +1,4 @@
|
||||
package main
|
||||
package lib
|
||||
|
||||
import (
|
||||
"bufio"
|
@ -1,4 +1,4 @@
|
||||
package main
|
||||
package lib
|
||||
|
||||
import (
|
||||
"bytes"
|
@ -1,4 +1,4 @@
|
||||
package main
|
||||
package lib
|
||||
|
||||
import (
|
||||
"fmt"
|
@ -1,4 +1,4 @@
|
||||
package main
|
||||
package lib
|
||||
|
||||
type OutboundLinkProtocol string
|
||||
|
@ -1,4 +1,4 @@
|
||||
package main
|
||||
package lib
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
@ -37,6 +37,10 @@ type ConnectionInfo struct {
|
||||
IsOutgoing bool
|
||||
}
|
||||
|
||||
func SomeExample() {
|
||||
fmt.Println("Hello from SomeExample")
|
||||
}
|
||||
|
||||
func (tid *tcpID) String() string {
|
||||
return fmt.Sprintf("%s->%s %s->%s", tid.srcIP, tid.dstIP, tid.srcPort, tid.dstPort)
|
||||
}
|
17
tap/extensions/http/main.go
Normal file
17
tap/extensions/http/main.go
Normal file
@ -0,0 +1,17 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/up9inc/mizu/tap/extensions/http/lib"
|
||||
)
|
||||
|
||||
type greeting string
|
||||
|
||||
func (g greeting) Greet() {
|
||||
fmt.Println("Hello HTTP")
|
||||
lib.SomeExample()
|
||||
}
|
||||
|
||||
// exported as symbol named "Greeter"
|
||||
var Greeter greeting
|
@ -15,6 +15,8 @@ import (
|
||||
"log"
|
||||
"os"
|
||||
"os/signal"
|
||||
"path"
|
||||
"path/filepath"
|
||||
"plugin"
|
||||
"runtime"
|
||||
"runtime/pprof"
|
||||
@ -128,6 +130,10 @@ type Extension struct {
|
||||
Plug *plugin.Plugin
|
||||
}
|
||||
|
||||
type Greeter interface {
|
||||
Greet()
|
||||
}
|
||||
|
||||
var extensions []Extension // global
|
||||
|
||||
type OutputChannelItem struct {
|
||||
@ -196,15 +202,16 @@ func (c *Context) GetCaptureInfo() gopacket.CaptureInfo {
|
||||
}
|
||||
|
||||
func StartPassiveTapper(opts *TapOpts) (<-chan *OutputChannelItem, <-chan *OutboundLink) {
|
||||
fmt.Printf("called StartPassiveTapper\n")
|
||||
hostMode = opts.HostMode
|
||||
|
||||
// var harWriter *HarWriter
|
||||
// if *dumpToHar {
|
||||
// harWriter = NewHarWriter(*HarOutputDir, *harEntriesPerFile)
|
||||
// }
|
||||
// outboundLinkWriter := NewOutboundLinkWriter()
|
||||
outboundLinkWriter := NewOutboundLinkWriter()
|
||||
|
||||
// go startPassiveTapper(harWriter, outboundLinkWriter)
|
||||
go startPassiveTapper(outboundLinkWriter)
|
||||
|
||||
// if harWriter != nil {
|
||||
// return harWriter.OutChan, outboundLinkWriter.OutChan
|
||||
@ -245,12 +252,20 @@ func startMemoryProfiler() {
|
||||
}
|
||||
|
||||
func loadExtensions() {
|
||||
dir, _ := filepath.Abs(filepath.Dir(os.Args[0]))
|
||||
abspath := path.Join(dir, "./extensions/http.so")
|
||||
fmt.Printf("abspath: %v\n", abspath)
|
||||
extension := &Extension{
|
||||
Name: "http",
|
||||
Path: "./extensions/http.so",
|
||||
Path: abspath,
|
||||
}
|
||||
plug, _ := plugin.Open(extension.Path)
|
||||
extension.Plug = plug
|
||||
symGreeter, _ := plug.Lookup("Greeter")
|
||||
|
||||
var greeter Greeter
|
||||
greeter, _ = symGreeter.(Greeter)
|
||||
greeter.Greet()
|
||||
}
|
||||
|
||||
func startPassiveTapper(outboundLinkWriter *OutboundLinkWriter) {
|
||||
|
Loading…
Reference in New Issue
Block a user