mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 22:58:20 +00:00

This is based on commit 2731def9159247e6da8a3191783c89683363689c from the zeek-docs repo.
13 lines
406 B
JavaScript
13 lines
406 B
JavaScript
// zeek-as.js
|
|
zeek.on('zeek_init', () => {
|
|
try {
|
|
// This throws because type_name takes an any parameter
|
|
zeek.invoke('type_name', ['192.168.0.0/16']);
|
|
} catch (e) {
|
|
console.error(`error: ${e}`);
|
|
}
|
|
|
|
// Explicit conversion of string to addr type.
|
|
let type_string = zeek.invoke('type_name', [zeek.as('subnet', '192.168.0.0/16')]);
|
|
console.log(`good: type_name is ${type_string}`);
|
|
});
|