Skip to content

lily-mosquitoes/embargoed-rust

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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!

About

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

Resources

License

Stars

Watchers

Forks