mirror of
https://github.com/kubeshark/kubeshark.git
synced 2025-07-31 00:04:43 +00:00
Declare the Dissect
function in the extension API
This commit is contained in:
parent
5ce85f4162
commit
4e4644d3ce
@ -1,6 +1,9 @@
|
||||
package api
|
||||
|
||||
import "plugin"
|
||||
import (
|
||||
"bufio"
|
||||
"plugin"
|
||||
)
|
||||
|
||||
type Extension struct {
|
||||
Name string
|
||||
@ -13,4 +16,5 @@ type Extension struct {
|
||||
type Dissector interface {
|
||||
Register(*Extension)
|
||||
Ping()
|
||||
Dissect(b *bufio.Reader) interface{}
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"bufio"
|
||||
"log"
|
||||
|
||||
"github.com/up9inc/mizu/tap/api"
|
||||
@ -19,7 +19,12 @@ func (g dissecting) Register(extension *api.Extension) {
|
||||
}
|
||||
|
||||
func (g dissecting) Ping() {
|
||||
fmt.Printf("pong AMQP\n")
|
||||
log.Printf("pong AMQP\n")
|
||||
}
|
||||
|
||||
func (g dissecting) Dissect(b *bufio.Reader) interface{} {
|
||||
// TODO: Implement
|
||||
return nil
|
||||
}
|
||||
|
||||
// exported as symbol named "Greeter"
|
||||
|
@ -1,8 +1,9 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"bufio"
|
||||
"log"
|
||||
"net/http"
|
||||
|
||||
"github.com/up9inc/mizu/tap/api"
|
||||
)
|
||||
@ -19,7 +20,14 @@ func (g dissecting) Register(extension *api.Extension) {
|
||||
}
|
||||
|
||||
func (g dissecting) Ping() {
|
||||
fmt.Printf("pong HTTP\n")
|
||||
log.Printf("pong HTTP\n")
|
||||
}
|
||||
|
||||
func (g dissecting) Dissect(b *bufio.Reader) interface{} {
|
||||
log.Printf("called Dissect!")
|
||||
req, _ := http.ReadRequest(b)
|
||||
log.Printf("HTTP Request: %+v\n", req)
|
||||
return nil
|
||||
}
|
||||
|
||||
// exported as symbol named "Greeter"
|
||||
|
@ -1,7 +1,7 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"bufio"
|
||||
"log"
|
||||
|
||||
"github.com/up9inc/mizu/tap/api"
|
||||
@ -19,7 +19,12 @@ func (g dissecting) Register(extension *api.Extension) {
|
||||
}
|
||||
|
||||
func (g dissecting) Ping() {
|
||||
fmt.Printf("pong Kafka\n")
|
||||
log.Printf("pong Kafka\n")
|
||||
}
|
||||
|
||||
func (g dissecting) Dissect(b *bufio.Reader) interface{} {
|
||||
// TODO: Implement
|
||||
return nil
|
||||
}
|
||||
|
||||
// exported as symbol named "Greeter"
|
||||
|
@ -1,6 +1,7 @@
|
||||
package tap
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
"fmt"
|
||||
"io"
|
||||
"sync"
|
||||
@ -39,7 +40,9 @@ func (h *tcpStream) run(wg *sync.WaitGroup) {
|
||||
defer wg.Done()
|
||||
for _, extension := range extensions {
|
||||
if containsPort(extension.Ports, h.transport.Dst().String()) {
|
||||
b := bufio.NewReader(h)
|
||||
extension.Dissector.Ping()
|
||||
extension.Dissector.Dissect(b)
|
||||
}
|
||||
}
|
||||
// b := bufio.NewReader(h)
|
||||
|
Loading…
Reference in New Issue
Block a user