Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is there any plan to support filter log or similar API? #397

Open
Haoxiqiang opened this issue Oct 18, 2024 · 1 comment
Open

Is there any plan to support filter log or similar API? #397

Haoxiqiang opened this issue Oct 18, 2024 · 1 comment

Comments

@Haoxiqiang
Copy link

When using multiple rule sets, it is difficult to know which rules are currently in effect when adjusting them. Consider supporting a filter log similar to AdGuard or uBlock Origin, as shown below:
Image

Image

I found adblock-rust contains the information.

pub struct NetworkFilter {
    ...
    pub hostname: Option<String>,
    pub(crate) tag: Option<String>,
    pub raw_line: Option<Box<String>>,
    ...
}

Can we provide a mechanism to extend BlockResult or have a completely new API implementation to support it?

@antonok-edm
Copy link
Collaborator

Yes, it is planned, but will require some significant changes. The way we have right now in BlockResult is not ideal; storing a copy of the rule string wastes a lot of runtime memory. That's why we currently don't enable it by default.

This should ultimately be implemented by storing a line number so that the original rule can be retrieved from the filter list as needed (i.e. only when a logger is opened).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants