pf.js 2.0 KB

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