VirtWeb/virtweb_backend/src/constants.rs

80 lines
2.0 KiB
Rust
Raw Normal View History

2023-09-02 07:12:36 +00:00
/// Name of the cookie that contains session information
pub const SESSION_COOKIE_NAME: &str = "X-auth-token";
/// Maximum session duration after inactivity, in seconds
pub const MAX_INACTIVITY_DURATION: u64 = 60 * 30;
/// Maximum session duration (6 hours)
pub const MAX_SESSION_DURATION: u64 = 3600 * 6;
2023-09-02 17:15:11 +00:00
/// The routes that can be accessed without authentication
2023-09-04 09:25:03 +00:00
pub const ROUTES_WITHOUT_AUTH: [&str; 5] = [
"/",
"/api/server/static_config",
"/api/auth/local",
"/api/auth/start_oidc",
"/api/auth/finish_oidc",
];
2023-09-05 11:19:25 +00:00
/// Allowed ISO mimetypes
2023-09-05 14:12:20 +00:00
pub const ALLOWED_ISO_MIME_TYPES: [&str; 3] = [
"application/x-cd-image",
"application/x-iso9660-image",
"application/octet-stream",
];
2023-09-05 11:19:25 +00:00
/// ISO max size
pub const ISO_MAX_SIZE: usize = 10 * 1000 * 1000 * 1000;
2023-10-04 09:18:50 +00:00
/// Min VM memory size (MB)
pub const MIN_VM_MEMORY: usize = 100;
/// Max VM memory size (MB)
pub const MAX_VM_MEMORY: usize = 64000;
2023-10-26 09:43:05 +00:00
/// Disk name min length
pub const DISK_NAME_MIN_LEN: usize = 2;
/// Disk name max length
pub const DISK_NAME_MAX_LEN: usize = 10;
/// Disk size min (MB)
pub const DISK_SIZE_MIN: usize = 100;
/// Disk size max (MB)
pub const DISK_SIZE_MAX: usize = 1000 * 1000 * 2;
2023-12-19 12:26:56 +00:00
/// Network mac address default prefix
pub const NET_MAC_ADDR_PREFIX: &str = "52:54:00";
2023-12-28 14:12:38 +00:00
/// Built-in network filter rules
pub const BUILTIN_NETWORK_FILTER_RULES: [&str; 24] = [
"allow-arp",
"allow-dhcp",
"allow-dhcp-server",
"allow-dhcpv6",
"allow-dhcpv6-server",
"allow-incoming-ipv4",
"allow-incoming-ipv6",
"allow-ipv4",
"allow-ipv6",
"clean-traffic",
"clean-traffic-gateway",
"no-arp-ip-spoofing",
"no-arp-mac-spoofing",
"no-arp-spoofing",
"no-ip-multicast",
"no-ip-spoofing",
"no-ipv6-multicast",
"no-ipv6-spoofing",
"no-mac-broadcast",
"no-mac-spoofing",
"no-other-l2-traffic",
"no-other-rarp-traffic",
"qemu-announce-self",
"qemu-announce-self-rarp",
];
2024-01-03 18:53:47 +00:00
/// List of valid network chains
pub const NETWORK_CHAINS: [&str; 8] = ["root", "mac", "stp", "vlan", "arp", "rarp", "ipv4", "ipv6"];