2022-01-21 18:10:26 +08:00
# ja-netfilter v2.2.1
2021-11-29 13:14:51 +08:00
2021-12-06 11:00:51 +08:00
### A javaagent framework
2021-11-29 16:59:07 +08:00
## Usage
2021-12-03 18:04:26 +08:00
* download from the [releases page ](https://github.com/ja-netfilter/ja-netfilter/releases )
2021-11-29 16:59:07 +08:00
* add `-javaagent:/absolute/path/to/ja-netfilter.jar` argument (**Change to your actual path**)
2021-11-30 17:06:48 +08:00
* add as an argument of the `java` command. eg: `java -javaagent:/absolute/path/to/ja-netfilter.jar -jar executable_jar_file.jar`
2021-11-29 16:59:07 +08:00
* 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!**
2022-01-20 14:55:03 +08:00
* or execute `java -jar /path/to/ja-netfilter.jar` to use `attach mode` .
2021-11-29 16:59:07 +08:00
2022-01-14 19:53:31 +08:00
* edit your plugin config files: `${lower plugin name}.conf` file in the `config` dir where `ja-netfilter.jar` is located.
2022-01-20 14:55:03 +08:00
* the `config` , `logs` and `plugins` directories can be specified through **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` .
* if no javaagent args, they default to `config` , `logs` and `plugins` .
* this mechanism will avoid extraneous and bloated `config` , `logs` and `plugins` .
2021-11-29 16:59:07 +08:00
* run your java application and enjoy~
## Config file format
```
2021-11-30 17:06:48 +08:00
[ABC]
2021-12-27 14:16:35 +08:00
# for the specified section name
2021-11-30 17:06:48 +08:00
2021-12-27 14:16:35 +08:00
# for example
2021-11-29 16:59:07 +08:00
[URL]
EQUAL,https://someurl
[DNS]
EQUAL,somedomain
2021-12-03 18:04:26 +08:00
# 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
2021-11-29 16:59:07 +08:00
```
2021-12-27 14:16:35 +08:00
2021-11-29 16:59:07 +08:00
## Debug info
* the `ja-netfilter` will **NOT** output debugging information by default
2022-01-20 14:55:03 +08:00
* 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
2022-01-21 18:10:26 +08:00
* log level: `NONE=0` , `DEBUG=1` , `INFO=2` , `WARN=3` , `ERROR=4`
2021-11-30 17:06:48 +08:00
## Plugin system
* for developer:
2021-12-03 18:04:26 +08:00
* view the [scaffold project ](https://github.com/ja-netfilter/ja-netfilter-sample-plugin ) written for the plugin system
2021-11-30 17:06:48 +08:00
* compile your plugin and publish it
* just use your imagination~
* for user:
* download the jar file of the plugin
* put it in the subdirectory called `plugins` where the ja-netfilter.jar file is located
* enjoy the new capabilities brought by the plugin
2022-01-14 10:40:36 +08:00