mirror of
https://github.com/kubeshark/kubeshark.git
synced 2025-08-17 16:08:12 +00:00
Rename SuperIdentifier
struct to ProtoIdentifier
This commit is contained in:
parent
0f2bd9fc13
commit
3c6fe8393f
@ -110,7 +110,7 @@ type SuperTimer struct {
|
|||||||
CaptureTime time.Time
|
CaptureTime time.Time
|
||||||
}
|
}
|
||||||
|
|
||||||
type SuperIdentifier struct {
|
type ProtoIdentifier struct {
|
||||||
Protocol *Protocol
|
Protocol *Protocol
|
||||||
IsClosedOthers bool
|
IsClosedOthers bool
|
||||||
}
|
}
|
||||||
|
@ -19,7 +19,7 @@ import (
|
|||||||
type TcpStream struct {
|
type TcpStream struct {
|
||||||
Id int64
|
Id int64
|
||||||
isClosed bool
|
isClosed bool
|
||||||
SuperIdentifier *SuperIdentifier
|
ProtoIdentifier *ProtoIdentifier
|
||||||
TcpState *reassembly.TCPSimpleFSM
|
TcpState *reassembly.TCPSimpleFSM
|
||||||
fsmerr bool
|
fsmerr bool
|
||||||
Optchecker reassembly.TCPOptionCheck
|
Optchecker reassembly.TCPOptionCheck
|
||||||
@ -181,24 +181,24 @@ func (t *TcpStream) Close() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (t *TcpStream) CloseOtherProtocolDissectors(protocol *Protocol) {
|
func (t *TcpStream) CloseOtherProtocolDissectors(protocol *Protocol) {
|
||||||
if t.SuperIdentifier.IsClosedOthers {
|
if t.ProtoIdentifier.IsClosedOthers {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
t.SuperIdentifier.Protocol = protocol
|
t.ProtoIdentifier.Protocol = protocol
|
||||||
|
|
||||||
for i := range t.Clients {
|
for i := range t.Clients {
|
||||||
reader := &t.Clients[i]
|
reader := &t.Clients[i]
|
||||||
if reader.Extension.Protocol != t.SuperIdentifier.Protocol {
|
if reader.Extension.Protocol != t.ProtoIdentifier.Protocol {
|
||||||
reader.Close()
|
reader.Close()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for i := range t.Servers {
|
for i := range t.Servers {
|
||||||
reader := &t.Servers[i]
|
reader := &t.Servers[i]
|
||||||
if reader.Extension.Protocol != t.SuperIdentifier.Protocol {
|
if reader.Extension.Protocol != t.ProtoIdentifier.Protocol {
|
||||||
reader.Close()
|
reader.Close()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
t.SuperIdentifier.IsClosedOthers = true
|
t.ProtoIdentifier.IsClosedOthers = true
|
||||||
}
|
}
|
||||||
|
@ -76,7 +76,7 @@ func (d dissecting) Dissect(b *bufio.Reader, reader *api.TcpReader, options *sha
|
|||||||
var lastMethodFrameMessage Message
|
var lastMethodFrameMessage Message
|
||||||
|
|
||||||
for {
|
for {
|
||||||
if reader.Parent.SuperIdentifier.Protocol != nil && reader.Parent.SuperIdentifier.Protocol != &protocol {
|
if reader.Parent.ProtoIdentifier.Protocol != nil && reader.Parent.ProtoIdentifier.Protocol != &protocol {
|
||||||
return errors.New("Identified by another protocol")
|
return errors.New("Identified by another protocol")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -108,7 +108,7 @@ func TestDissect(t *testing.T) {
|
|||||||
Request: 0,
|
Request: 0,
|
||||||
Response: 0,
|
Response: 0,
|
||||||
}
|
}
|
||||||
superIdentifier := &api.SuperIdentifier{}
|
protoIdentifier := &api.ProtoIdentifier{}
|
||||||
|
|
||||||
// Request
|
// Request
|
||||||
pathClient := _path
|
pathClient := _path
|
||||||
@ -128,7 +128,7 @@ func TestDissect(t *testing.T) {
|
|||||||
Progress: &api.ReadProgress{},
|
Progress: &api.ReadProgress{},
|
||||||
Parent: &api.TcpStream{
|
Parent: &api.TcpStream{
|
||||||
Origin: api.Pcap,
|
Origin: api.Pcap,
|
||||||
SuperIdentifier: superIdentifier,
|
ProtoIdentifier: protoIdentifier,
|
||||||
},
|
},
|
||||||
IsClient: true,
|
IsClient: true,
|
||||||
TcpID: tcpIDClient,
|
TcpID: tcpIDClient,
|
||||||
@ -158,7 +158,7 @@ func TestDissect(t *testing.T) {
|
|||||||
Progress: &api.ReadProgress{},
|
Progress: &api.ReadProgress{},
|
||||||
Parent: &api.TcpStream{
|
Parent: &api.TcpStream{
|
||||||
Origin: api.Pcap,
|
Origin: api.Pcap,
|
||||||
SuperIdentifier: superIdentifier,
|
ProtoIdentifier: protoIdentifier,
|
||||||
},
|
},
|
||||||
IsClient: false,
|
IsClient: false,
|
||||||
TcpID: tcpIDServer,
|
TcpID: tcpIDServer,
|
||||||
|
@ -117,7 +117,7 @@ func (d dissecting) Dissect(b *bufio.Reader, reader *api.TcpReader, options *sha
|
|||||||
http2Assembler = createHTTP2Assembler(b)
|
http2Assembler = createHTTP2Assembler(b)
|
||||||
}
|
}
|
||||||
|
|
||||||
if reader.Parent.SuperIdentifier.Protocol != nil && reader.Parent.SuperIdentifier.Protocol != &http11protocol {
|
if reader.Parent.ProtoIdentifier.Protocol != nil && reader.Parent.ProtoIdentifier.Protocol != &http11protocol {
|
||||||
return errors.New("Identified by another protocol")
|
return errors.New("Identified by another protocol")
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -173,7 +173,7 @@ func (d dissecting) Dissect(b *bufio.Reader, reader *api.TcpReader, options *sha
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if reader.Parent.SuperIdentifier.Protocol == nil {
|
if reader.Parent.ProtoIdentifier.Protocol == nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -110,7 +110,7 @@ func TestDissect(t *testing.T) {
|
|||||||
Request: 0,
|
Request: 0,
|
||||||
Response: 0,
|
Response: 0,
|
||||||
}
|
}
|
||||||
superIdentifier := &api.SuperIdentifier{}
|
protoIdentifier := &api.ProtoIdentifier{}
|
||||||
|
|
||||||
// Request
|
// Request
|
||||||
pathClient := _path
|
pathClient := _path
|
||||||
@ -130,7 +130,7 @@ func TestDissect(t *testing.T) {
|
|||||||
Progress: &api.ReadProgress{},
|
Progress: &api.ReadProgress{},
|
||||||
Parent: &api.TcpStream{
|
Parent: &api.TcpStream{
|
||||||
Origin: api.Pcap,
|
Origin: api.Pcap,
|
||||||
SuperIdentifier: superIdentifier,
|
ProtoIdentifier: protoIdentifier,
|
||||||
},
|
},
|
||||||
IsClient: true,
|
IsClient: true,
|
||||||
TcpID: tcpIDClient,
|
TcpID: tcpIDClient,
|
||||||
@ -160,7 +160,7 @@ func TestDissect(t *testing.T) {
|
|||||||
Progress: &api.ReadProgress{},
|
Progress: &api.ReadProgress{},
|
||||||
Parent: &api.TcpStream{
|
Parent: &api.TcpStream{
|
||||||
Origin: api.Pcap,
|
Origin: api.Pcap,
|
||||||
SuperIdentifier: superIdentifier,
|
ProtoIdentifier: protoIdentifier,
|
||||||
},
|
},
|
||||||
IsClient: false,
|
IsClient: false,
|
||||||
TcpID: tcpIDServer,
|
TcpID: tcpIDServer,
|
||||||
|
@ -39,7 +39,7 @@ func (d dissecting) Ping() {
|
|||||||
func (d dissecting) Dissect(b *bufio.Reader, reader *api.TcpReader, options *shared.TrafficFilteringOptions) error {
|
func (d dissecting) Dissect(b *bufio.Reader, reader *api.TcpReader, options *shared.TrafficFilteringOptions) error {
|
||||||
reqResMatcher := reader.ReqResMatcher.(*requestResponseMatcher)
|
reqResMatcher := reader.ReqResMatcher.(*requestResponseMatcher)
|
||||||
for {
|
for {
|
||||||
if reader.Parent.SuperIdentifier.Protocol != nil && reader.Parent.SuperIdentifier.Protocol != &_protocol {
|
if reader.Parent.ProtoIdentifier.Protocol != nil && reader.Parent.ProtoIdentifier.Protocol != &_protocol {
|
||||||
return errors.New("Identified by another protocol")
|
return errors.New("Identified by another protocol")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -108,7 +108,7 @@ func TestDissect(t *testing.T) {
|
|||||||
Request: 0,
|
Request: 0,
|
||||||
Response: 0,
|
Response: 0,
|
||||||
}
|
}
|
||||||
superIdentifier := &api.SuperIdentifier{}
|
protoIdentifier := &api.ProtoIdentifier{}
|
||||||
|
|
||||||
// Request
|
// Request
|
||||||
pathClient := _path
|
pathClient := _path
|
||||||
@ -129,7 +129,7 @@ func TestDissect(t *testing.T) {
|
|||||||
Progress: &api.ReadProgress{},
|
Progress: &api.ReadProgress{},
|
||||||
Parent: &api.TcpStream{
|
Parent: &api.TcpStream{
|
||||||
Origin: api.Pcap,
|
Origin: api.Pcap,
|
||||||
SuperIdentifier: superIdentifier,
|
ProtoIdentifier: protoIdentifier,
|
||||||
},
|
},
|
||||||
IsClient: true,
|
IsClient: true,
|
||||||
TcpID: tcpIDClient,
|
TcpID: tcpIDClient,
|
||||||
@ -159,7 +159,7 @@ func TestDissect(t *testing.T) {
|
|||||||
Progress: &api.ReadProgress{},
|
Progress: &api.ReadProgress{},
|
||||||
Parent: &api.TcpStream{
|
Parent: &api.TcpStream{
|
||||||
Origin: api.Pcap,
|
Origin: api.Pcap,
|
||||||
SuperIdentifier: superIdentifier,
|
ProtoIdentifier: protoIdentifier,
|
||||||
},
|
},
|
||||||
IsClient: false,
|
IsClient: false,
|
||||||
TcpID: tcpIDServer,
|
TcpID: tcpIDServer,
|
||||||
|
@ -109,7 +109,7 @@ func TestDissect(t *testing.T) {
|
|||||||
Request: 0,
|
Request: 0,
|
||||||
Response: 0,
|
Response: 0,
|
||||||
}
|
}
|
||||||
superIdentifier := &api.SuperIdentifier{}
|
protoIdentifier := &api.ProtoIdentifier{}
|
||||||
|
|
||||||
// Request
|
// Request
|
||||||
pathClient := _path
|
pathClient := _path
|
||||||
@ -129,7 +129,7 @@ func TestDissect(t *testing.T) {
|
|||||||
Progress: &api.ReadProgress{},
|
Progress: &api.ReadProgress{},
|
||||||
Parent: &api.TcpStream{
|
Parent: &api.TcpStream{
|
||||||
Origin: api.Pcap,
|
Origin: api.Pcap,
|
||||||
SuperIdentifier: superIdentifier,
|
ProtoIdentifier: protoIdentifier,
|
||||||
},
|
},
|
||||||
IsClient: true,
|
IsClient: true,
|
||||||
TcpID: tcpIDClient,
|
TcpID: tcpIDClient,
|
||||||
@ -159,7 +159,7 @@ func TestDissect(t *testing.T) {
|
|||||||
Progress: &api.ReadProgress{},
|
Progress: &api.ReadProgress{},
|
||||||
Parent: &api.TcpStream{
|
Parent: &api.TcpStream{
|
||||||
Origin: api.Pcap,
|
Origin: api.Pcap,
|
||||||
SuperIdentifier: superIdentifier,
|
ProtoIdentifier: protoIdentifier,
|
||||||
},
|
},
|
||||||
IsClient: false,
|
IsClient: false,
|
||||||
TcpID: tcpIDServer,
|
TcpID: tcpIDServer,
|
||||||
|
@ -65,7 +65,7 @@ func (factory *tcpStreamFactory) New(net, transport gopacket.Flow, tcp *layers.T
|
|||||||
TcpState: reassembly.NewTCPSimpleFSM(fsmOptions),
|
TcpState: reassembly.NewTCPSimpleFSM(fsmOptions),
|
||||||
Ident: fmt.Sprintf("%s:%s", net, transport),
|
Ident: fmt.Sprintf("%s:%s", net, transport),
|
||||||
Optchecker: reassembly.NewTCPOptionCheck(),
|
Optchecker: reassembly.NewTCPOptionCheck(),
|
||||||
SuperIdentifier: &api.SuperIdentifier{},
|
ProtoIdentifier: &api.ProtoIdentifier{},
|
||||||
StreamsMap: factory.streamsMap,
|
StreamsMap: factory.streamsMap,
|
||||||
Origin: getPacketOrigin(ac),
|
Origin: getPacketOrigin(ac),
|
||||||
}
|
}
|
||||||
|
@ -170,7 +170,7 @@ func dissect(extension *api.Extension, reader *tlsReader, isRequest bool, tcpid
|
|||||||
Progress: reader.progress,
|
Progress: reader.progress,
|
||||||
Parent: &api.TcpStream{
|
Parent: &api.TcpStream{
|
||||||
Origin: api.Ebpf,
|
Origin: api.Ebpf,
|
||||||
SuperIdentifier: &api.SuperIdentifier{},
|
ProtoIdentifier: &api.ProtoIdentifier{},
|
||||||
},
|
},
|
||||||
IsClient: isRequest,
|
IsClient: isRequest,
|
||||||
TcpID: tcpid,
|
TcpID: tcpid,
|
||||||
|
Loading…
Reference in New Issue
Block a user