-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplugin_interface.go
49 lines (42 loc) · 907 Bytes
/
plugin_interface.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
package plugin_api
import (
"net/http"
)
type Address struct {
Addr string
Port uint16
Name string
Namespace string
}
type TCPEvent struct {
Client Address
Server Address
TxB uint64
RxB uint64
DeltaUs uint64
}
type TLSEvent struct {
Client Address
Server Address
TlsVersions []uint16
Ciphers []uint16
ServerName string
UsedTlsVersion uint16
UsedCipher uint16
}
type ConsumerPlugin interface {
InitPlugin(manager PluginManager)
}
type TCPConsumerPlugin interface {
ConsumerPlugin
DistributeTCPEvent(tcpEvent TCPEvent)
}
type TLSConsumerPlugin interface {
ConsumerPlugin
DistributeTLSEvent(tlsEvent TLSEvent)
}
type PluginManager interface {
RegisterTCPPlugin(plugin TCPConsumerPlugin)
RegisterTLSPlugin(plugin TLSConsumerPlugin)
RegisterHttpHandler(pattern string, handler func(http.ResponseWriter, *http.Request))
}