mirror of
https://github.com/speatzle/nfsense.git
synced 2025-05-11 19:08:20 +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::firewall;
|
||||||
use super::network;
|
use super::network;
|
||||||
|
use super::network::AddressingMode;
|
||||||
|
use super::network::NetworkInterfaceType;
|
||||||
use super::object;
|
use super::object;
|
||||||
use super::service;
|
use super::service;
|
||||||
use super::system;
|
use super::system;
|
||||||
|
@ -26,7 +28,17 @@ macro_db!(
|
||||||
[ S: interface, service::DHCPServer, network.interfaces; service.dhcp_servers ()],
|
[ S: interface, service::DHCPServer, network.interfaces; service.dhcp_servers ()],
|
||||||
[ S: interface, service::DNSServer, network.interfaces; service.dns_servers ()],
|
[ S: interface, service::DNSServer, network.interfaces; service.dns_servers ()],
|
||||||
[ S: interface, service::NTPServer, network.interfaces; service.ntp_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
|
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 {
|
impl $thing_referencing {
|
||||||
|
#[allow(dead_code)]
|
||||||
fn $field_name(&self, config: Config) -> $thing_referenced {
|
fn $field_name(&self, config: Config) -> $thing_referenced {
|
||||||
|
|
||||||
let index = config.$($path_referenced).+.iter().position(|e| *e.name == self.$field_name);
|
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 config;
|
||||||
pub mod firewall;
|
pub mod firewall;
|
||||||
pub mod macro_db;
|
pub mod macro_db;
|
||||||
|
|
|
@ -1,6 +1,4 @@
|
||||||
use ipnet::IpNet;
|
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use std::net::IpAddr;
|
|
||||||
use validator::Validate;
|
use validator::Validate;
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Clone, Validate, Default, Debug)]
|
#[derive(Serialize, Deserialize, Clone, Validate, Default, Debug)]
|
||||||
|
@ -40,9 +38,8 @@ pub enum AddressingMode {
|
||||||
pub struct StaticRoute {
|
pub struct StaticRoute {
|
||||||
pub name: String,
|
pub name: String,
|
||||||
pub interface: String,
|
pub interface: String,
|
||||||
// TODO make this a Address Object Reference?
|
pub gateway: String,
|
||||||
pub gateway: IpAddr,
|
pub destination: String,
|
||||||
pub destination: IpNet,
|
|
||||||
pub metric: u64,
|
pub metric: u64,
|
||||||
pub comment: String,
|
pub comment: String,
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue