Skip to content

Commit

Permalink
avoid overflow of day depending of the month
Browse files Browse the repository at this point in the history
  • Loading branch information
erebe committed Aug 27, 2024
1 parent fc729a0 commit 8dcaf17
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "wstunnel"
version = "10.0.2"
version = "10.0.1"
edition = "2021"
repository = "https://github.com/erebe/wstunnel.git"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
Expand Down
4 changes: 2 additions & 2 deletions src/embedded_certificate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ pub static TLS_CERTIFICATE: LazyLock<(Vec<CertificateDer<'static>>, PrivateKeyDe
let el = now.elapsed();
let year = 2024 - (el.as_nanos() % 2) as i32;
let month = 1 + (el.as_nanos() % 12) as u8;
let day = 1 + (el.as_nanos() % 31) as u8;
let day = 1 + (el.as_nanos() % 28) as u8;
cert.not_before = date_time_ymd(year, month, day);

let el = now.elapsed();
let year = 2024 + (el.as_nanos() % 50) as i32;
let month = 1 + (el.as_nanos() % 12) as u8;
let day = 1 + (el.as_nanos() % 31) as u8;
let day = 1 + (el.as_nanos() % 28) as u8;
cert.not_after = date_time_ymd(year, month, day);

let cert = cert.self_signed(&key_pair).unwrap().der().clone();
Expand Down

0 comments on commit 8dcaf17

Please sign in to comment.