mirror of
https://github.com/kubeshark/kubeshark.git
synced 2025-06-24 23:34:45 +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"
|
||||
|
||||
type golangConnection struct {
|
||||
Pid uint32
|
||||
ConnAddr uint32
|
||||
AddressPair addressPair
|
||||
Requests [][]byte
|
||||
Responses [][]byte
|
||||
Stream *tlsStream
|
||||
ClientReader *golangReader
|
||||
ServerReader *golangReader
|
||||
pid uint32
|
||||
connAddr uint32
|
||||
addressPair addressPair
|
||||
stream *tlsStream
|
||||
clientReader *golangReader
|
||||
serverReader *golangReader
|
||||
}
|
||||
|
||||
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)
|
||||
stream.reader = clientReader
|
||||
return &golangConnection{
|
||||
Pid: pid,
|
||||
ConnAddr: connAddr,
|
||||
Stream: stream,
|
||||
ClientReader: clientReader,
|
||||
ServerReader: serverReader,
|
||||
pid: pid,
|
||||
connAddr: connAddr,
|
||||
stream: stream,
|
||||
clientReader: clientReader,
|
||||
serverReader: serverReader,
|
||||
}
|
||||
}
|
||||
|
||||
@ -34,6 +32,6 @@ func (c *golangConnection) setAddressBySockfd(procfs string, pid uint32, fd uint
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
c.AddressPair = addrPair
|
||||
c.addressPair = addrPair
|
||||
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)
|
||||
p.golangReadWriteMap.Set(identifier, connection)
|
||||
streamsMap.Store(streamsMap.NextId(), connection.Stream)
|
||||
streamsMap.Store(streamsMap.NextId(), connection.stream)
|
||||
} else {
|
||||
connection = _connection.(*golangConnection)
|
||||
}
|
||||
@ -168,25 +168,25 @@ func (p *tlsPoller) pollGolangReadWrite(rd *ringbuf.Reader, emitter api.Emitter,
|
||||
continue
|
||||
}
|
||||
|
||||
tcpid := p.buildTcpId(&connection.AddressPair)
|
||||
connection.ClientReader.tcpID = &tcpid
|
||||
connection.ServerReader.tcpID = &api.TcpID{
|
||||
SrcIP: connection.ClientReader.tcpID.DstIP,
|
||||
DstIP: connection.ClientReader.tcpID.SrcIP,
|
||||
SrcPort: connection.ClientReader.tcpID.DstPort,
|
||||
DstPort: connection.ClientReader.tcpID.SrcPort,
|
||||
tcpid := p.buildTcpId(&connection.addressPair)
|
||||
connection.clientReader.tcpID = &tcpid
|
||||
connection.serverReader.tcpID = &api.TcpID{
|
||||
SrcIP: tcpid.DstIP,
|
||||
DstIP: tcpid.SrcIP,
|
||||
SrcPort: tcpid.DstPort,
|
||||
DstPort: tcpid.SrcPort,
|
||||
}
|
||||
|
||||
go dissect(p.extension, connection.ClientReader, options)
|
||||
go dissect(p.extension, connection.ServerReader, options)
|
||||
go dissect(p.extension, connection.clientReader, options)
|
||||
go dissect(p.extension, connection.serverReader, options)
|
||||
|
||||
request := make([]byte, len(b.Data[:b.Len]))
|
||||
copy(request, b.Data[:b.Len])
|
||||
connection.ClientReader.send(request)
|
||||
connection.clientReader.send(request)
|
||||
} else {
|
||||
response := make([]byte, len(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