Add network filters metadata
This commit is contained in:
@ -74,3 +74,6 @@ pub const BUILTIN_NETWORK_FILTER_RULES: [&str; 24] = [
|
||||
"qemu-announce-self",
|
||||
"qemu-announce-self-rarp",
|
||||
];
|
||||
|
||||
/// List of valid network chains
|
||||
pub const NETWORK_CHAINS: [&str; 8] = ["root", "mac", "stp", "vlan", "arp", "rarp", "ipv4", "ipv6"];
|
||||
|
@ -15,8 +15,9 @@ struct StaticConfig {
|
||||
oidc_auth_enabled: bool,
|
||||
iso_mimetypes: &'static [&'static str],
|
||||
net_mac_prefix: &'static str,
|
||||
constraints: ServerConstraints,
|
||||
builtin_nwfilter_rules: &'static [&'static str],
|
||||
nwfilter_chains: &'static [&'static str],
|
||||
constraints: ServerConstraints,
|
||||
}
|
||||
|
||||
#[derive(serde::Serialize)]
|
||||
@ -25,6 +26,12 @@ struct LenConstraints {
|
||||
max: usize,
|
||||
}
|
||||
|
||||
#[derive(serde::Serialize)]
|
||||
struct SLenConstraints {
|
||||
min: i64,
|
||||
max: i64,
|
||||
}
|
||||
|
||||
#[derive(serde::Serialize)]
|
||||
struct ServerConstraints {
|
||||
iso_max_size: usize,
|
||||
@ -37,6 +44,9 @@ struct ServerConstraints {
|
||||
net_name_size: LenConstraints,
|
||||
net_title_size: LenConstraints,
|
||||
dhcp_reservation_host_name: LenConstraints,
|
||||
nwfilter_name_size: LenConstraints,
|
||||
nwfilter_comment_size: LenConstraints,
|
||||
nwfilter_priority: SLenConstraints,
|
||||
}
|
||||
|
||||
pub async fn static_config(local_auth: LocalAuthEnabled) -> impl Responder {
|
||||
@ -47,6 +57,7 @@ pub async fn static_config(local_auth: LocalAuthEnabled) -> impl Responder {
|
||||
iso_mimetypes: &constants::ALLOWED_ISO_MIME_TYPES,
|
||||
net_mac_prefix: constants::NET_MAC_ADDR_PREFIX,
|
||||
builtin_nwfilter_rules: &constants::BUILTIN_NETWORK_FILTER_RULES,
|
||||
nwfilter_chains: &constants::NETWORK_CHAINS,
|
||||
constraints: ServerConstraints {
|
||||
iso_max_size: constants::ISO_MAX_SIZE,
|
||||
|
||||
@ -71,6 +82,13 @@ pub async fn static_config(local_auth: LocalAuthEnabled) -> impl Responder {
|
||||
net_title_size: LenConstraints { min: 0, max: 50 },
|
||||
|
||||
dhcp_reservation_host_name: LenConstraints { min: 2, max: 250 },
|
||||
|
||||
nwfilter_name_size: LenConstraints { min: 2, max: 250 },
|
||||
nwfilter_comment_size: LenConstraints { min: 0, max: 256 },
|
||||
nwfilter_priority: SLenConstraints {
|
||||
min: -1000,
|
||||
max: 1000,
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
|
Reference in New Issue
Block a user