mirror of
https://github.com/kubeshark/kubeshark.git
synced 2025-08-01 16:57:28 +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
|
package api
|
||||||
|
|
||||||
import "plugin"
|
import (
|
||||||
|
"bufio"
|
||||||
|
"plugin"
|
||||||
|
)
|
||||||
|
|
||||||
type Extension struct {
|
type Extension struct {
|
||||||
Name string
|
Name string
|
||||||
@ -13,4 +16,5 @@ type Extension struct {
|
|||||||
type Dissector interface {
|
type Dissector interface {
|
||||||
Register(*Extension)
|
Register(*Extension)
|
||||||
Ping()
|
Ping()
|
||||||
|
Dissect(b *bufio.Reader) interface{}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"bufio"
|
||||||
"log"
|
"log"
|
||||||
|
|
||||||
"github.com/up9inc/mizu/tap/api"
|
"github.com/up9inc/mizu/tap/api"
|
||||||
@ -19,7 +19,12 @@ func (g dissecting) Register(extension *api.Extension) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (g dissecting) Ping() {
|
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"
|
// exported as symbol named "Greeter"
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"bufio"
|
||||||
"log"
|
"log"
|
||||||
|
"net/http"
|
||||||
|
|
||||||
"github.com/up9inc/mizu/tap/api"
|
"github.com/up9inc/mizu/tap/api"
|
||||||
)
|
)
|
||||||
@ -19,7 +20,14 @@ func (g dissecting) Register(extension *api.Extension) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (g dissecting) Ping() {
|
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"
|
// exported as symbol named "Greeter"
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"bufio"
|
||||||
"log"
|
"log"
|
||||||
|
|
||||||
"github.com/up9inc/mizu/tap/api"
|
"github.com/up9inc/mizu/tap/api"
|
||||||
@ -19,7 +19,12 @@ func (g dissecting) Register(extension *api.Extension) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (g dissecting) Ping() {
|
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"
|
// exported as symbol named "Greeter"
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package tap
|
package tap
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"bufio"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"sync"
|
"sync"
|
||||||
@ -39,7 +40,9 @@ func (h *tcpStream) run(wg *sync.WaitGroup) {
|
|||||||
defer wg.Done()
|
defer wg.Done()
|
||||||
for _, extension := range extensions {
|
for _, extension := range extensions {
|
||||||
if containsPort(extension.Ports, h.transport.Dst().String()) {
|
if containsPort(extension.Ports, h.transport.Dst().String()) {
|
||||||
|
b := bufio.NewReader(h)
|
||||||
extension.Dissector.Ping()
|
extension.Dissector.Ping()
|
||||||
|
extension.Dissector.Dissect(b)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// b := bufio.NewReader(h)
|
// b := bufio.NewReader(h)
|
||||||
|
Loading…
Reference in New Issue
Block a user