update README.md.

This commit is contained in:
carrot729 2022-06-14 11:18:31 +00:00 committed by Gitee
parent 30a07f9c60
commit 095eb5819e
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
1 changed files with 29 additions and 29 deletions

View File

@ -1,31 +1,31 @@
# ja-netfilter 2022.2.0 # ja-netfilter 2022.2.0
### A Java Instrumentation Framework ### A Java 框架
## Usage ## 使用方法
* download from the [releases page](https://gitee.com/ja-netfilter/ja-netfilter/releases) * 从[releases 页面](https://gitee.com/ja-netfilter/ja-netfilter/releases)下载
* add `-javaagent:/absolute/path/to/ja-netfilter.jar` argument (**Change to your actual path**) * 添加 `-javaagent:/aplute/path/to/ja-netfilter.jar` 参数 (**更改您的实际路径**)
* add as an argument of the `java` command. eg: `java -javaagent:/absolute/path/to/ja-netfilter.jar -jar executable_jar_file.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 the `JVM Options file`. * some apps support the `JVM Options file`, you can add as a line of the `JVM Options file`.
* **WARNING: DO NOT put some unnecessary whitespace characters!** * **警告: 不要放一些不必要的空格!**
* or execute `java -jar /path/to/ja-netfilter.jar` to use `attach mode`. * 或执行 `java -jar /path/to/ja-netfilter.jar` 以使用 `attach mode`.
* for **Java 17** you have to add at least these `JVM Options`: * 对于 **Java 17** 你得添加以下 `JVM Options`:
``` ```
--add-opens=java.base/jdk.internal.org.objectweb.asm=ALL-UNNAMED --add-opens=java.base/jdk.internal.org.objectweb.asm=ALL-UNNAMED
--add-opens=java.base/jdk.internal.org.objectweb.asm.tree=ALL-UNNAMED --add-opens=java.base/jdk.internal.org.objectweb.asm.tree=ALL-UNNAMED
``` ```
* edit your plugin config files: `${lower plugin name}.conf` file in the `config` dir where `ja-netfilter.jar` is located. * 编辑你的插件配置文件: `${lower plugin name}.conf` 所在的 `config` dir 中的 `ja-netfilter.jar` 文件。
* the `config`, `logs` and `plugins` directories can be specified through **the javaagent args**. * `config`, `logs` 和plugins` 目录可被**the javaagent args**目录指定。
* eg: `-javaagent:/path/to/ja-netfilter.jar=appName`, your config, logs and plugins directories will be `config-appname`, `logs-appname` and `plugins-appname`. * 例如: `-javaagent:/path/to/ja-netfilter.jar=appName`, 你的配置,日志和插件目录将是 `config-appname`, `logs-appname` plugins-appname`。
* if no javaagent args, they default to `config`, `logs` and `plugins`. * 如果没有 javaagent args, 他们会默认为 `config`, `logs` 和plugins`.
* this mechanism will avoid extraneous and bloated `config`, `logs` and `plugins`. * this mechanism will avoid extraneous and bloated `config`, `logs` 和`plugins`.
* run your java application and enjoy~ * 现在你的运行java应用程序吧~
## Config file format ## 配置文件格式
``` ```
[ABC] [ABC]
@ -50,31 +50,31 @@ EQUAL,somedomain
``` ```
## Debug info ## Debug信息
* the `ja-netfilter` will **NOT** output debugging information by default * the `ja-netfilter` will **NOT** output debugging information by default
* add environment variable `JANF_DEBUG=1` (log level) and start to enable it * 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 * or add system property `-Djanf.debug=1` (log level) to enable it
* log level: `NONE=0`, `DEBUG=1`, `INFO=2`, `WARN=3`, `ERROR=4` * log level: `NONE=0`, `DEBUG=1`, `INFO=2`, `WARN=3`, `ERROR=4`
## Debug output ## Debug输出
* the `ja-netfilter` will output debugging information to the `console` by default * the `ja-netfilter` will output debugging information to the `console` by default
* add environment variable `JANF_OUTPUT=value` and start to change output medium * add environment variable `JANF_OUTPUTplue` and start to change output medium
* or add system property `-Djanf.output=value` to change output medium * or add system property `-Djanf.outputplue` to change output medium
* output medium value: [`NONE=0`, `CONSOLE=1`, `FILE=2`, `CONSOLE+FILE=3`, `WITH_PID=4`] * 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` * eg: `console` + `file` + `pid file name` = 1 + 2 + 4 = 7, so the `-Djanf.output=7`
## Plugin system ## 插件系统
* for developer: * 对于开发人员:
* view the [scaffold project](https://gitee.com/ja-netfilter/ja-netfilter-sample-plugin) written for the plugin system * 查看[scaffold project](https://gitee.com/ja-netfilter/ja-netfilter-sample-plugin)
* compile your plugin and publish it * 编译插件并发布
* just use your imagination~ * 发挥想象力~
* for user: * 对于普通用户:
* download the jar file of the plugin * 下载jar文件
* put it in the subdirectory called `plugins` where the ja-netfilter.jar file is located * 把它放在ja-netfilter.jar文件所在的“ppplu
* enjoy the new capabilities brought by the plugin * enjoy the new capabilities brought by the plugin
* if the file suffix is `.disabled.jar`, the plugin will be disabled * if the file suffix is `.disabled.jar`, thplugin will be disabled