mirror of
https://github.com/kubeshark/kubeshark.git
synced 2025-10-22 15:58:44 +00:00
* Update passive_tapper.go and tls_utils.go * Update go.mod, go.sum, and 18 more files... * go fmt * Update http_reader.go, passive_tapper.go, and 3 more files... * Update status_controller.go and status_provider.go Co-authored-by: RamiBerm <rami.berman@up9.com>
79 lines
2.1 KiB
Go
79 lines
2.1 KiB
Go
package shared
|
|
|
|
type WebSocketMessageType string
|
|
|
|
const (
|
|
WebSocketMessageTypeEntry WebSocketMessageType = "entry"
|
|
WebSocketMessageTypeTappedEntry WebSocketMessageType = "tappedEntry"
|
|
WebSocketMessageTypeUpdateStatus WebSocketMessageType = "status"
|
|
WebSocketMessageTypeAnalyzeStatus WebSocketMessageType = "analyzeStatus"
|
|
WebsocketMessageTypeOutboundLink WebSocketMessageType = "outboundLink"
|
|
)
|
|
|
|
type WebSocketMessageMetadata struct {
|
|
MessageType WebSocketMessageType `json:"messageType,omitempty"`
|
|
}
|
|
|
|
type WebSocketAnalyzeStatusMessage struct {
|
|
*WebSocketMessageMetadata
|
|
AnalyzeStatus AnalyzeStatus `json:"analyzeStatus"`
|
|
}
|
|
|
|
type AnalyzeStatus struct {
|
|
IsAnalyzing bool `json:"isAnalyzing"`
|
|
RemoteUrl string `json:"remoteUrl"`
|
|
IsRemoteReady bool `json:"isRemoteReady"`
|
|
SentCount int `json:"sentCount"`
|
|
}
|
|
|
|
type WebSocketStatusMessage struct {
|
|
*WebSocketMessageMetadata
|
|
TappingStatus TapStatus `json:"tappingStatus"`
|
|
}
|
|
|
|
type TapStatus struct {
|
|
Pods []PodInfo `json:"pods"`
|
|
TLSLinks []TLSLinkInfo `json:"tlsLinks"`
|
|
}
|
|
|
|
type PodInfo struct {
|
|
Namespace string `json:"namespace"`
|
|
Name string `json:"name"`
|
|
}
|
|
|
|
type TLSLinkInfo struct {
|
|
SourceIP string `json:"sourceIP"`
|
|
DestinationAddress string `json:"destinationAddress"`
|
|
ResolvedDestinationName string `json:"resolvedDestinationName"`
|
|
ResolvedSourceName string `json:"resolvedSourceName"`
|
|
}
|
|
|
|
func CreateWebSocketStatusMessage(tappingStatus TapStatus) WebSocketStatusMessage {
|
|
return WebSocketStatusMessage{
|
|
WebSocketMessageMetadata: &WebSocketMessageMetadata{
|
|
MessageType: WebSocketMessageTypeUpdateStatus,
|
|
},
|
|
TappingStatus: tappingStatus,
|
|
}
|
|
}
|
|
|
|
func CreateWebSocketMessageTypeAnalyzeStatus(analyzeStatus AnalyzeStatus) WebSocketAnalyzeStatusMessage {
|
|
return WebSocketAnalyzeStatusMessage{
|
|
WebSocketMessageMetadata: &WebSocketMessageMetadata{
|
|
MessageType: WebSocketMessageTypeAnalyzeStatus,
|
|
},
|
|
AnalyzeStatus: analyzeStatus,
|
|
}
|
|
}
|
|
|
|
type TrafficFilteringOptions struct {
|
|
PlainTextMaskingRegexes []*SerializableRegexp
|
|
HideHealthChecks bool
|
|
DisableRedaction bool
|
|
}
|
|
|
|
type VersionResponse struct {
|
|
SemVer string `json:"semver"`
|
|
}
|
|
|