oxedyne/fe2o3/fe2o3_steel/src/srv/constant.rs
3.6 KiB, 5 runs
created by r1870400018:973, which is this file's identity for as long as the history lasts, whatever it is later renamed to
download · who wrote it · its history
| 1 | use oxedyne_fe2o3_o3db_sync::{ |
| 2 | comm::response::Wait, |
| 3 | }; |
| 4 | |
| 5 | use std::{ |
| 6 | time::Duration, |
| 7 | }; |
| 8 | |
| 9 | // Database. |
| 10 | pub const DB_DIR: &'static str = "o3db"; |
| 11 | pub const GET_DATA_WAIT: Wait = Wait::new_default(); |
| 12 | |
| 13 | // Routes. |
| 14 | pub const DEFAULT_INDEX_FILE: &'static str = "index.html"; |
| 15 | |
| 16 | pub const HTTP_DEFAULT_HEADER_CHUNK_SIZE: usize = 1_500; |
| 17 | pub const HTTP_DEFAULT_BODY_CHUNK_SIZE: usize = 5_000; |
| 18 | |
| 19 | pub const STACK_SIZE: usize = 2 * 1024 * 1024; |
| 20 | |
| 21 | pub const SERVER_INT_CHANNEL_CHECK_INTERVAL: Duration = Duration::from_nanos(1_000); |
| 22 | pub const SERVER_EXT_SOCKET_CHECK_INTERVAL: Duration = Duration::from_secs(1); |
| 23 | |
| 24 | // Retain enough passhashes to be satisfied that the user is not reusing recent passphrases. |
| 25 | pub const SERVER_RETAIN_PREV_PASSHASHES: usize = 10; |
| 26 | // Retain archives of recent sessions. |
| 27 | pub const SERVER_RETAIN_PREV_SESSION_ARCHIVES: usize = 10; |
| 28 | // WHen adding a new user, a new user id (UID) is randomly generated, which could collide with an |
| 29 | // existing UID, particularly for smaller UID lengths. This value limits the number of |
| 30 | // regenerations. |
| 31 | pub const SERVER_MAX_UID_COLLISION_ATTEMPTS: usize = 10; |
| 32 | // Generic message for unsuccessful login. |
| 33 | pub const SERVER_BAD_LOGIN_MSG: &'static str = "Login unsuccessful."; |
| 34 | |
| 35 | // WebSocket. |
| 36 | pub const WEBSOCKET_CHUNK_SIZE: usize = 10;//4_096; |
| 37 | pub const WEBSOCKET_CHUNKING_THRESHOLD: usize = 20;//16_384; |
| 38 | |
| 39 | // rcgen TLS encryption schemes. |
| 40 | pub const PKCS_RSA_SHA256: &[u64] = &[1, 2, 840, 113549, 1, 1, 11]; |
| 41 | pub const PKCS_RSA_SHA384: &[u64] = &[1, 2, 840, 113549, 1, 1, 12]; |
| 42 | pub const PKCS_RSA_SHA512: &[u64] = &[1, 2, 840, 113549, 1, 1, 13]; |
| 43 | pub const PKCS_RSA_PSS_SHA256: &[u64] = &[1, 2, 840, 113549, 1, 1, 10]; |
| 44 | pub const PKCS_ECDSA_P256_SHA256: &[u64] = &[1, 2, 840, 10045, 4, 3, 2]; |
| 45 | pub const PKCS_ECDSA_P384_SHA384: &[u64] = &[1, 2, 840, 10045, 4, 3, 3]; |
| 46 | pub const PKCS_ED25519: &[u64] = &[1, 3, 101, 112]; |
| 47 | |
| 48 | pub const UGRD_SHARDMAP_INIT_SHARDS: usize = 10; |
| 49 | pub const AGRD_SHARDMAP_INIT_SHARDS: usize = 10; |
| 50 | pub const GUARD_SHARDMAP_SALT_LEN: usize = 8; |
| 51 | pub const SALT8: [u8; 8] = [ |
| 52 | 0x13, 0x8b, 0x4f, 0xe3, 0xd3, 0x75, 0x67, 0x86, |
| 53 | ]; |
| 54 | |
| 55 | // TLS certificate locations. |
| 56 | pub const TLS_DIR_DEV: &'static str = "dev"; |
| 57 | pub const TLS_DIR_PROD: &'static str = "prod"; |
| 58 | |
| 59 | // Credits: |
| 60 | // Image: https://ascii-generator.site/ |
| 61 | // Text: https://www.asciiart.eu/text-to-ascii-art Nancyj Improved with touch ups. |
| 62 | pub const SPLASH: &'static str = |
| 63 | r#" |
| 64 | |
| 65 | =***********************= |
| 66 | :*************************: |
| 67 | *************************** |
| 68 | ***=:::::::::::::::::::=*** 88888888b .o88888o. |
| 69 | ***: :+*** 88 d8' `8b |
| 70 | *******+=. .=+******* 88aaaa .d8888b. 88 88 |
| 71 | ********** ********** 88 88ooood8 d8888b. 88 88 d8888b. |
| 72 | *********= =********* 88 88. ... `88 Y8. .8P `88 |
| 73 | ******+:. .---. .:+****** dP `88888P' .aaadP' `888888P' aaad8' |
| 74 | ******+ -*****- =****** 88' `88 |
| 75 | *******---*******---******* Y88888P d88888P |
| 76 | *************************** |
| 77 | '^*********************^' |
| 78 | Steel Web Server |
| 79 | |
| 80 | "#; |