forked from NationTech/harmony
		
	Add new fields for OPNSense 25.1
This commit is contained in:
		
							parent
							
								
									537da5800f
								
							
						
					
					
						commit
						c4f4a58dcf
					
				| @ -22,8 +22,10 @@ use harmony_macros::{ip, mac_address}; | ||||
| 
 | ||||
| #[tokio::main] | ||||
| async fn main() { | ||||
|     env_logger::init(); | ||||
| 
 | ||||
|     let firewall = harmony::topology::LogicalHost { | ||||
|         ip: ip!("192.168.5.229"), | ||||
|         ip: ip!("192.168.122.106"), | ||||
|         name: String::from("opnsense-1"), | ||||
|     }; | ||||
| 
 | ||||
|  | ||||
| @ -83,6 +83,7 @@ pub struct Interface { | ||||
|     pub adv_dhcp_config_advanced: Option<MaybeString>, | ||||
|     pub adv_dhcp_config_file_override: Option<MaybeString>, | ||||
|     pub adv_dhcp_config_file_override_path: Option<MaybeString>, | ||||
|     pub mtu: Option<u32>, | ||||
| } | ||||
| 
 | ||||
| #[cfg(test)] | ||||
|  | ||||
| @ -1,6 +1,6 @@ | ||||
| use crate::HAProxy; | ||||
| use crate::{data::dhcpd::DhcpInterface, xml_utils::to_xml_str}; | ||||
| use log::error; | ||||
| use log::{debug, error}; | ||||
| use uuid::Uuid; | ||||
| use yaserde::{MaybeString, NamedList, RawXml}; | ||||
| use yaserde_derive::{YaDeserialize, YaSerialize}; | ||||
| @ -17,12 +17,12 @@ pub struct OPNsense { | ||||
|     pub dhcpd: NamedList<DhcpInterface>, | ||||
|     pub snmpd: Snmpd, | ||||
|     pub syslog: Syslog, | ||||
|     pub nat: Nat, | ||||
|     pub nat: Option<Nat>, | ||||
|     pub filter: Filters, | ||||
|     pub load_balancer: Option<LoadBalancer>, | ||||
|     pub rrd: Option<RawXml>, | ||||
|     pub ntpd: Ntpd, | ||||
|     pub widgets: Widgets, | ||||
|     pub widgets: Option<Widgets>, | ||||
|     pub revision: Revision, | ||||
|     #[yaserde(rename = "OPNsense")] | ||||
|     pub opnsense: OPNsenseXmlSection, | ||||
| @ -46,10 +46,12 @@ pub struct OPNsense { | ||||
|     pub pischem: Option<Pischem>, | ||||
|     pub ifgroups: Ifgroups, | ||||
|     pub dnsmasq: Option<RawXml>, | ||||
|     pub wizardtemp: Option<RawXml>, | ||||
| } | ||||
| 
 | ||||
| impl From<String> for OPNsense { | ||||
|     fn from(content: String) -> Self { | ||||
|         debug!("XML content: {content}"); | ||||
|         yaserde::de::from_str(&content) | ||||
|             .map_err(|e| println!("{}", e.to_string())) | ||||
|             .expect("OPNSense received invalid string, should be full XML") | ||||
| @ -242,6 +244,7 @@ pub struct Ssh { | ||||
|     pub passwordauth: u8, | ||||
|     pub keysig: MaybeString, | ||||
|     pub permitrootlogin: u8, | ||||
|     pub rekeylimit: MaybeString, | ||||
| } | ||||
| 
 | ||||
| #[derive(Default, PartialEq, Debug, YaSerialize, YaDeserialize)] | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user