pf.js 2.0 KB

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