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
|
||||
}
|
||||
|
||||
type SuperIdentifier struct {
|
||||
type ProtoIdentifier struct {
|
||||
Protocol *Protocol
|
||||
IsClosedOthers bool
|
||||
}
|
||||
|
@ -19,7 +19,7 @@ import (
|
||||
type TcpStream struct {
|
||||
Id int64
|
||||
isClosed bool
|
||||
SuperIdentifier *SuperIdentifier
|
||||
ProtoIdentifier *ProtoIdentifier
|
||||
TcpState *reassembly.TCPSimpleFSM
|
||||
fsmerr bool
|
||||
Optchecker reassembly.TCPOptionCheck
|
||||
@ -181,24 +181,24 @@ func (t *TcpStream) Close() {
|
||||
}
|
||||
|
||||
func (t *TcpStream) CloseOtherProtocolDissectors(protocol *Protocol) {
|
||||
if t.SuperIdentifier.IsClosedOthers {
|
||||
if t.ProtoIdentifier.IsClosedOthers {
|
||||
return
|
||||
}
|
||||
|
||||
t.SuperIdentifier.Protocol = protocol
|
||||
t.ProtoIdentifier.Protocol = protocol
|
||||
|
||||
for i := range t.Clients {
|
||||
reader := &t.Clients[i]
|
||||
if reader.Extension.Protocol != t.SuperIdentifier.Protocol {
|
||||
if reader.Extension.Protocol != t.ProtoIdentifier.Protocol {
|
||||
reader.Close()
|
||||
}
|
||||
}
|
||||
for i := range t.Servers {
|
||||
reader := &t.Servers[i]
|
||||
if reader.Extension.Protocol != t.SuperIdentifier.Protocol {
|
||||
if reader.Extension.Protocol != t.ProtoIdentifier.Protocol {
|
||||
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
|
||||
|
||||
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")
|
||||
}
|
||||
|
||||
|
@ -108,7 +108,7 @@ func TestDissect(t *testing.T) {
|
||||
Request: 0,
|
||||
Response: 0,
|
||||
}
|
||||
superIdentifier := &api.SuperIdentifier{}
|
||||
protoIdentifier := &api.ProtoIdentifier{}
|
||||
|
||||
// Request
|
||||
pathClient := _path
|
||||
@ -128,7 +128,7 @@ func TestDissect(t *testing.T) {
|
||||
Progress: &api.ReadProgress{},
|
||||
Parent: &api.TcpStream{
|
||||
Origin: api.Pcap,
|
||||
SuperIdentifier: superIdentifier,
|
||||
ProtoIdentifier: protoIdentifier,
|
||||
},
|
||||
IsClient: true,
|
||||
TcpID: tcpIDClient,
|
||||
@ -158,7 +158,7 @@ func TestDissect(t *testing.T) {
|
||||
Progress: &api.ReadProgress{},
|
||||
Parent: &api.TcpStream{
|
||||
Origin: api.Pcap,
|
||||
SuperIdentifier: superIdentifier,
|
||||
ProtoIdentifier: protoIdentifier,
|
||||
},
|
||||
IsClient: false,
|
||||
TcpID: tcpIDServer,
|
||||
|
@ -117,7 +117,7 @@ func (d dissecting) Dissect(b *bufio.Reader, reader *api.TcpReader, options *sha
|
||||
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")
|
||||
}
|
||||
|
||||
@ -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
|
||||
}
|
||||
|
||||
|
@ -110,7 +110,7 @@ func TestDissect(t *testing.T) {
|
||||
Request: 0,
|
||||
Response: 0,
|
||||
}
|
||||
superIdentifier := &api.SuperIdentifier{}
|
||||
protoIdentifier := &api.ProtoIdentifier{}
|
||||
|
||||
// Request
|
||||
pathClient := _path
|
||||
@ -130,7 +130,7 @@ func TestDissect(t *testing.T) {
|
||||
Progress: &api.ReadProgress{},
|
||||
Parent: &api.TcpStream{
|
||||
Origin: api.Pcap,
|
||||
SuperIdentifier: superIdentifier,
|
||||
ProtoIdentifier: protoIdentifier,
|
||||
},
|
||||
IsClient: true,
|
||||
TcpID: tcpIDClient,
|
||||
@ -160,7 +160,7 @@ func TestDissect(t *testing.T) {
|
||||
Progress: &api.ReadProgress{},
|
||||
Parent: &api.TcpStream{
|
||||
Origin: api.Pcap,
|
||||
SuperIdentifier: superIdentifier,
|
||||
ProtoIdentifier: protoIdentifier,
|
||||
},
|
||||
IsClient: false,
|
||||
TcpID: tcpIDServer,
|
||||
|
@ -39,7 +39,7 @@ func (d dissecting) Ping() {
|
||||
func (d dissecting) Dissect(b *bufio.Reader, reader *api.TcpReader, options *shared.TrafficFilteringOptions) error {
|
||||
reqResMatcher := reader.ReqResMatcher.(*requestResponseMatcher)
|
||||
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")
|
||||
}
|
||||
|
||||
|
@ -108,7 +108,7 @@ func TestDissect(t *testing.T) {
|
||||
Request: 0,
|
||||
Response: 0,
|
||||
}
|
||||
superIdentifier := &api.SuperIdentifier{}
|
||||
protoIdentifier := &api.ProtoIdentifier{}
|
||||
|
||||
// Request
|
||||
pathClient := _path
|
||||
@ -129,7 +129,7 @@ func TestDissect(t *testing.T) {
|
||||
Progress: &api.ReadProgress{},
|
||||
Parent: &api.TcpStream{
|
||||
Origin: api.Pcap,
|
||||
SuperIdentifier: superIdentifier,
|
||||
ProtoIdentifier: protoIdentifier,
|
||||
},
|
||||
IsClient: true,
|
||||
TcpID: tcpIDClient,
|
||||
@ -159,7 +159,7 @@ func TestDissect(t *testing.T) {
|
||||
Progress: &api.ReadProgress{},
|
||||
Parent: &api.TcpStream{
|
||||
Origin: api.Pcap,
|
||||
SuperIdentifier: superIdentifier,
|
||||
ProtoIdentifier: protoIdentifier,
|
||||
},
|
||||
IsClient: false,
|
||||
TcpID: tcpIDServer,
|
||||
|
@ -109,7 +109,7 @@ func TestDissect(t *testing.T) {
|
||||
Request: 0,
|
||||
Response: 0,
|
||||
}
|
||||
superIdentifier := &api.SuperIdentifier{}
|
||||
protoIdentifier := &api.ProtoIdentifier{}
|
||||
|
||||
// Request
|
||||
pathClient := _path
|
||||
@ -129,7 +129,7 @@ func TestDissect(t *testing.T) {
|
||||
Progress: &api.ReadProgress{},
|
||||
Parent: &api.TcpStream{
|
||||
Origin: api.Pcap,
|
||||
SuperIdentifier: superIdentifier,
|
||||
ProtoIdentifier: protoIdentifier,
|
||||
},
|
||||
IsClient: true,
|
||||
TcpID: tcpIDClient,
|
||||
@ -159,7 +159,7 @@ func TestDissect(t *testing.T) {
|
||||
Progress: &api.ReadProgress{},
|
||||
Parent: &api.TcpStream{
|
||||
Origin: api.Pcap,
|
||||
SuperIdentifier: superIdentifier,
|
||||
ProtoIdentifier: protoIdentifier,
|
||||
},
|
||||
IsClient: false,
|
||||
TcpID: tcpIDServer,
|
||||
|
@ -65,7 +65,7 @@ func (factory *tcpStreamFactory) New(net, transport gopacket.Flow, tcp *layers.T
|
||||
TcpState: reassembly.NewTCPSimpleFSM(fsmOptions),
|
||||
Ident: fmt.Sprintf("%s:%s", net, transport),
|
||||
Optchecker: reassembly.NewTCPOptionCheck(),
|
||||
SuperIdentifier: &api.SuperIdentifier{},
|
||||
ProtoIdentifier: &api.ProtoIdentifier{},
|
||||
StreamsMap: factory.streamsMap,
|
||||
Origin: getPacketOrigin(ac),
|
||||
}
|
||||
|
@ -170,7 +170,7 @@ func dissect(extension *api.Extension, reader *tlsReader, isRequest bool, tcpid
|
||||
Progress: reader.progress,
|
||||
Parent: &api.TcpStream{
|
||||
Origin: api.Ebpf,
|
||||
SuperIdentifier: &api.SuperIdentifier{},
|
||||
ProtoIdentifier: &api.ProtoIdentifier{},
|
||||
},
|
||||
IsClient: isRequest,
|
||||
TcpID: tcpid,
|
||||
|
Loading…
Reference in New Issue
Block a user