chifflier / nfqueue-go

Go bindings for NFQueue
GNU General Public License v2.0
51 stars 21 forks source link

Add nfq_get_packet_hw please #7

Closed sir-go closed 7 years ago

sir-go commented 7 years ago

I maked these...

// Returns the packet HW address
func (p *Payload) GetSrcHwAddr() []byte {
    hwInfo := C.nfq_get_packet_hw(p.nfad)
    addrl := int(C.ntohs(C.uint16_t(hwInfo.hw_addrlen)))
    res := make([]byte, addrl)
    for i := 0; i < addrl; i++  {
        res[i] = byte(hwInfo.hw_addr[i])
    }
    return res
}