Skip to content

Commit bb40944

Browse files
authored
Merge pull request #3 from k8spacket/ebpf-k8spacket-version
Ebpf k8spacket version
2 parents d839cdb + be490bb commit bb40944

2 files changed

Lines changed: 37 additions & 25 deletions

File tree

go.mod

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
module github.com/k8spacket/plugin-api
1+
module github.com/k8spacket/plugin-api/v2
22

33
go 1.21
4-
5-
retract v1.0.0 // Published accidentally.

plugin_interface.go

Lines changed: 36 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,49 @@
11
package plugin_api
22

3-
import "net/http"
3+
import (
4+
"net/http"
5+
)
46

5-
type ReassembledStream struct {
6-
StreamId uint32
7-
Src string
8-
SrcPort string
9-
SrcName string
10-
SrcNamespace string
11-
Dst string
12-
DstPort string
13-
DstName string
14-
DstNamespace string
15-
Closed bool
16-
BytesSent float64
17-
BytesReceived float64
18-
Duration float64
7+
type Address struct {
8+
Addr string
9+
Port uint16
10+
Name string
11+
Namespace string
12+
}
13+
type TCPEvent struct {
14+
Client Address
15+
Server Address
16+
TxB uint64
17+
RxB uint64
18+
DeltaUs uint64
1919
}
2020

21-
type TCPPacketPayload struct {
22-
StreamId uint32
23-
Payload []byte
21+
type TLSEvent struct {
22+
Client Address
23+
Server Address
24+
TlsVersions []uint16
25+
Ciphers []uint16
26+
ServerName string
27+
UsedTlsVersion uint16
28+
UsedCipher uint16
2429
}
2530

26-
type StreamPlugin interface {
31+
type ConsumerPlugin interface {
2732
InitPlugin(manager PluginManager)
28-
DistributeReassembledStream(stream ReassembledStream)
29-
DistributeTCPPacketPayload(tcpPacket TCPPacketPayload)
33+
}
34+
35+
type TCPConsumerPlugin interface {
36+
ConsumerPlugin
37+
DistributeTCPEvent(tcpEvent TCPEvent)
38+
}
39+
40+
type TLSConsumerPlugin interface {
41+
ConsumerPlugin
42+
DistributeTLSEvent(tlsEvent TLSEvent)
3043
}
3144

3245
type PluginManager interface {
33-
RegisterPlugin(plugin StreamPlugin)
46+
RegisterTCPPlugin(plugin TCPConsumerPlugin)
47+
RegisterTLSPlugin(plugin TLSConsumerPlugin)
3448
RegisterHttpHandler(pattern string, handler func(http.ResponseWriter, *http.Request))
3549
}

0 commit comments

Comments
 (0)