mirror of
https://gitee.com/ja-netfilter/ja-netfilter
synced 2026-06-21 00:47:00 +08:00
3 KiB
3 KiB
ja-netfilter 2022.2.0
A Java 框架
使用方法
-
从releases 页面下载
-
添加
-javaagent:/aplute/path/to/ja-netfilter.jar参数 (更改您的实际路径)- 添加为
java命令的参数。例如:java -javaagent:/aplute/path/to/ja-netfilter.jar -jar executable_jar_file.jar - some apps support the
JVM Options file, you can add as a line of theJVM Options file. - 警告: 不要放一些不必要的空格!
- 添加为
-
或执行
java -jar /path/to/ja-netfilter.jar以使用attach mode. -
对于 Java 17 你得添加以下
JVM Options:--add-opens=java.base/jdk.internal.org.objectweb.asm=ALL-UNNAMED --add-opens=java.base/jdk.internal.org.objectweb.asm.tree=ALL-UNNAMED -
编辑你的插件配置文件:
${lower plugin name}.conf所在的configdir 中的ja-netfilter.jar文件。 -
config,logs和plugins` 目录可被the javaagent args目录指定。- 例如:
-javaagent:/path/to/ja-netfilter.jar=appName, 你的配置,日志和插件目录将是config-appname,logs-appnameplugins-appname`。 - 如果没有 javaagent args, 他们会默认为
config,logs和plugins`. - this mechanism will avoid extraneous and bloated
config,logs和plugins.
- 例如:
-
现在你的运行java应用程序吧~
配置文件格式
[ABC]
# for the specified section name
# for example
[URL]
EQUAL,https://someurl
[DNS]
EQUAL,somedomain
# EQUAL Use `equals` to compare
# EQUAL_IC Use `equals` to compare, ignore case
# KEYWORD Use `contains` to compare
# KEYWORD_IC Use `contains` to compare, ignore case
# PREFIX Use `startsWith` to compare
# PREFIX_IC Use `startsWith` to compare, ignore case
# SUFFIX Use `endsWith` to compare
# SUFFIX_IC Use `endsWith` to compare, ignore case
# REGEXP Use regular expressions to match
Debug信息
- the
ja-netfilterwill NOT output debugging information by default - add environment variable
JANF_DEBUG=1(log level) and start to enable it - or add system property
-Djanf.debug=1(log level) to enable it - log level:
NONE=0,DEBUG=1,INFO=2,WARN=3,ERROR=4
Debug输出
- the
ja-netfilterwill output debugging information to theconsoleby default - add environment variable
JANF_OUTPUTplueand start to change output medium - or add system property
-Djanf.outputplueto change output medium - output mediumplue: [
NONE=0,CONSOLE=1,FILE=2,CONSOLE+FILE=3,WITH_PID=4] - eg:
console+file+pid file name= 1 + 2 + 4 = 7, so the-Djanf.output=7
插件系统
-
对于开发人员:
- 查看scaffold project
- 编译插件并发布
- 发挥想象力~
-
对于普通用户:
- 下载jar文件
- 把它放在ja-netfilter.jar文件所在的“p pplu
- enjoy the new capabilities brought by the plugin
- if the file suffix is
.disabled.jar, thplugin will be disabled