sniffing websocket frame

This commit is contained in:
ginuerzh
2024-10-19 19:36:06 +08:00
parent a0cbee8817
commit 6b932e35bf
28 changed files with 1238 additions and 301 deletions
+34 -19
View File
@@ -38,6 +38,19 @@ type HTTPRecorderObject struct {
Response HTTPResponseRecorderObject `json:"response"`
}
type WebsocketRecorderObject struct {
From string `json:"from"`
Fin bool `json:"fin"`
Rsv1 bool `json:"rsv1"`
Rsv2 bool `json:"rsv2"`
Rsv3 bool `json:"rsv3"`
OpCode int `json:"opcode"`
Masked bool `json:"masked"`
MaskKey uint32 `json:"maskKey"`
Length int64 `json:"length"`
Payload []byte `json:"payload"`
}
type TLSRecorderObject struct {
ServerName string `json:"serverName"`
CipherSuite string `json:"cipherSuite"`
@@ -59,25 +72,27 @@ type DNSRecorderObject struct {
}
type HandlerRecorderObject struct {
Node string `json:"node,omitempty"`
Service string `json:"service"`
Network string `json:"network"`
RemoteAddr string `json:"remote"`
LocalAddr string `json:"local"`
Host string `json:"host"`
Proto string `json:"proto,omitempty"`
ClientIP string `json:"clientIP"`
ClientID string `json:"clientID,omitempty"`
HTTP *HTTPRecorderObject `json:"http,omitempty"`
TLS *TLSRecorderObject `json:"tls,omitempty"`
DNS *DNSRecorderObject `json:"dns,omitempty"`
Route string `json:"route,omitempty"`
InputBytes uint64 `json:"inputBytes"`
OutputBytes uint64 `json:"outputBytes"`
Err string `json:"err,omitempty"`
SID string `json:"sid"`
Duration time.Duration `json:"duration"`
Time time.Time `json:"time"`
Node string `json:"node,omitempty"`
Service string `json:"service"`
Network string `json:"network"`
RemoteAddr string `json:"remote"`
LocalAddr string `json:"local"`
Host string `json:"host"`
Dst string `json:"dst"`
Proto string `json:"proto,omitempty"`
ClientIP string `json:"clientIP"`
ClientID string `json:"clientID,omitempty"`
HTTP *HTTPRecorderObject `json:"http,omitempty"`
Websocket *WebsocketRecorderObject `json:"websocket,omitempty"`
TLS *TLSRecorderObject `json:"tls,omitempty"`
DNS *DNSRecorderObject `json:"dns,omitempty"`
Route string `json:"route,omitempty"`
InputBytes uint64 `json:"inputBytes"`
OutputBytes uint64 `json:"outputBytes"`
Err string `json:"err,omitempty"`
SID string `json:"sid"`
Duration time.Duration `json:"duration"`
Time time.Time `json:"time"`
}
func (p *HandlerRecorderObject) Record(ctx context.Context, r recorder.Recorder) error {