mirror of
https://github.com/speatzle/nfsense.git
synced 2025-05-10 18:38:22 +00:00
Adding Macrodb References
Diagnoseing rust-analyser panic...
This commit is contained in:
parent
a0c04e3614
commit
3508745b45
4 changed files with 15 additions and 7 deletions
|
@ -3,6 +3,8 @@ use validator::Validate;
|
|||
|
||||
use super::firewall;
|
||||
use super::network;
|
||||
use super::network::AddressingMode;
|
||||
use super::network::NetworkInterfaceType;
|
||||
use super::object;
|
||||
use super::service;
|
||||
use super::system;
|
||||
|
@ -26,7 +28,17 @@ macro_db!(
|
|||
[ S: interface, service::DHCPServer, network.interfaces; service.dhcp_servers ()],
|
||||
[ S: interface, service::DNSServer, network.interfaces; service.dns_servers ()],
|
||||
[ S: interface, service::NTPServer, network.interfaces; service.ntp_servers ()],
|
||||
[ E: parent, network::NetworkInterface, network.interfaces; network.interfaces (interface_type, NetworkInterfaceType, Vlan, vlan_parent)],
|
||||
//[ E: members, network::NetworkInterface, network.interfaces; network.interfaces (interface_type, NetworkInterfaceType, Bond, bond_members)],
|
||||
//[ E: members, network::NetworkInterface, network.interfaces; network.interfaces (interface_type, NetworkInterfaceType, Bridge, bridge_members)],
|
||||
->
|
||||
network::NetworkInterface
|
||||
},
|
||||
{
|
||||
[ S: gateway, network::StaticRoute, object.addresses; network.static_routes ()],
|
||||
[ S: destination, network::StaticRoute, object.addresses; network.static_routes ()],
|
||||
[ E: address, network::NetworkInterface, object.addresses; network.interfaces (addressing_mode, AddressingMode, Static, address)],
|
||||
->
|
||||
object::Address
|
||||
},
|
||||
);
|
||||
|
|
|
@ -121,6 +121,7 @@ macro_rules! macro_db_link {
|
|||
()
|
||||
) => {
|
||||
impl $thing_referencing {
|
||||
#[allow(dead_code)]
|
||||
fn $field_name(&self, config: Config) -> $thing_referenced {
|
||||
|
||||
let index = config.$($path_referenced).+.iter().position(|e| *e.name == self.$field_name);
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
use self::config::Config;
|
||||
|
||||
pub mod config;
|
||||
pub mod firewall;
|
||||
pub mod macro_db;
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
use ipnet::IpNet;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::net::IpAddr;
|
||||
use validator::Validate;
|
||||
|
||||
#[derive(Serialize, Deserialize, Clone, Validate, Default, Debug)]
|
||||
|
@ -40,9 +38,8 @@ pub enum AddressingMode {
|
|||
pub struct StaticRoute {
|
||||
pub name: String,
|
||||
pub interface: String,
|
||||
// TODO make this a Address Object Reference?
|
||||
pub gateway: IpAddr,
|
||||
pub destination: IpNet,
|
||||
pub gateway: String,
|
||||
pub destination: String,
|
||||
pub metric: u64,
|
||||
pub comment: String,
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue