mirror of
https://github.com/kubeshark/kubeshark.git
synced 2025-06-25 15:54:43 +00:00
Don't export any fields of golangConnection
This commit is contained in:
parent
f26511df14
commit
97ce9d71c1
@ -3,14 +3,12 @@ package tlstapper
|
|||||||
import "github.com/up9inc/mizu/tap/api"
|
import "github.com/up9inc/mizu/tap/api"
|
||||||
|
|
||||||
type golangConnection struct {
|
type golangConnection struct {
|
||||||
Pid uint32
|
pid uint32
|
||||||
ConnAddr uint32
|
connAddr uint32
|
||||||
AddressPair addressPair
|
addressPair addressPair
|
||||||
Requests [][]byte
|
stream *tlsStream
|
||||||
Responses [][]byte
|
clientReader *golangReader
|
||||||
Stream *tlsStream
|
serverReader *golangReader
|
||||||
ClientReader *golangReader
|
|
||||||
ServerReader *golangReader
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewGolangConnection(pid uint32, connAddr uint32, extension *api.Extension, emitter api.Emitter) *golangConnection {
|
func NewGolangConnection(pid uint32, connAddr uint32, extension *api.Extension, emitter api.Emitter) *golangConnection {
|
||||||
@ -21,11 +19,11 @@ func NewGolangConnection(pid uint32, connAddr uint32, extension *api.Extension,
|
|||||||
serverReader := NewGolangReader(extension, false, emitter, counterPair, stream, reqResMatcher)
|
serverReader := NewGolangReader(extension, false, emitter, counterPair, stream, reqResMatcher)
|
||||||
stream.reader = clientReader
|
stream.reader = clientReader
|
||||||
return &golangConnection{
|
return &golangConnection{
|
||||||
Pid: pid,
|
pid: pid,
|
||||||
ConnAddr: connAddr,
|
connAddr: connAddr,
|
||||||
Stream: stream,
|
stream: stream,
|
||||||
ClientReader: clientReader,
|
clientReader: clientReader,
|
||||||
ServerReader: serverReader,
|
serverReader: serverReader,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -34,6 +32,6 @@ func (c *golangConnection) setAddressBySockfd(procfs string, pid uint32, fd uint
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
c.AddressPair = addrPair
|
c.addressPair = addrPair
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
@ -156,7 +156,7 @@ func (p *tlsPoller) pollGolangReadWrite(rd *ringbuf.Reader, emitter api.Emitter,
|
|||||||
|
|
||||||
connection = NewGolangConnection(b.Pid, b.ConnAddr, p.extension, tlsEmitter)
|
connection = NewGolangConnection(b.Pid, b.ConnAddr, p.extension, tlsEmitter)
|
||||||
p.golangReadWriteMap.Set(identifier, connection)
|
p.golangReadWriteMap.Set(identifier, connection)
|
||||||
streamsMap.Store(streamsMap.NextId(), connection.Stream)
|
streamsMap.Store(streamsMap.NextId(), connection.stream)
|
||||||
} else {
|
} else {
|
||||||
connection = _connection.(*golangConnection)
|
connection = _connection.(*golangConnection)
|
||||||
}
|
}
|
||||||
@ -168,25 +168,25 @@ func (p *tlsPoller) pollGolangReadWrite(rd *ringbuf.Reader, emitter api.Emitter,
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
tcpid := p.buildTcpId(&connection.AddressPair)
|
tcpid := p.buildTcpId(&connection.addressPair)
|
||||||
connection.ClientReader.tcpID = &tcpid
|
connection.clientReader.tcpID = &tcpid
|
||||||
connection.ServerReader.tcpID = &api.TcpID{
|
connection.serverReader.tcpID = &api.TcpID{
|
||||||
SrcIP: connection.ClientReader.tcpID.DstIP,
|
SrcIP: tcpid.DstIP,
|
||||||
DstIP: connection.ClientReader.tcpID.SrcIP,
|
DstIP: tcpid.SrcIP,
|
||||||
SrcPort: connection.ClientReader.tcpID.DstPort,
|
SrcPort: tcpid.DstPort,
|
||||||
DstPort: connection.ClientReader.tcpID.SrcPort,
|
DstPort: tcpid.SrcPort,
|
||||||
}
|
}
|
||||||
|
|
||||||
go dissect(p.extension, connection.ClientReader, options)
|
go dissect(p.extension, connection.clientReader, options)
|
||||||
go dissect(p.extension, connection.ServerReader, options)
|
go dissect(p.extension, connection.serverReader, options)
|
||||||
|
|
||||||
request := make([]byte, len(b.Data[:b.Len]))
|
request := make([]byte, len(b.Data[:b.Len]))
|
||||||
copy(request, b.Data[:b.Len])
|
copy(request, b.Data[:b.Len])
|
||||||
connection.ClientReader.send(request)
|
connection.clientReader.send(request)
|
||||||
} else {
|
} else {
|
||||||
response := make([]byte, len(b.Data[:b.Len]))
|
response := make([]byte, len(b.Data[:b.Len]))
|
||||||
copy(response, b.Data[:b.Len])
|
copy(response, b.Data[:b.Len])
|
||||||
connection.ServerReader.send(response)
|
connection.serverReader.send(response)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user