This commit is contained in:
crusader 2018-09-29 13:07:01 +09:00
parent 50c7d862c6
commit 68ad5ce901

View File

@ -108,24 +108,37 @@ Loop:
}
}
}
startTime := time.Now()
tcpPacket.TCP.DstPort = layers.TCPPort(portNumber)
if err := tcpPacket.TCP.SetNetworkLayerForChecksum(tcpPacket.IP); err != nil {
return err
}
if 80 == portNumber || 41111 == portNumber {
log.Print("1 SYN IP:", host.Address, " Port:", portNumber, " t:", time.Since(startTime))
}
if err := gopacket.SerializeLayers(buf, tcpPacket.Opts, tcpPacket.Eth, tcpPacket.IP, tcpPacket.TCP); err != nil {
return err
}
if 80 == portNumber || 41111 == portNumber {
log.Print("2 SYN IP:", host.Address, " Port:", portNumber, " t:", time.Since(startTime))
}
if err := ps.WritePacketData(buf.Bytes()); err != nil {
return err
}
if 80 == portNumber || 41111 == portNumber {
log.Print("3 SYN IP:", host.Address, " Port:", portNumber, " t:", time.Since(startTime))
}
select {
case <-time.After(time.Microsecond * 100):
case <-stopChan:
return nil
}
if 80 == portNumber || 41111 == portNumber {
log.Print("4 SYN IP:", host.Address, " Port:", portNumber, " t:", time.Since(startTime))
}
}
return nil