pf.js 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. module.exports = function(hljs) {
  2. var MACRO = {
  3. className: 'variable',
  4. begin: /\$[\w\d#@][\w\d_]*/
  5. };
  6. var TABLE = {
  7. className: 'variable',
  8. begin: /<(?!\/)/, end: />/
  9. };
  10. var QUOTE_STRING = {
  11. className: 'string',
  12. begin: /"/, end: /"/
  13. };
  14. return {
  15. aliases: ['pf.conf'],
  16. lexemes: /[a-z0-9_<>-]+/,
  17. keywords: {
  18. built_in: /* block match pass are "actions" in pf.conf(5), the rest are
  19. * lexically similar top-level commands.
  20. */
  21. 'block match pass load anchor|5 antispoof|10 set table',
  22. keyword:
  23. 'in out log quick on rdomain inet inet6 proto from port os to route' +
  24. 'allow-opts divert-packet divert-reply divert-to flags group icmp-type' +
  25. 'icmp6-type label once probability recieved-on rtable prio queue' +
  26. 'tos tag tagged user keep fragment for os drop' +
  27. 'af-to|10 binat-to|10 nat-to|10 rdr-to|10 bitmask least-stats random round-robin' +
  28. 'source-hash static-port' +
  29. 'dup-to reply-to route-to' +
  30. 'parent bandwidth default min max qlimit' +
  31. 'block-policy debug fingerprints hostid limit loginterface optimization' +
  32. 'reassemble ruleset-optimization basic none profile skip state-defaults' +
  33. 'state-policy timeout' +
  34. 'const counters persist' +
  35. 'no modulate synproxy state|5 floating if-bound no-sync pflow|10 sloppy' +
  36. 'source-track global rule max-src-nodes max-src-states max-src-conn' +
  37. 'max-src-conn-rate overload flush' +
  38. 'scrub|5 max-mss min-ttl no-df|10 random-id',
  39. literal:
  40. 'all any no-route self urpf-failed egress|5 unknown'
  41. },
  42. contains: [
  43. hljs.HASH_COMMENT_MODE,
  44. hljs.NUMBER_MODE,
  45. hljs.QUOTE_STRING_MODE,
  46. MACRO,
  47. TABLE
  48. ]
  49. };
  50. };