diff --git a/tap/tlstapper/golang_connection.go b/tap/tlstapper/golang_connection.go index 9c4eb1282..7ac084ad7 100644 --- a/tap/tlstapper/golang_connection.go +++ b/tap/tlstapper/golang_connection.go @@ -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 } diff --git a/tap/tlstapper/tls_poller.go b/tap/tlstapper/tls_poller.go index 5e9a7abe1..0bb5eb82f 100644 --- a/tap/tlstapper/tls_poller.go +++ b/tap/tlstapper/tls_poller.go @@ -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) } } }