feat: 防火墙 hook 注册,新增 registerHookToFirst、registerHookToSecond 方法,以便更灵活的控制 hook 顺序

This commit is contained in:
click33 2025-04-08 02:41:40 +08:00
parent 8c5ea5112d
commit 14e645a8ac

View File

@ -63,6 +63,25 @@ public final class SaFirewallStrategy {
checkHooks.add(checkHook);
}
/**
* 注册一个防火墙校验 hook 到第一位
* <b>请注意将 hook 注册到第一位将会优先于白名单的判断如果您依然希望白名单 hook 保持最高优先级请调用 registerHookToSecond </b>
* @param checkHook /
*/
public void registerHookToFirst(SaFirewallCheckHook checkHook) {
SaManager.getLog().info("防火墙校验 hook 注册成功: " + checkHook.getClass());
checkHooks.add(0, checkHook);
}
/**
* 注册一个防火墙校验 hook 到第二位
* @param checkHook /
*/
public void registerHookToSecond(SaFirewallCheckHook checkHook) {
SaManager.getLog().info("防火墙校验 hook 注册成功: " + checkHook.getClass());
checkHooks.add(1, checkHook);
}
/**
* 移除指定类型的防火墙校验 hook
* @param hookClass /