Improve entity metadata initialization
This commit is contained in:
@@ -438,12 +438,12 @@ func (conn *Connection) GatherConnectionInfo(pkt packet.Packet) (err error) {
|
||||
// Create remote entity.
|
||||
if conn.Entity == nil {
|
||||
// Remote
|
||||
conn.Entity = &intel.Entity{
|
||||
conn.Entity = (&intel.Entity{
|
||||
IP: pkt.Info().RemoteIP(),
|
||||
Protocol: uint8(pkt.Info().Protocol),
|
||||
Port: pkt.Info().RemotePort(),
|
||||
}
|
||||
conn.Entity.SetIP(pkt.Info().RemoteIP())
|
||||
conn.Entity.SetDstPort(pkt.Info().DstPort)
|
||||
}).Init(pkt.Info().DstPort)
|
||||
|
||||
// Local
|
||||
conn.SetLocalIP(pkt.Info().LocalIP())
|
||||
conn.LocalPort = pkt.Info().LocalPort()
|
||||
|
||||
@@ -27,11 +27,11 @@ func NewDefaultConnection(localIP net.IP, localPort uint16, remoteIP net.IP, rem
|
||||
LocalIPScope: netutils.Global,
|
||||
LocalPort: localPort,
|
||||
PID: process.UnidentifiedProcessID,
|
||||
Entity: &intel.Entity{
|
||||
Protocol: uint8(protocol),
|
||||
Entity: (&intel.Entity{
|
||||
IP: remoteIP,
|
||||
Protocol: uint8(protocol),
|
||||
Port: remotePort,
|
||||
},
|
||||
}).Init(0),
|
||||
Resolver: nil,
|
||||
Started: time.Now().Unix(),
|
||||
VerdictPermanent: false,
|
||||
|
||||
Reference in New Issue
Block a user