extend("flow")
extend("net")
extend("json")
extend("sys")
run = (int#delay, int#timeout_ms) => {
start = sys:timestamp_ms()
flow:compose(
flow:drain_async,
flow:stop_when(_ => sys:timestamp_ms() >= start + timeout_ms),
flow:chain(row => slog(json:encode(row))),
flow:throttle(delay)
)
}
run(100, 5000)(
net:lldp([
ifaces:["eth0","eth1"],
mode:"listen",
protocols:["LLDP","CDP"],
ttl:120
])
)