#ip-address #applications #message #requests #addresses #rocket #russian

embargoed

Rust library to intercept all requests from Russian IP addresses to any Rocket application and respond with a pro-Ukraine message instead

2 releases

0.1.1 Mar 13, 2022
0.1.0 Mar 3, 2022

#13 in #russian

MIT AND Apache-2.0

3.5MB
61 lines

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!

Dependencies

~15–50MB
~801K SLoC