Crates.io | embargoed |
lib.rs | embargoed |
version | 0.1.1 |
source | src |
created_at | 2022-03-03 00:26:33.882428 |
updated_at | 2022-03-13 01:27:31.830438 |
description | Rust library to intercept all requests from Russian IP addresses to any Rocket application and respond with a pro-Ukraine message instead |
homepage | |
repository | https://github.com/lily-mosquitoes/embargoed-rust |
max_upload_size | |
id | 542610 |
size | 9,371,520 |
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
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!
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!