add player response model
This commit is contained in:
parent
b85b9893a8
commit
030fd9934e
25 changed files with 11765 additions and 121 deletions
11
src/util.rs
11
src/util.rs
|
|
@ -1,6 +1,9 @@
|
|||
use fancy_regex::Regex;
|
||||
use rand::Rng;
|
||||
|
||||
const CONTENT_PLAYBACK_NONCE_ALPHABET: &[u8; 64] =
|
||||
b"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";
|
||||
|
||||
/// Return the given capture group that matches first in a list of regexes
|
||||
pub fn get_cg_from_regexes<'a, I>(mut regexes: I, text: &str, cg: usize) -> Option<String>
|
||||
where
|
||||
|
|
@ -26,3 +29,11 @@ pub fn random_string(charset: &[u8], length: usize) -> String {
|
|||
|
||||
result
|
||||
}
|
||||
|
||||
pub fn generate_content_playback_nonce() -> String {
|
||||
random_string(CONTENT_PLAYBACK_NONCE_ALPHABET, 16)
|
||||
}
|
||||
|
||||
pub fn generate_t_parameter() -> String {
|
||||
random_string(CONTENT_PLAYBACK_NONCE_ALPHABET, 12)
|
||||
}
|
||||
|
|
|
|||
Reference in a new issue