pf.js 2.0 KB

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