1. update the version of ja-netfilter
2. add example of global transformer Signed-off-by: pengzhile <pengzhile@gmail.com>
This commit is contained in:
parent
e393f8e141
commit
2fa0e53176
2
pom.xml
2
pom.xml
@ -68,7 +68,7 @@
|
||||
<dependency>
|
||||
<groupId>com.ja-netfilter</groupId>
|
||||
<artifactId>ja-netfilter</artifactId>
|
||||
<version>2.2.0</version>
|
||||
<version>2.2.1</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
35
src/main/java/my/sample/plugin/GlobalTransformer.java
Normal file
35
src/main/java/my/sample/plugin/GlobalTransformer.java
Normal file
@ -0,0 +1,35 @@
|
||||
package my.sample.plugin;
|
||||
|
||||
import com.janetfilter.core.commons.DebugInfo;
|
||||
import com.janetfilter.core.plugin.MyTransformer;
|
||||
|
||||
public class GlobalTransformer implements MyTransformer {
|
||||
@Override
|
||||
public String getHookClassName() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void before(String className, byte[] classBytes) throws Exception {
|
||||
DebugInfo.debug("before transform: " + className);
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte[] preTransform(String className, byte[] classBytes, int order) throws Exception {
|
||||
DebugInfo.debug("pre transform: " + className + ", order: " + order);
|
||||
|
||||
return classBytes;
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte[] postTransform(String className, byte[] classBytes, int order) throws Exception {
|
||||
DebugInfo.debug("post transform: " + className + ", order: " + order);
|
||||
|
||||
return classBytes;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void after(String className, byte[] classBytes) throws Exception {
|
||||
DebugInfo.debug("pre transform: " + className);
|
||||
}
|
||||
}
|
||||
@ -11,6 +11,7 @@ public class MyPluginEntry implements PluginEntry {
|
||||
|
||||
public MyPluginEntry() {
|
||||
transformers.add(new TestTransformer());
|
||||
transformers.add(new GlobalTransformer());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Loading…
Reference in New Issue
Block a user