promaton / cloudfront-sign-rs Goto Github PK
View Code? Open in Web Editor NEWUtility module for AWS CloudFront in Rust allowing you to create signed urls and cookies
Home Page: https://crates.io/crates/cloudfront_sign
License: MIT License
Utility module for AWS CloudFront in Rust allowing you to create signed urls and cookies
Home Page: https://crates.io/crates/cloudfront_sign
License: MIT License
How would you generate a signed cookie with access to anything under a specific sub folder?
ie
- folder 1 (no access)
- folder 2 (access)
- file 1 (access)
- file 2 (access)
Currently Policy parameter is always generated even when it is redundant (no user ip or other options passed).
Botocore library uses either Expires or Policy parameter depending on input options: https://github.com/boto/botocore/blob/2cf64649cc020c2edcf28e22e6384750b5d8edb0/botocore/signers.py#L399-L402
This can be a big optimization for simple use cases and current behavior might not even be correct if both Expires
and Policy
are present with date_greater_than inside policy
I have been testing and benchmarking it. Compared with rusoto presigned urls take to 150 times more to complete around 150 presigned urls.
Async vs Sync
but using multithreading aproach with tokio::spawn and join_all the diference is reduced to 10 times slower.
let mut handles = Vec::new();
for i in 1..10 {
let mut private_key = fs::read_to_string("files/pk2.pem").unwrap();
handles.push(tokio::spawn(async {
let mut options = SignedOptions {
key_pair_id: String::from("KEYPARD"),
private_key: private_key,
..Default::default()
};
get_signed_url("https://domainHere/asdasd-2020-01-30-59245video/mp4", &options)
}));
}
futures::future::join_all(handles).await;
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.