embargoed

Crates.ioembargoed
lib.rsembargoed
version0.1.1
sourcesrc
created_at2022-03-03 00:26:33.882428
updated_at2022-03-13 01:27:31.830438
descriptionRust library to intercept all requests from Russian IP addresses to any Rocket application and respond with a pro-Ukraine message instead
homepage
repositoryhttps://github.com/lily-mosquitoes/embargoed-rust
max_upload_size
id542610
size9,371,520
LĂ­lian (lily-mosquitoes)

documentation

README

Embargoed-Rust

embargoed is a Rust library for Rocket, which implements a fairing that can be used to block all requests from Russian IP addresses and display a pro-Ukraine message instead.

This is a port of the Embargoed Gem (for Ruby/Rails) by rameerez.

check out their official list of ports for other frameworks.

This is the message which will replace all pages of your application:

Embargoed message displayed to Russian visitors

How to use

embargoed is published in crates.io, so simply add it to your dependencies on Cargo.toml:

// --snip--

[dependencies]
embargoed = "0.1.0"

Then in your rocket::build() attach embargoed::fairing(), as in this example:

// --snip--

#[launch]
fn rocket() -> _ {
    rocket::build()
        .attach(embargoed::fairing())
        .mount("/", routes![my_route])
}

You're done! Now all requests coming from Russian IP addresses will receive a response containing only the pro-Ukraine message depicted above!

Collaborate

Please check out the original project by rameerez for porting this to other languages/frameworks.

Feel free to contact me or open a PR for contributing to this repository!

Commit count: 13

cargo fmt