gfwlist

Crates.iogfwlist
lib.rsgfwlist
version0.2.1
created_at2025-05-07 03:43:14.213808+00
updated_at2025-05-09 06:49:21.702338+00
descriptionA fast GFW list parser and matcher.
homepage
repositoryhttps://github.com/shigma/gfwlist
max_upload_size
id1663447
size22,743
Shigma (shigma)

documentation

https://docs.rs/gfwlist

README

gfwlist

A fast GFW list parser and matcher.

Installation

cargo add gfwlist

Usage

use gfwlist::GfwList;

let list_content = "\
    ||blocked-site.com\n\
    @@||exception.com\n\
    /regex-pattern/\n\
";
let gfw = GfwList::from(list_content).unwrap();

assert_eq!(gfw.test("http://blocked-site.com/page").unwrap(), Some("||blocked-site.com"));
assert_eq!(gfw.test("http://exception.com/page").unwrap(), None);
assert_eq!(gfw.test("http://allowed-site.com/page").unwrap(), None);
Commit count: 13

cargo fmt