actix-ip-filter

Actix Middleware for IP filter. Support glob pattern.

Documentation

Usage

```rust use actixweb::{App, HttpServer, HttpRequest, web, middleware}; use actixip_filter::IPFilter;

async fn index(req: HttpRequest) -> &'static str { "Hello world" }

[actix_web::main]

async fn main() -> std::io::Result<()> { HttpServer::new(|| App::new() // enable logger .wrap(middleware::Logger::default()) // setup ip filters .wrap( IPFilter::new() .allow(vec!["172.??.6*.12"]) .block(vec!["192.168.1.222"]) ) // register simple route, handle all methods .service(web::resource("/").to(index)) ) .bind("0.0.0.0:8080")?; Ok(()) } ```