/resty-hyperscan-ffi

LuaFFI bindings for Intel Hyperscan, primarily intended for use with OpenResty.

Primary LanguageC++MIT LicenseMIT

resty-hyperscan-ffi

intel hyperscan luaffi bind

QuickStart

apt-get install libhyperscan-dev

make tool

g++ -O3 -o hs_scan hs_scan.cpp $(pkg-config --cflags --libs libhs)

./hs_scan -h

txt db example

0:/st[A-Z]r/HV

1:/str2/HV

make lib

g++ -shared -fPIC -O3 -o libhscan.so hs_scan.cpp $(pkg-config --cflags --libs libhs) -fopenmp

cp libhscan.so to openresty path -- "/opt/openresty/nginx/lib/libhscan.so"

cmake

mkdir build

cd build

cmake -DCMAKE_BUILD_TYPE=Release ..

make

run

local modhs = require "hs_scan"

local m = modhs.match("updatexml user_tables", "/opt/sql_hs.bin")

ngx.log(ngx.DEBUG, "count ", m.count)

ngx.log(ngx.DEBUG, "id 1 ", m.groups[0].id)

ngx.log(ngx.DEBUG, "id 2 ", m.groups[1].id)