Documentation
¶
Overview ¶
Package model defines the data structures for OPNsense configurations.
Package model defines the data structures for OPNsense configurations.
This package provides comprehensive data models for OPNsense firewall configurations, supporting XML, JSON, and YAML serialization formats.
Package model defines the data structures for OPNsense configurations.
Package model defines the data structures for OPNsense configurations.
Package model defines the data structures for OPNsense configurations.
Package model defines the data structures for OPNsense configurations.
Package model defines the data structures for OPNsense configurations.
Package model defines the data structures for OPNsense configurations.
Package model defines the data structures for OPNsense configurations.
Package model defines the data structures for OPNsense configurations.
Package model defines the data structures for OPNsense configurations.
Package model defines the data structures for OPNsense configurations.
Package model defines the data structures for OPNsense configurations.
Index ¶
- Constants
- type APIKey
- type Analysis
- type BoolFlag
- type Bridge
- type Bridges
- type BridgesConfig
- type Cert
- type CertificateAuthority
- type ChangeMeta
- type ClientExport
- type ComplianceChecks
- type ConsistencyFinding
- type Created
- type DHCPNumberOption
- type DHCPScopeStatistics
- type DHCPStaticLease
- type DHCPv6Server
- type DNSMasq
- type DNSMasqHost
- type DeadRuleFinding
- type Destination
- type DhcpOption
- type DhcpRange
- type Dhcpd
- func (d *Dhcpd) Get(key string) (DhcpdInterface, bool)
- func (d *Dhcpd) Lan() (DhcpdInterface, bool)
- func (d *Dhcpd) MarshalXML(e *xml.Encoder, start xml.StartElement) error
- func (d *Dhcpd) Names() []string
- func (d *Dhcpd) UnmarshalXML(decoder *xml.Decoder, start xml.StartElement) error
- func (d *Dhcpd) Wan() (DhcpdInterface, bool)
- type DhcpdInterface
- type DomainOverride
- type EnrichedOpnSenseDocument
- type Filter
- type Firewall
- type Firmware
- type ForwarderGroup
- type GIFInterfaces
- type GREInterfaces
- type Gateway
- type GatewayGroup
- type Gateways
- type Group
- type HighAvailabilitySync
- type IDS
- type IPsec
- type Interface
- type InterfaceGroups
- type InterfaceStatistics
- type Interfaces
- func (i *Interfaces) Get(key string) (Interface, bool)
- func (i *Interfaces) Lan() (Interface, bool)
- func (i *Interfaces) MarshalXML(e *xml.Encoder, start xml.StartElement) error
- func (i *Interfaces) Names() []string
- func (i *Interfaces) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error
- func (i *Interfaces) Wan() (Interface, bool)
- type LAGGInterfaces
- type LoadBalancer
- type Monit
- type MonitService
- type MonitTest
- type MonitorType
- type Nat
- type NetworkConfig
- type Ntpd
- type OPNsense
- type OpenVPN
- type OpenVPNCSC
- type OpenVPNClient
- type OpenVPNExport
- type OpenVPNServer
- type OpenVPNSystem
- type OpnSenseDocument
- func (o *OpnSenseDocument) FilterRules() []Rule
- func (o *OpnSenseDocument) Hostname() string
- func (o *OpnSenseDocument) InterfaceByName(name string) *Interface
- func (o *OpnSenseDocument) NetworkConfig() NetworkConfig
- func (o *OpnSenseDocument) SecurityConfig() SecurityConfig
- func (o *OpnSenseDocument) ServiceConfig() ServiceConfig
- func (o *OpnSenseDocument) SystemConfig() SystemConfig
- type Options
- type Outbound
- type PPPInterfaces
- type PerformanceFinding
- type PerformanceMetrics
- type Range
- type Revision
- type Rrd
- type Rule
- type RuleLocation
- type SSHConfig
- type SecurityAssessment
- type SecurityConfig
- type SecurityFinding
- type ServiceConfig
- type ServiceStatistics
- type Snmpd
- type Source
- type StaticRoute
- type StaticRoutes
- type Statistics
- type StatisticsSummary
- type Swanctl
- type SysctlItem
- type Syslog
- type System
- type SystemConfig
- type Unbound
- type UnusedInterfaceFinding
- type Updated
- type User
- type VLAN
- type VLANConfig
- type VLANs
- type VirtualIP
- type WebGUIConfig
- type Widgets
- type WireGuard
- type WireGuardClientItem
- type WireGuardServerItem
- type Wireless
Constants ¶
const ( // ProtocolHTTPS is the HTTPS protocol constant. ProtocolHTTPS = "https" // ProtocolHTTP is the HTTP protocol constant. ProtocolHTTP = "http" // RuleTypePass is the pass rule type constant. RuleTypePass = "pass" // RuleTypeBlock is the block rule type constant. RuleTypeBlock = "block" // NetworkAny is the "any" network constant. NetworkAny = "any" // MaxComplexityScore is the maximum complexity score. MaxComplexityScore = 100 // MaxSecurityScore is the maximum security score. MaxSecurityScore = 100 // MaxComplianceScore is the maximum compliance score. MaxComplianceScore = 100 // RuleComplexityWeight is the weight for rule complexity calculation. RuleComplexityWeight = 2 // ServiceComplexityWeight is the weight for service complexity calculation. ServiceComplexityWeight = 3 // MaxRulesThreshold is the threshold for too many rules. MaxRulesThreshold = 100 // BaseSecurityScore is the base security score. BaseSecurityScore = 50 // BaseResourceUsage is the base resource usage. BaseResourceUsage = 50 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type APIKey ¶
type APIKey struct {
Key string `xml:"key" json:"key" yaml:"key"`
Secret string `xml:"secret" json:"secret" yaml:"secret"`
Privileges string `xml:"privileges,omitempty" json:"privileges,omitempty" yaml:"privileges,omitempty"`
Priv string `xml:"priv,omitempty" json:"priv,omitempty" yaml:"priv,omitempty"`
Scope string `xml:"scope,omitempty" json:"scope,omitempty" yaml:"scope,omitempty"`
UID int `xml:"uid,omitempty" json:"uid,omitempty" yaml:"uid,omitempty"`
GID int `xml:"gid,omitempty" json:"gid,omitempty" yaml:"gid,omitempty"`
Description string `xml:"descr,omitempty" json:"description,omitempty" yaml:"description,omitempty"`
CTime int64 `xml:"ctime,omitempty" json:"ctime,omitempty" yaml:"ctime,omitempty"`
MTime int64 `xml:"mtime,omitempty" json:"mtime,omitempty" yaml:"mtime,omitempty"`
CTimeUSec int `xml:"ctime_usec,omitempty" json:"ctimeUsec,omitempty" yaml:"ctimeUsec,omitempty"`
MTimeUSec int `xml:"mtime_usec,omitempty" json:"mtimeUsec,omitempty" yaml:"mtimeUsec,omitempty"`
CTimeNSec int `xml:"ctime_nsec,omitempty" json:"ctimeNsec,omitempty" yaml:"ctimeNsec,omitempty"`
MTimeNSec int `xml:"mtime_nsec,omitempty" json:"mtimeNsec,omitempty" yaml:"mtimeNsec,omitempty"`
CTimeSec int64 `xml:"ctime_sec,omitempty" json:"ctimeSec,omitempty" yaml:"ctimeSec,omitempty"`
MTimeSec int64 `xml:"mtime_sec,omitempty" json:"mtimeSec,omitempty" yaml:"mtimeSec,omitempty"`
}
APIKey represents a user API key.
type Analysis ¶
type Analysis struct {
// Dead rule detection
DeadRules []DeadRuleFinding `json:"deadRules,omitempty"`
// Unused interfaces
UnusedInterfaces []UnusedInterfaceFinding `json:"unusedInterfaces,omitempty"`
// Security issues
SecurityIssues []SecurityFinding `json:"securityIssues,omitempty"`
// Performance issues
PerformanceIssues []PerformanceFinding `json:"performanceIssues,omitempty"`
// Consistency issues
ConsistencyIssues []ConsistencyFinding `json:"consistencyIssues,omitempty"`
}
Analysis contains analysis findings and insights.
type BoolFlag ¶
type BoolFlag bool
BoolFlag provides custom XML marshaling for OPNsense boolean values.
func (*BoolFlag) MarshalXML ¶
MarshalXML implements custom XML marshaling for boolean flags.
func (*BoolFlag) UnmarshalXML ¶
UnmarshalXML implements custom XML unmarshaling for boolean flags.
type Bridge ¶
type Bridge struct {
XMLName xml.Name `xml:"bridge"`
Members string `xml:"members,omitempty"`
Descr string `xml:"descr,omitempty"`
Bridgeif string `xml:"bridgeif,omitempty"`
STP BoolFlag `xml:"stp,omitempty"`
Created string `xml:"created,omitempty"`
Updated string `xml:"updated,omitempty"`
}
Bridge represents a network bridge configuration.
type Bridges ¶
Bridges represents a collection of bridge configurations.
func NewBridges ¶
func NewBridges() *Bridges
NewBridges returns a pointer to a Bridges struct with an initialized empty slice of Bridge.
type BridgesConfig ¶
type BridgesConfig struct {
XMLName xml.Name `xml:"bridges"`
Bridged string `xml:"bridged,omitempty"`
}
BridgesConfig represents the root-level bridges configuration.
type Cert ¶
type Cert struct {
Text string `xml:",chardata" json:"text,omitempty"`
Refid string `xml:"refid"`
Descr string `xml:"descr"`
Crt string `xml:"crt"`
Prv string `xml:"prv"`
}
Cert represents a certificate configuration.
type CertificateAuthority ¶
CertificateAuthority represents certificate authority configuration.
type ChangeMeta ¶
type ChangeMeta struct {
Created string `xml:"created,omitempty"`
Updated string `xml:"updated,omitempty"`
Username string `xml:"username,omitempty"`
}
ChangeMeta tracks creation and modification metadata for configuration items.
type ClientExport ¶
type ClientExport struct {
XMLName xml.Name `xml:"openvpn-client-export"`
Server_list []string `xml:"server_list,omitempty"` //nolint:revive,staticcheck // XML field name requires underscore
Hostname string `xml:"hostname,omitempty"`
Random_local_port BoolFlag `xml:"random_local_port,omitempty"` //nolint:revive,staticcheck // XML field name requires underscore
Silent_install BoolFlag `xml:"silent_install,omitempty"` //nolint:revive,staticcheck // XML field name requires underscore
Use_token BoolFlag `xml:"use_token,omitempty"` //nolint:revive,staticcheck // XML field name requires underscore
}
ClientExport represents client export options for OpenVPN.
func NewClientExport ¶
func NewClientExport() *ClientExport
NewClientExport returns a new ClientExport instance with an empty server list.
type ComplianceChecks ¶
type ComplianceChecks struct {
ComplianceScore int `json:"complianceScore"`
ComplianceItems []string `json:"complianceItems"`
Violations []string `json:"violations"`
}
ComplianceChecks contains compliance check results.
type ConsistencyFinding ¶
type ConsistencyFinding struct {
Component string `json:"component"`
Issue string `json:"issue"`
Severity string `json:"severity"`
Description string `json:"description"`
Recommendation string `json:"recommendation"`
}
ConsistencyFinding represents a consistency finding.
type Created ¶
type Created struct {
Username string `xml:"username"`
Time string `xml:"time"`
Description string `xml:"description"`
}
Created represents creation information.
type DHCPNumberOption ¶
type DHCPNumberOption struct {
Number string `xml:"number"`
Type string `xml:"type,omitempty"`
Value string `xml:"value,omitempty"`
}
DHCPNumberOption represents a DHCP option with a number and value.
type DHCPScopeStatistics ¶
type DHCPScopeStatistics struct {
Interface string `json:"interface"`
Enabled bool `json:"enabled"`
From string `json:"from"`
To string `json:"to"`
}
DHCPScopeStatistics contains statistics for a DHCP scope.
type DHCPStaticLease ¶
type DHCPStaticLease struct {
Mac string `xml:"mac"`
Cid string `xml:"cid,omitempty"`
IPAddr string `xml:"ipaddr"`
Hostname string `xml:"hostname,omitempty"`
Descr string `xml:"descr,omitempty"`
Filename string `xml:"filename,omitempty"`
Rootpath string `xml:"rootpath,omitempty"`
Defaultleasetime string `xml:"defaultleasetime,omitempty"`
Maxleasetime string `xml:"maxleasetime,omitempty"`
}
DHCPStaticLease represents a static DHCP lease.
type DHCPv6Server ¶
DHCPv6Server represents DHCPv6 server configuration.
type DNSMasq ¶
type DNSMasq struct {
XMLName xml.Name `xml:"dnsmasq"`
Enable BoolFlag `xml:"enable,omitempty"`
Regdhcp BoolFlag `xml:"regdhcp,omitempty"`
Regdhcpstatic BoolFlag `xml:"regdhcpstatic,omitempty"`
Dhcpfirst BoolFlag `xml:"dhcpfirst,omitempty"`
Strict_order BoolFlag `xml:"strict_order,omitempty"` //nolint:revive,staticcheck // XML field name requires underscore
Domain_needed BoolFlag `xml:"domain_needed,omitempty"` //nolint:revive,staticcheck // XML field name requires underscore
No_private_reverse BoolFlag `xml:"no_private_reverse,omitempty"` //nolint:revive,staticcheck // XML field name requires underscore
Forwarders []ForwarderGroup `xml:"forwarders,omitempty"`
Custom_options string `xml:"custom_options,omitempty"` //nolint:revive,staticcheck // XML field name requires underscore
Hosts []DNSMasqHost `xml:"hosts>host,omitempty"`
DomainOverrides []DomainOverride `xml:"domainoverrides>domainoverride,omitempty"`
Created string `xml:"created,omitempty"`
Updated string `xml:"updated,omitempty"`
}
DNSMasq represents DNS masquerading configuration.
func NewDNSMasq ¶
func NewDNSMasq() *DNSMasq
NewDNSMasq returns a new DNSMasq configuration with initialized empty slices for hosts, forwarders, and domain overrides.
type DNSMasqHost ¶
type DNSMasqHost struct {
XMLName xml.Name `xml:"host"`
Host string `xml:"host,omitempty"`
Domain string `xml:"domain,omitempty"`
IP string `xml:"ip,omitempty"`
Descr string `xml:"descr,omitempty"`
Aliases []string `xml:"aliases,omitempty"`
}
DNSMasqHost represents a DNSMasq host entry.
func NewDNSMasqHost ¶
func NewDNSMasqHost() DNSMasqHost
NewDNSMasqHost returns a DNSMasqHost instance with an initialized empty Aliases slice.
type DeadRuleFinding ¶
type DeadRuleFinding struct {
RuleIndex int `json:"ruleIndex"`
Interface string `json:"interface"`
Description string `json:"description"`
Recommendation string `json:"recommendation"`
}
DeadRuleFinding represents a dead rule finding.
type Destination ¶
type Destination struct {
Any string `xml:"any,omitempty"`
Network string `xml:"network,omitempty"`
Port string `xml:"port,omitempty"`
}
Destination represents a firewall rule destination.
type DhcpOption ¶
type DhcpOption struct {
Number string `xml:"number,omitempty" json:"number,omitempty" yaml:"number,omitempty"`
Value string `xml:"value,omitempty" json:"value,omitempty" yaml:"value,omitempty"`
}
DhcpOption represents a DHCP option.
type DhcpRange ¶
type DhcpRange struct {
From string `xml:"from,omitempty" json:"from,omitempty" yaml:"from,omitempty"`
To string `xml:"to,omitempty" json:"to,omitempty" yaml:"to,omitempty"`
}
DhcpRange represents a DHCP range.
type Dhcpd ¶
type Dhcpd struct {
Items map[string]DhcpdInterface `xml:",any" json:"dhcp,omitempty" yaml:"dhcp,omitempty"`
}
Dhcpd contains the DHCP server configuration for all interfaces. Uses a map-based representation to store all interface blocks generically, supporting wan, lan, opt0, opt1, etc., and any custom interface elements.
func (*Dhcpd) Get ¶
func (d *Dhcpd) Get(key string) (DhcpdInterface, bool)
Get returns a DHCP interface configuration by its key name (e.g., "wan", "lan", "opt0"). Returns the DHCP interface configuration and a boolean indicating if it was found.
Example:
if lanDhcp, ok := dhcpd.Get("lan"); ok {
fmt.Printf("LAN DHCP range: %s - %s\n", lanDhcp.Range.From, lanDhcp.Range.To)
}
func (*Dhcpd) Lan ¶
func (d *Dhcpd) Lan() (DhcpdInterface, bool)
Lan returns the LAN DHCP interface configuration if it exists, otherwise returns a zero-value DhcpdInterface and false. This is a convenience method for backward compatibility.
func (*Dhcpd) MarshalXML ¶
MarshalXML implements custom XML marshaling for the Dhcpd map.
func (*Dhcpd) Names ¶
Names returns a slice of all DHCP interface key names in the configuration. This includes standard interfaces like "wan", "lan" and optional ones like "opt0", "opt1", etc.
Example:
names := dhcpd.Names()
fmt.Printf("DHCP configured on interfaces: %s\n", strings.Join(names, ", "))
func (*Dhcpd) UnmarshalXML ¶
UnmarshalXML implements custom XML unmarshaling for the Dhcpd map.
func (*Dhcpd) Wan ¶
func (d *Dhcpd) Wan() (DhcpdInterface, bool)
Wan returns the WAN DHCP interface configuration if it exists, otherwise returns a zero-value DhcpdInterface and false. This is a convenience method for backward compatibility.
type DhcpdInterface ¶
type DhcpdInterface struct {
Enable string `xml:"enable,omitempty"`
Range Range `xml:"range,omitempty"`
Gateway string `xml:"gateway,omitempty"`
DdnsDomainAlgorithm string `xml:"ddnsdomainalgorithm,omitempty"`
NumberOptions []DHCPNumberOption `xml:"numberoptions>item,omitempty"`
Winsserver string `xml:"winsserver,omitempty"`
Dnsserver string `xml:"dnsserver,omitempty"`
Ntpserver string `xml:"ntpserver,omitempty"`
Staticmap []DHCPStaticLease `xml:"staticmap,omitempty"`
// Advanced DHCP fields
AliasAddress string `xml:"alias-address,omitempty"`
AliasSubnet string `xml:"alias-subnet,omitempty"`
DHCPRejectFrom string `xml:"dhcprejectfrom,omitempty"`
// Advanced DHCP options
AdvDHCPPTTimeout string `xml:"adv_dhcp_pt_timeout,omitempty"`
AdvDHCPPTRetry string `xml:"adv_dhcp_pt_retry,omitempty"`
AdvDHCPPTSelectTimeout string `xml:"adv_dhcp_pt_select_timeout,omitempty"`
AdvDHCPPTReboot string `xml:"adv_dhcp_pt_reboot,omitempty"`
AdvDHCPPTBackoffCutoff string `xml:"adv_dhcp_pt_backoff_cutoff,omitempty"`
AdvDHCPPTInitialInterval string `xml:"adv_dhcp_pt_initial_interval,omitempty"`
AdvDHCPPTValues string `xml:"adv_dhcp_pt_values,omitempty"`
AdvDHCPSendOptions string `xml:"adv_dhcp_send_options,omitempty"`
AdvDHCPRequestOptions string `xml:"adv_dhcp_request_options,omitempty"`
AdvDHCPRequiredOptions string `xml:"adv_dhcp_required_options,omitempty"`
AdvDHCPOptionModifiers string `xml:"adv_dhcp_option_modifiers,omitempty"`
AdvDHCPConfigAdvanced string `xml:"adv_dhcp_config_advanced,omitempty"`
AdvDHCPConfigFileOverride string `xml:"adv_dhcp_config_file_override,omitempty"`
AdvDHCPConfigFileOverridePath string `xml:"adv_dhcp_config_file_override_path,omitempty"`
// Advanced DHCPv6 fields
Track6Interface string `xml:"track6-interface,omitempty"`
Track6PrefixID string `xml:"track6-prefix-id,omitempty"`
AdvDHCP6InterfaceStatementSendOptions string `xml:"adv_dhcp6_interface_statement_send_options,omitempty"`
AdvDHCP6InterfaceStatementRequestOptions string `xml:"adv_dhcp6_interface_statement_request_options,omitempty"`
AdvDHCP6InterfaceStatementInformationOnlyEnable string `xml:"adv_dhcp6_interface_statement_information_only_enable,omitempty"`
AdvDHCP6InterfaceStatementScript string `xml:"adv_dhcp6_interface_statement_script,omitempty"`
AdvDHCP6IDAssocStatementAddressEnable string `xml:"adv_dhcp6_id_assoc_statement_address_enable,omitempty"`
AdvDHCP6IDAssocStatementAddress string `xml:"adv_dhcp6_id_assoc_statement_address,omitempty"`
AdvDHCP6IDAssocStatementAddressID string `xml:"adv_dhcp6_id_assoc_statement_address_id,omitempty"`
AdvDHCP6IDAssocStatementAddressPLTime string `xml:"adv_dhcp6_id_assoc_statement_address_pltime,omitempty"`
AdvDHCP6IDAssocStatementAddressVLTime string `xml:"adv_dhcp6_id_assoc_statement_address_vltime,omitempty"`
AdvDHCP6IDAssocStatementPrefixEnable string `xml:"adv_dhcp6_id_assoc_statement_prefix_enable,omitempty"`
AdvDHCP6IDAssocStatementPrefix string `xml:"adv_dhcp6_id_assoc_statement_prefix,omitempty"`
AdvDHCP6IDAssocStatementPrefixID string `xml:"adv_dhcp6_id_assoc_statement_prefix_id,omitempty"`
AdvDHCP6IDAssocStatementPrefixPLTime string `xml:"adv_dhcp6_id_assoc_statement_prefix_pltime,omitempty"`
AdvDHCP6IDAssocStatementPrefixVLTime string `xml:"adv_dhcp6_id_assoc_statement_prefix_vltime,omitempty"`
AdvDHCP6PrefixInterfaceStatementSLALen string `xml:"adv_dhcp6_prefix_interface_statement_sla_len,omitempty"`
AdvDHCP6AuthenticationStatementAuthName string `xml:"adv_dhcp6_authentication_statement_authname,omitempty"`
AdvDHCP6AuthenticationStatementProtocol string `xml:"adv_dhcp6_authentication_statement_protocol,omitempty"`
AdvDHCP6AuthenticationStatementAlgorithm string `xml:"adv_dhcp6_authentication_statement_algorithm,omitempty"`
AdvDHCP6AuthenticationStatementRDM string `xml:"adv_dhcp6_authentication_statement_rdm,omitempty"`
AdvDHCP6KeyInfoStatementKeyName string `xml:"adv_dhcp6_key_info_statement_keyname,omitempty"`
AdvDHCP6KeyInfoStatementRealm string `xml:"adv_dhcp6_key_info_statement_realm,omitempty"`
AdvDHCP6KeyInfoStatementKeyID string `xml:"adv_dhcp6_key_info_statement_keyid,omitempty"`
AdvDHCP6KeyInfoStatementSecret string `xml:"adv_dhcp6_key_info_statement_secret,omitempty"`
AdvDHCP6KeyInfoStatementExpire string `xml:"adv_dhcp6_key_info_statement_expire,omitempty"`
AdvDHCP6ConfigAdvanced string `xml:"adv_dhcp6_config_advanced,omitempty"`
AdvDHCP6ConfigFileOverride string `xml:"adv_dhcp6_config_file_override,omitempty"`
AdvDHCP6ConfigFileOverridePath string `xml:"adv_dhcp6_config_file_override_path,omitempty"`
}
DhcpdInterface contains the DHCP server configuration for a specific interface.
func NewDhcpdInterface ¶
func NewDhcpdInterface() DhcpdInterface
NewDhcpdInterface returns a new DhcpdInterface with empty NumberOptions and Staticmap slices initialized.
type DomainOverride ¶
type DomainOverride struct {
XMLName xml.Name `xml:"domainoverride"`
Domain string `xml:"domain,omitempty"`
IP string `xml:"ip,omitempty"`
Descr string `xml:"descr,omitempty"`
}
DomainOverride represents a domain override entry.
type EnrichedOpnSenseDocument ¶
type EnrichedOpnSenseDocument struct {
*OpnSenseDocument
// Calculated statistics
Statistics *Statistics `json:"statistics,omitempty"`
// Analysis data
Analysis *Analysis `json:"analysis,omitempty"`
// Security assessment
SecurityAssessment *SecurityAssessment `json:"securityAssessment,omitempty"`
// Performance metrics
PerformanceMetrics *PerformanceMetrics `json:"performanceMetrics,omitempty"`
// Compliance checks
ComplianceChecks *ComplianceChecks `json:"complianceChecks,omitempty"`
}
EnrichedOpnSenseDocument extends OpnSenseDocument with calculated fields and analysis data.
func EnrichDocument ¶
func EnrichDocument(cfg *OpnSenseDocument) *EnrichedOpnSenseDocument
EnrichDocument returns an EnrichedOpnSenseDocument containing computed statistics, analysis findings, security assessment, performance metrics, and compliance checks for the provided OpnSenseDocument. Returns nil if the input configuration is nil.
type Filter ¶
type Filter struct {
Rule []Rule `xml:"rule"`
}
Filter represents firewall filter configuration.
type Firewall ¶
type Firewall struct {
XMLName xml.Name `xml:"Firewall"`
Text string `xml:",chardata" json:"text,omitempty"`
Lvtemplate struct {
Text string `xml:",chardata" json:"text,omitempty"`
Version string `xml:"version,attr" json:"version,omitempty"`
Templates string `xml:"templates"`
} `xml:"Lvtemplate" json:"lvtemplate"`
Alias struct {
Text string `xml:",chardata" json:"text,omitempty"`
Version string `xml:"version,attr" json:"version,omitempty"`
Geoip struct {
Text string `xml:",chardata" json:"text,omitempty"`
URL string `xml:"url"`
} `xml:"geoip" json:"geoip"`
Aliases string `xml:"aliases"`
} `xml:"Alias" json:"alias"`
Category struct {
Text string `xml:",chardata" json:"text,omitempty"`
Version string `xml:"version,attr" json:"version,omitempty"`
Categories string `xml:"categories"`
} `xml:"Category" json:"category"`
Filter struct {
Text string `xml:",chardata" json:"text,omitempty"`
Version string `xml:"version,attr" json:"version,omitempty"`
Rules string `xml:"rules"`
Snatrules string `xml:"snatrules"`
Npt string `xml:"npt"`
Onetoone string `xml:"onetoone"`
} `xml:"Filter" json:"filter"`
}
Firewall represents firewall configuration.
func NewFirewall ¶
func NewFirewall() *Firewall
NewFirewall returns a pointer to a new, empty Firewall configuration.
type Firmware ¶
type Firmware struct {
Version string `xml:"version,attr" json:"version,omitempty" yaml:"version,omitempty"`
Mirror string `xml:"mirror" json:"mirror,omitempty" yaml:"mirror,omitempty"`
Flavour string `xml:"flavour" json:"flavour,omitempty" yaml:"flavour,omitempty"`
Plugins string `xml:"plugins" json:"plugins,omitempty" yaml:"plugins,omitempty"`
Type struct{} `xml:"type,omitempty" json:"type" yaml:"type,omitempty"`
Subscription struct{} `xml:"subscription,omitempty" json:"subscription" yaml:"subscription,omitempty"`
Reboot struct{} `xml:"reboot,omitempty" json:"reboot" yaml:"reboot,omitempty"`
}
Firmware represents the firmware configuration.
type ForwarderGroup ¶
type ForwarderGroup struct {
XMLName xml.Name `xml:"forwarder"`
IP string `xml:"ip,omitempty"`
Port string `xml:"port,omitempty"`
Descr string `xml:"descr,omitempty"`
}
ForwarderGroup represents a DNS forwarder group configuration.
type GIFInterfaces ¶
type GIFInterfaces struct {
XMLName xml.Name `xml:"gifs" json:"-" yaml:"-"`
Version string `xml:"version,attr,omitempty" json:"version,omitempty" yaml:"version,omitempty"`
Gif string `xml:"gif,omitempty" json:"gif,omitempty" yaml:"gif,omitempty"`
}
GIFInterfaces represents GIF interface configuration.
type GREInterfaces ¶
type GREInterfaces struct {
XMLName xml.Name `xml:"gres" json:"-" yaml:"-"`
Version string `xml:"version,attr,omitempty" json:"version,omitempty" yaml:"version,omitempty"`
Gre string `xml:"gre,omitempty" json:"gre,omitempty" yaml:"gre,omitempty"`
}
GREInterfaces represents GRE interface configuration.
type Gateway ¶
type Gateway struct {
XMLName xml.Name `xml:"gateway_item"`
Interface string `xml:"interface,omitempty"`
Gateway string `xml:"gateway,omitempty"`
Name string `xml:"name,omitempty"`
Weight string `xml:"weight,omitempty"`
IPProtocol string `xml:"ipprotocol,omitempty"`
Interval string `xml:"interval,omitempty"`
Descr string `xml:"descr,omitempty"`
Monitor string `xml:"monitor,omitempty"`
Disabled BoolFlag `xml:"disabled,omitempty"`
Created string `xml:"created,omitempty"`
Updated string `xml:"updated,omitempty"`
DefaultGW string `xml:"defaultgw,omitempty"`
MonitorDisable string `xml:"monitor_disable,omitempty"`
FarGW string `xml:"fargw,omitempty"`
}
Gateway struct for individual gateway configuration.
type GatewayGroup ¶
type GatewayGroup struct {
XMLName xml.Name `xml:"gateway_group"`
Name string `xml:"name,omitempty"`
Item []string `xml:"item,omitempty"`
Trigger string `xml:"trigger,omitempty"`
Descr string `xml:"descr,omitempty"`
}
GatewayGroup represents a group of gateways for OPNsense configuration.
func NewGatewayGroup ¶
func NewGatewayGroup() GatewayGroup
NewGatewayGroup returns a GatewayGroup with an initialized empty slice of items.
type Gateways ¶
type Gateways struct {
XMLName xml.Name `xml:"gateways"`
Gateway []Gateway `xml:"gateway_item,omitempty"`
Groups []GatewayGroup `xml:"gateway_group,omitempty"`
}
Gateways represents gateway configuration.
func NewGateways ¶
func NewGateways() *Gateways
NewGateways returns a pointer to a Gateways struct with empty slices for gateways and gateway groups.
type Group ¶
type Group struct {
Name string `xml:"name" json:"name" yaml:"name" validate:"required,alphanum"`
Description string `xml:"description" json:"description,omitempty" yaml:"description,omitempty"`
Scope string `xml:"scope" json:"scope" yaml:"scope" validate:"required,oneof=system local"`
Gid string `xml:"gid" json:"gid" yaml:"gid" validate:"required,numeric"` //nolint:staticcheck // Field name matches OPNsense schema
Member string `xml:"member" json:"member,omitempty" yaml:"member,omitempty"`
Priv string `xml:"priv" json:"privileges,omitempty" yaml:"privileges,omitempty"`
}
Group represents a user group.
type HighAvailabilitySync ¶
type HighAvailabilitySync struct {
XMLName xml.Name `xml:"hasync" json:"-" yaml:"-"`
Version string `xml:"version,attr,omitempty" json:"version,omitempty" yaml:"version,omitempty"`
Disablepreempt string `xml:"disablepreempt,omitempty" json:"disablepreempt,omitempty" yaml:"disablepreempt,omitempty"`
Disconnectppps string `xml:"disconnectppps,omitempty" json:"disconnectppps,omitempty" yaml:"disconnectppps,omitempty"`
Pfsyncinterface string `xml:"pfsyncinterface,omitempty" json:"pfsyncinterface,omitempty" yaml:"pfsyncinterface,omitempty"`
Pfsyncpeerip string `xml:"pfsyncpeerip,omitempty" json:"pfsyncpeerip,omitempty" yaml:"pfsyncpeerip,omitempty"`
Pfsyncversion string `xml:"pfsyncversion,omitempty" json:"pfsyncversion,omitempty" yaml:"pfsyncversion,omitempty"`
Synchronizetoip string `xml:"synchronizetoip,omitempty" json:"synchronizetoip,omitempty" yaml:"synchronizetoip,omitempty"`
Username string `xml:"username,omitempty" json:"username,omitempty" yaml:"username,omitempty"`
Password string `xml:"password,omitempty" json:"password,omitempty" yaml:"password,omitempty"`
Syncitems string `xml:"syncitems,omitempty" json:"syncitems,omitempty" yaml:"syncitems,omitempty"`
}
HighAvailabilitySync represents high availability synchronization configuration.
type IDS ¶
type IDS struct {
XMLName xml.Name `xml:"IDS"`
Text string `xml:",chardata" json:"text,omitempty"`
Version string `xml:"version,attr" json:"version,omitempty"`
Rules string `xml:"rules"`
Policies string `xml:"policies"`
UserDefinedRules string `xml:"userDefinedRules"`
Files string `xml:"files"`
FileTags string `xml:"fileTags"`
General struct {
Text string `xml:",chardata" json:"text,omitempty"`
Enabled string `xml:"enabled"`
Ips string `xml:"ips"`
Promisc string `xml:"promisc"`
Interfaces string `xml:"interfaces"`
Homenet string `xml:"homenet"`
DefaultPacketSize string `xml:"defaultPacketSize"`
UpdateCron string `xml:"UpdateCron"`
AlertLogrotate string `xml:"AlertLogrotate"`
AlertSaveLogs string `xml:"AlertSaveLogs"`
MPMAlgo string `xml:"MPMAlgo"`
Detect struct {
Text string `xml:",chardata" json:"text,omitempty"`
Profile string `xml:"Profile"`
ToclientGroups string `xml:"toclient_groups"`
ToserverGroups string `xml:"toserver_groups"`
} `xml:"detect" json:"detect"`
Syslog string `xml:"syslog"`
SyslogEve string `xml:"syslog_eve"`
LogPayload string `xml:"LogPayload"`
Verbosity string `xml:"verbosity"`
EveLog struct {
Text string `xml:",chardata" json:"text,omitempty"`
HTTP struct {
Text string `xml:",chardata" json:"text,omitempty"`
Enable string `xml:"enable"`
Extended string `xml:"extended"`
DumpAllHeaders string `xml:"dumpAllHeaders"`
} `xml:"http" json:"http"`
TLS struct {
Text string `xml:",chardata" json:"text,omitempty"`
Enable string `xml:"enable"`
Extended string `xml:"extended"`
SessionResumption string `xml:"sessionResumption"`
Custom string `xml:"custom"`
} `xml:"tls" json:"tls"`
} `xml:"eveLog" json:"evelog"`
} `xml:"general" json:"general"`
}
IDS represents the complete Intrusion Detection System configuration.
type IPsec ¶
type IPsec struct {
XMLName xml.Name `xml:"IPsec"`
Text string `xml:",chardata" json:"text,omitempty"`
Version string `xml:"version,attr" json:"version,omitempty"`
General struct {
Text string `xml:",chardata" json:"text,omitempty"`
Enabled string `xml:"enabled"`
PreferredOldsa string `xml:"preferred_oldsa"`
Disablevpnrules string `xml:"disablevpnrules"`
PassthroughNetworks string `xml:"passthrough_networks"`
} `xml:"general" json:"general"`
Charon struct {
Text string `xml:",chardata" json:"text,omitempty"`
MaxIkev1Exchanges string `xml:"max_ikev1_exchanges"`
Threads string `xml:"threads"`
IkesaTableSize string `xml:"ikesa_table_size"`
IkesaTableSegments string `xml:"ikesa_table_segments"`
InitLimitHalfOpen string `xml:"init_limit_half_open"`
IgnoreAcquireTs string `xml:"ignore_acquire_ts"` //nolint:staticcheck // XML field name requires underscore
MakeBeforeBreak string `xml:"make_before_break"`
RetransmitTries string `xml:"retransmit_tries"`
RetransmitTimeout string `xml:"retransmit_timeout"`
RetransmitBase string `xml:"retransmit_base"`
RetransmitJitter string `xml:"retransmit_jitter"`
RetransmitLimit string `xml:"retransmit_limit"`
Syslog struct {
Text string `xml:",chardata" json:"text,omitempty"`
Daemon struct {
Text string `xml:",chardata" json:"text,omitempty"`
IkeName string `xml:"ike_name"`
LogLevel string `xml:"log_level"`
App string `xml:"app"`
Asn string `xml:"asn"`
Cfg string `xml:"cfg"`
Chd string `xml:"chd"`
Dmn string `xml:"dmn"`
Enc string `xml:"enc"`
Esp string `xml:"esp"`
Ike string `xml:"ike"`
Imc string `xml:"imc"`
Imv string `xml:"imv"`
Job string `xml:"job"`
Knl string `xml:"knl"`
Lib string `xml:"lib"`
Mgr string `xml:"mgr"`
Net string `xml:"net"`
Pts string `xml:"pts"`
TLS string `xml:"tls"`
Tnc string `xml:"tnc"`
} `xml:"daemon" json:"daemon"`
} `xml:"syslog" json:"syslog"`
} `xml:"charon" json:"charon"`
KeyPairs string `xml:"keyPairs"`
}
IPsec represents IPsec configuration.
type Interface ¶
type Interface struct {
Enable string `xml:"enable,omitempty" json:"enable,omitempty" yaml:"enable,omitempty"`
If string `xml:"if,omitempty" json:"if,omitempty" yaml:"if,omitempty"`
Descr string `xml:"descr,omitempty" json:"descr,omitempty" yaml:"descr,omitempty"`
Spoofmac string `xml:"spoofmac,omitempty" json:"spoofmac,omitempty" yaml:"spoofmac,omitempty"`
InternalDynamic int `xml:"internal_dynamic,omitempty" json:"internalDynamic,omitempty" yaml:"internalDynamic,omitempty"`
Type string `xml:"type,omitempty" json:"type,omitempty" yaml:"type,omitempty"`
Virtual int `xml:"virtual,omitempty" json:"virtual,omitempty" yaml:"virtual,omitempty"`
Lock int `xml:"lock,omitempty" json:"lock,omitempty" yaml:"lock,omitempty"`
MTU string `xml:"mtu,omitempty" json:"mtu,omitempty" yaml:"mtu,omitempty"`
IPAddr string `xml:"ipaddr,omitempty" json:"ipaddr,omitempty" yaml:"ipaddr,omitempty"`
IPAddrv6 string `xml:"ipaddrv6,omitempty" json:"ipaddrv6,omitempty" yaml:"ipaddrv6,omitempty"`
Subnet string `xml:"subnet,omitempty" json:"subnet,omitempty" yaml:"subnet,omitempty"`
Subnetv6 string `xml:"subnetv6,omitempty" json:"subnetv6,omitempty" yaml:"subnetv6,omitempty"`
Gateway string `xml:"gateway,omitempty" json:"gateway,omitempty" yaml:"gateway,omitempty"`
Gatewayv6 string `xml:"gatewayv6,omitempty" json:"gatewayv6,omitempty" yaml:"gatewayv6,omitempty"`
BlockPriv string `xml:"blockpriv,omitempty" json:"blockpriv,omitempty" yaml:"blockpriv,omitempty"`
BlockBogons string `xml:"blockbogons,omitempty" json:"blockbogons,omitempty" yaml:"blockbogons,omitempty"`
DHCPHostname string `xml:"dhcphostname,omitempty" json:"dhcphostname,omitempty" yaml:"dhcphostname,omitempty"`
Media string `xml:"media,omitempty" json:"media,omitempty" yaml:"media,omitempty"`
MediaOpt string `xml:"mediaopt,omitempty" json:"mediaopt,omitempty" yaml:"mediaopt,omitempty"`
DHCP6IaPdLen int `xml:"dhcp6-ia-pd-len,omitempty" json:"dhcp6IaPdLen,omitempty" yaml:"dhcp6IaPdLen,omitempty"`
Track6Interface string `xml:"track6-interface,omitempty" json:"track6Interface,omitempty" yaml:"track6Interface,omitempty"`
Track6PrefixID string `xml:"track6-prefix-id,omitempty" json:"track6PrefixId,omitempty" yaml:"track6PrefixId,omitempty"`
AliasAddress string `xml:"alias-address,omitempty" json:"aliasAddress,omitempty" yaml:"aliasAddress,omitempty"`
AliasSubnet string `xml:"alias-subnet,omitempty" json:"aliasSubnet,omitempty" yaml:"aliasSubnet,omitempty"`
DHCPRejectFrom string `xml:"dhcprejectfrom,omitempty" json:"dhcprejectfrom,omitempty" yaml:"dhcprejectfrom,omitempty"`
DDNSDomainAlgorithm string `xml:"ddnsdomainalgorithm,omitempty" json:"ddnsdomainalgorithm,omitempty" yaml:"ddnsdomainalgorithm,omitempty"`
NumberOptions []DhcpOption `xml:"numberoptions,omitempty" json:"numberoptions,omitempty" yaml:"numberoptions,omitempty"`
Range DhcpRange `xml:"range,omitempty" json:"range" yaml:"range,omitempty"`
Winsserver string `xml:"winsserver,omitempty" json:"winsserver,omitempty" yaml:"winsserver,omitempty"`
Dnsserver string `xml:"dnsserver,omitempty" json:"dnsserver,omitempty" yaml:"dnsserver,omitempty"`
Ntpserver string `xml:"ntpserver,omitempty" json:"ntpserver,omitempty" yaml:"ntpserver,omitempty"`
// Advanced DHCP fields for interfaces
AdvDHCPRequestOptions string `` /* 158-byte string literal not displayed */
AdvDHCPRequiredOptions string `` /* 159-byte string literal not displayed */
AdvDHCP6InterfaceStatementRequestOptions string `` /* 177-byte string literal not displayed */
AdvDHCP6ConfigFileOverride string `` /* 163-byte string literal not displayed */
AdvDHCP6IDAssocStatementPrefixPLTime string `` /* 173-byte string literal not displayed */
}
Interface represents a network interface configuration.
type InterfaceGroups ¶
type InterfaceGroups struct {
XMLName xml.Name `xml:"ifgroups" json:"-" yaml:"-"`
Version string `xml:"version,attr,omitempty" json:"version,omitempty" yaml:"version,omitempty"`
}
InterfaceGroups represents interface groups configuration.
type InterfaceStatistics ¶
type InterfaceStatistics struct {
Name string `json:"name"`
Type string `json:"type"`
Enabled bool `json:"enabled"`
HasIPv4 bool `json:"hasIpv4"`
HasIPv6 bool `json:"hasIpv6"`
HasDHCP bool `json:"hasDhcp"`
BlockPriv bool `json:"blockPriv"`
BlockBogons bool `json:"blockBogons"`
}
InterfaceStatistics contains detailed statistics for a single interface.
type Interfaces ¶
type Interfaces struct {
Items map[string]Interface `xml:",any" json:"interfaces,omitempty" yaml:"interfaces,omitempty"`
}
Interfaces contains the network interface configurations. Uses a map-based representation to store all interface blocks generically, supporting wan, lan, opt0, opt1, etc., and any custom interface elements.
func (*Interfaces) Get ¶
func (i *Interfaces) Get(key string) (Interface, bool)
Get returns an interface by its key name (e.g., "wan", "lan", "opt0"). Returns the interface and a boolean indicating if it was found.
Example:
if wan, ok := interfaces.Get("wan"); ok {
fmt.Printf("WAN IP: %s\n", wan.IPAddr)
}
func (*Interfaces) Lan ¶
func (i *Interfaces) Lan() (Interface, bool)
Lan returns the LAN interface if it exists, otherwise returns a zero-value Interface and false. This is a convenience method for backward compatibility.
func (*Interfaces) MarshalXML ¶
func (i *Interfaces) MarshalXML(e *xml.Encoder, start xml.StartElement) error
MarshalXML implements custom XML marshaling for the Interfaces map.
func (*Interfaces) Names ¶
func (i *Interfaces) Names() []string
Names returns a slice of all interface key names in the configuration. This includes standard interfaces like "wan", "lan" and optional ones like "opt0", "opt1", etc.
Example:
names := interfaces.Names()
fmt.Printf("Available interfaces: %s\n", strings.Join(names, ", "))
func (*Interfaces) UnmarshalXML ¶
func (i *Interfaces) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error
UnmarshalXML implements custom XML unmarshaling for the Interfaces map.
func (*Interfaces) Wan ¶
func (i *Interfaces) Wan() (Interface, bool)
Wan returns the WAN interface if it exists, otherwise returns a zero-value Interface and false. This is a convenience method for backward compatibility.
type LAGGInterfaces ¶
type LAGGInterfaces struct {
XMLName xml.Name `xml:"laggs" json:"-" yaml:"-"`
Version string `xml:"version,attr,omitempty" json:"version,omitempty" yaml:"version,omitempty"`
Lagg string `xml:"lagg,omitempty" json:"lagg,omitempty" yaml:"lagg,omitempty"`
}
LAGGInterfaces represents LAGG interface configuration.
type LoadBalancer ¶
type LoadBalancer struct {
MonitorType []MonitorType `xml:"monitor_type"`
}
LoadBalancer contains the load balancer configuration.
type Monit ¶
type Monit struct {
XMLName xml.Name `xml:"monit"`
Text string `xml:",chardata" json:"text,omitempty"`
Version string `xml:"version,attr" json:"version,omitempty"`
General struct {
Text string `xml:",chardata" json:"text,omitempty"`
Enabled string `xml:"enabled"`
Interval string `xml:"interval"`
Startdelay string `xml:"startdelay"`
Mailserver string `xml:"mailserver"`
Port string `xml:"port"`
Username string `xml:"username"`
Password string `xml:"password"`
Ssl string `xml:"ssl"`
Sslversion string `xml:"sslversion"`
Sslverify string `xml:"sslverify"`
Logfile string `xml:"logfile"`
Statefile string `xml:"statefile"`
EventqueuePath string `xml:"eventqueuePath"`
EventqueueSlots string `xml:"eventqueueSlots"`
HttpdEnabled string `xml:"httpdEnabled"`
HttpdUsername string `xml:"httpdUsername"`
HttpdPassword string `xml:"httpdPassword"`
HttpdPort string `xml:"httpdPort"`
HttpdAllow string `xml:"httpdAllow"`
MmonitURL string `xml:"mmonitUrl"`
MmonitTimeout string `xml:"mmonitTimeout"`
MmonitRegisterCredentials string `xml:"mmonitRegisterCredentials"`
} `xml:"general" json:"general"`
Alert struct {
Text string `xml:",chardata" json:"text,omitempty"`
UUID string `xml:"uuid,attr" json:"uuid,omitempty"`
Enabled string `xml:"enabled"`
Recipient string `xml:"recipient"`
Noton string `xml:"noton"`
Events string `xml:"events"`
Format string `xml:"format"`
Reminder string `xml:"reminder"`
Description string `xml:"description"`
} `xml:"alert" json:"alert"`
Service []MonitService `xml:"service" json:"service,omitempty"`
Test []MonitTest `xml:"test" json:"test,omitempty"`
}
Monit represents system monitoring configuration.
type MonitService ¶
type MonitService struct {
Text string `xml:",chardata" json:"text,omitempty"`
UUID string `xml:"uuid,attr" json:"uuid,omitempty"`
Enabled string `xml:"enabled"`
Name string `xml:"name"`
Description string `xml:"description"`
Type string `xml:"type"`
Pidfile string `xml:"pidfile"`
Match string `xml:"match"`
Path string `xml:"path"`
Timeout string `xml:"timeout"`
Starttimeout string `xml:"starttimeout"`
Address string `xml:"address"`
Interface string `xml:"interface"`
Start string `xml:"start"`
Stop string `xml:"stop"`
Tests string `xml:"tests"`
Depends string `xml:"depends"`
Polltime string `xml:"polltime"`
}
MonitService represents a monitored service.
type MonitTest ¶
type MonitTest struct {
Text string `xml:",chardata" json:"text,omitempty"`
UUID string `xml:"uuid,attr" json:"uuid,omitempty"`
Name string `xml:"name"`
Type string `xml:"type"`
Condition string `xml:"condition"`
Action string `xml:"action"`
Path string `xml:"path"`
}
MonitTest represents a monitoring test.
type MonitorType ¶
type MonitorType struct {
Name string `xml:"name"`
Type string `xml:"type"`
Descr string `xml:"descr"`
Options Options `xml:"options"`
}
MonitorType represents a load balancer monitor type.
type NetworkConfig ¶
type NetworkConfig struct {
Interfaces Interfaces `json:"interfaces" yaml:"interfaces,omitempty" validate:"required"`
VLANs []VLANConfig `json:"vlans,omitempty" yaml:"vlans,omitempty"`
Gateways []Gateway `json:"gateways,omitempty" yaml:"gateways,omitempty"`
}
NetworkConfig groups network-related configuration.
func NewNetworkConfig ¶
func NewNetworkConfig() NetworkConfig
NewNetworkConfig returns a NetworkConfig with initialized empty slices for VLANs and Gateways, and an initialized map for Interfaces.
type Ntpd ¶
type Ntpd struct {
Prefer string `xml:"prefer"`
}
Ntpd contains the NTP daemon configuration.
type OPNsense ¶
type OPNsense struct {
XMLName xml.Name `xml:"OPNsense"`
Text string `xml:",chardata" json:"text,omitempty"`
Captiveportal struct {
Text string `xml:",chardata" json:"text,omitempty"`
Version string `xml:"version,attr" json:"version,omitempty"`
Zones string `xml:"zones"`
Templates string `xml:"templates"`
} `xml:"captiveportal" json:"captiveportal"`
Cron struct {
Text string `xml:",chardata" json:"text,omitempty"`
Version string `xml:"version,attr" json:"version,omitempty"`
Jobs string `xml:"jobs"`
} `xml:"cron" json:"cron"`
DHCPRelay struct {
Text string `xml:",chardata" json:"text,omitempty"`
Version string `xml:"version,attr" json:"version,omitempty"`
} `xml:"DHCRelay" json:"dhcrelay"`
// Security components - now using references
Firewall *Firewall `xml:"Firewall,omitempty" json:"firewall,omitempty"`
IntrusionDetectionSystem *IDS `xml:"IDS,omitempty" json:"ids,omitempty"`
IPsec *IPsec `xml:"IPsec,omitempty" json:"ipsec,omitempty"`
Swanctl *Swanctl `xml:"Swanctl,omitempty" json:"swanctl,omitempty"`
// VPN components - now using references
OpenVPNExport *OpenVPNExport `xml:"OpenVPNExport,omitempty" json:"openvpnexport,omitempty"`
OpenVPN *OpenVPNSystem `xml:"OpenVPN,omitempty" json:"openvpn_system,omitempty"`
Wireguard *WireGuard `xml:"wireguard,omitempty" json:"wireguard,omitempty"`
// Monitoring components - now using references
Monit *Monit `xml:"monit,omitempty" json:"monit,omitempty"`
// Network components
Interfaces struct {
Text string `xml:",chardata" json:"text,omitempty"`
Loopbacks struct {
Text string `xml:",chardata" json:"text,omitempty"`
Version string `xml:"version,attr" json:"version,omitempty"`
} `xml:"loopbacks" json:"loopbacks"`
Neighbors struct {
Text string `xml:",chardata" json:"text,omitempty"`
Version string `xml:"version,attr" json:"version,omitempty"`
} `xml:"neighbors" json:"neighbors"`
Vxlans struct {
Text string `xml:",chardata" json:"text,omitempty"`
Version string `xml:"version,attr" json:"version,omitempty"`
} `xml:"vxlans" json:"vxlans"`
} `xml:"Interfaces" json:"interfaces"`
// DHCP components
Kea struct {
Text string `xml:",chardata" json:"text,omitempty"`
Version string `xml:"version,attr" json:"version,omitempty"`
Dhcp4 struct {
Text string `xml:",chardata" json:"text,omitempty"`
Version string `xml:"version,attr" json:"version,omitempty"`
General struct {
Text string `xml:",chardata" json:"text,omitempty"`
Enabled string `xml:"enabled"`
Interfaces string `xml:"interfaces"`
FirewallRules string `xml:"fwrules"`
ValidLifetime string `xml:"valid_lifetime"`
} `xml:"general" json:"general"`
HighAvailability struct {
Text string `xml:",chardata" json:"text,omitempty"`
Enabled string `xml:"enabled"`
ThisServerName string `xml:"this_server_name"`
MaxUnackedClients string `xml:"max_unacked_clients"`
} `xml:"ha" json:"ha"`
Subnets string `xml:"subnets"`
Reservations string `xml:"reservations"`
HAPeers string `xml:"ha_peers"`
} `xml:"dhcp4" json:"dhcp4"`
CtrlAgent struct {
Text string `xml:",chardata" json:"text,omitempty"`
Version string `xml:"version,attr" json:"version,omitempty"`
General struct {
Text string `xml:",chardata" json:"text,omitempty"`
Enabled string `xml:"enabled"`
HTTPHost string `xml:"http_host"`
HTTPPort string `xml:"http_port"`
} `xml:"general" json:"general"`
} `xml:"ctrl_agent" json:"ctrlAgent"`
} `xml:"Kea" json:"kea"`
// Other system components
Gateways struct {
Text string `xml:",chardata" json:"text,omitempty"`
Version string `xml:"version,attr" json:"version,omitempty"`
} `xml:"Gateways" json:"gateways_internal"`
Netflow struct {
Text string `xml:",chardata" json:"text,omitempty"`
Version string `xml:"version,attr" json:"version,omitempty"`
Capture struct {
Text string `xml:",chardata" json:"text,omitempty"`
Interfaces string `xml:"interfaces"`
Version string `xml:"version"`
EgressOnly string `xml:"egress_only"`
Targets string `xml:"targets"`
} `xml:"capture" json:"capture"`
Collect struct {
Text string `xml:",chardata" json:"text,omitempty"`
Enable string `xml:"enable"`
} `xml:"collect" json:"collect"`
InactiveTimeout string `xml:"inactiveTimeout"`
ActiveTimeout string `xml:"activeTimeout"`
} `xml:"Netflow" json:"netflow"`
Syslog struct {
Text string `xml:",chardata" json:"text,omitempty"`
Version string `xml:"version,attr" json:"version,omitempty"`
General struct {
Text string `xml:",chardata" json:"text,omitempty"`
Enabled string `xml:"enabled"`
Loglocal string `xml:"loglocal"`
Maxpreserve string `xml:"maxpreserve"`
Maxfilesize string `xml:"maxfilesize"`
} `xml:"general" json:"general"`
Destinations string `xml:"destinations"`
} `xml:"Syslog" json:"syslog_internal"`
TrafficShaper struct {
Text string `xml:",chardata" json:"text,omitempty"`
Version string `xml:"version,attr" json:"version,omitempty"`
Pipes string `xml:"pipes"`
Queues string `xml:"queues"`
Rules string `xml:"rules"`
} `xml:"TrafficShaper" json:"trafficshaper"`
Trust struct {
Text string `xml:",chardata" json:"text,omitempty"`
General struct {
Text string `xml:",chardata" json:"text,omitempty"`
Version string `xml:"version,attr" json:"version,omitempty"`
StoreIntermediateCerts string `xml:"store_intermediate_certs"`
InstallCrls string `xml:"install_crls"`
FetchCrls string `xml:"fetch_crls"`
EnableLegacySect string `xml:"enable_legacy_sect"`
EnableConfigConstraints string `xml:"enable_config_constraints"`
CipherString string `xml:"CipherString"`
Ciphersuites string `xml:"Ciphersuites"`
Groups string `xml:"groups"`
MinProtocol string `xml:"MinProtocol"`
MinProtocolDTLS string `xml:"MinProtocol_DTLS"`
} `xml:"general" json:"general"`
} `xml:"trust" json:"trust"`
UnboundPlus struct {
Text string `xml:",chardata" json:"text,omitempty"`
Version string `xml:"version,attr" json:"version,omitempty"`
General struct {
Text string `xml:",chardata" json:"text,omitempty"`
Enabled string `xml:"enabled"`
Port string `xml:"port"`
Stats string `xml:"stats"`
ActiveInterface string `xml:"active_interface"`
Dnssec string `xml:"dnssec"`
DNS64 string `xml:"dns64"`
DNS64prefix string `xml:"dns64prefix"`
Noarecords string `xml:"noarecords"`
RegisterDHCP string `xml:"regdhcp"`
RegisterDHCPDomain string `xml:"regdhcpdomain"`
RegisterDHCPStatic string `xml:"regdhcpstatic"`
NoRegisterLLAddr6 string `xml:"noreglladdr6"`
NoRegisterRecords string `xml:"noregrecords"`
Txtsupport string `xml:"txtsupport"`
Cacheflush string `xml:"cacheflush"`
LocalZoneType string `xml:"local_zone_type"`
OutgoingInterface string `xml:"outgoing_interface"`
EnableWpad string `xml:"enable_wpad"`
} `xml:"general" json:"general"`
Advanced struct {
Text string `xml:",chardata" json:"text,omitempty"`
Hideidentity string `xml:"hideidentity"`
Hideversion string `xml:"hideversion"`
Prefetch string `xml:"prefetch"`
Prefetchkey string `xml:"prefetchkey"`
Dnssecstripped string `xml:"dnssecstripped"`
Aggressivensec string `xml:"aggressivensec"`
Serveexpired string `xml:"serveexpired"`
Serveexpiredreplyttl string `xml:"serveexpiredreplyttl"`
Serveexpiredttl string `xml:"serveexpiredttl"`
Serveexpiredttlreset string `xml:"serveexpiredttlreset"`
Serveexpiredclienttimeout string `xml:"serveexpiredclienttimeout"`
Qnameminstrict string `xml:"qnameminstrict"`
Extendedstatistics string `xml:"extendedstatistics"`
Logqueries string `xml:"logqueries"`
Logreplies string `xml:"logreplies"`
Logtagqueryreply string `xml:"logtagqueryreply"`
Logservfail string `xml:"logservfail"`
Loglocalactions string `xml:"loglocalactions"`
Logverbosity string `xml:"logverbosity"`
Valloglevel string `xml:"valloglevel"`
Privatedomain string `xml:"privatedomain"`
Privateaddress string `xml:"privateaddress"`
Insecuredomain string `xml:"insecuredomain"`
Msgcachesize string `xml:"msgcachesize"`
Rrsetcachesize string `xml:"rrsetcachesize"`
Outgoingnumtcp string `xml:"outgoingnumtcp"`
Incomingnumtcp string `xml:"incomingnumtcp"`
Numqueriesperthread string `xml:"numqueriesperthread"`
Outgoingrange string `xml:"outgoingrange"`
Jostletimeout string `xml:"jostletimeout"`
Discardtimeout string `xml:"discardtimeout"`
Cachemaxttl string `xml:"cachemaxttl"`
Cachemaxnegativettl string `xml:"cachemaxnegativettl"`
Cacheminttl string `xml:"cacheminttl"`
Infrahostttl string `xml:"infrahostttl"`
Infrakeepprobing string `xml:"infrakeepprobing"`
Infracachenumhosts string `xml:"infracachenumhosts"`
Unwantedreplythreshold string `xml:"unwantedreplythreshold"`
} `xml:"advanced" json:"advanced"`
Acls struct {
Text string `xml:",chardata" json:"text,omitempty"`
DefaultAction string `xml:"default_action"`
} `xml:"acls" json:"acls"`
Dnsbl struct {
Text string `xml:",chardata" json:"text,omitempty"`
Enabled string `xml:"enabled"`
Safesearch string `xml:"safesearch"`
Type string `xml:"type"`
Lists string `xml:"lists"`
Whitelists string `xml:"whitelists"`
Blocklists string `xml:"blocklists"`
Wildcards string `xml:"wildcards"`
Address string `xml:"address"`
Nxdomain string `xml:"nxdomain"`
} `xml:"dnsbl" json:"dnsbl"`
Forwarding struct {
Text string `xml:",chardata" json:"text,omitempty"`
Enabled string `xml:"enabled"`
} `xml:"forwarding" json:"forwarding"`
Dots string `xml:"dots"`
Hosts string `xml:"hosts"`
Aliases string `xml:"aliases"`
Domains string `xml:"domains"`
} `xml:"unboundplus" json:"unboundplus"`
// Legacy components removed - use dedicated structs from interfaces.go instead
// Openvpn field removed - not present in actual XML files
// Additional legacy components removed - use dedicated structs instead
// CertificateAuthority and DHCPv6Server fields removed - not present in actual XML files
// Cert struct removed - use dedicated struct from certificates.go instead
Routes struct {
Text string `xml:",chardata" json:"text,omitempty"`
Version string `xml:"version,attr" json:"version,omitempty"`
Route string `xml:"route"`
} `xml:"routes" json:"routes"`
UnboundDNS struct {
Text string `xml:",chardata" json:"text,omitempty"`
Version string `xml:"version,attr" json:"version,omitempty"`
Unbound string `xml:"unbound"`
} `xml:"unbound" json:"unbound_internal"`
Created string `xml:"created,omitempty"`
Updated string `xml:"updated,omitempty"`
}
OPNsense represents the main OPNsense system configuration.
type OpenVPN ¶
type OpenVPN struct {
XMLName xml.Name `xml:"openvpn"`
Servers []OpenVPNServer `xml:"openvpn-server,omitempty"`
Clients []OpenVPNClient `xml:"openvpn-client,omitempty"`
ClientExport *ClientExport `xml:"openvpn-client-export,omitempty"`
CSC []OpenVPNCSC `xml:"openvpn-csc,omitempty"`
Created string `xml:"created,omitempty"`
Updated string `xml:"updated,omitempty"`
}
OpenVPN represents OpenVPN configuration.
func NewOpenVPN ¶
func NewOpenVPN() *OpenVPN
NewOpenVPN returns a new OpenVPN configuration with empty server, client, and client-specific configuration lists.
type OpenVPNCSC ¶
type OpenVPNCSC struct {
XMLName xml.Name `xml:"openvpn-csc"`
Common_name string `xml:"common_name,omitempty"` //nolint:revive,staticcheck // XML field name requires underscore
Block BoolFlag `xml:"block,omitempty"`
Tunnel_network string `xml:"tunnel_network,omitempty"` //nolint:revive,staticcheck // XML field name requires underscore
Tunnel_networkv6 string `xml:"tunnel_networkv6,omitempty"` //nolint:revive,staticcheck // XML field name requires underscore
Local_network string `xml:"local_network,omitempty"` //nolint:revive,staticcheck // XML field name requires underscore
Local_networkv6 string `xml:"local_networkv6,omitempty"` //nolint:revive,staticcheck // XML field name requires underscore
Remote_network string `xml:"remote_network,omitempty"` //nolint:revive,staticcheck // XML field name requires underscore
Remote_networkv6 string `xml:"remote_networkv6,omitempty"` //nolint:revive,staticcheck // XML field name requires underscore
Gwredir BoolFlag `xml:"gwredir,omitempty"`
Push_reset BoolFlag `xml:"push_reset,omitempty"` //nolint:revive,staticcheck // XML field name requires underscore
Remove_route BoolFlag `xml:"remove_route,omitempty"` //nolint:revive,staticcheck // XML field name requires underscore
DNS_domain string `xml:"dns_domain,omitempty"` //nolint:revive,staticcheck // XML field name requires underscore
DNS_server1 string `xml:"dns_server1,omitempty"` //nolint:revive,staticcheck // XML field name requires underscore
DNS_server2 string `xml:"dns_server2,omitempty"` //nolint:revive,staticcheck // XML field name requires underscore
DNS_server3 string `xml:"dns_server3,omitempty"` //nolint:revive,staticcheck // XML field name requires underscore
DNS_server4 string `xml:"dns_server4,omitempty"` //nolint:revive,staticcheck // XML field name requires underscore
NTP_server1 string `xml:"ntp_server1,omitempty"` //nolint:revive,staticcheck // XML field name requires underscore
NTP_server2 string `xml:"ntp_server2,omitempty"` //nolint:revive,staticcheck // XML field name requires underscore
Custom_options string `xml:"custom_options,omitempty"` //nolint:revive,staticcheck // XML field name requires underscore
Created string `xml:"created,omitempty"`
Updated string `xml:"updated,omitempty"`
}
OpenVPNCSC represents client-specific configurations for OpenVPN.
type OpenVPNClient ¶
type OpenVPNClient struct {
XMLName xml.Name `xml:"openvpn-client"`
VPN_ID string `xml:"vpnid,omitempty"` //nolint:revive,staticcheck // XML field name requires underscore
Mode string `xml:"mode,omitempty"`
Protocol string `xml:"protocol,omitempty"`
Dev_mode string `xml:"dev_mode,omitempty"` //nolint:revive,staticcheck // XML field name requires underscore
Interface string `xml:"interface,omitempty"`
Server_addr string `xml:"server_addr,omitempty"` //nolint:revive,staticcheck // XML field name requires underscore
Server_port string `xml:"server_port,omitempty"` //nolint:revive,staticcheck // XML field name requires underscore
Description string `xml:"description,omitempty"`
Custom_options string `xml:"custom_options,omitempty"` //nolint:revive,staticcheck // XML field name requires underscore
Cert_ref string `xml:"certref,omitempty"` //nolint:revive,staticcheck // XML field name requires underscore
CA_ref string `xml:"caref,omitempty"` //nolint:revive,staticcheck // XML field name requires underscore
Compression string `xml:"compression,omitempty"`
Verbosity_level string `xml:"verbosity_level,omitempty"` //nolint:revive,staticcheck // XML field name requires underscore
Created string `xml:"created,omitempty"`
Updated string `xml:"updated,omitempty"`
}
OpenVPNClient represents an OpenVPN client configuration.
type OpenVPNExport ¶
type OpenVPNExport struct {
XMLName xml.Name `xml:"OpenVPNExport"`
Text string `xml:",chardata" json:"text,omitempty"`
Version string `xml:"version,attr" json:"version,omitempty"`
Servers string `xml:"servers"`
}
OpenVPNExport represents OpenVPN export configuration.
func NewOpenVPNExport ¶
func NewOpenVPNExport() *OpenVPNExport
NewOpenVPNExport initializes and returns an empty OpenVPNExport configuration.
type OpenVPNServer ¶
type OpenVPNServer struct {
XMLName xml.Name `xml:"openvpn-server"`
VPN_ID string `xml:"vpnid,omitempty"` //nolint:revive,staticcheck // XML field name requires underscore
Mode string `xml:"mode,omitempty"`
Protocol string `xml:"protocol,omitempty"`
Dev_mode string `xml:"dev_mode,omitempty"` //nolint:revive,staticcheck // XML field name requires underscore
Interface string `xml:"interface,omitempty"`
Local_port string `xml:"local_port,omitempty"` //nolint:revive,staticcheck // XML field name requires underscore
Description string `xml:"description,omitempty"`
Custom_options string `xml:"custom_options,omitempty"` //nolint:revive,staticcheck // XML field name requires underscore
TLS string `xml:"tls,omitempty"`
TLS_type string `xml:"tls_type,omitempty"` //nolint:revive,staticcheck // XML field name requires underscore
Cert_ref string `xml:"certref,omitempty"` //nolint:revive,staticcheck // XML field name requires underscore
CA_ref string `xml:"caref,omitempty"` //nolint:revive,staticcheck // XML field name requires underscore
CRL_ref string `xml:"crlref,omitempty"` //nolint:revive,staticcheck // XML field name requires underscore
DH_length string `xml:"dh_length,omitempty"` //nolint:revive,staticcheck // XML field name requires underscore
Ecdh_curve string `xml:"ecdh_curve,omitempty"` //nolint:revive,staticcheck // XML field name requires underscore
Cert_depth string `xml:"cert_depth,omitempty"` //nolint:revive,staticcheck // XML field name requires underscore
Strictusercn BoolFlag `xml:"strictusercn,omitempty"`
Tunnel_network string `xml:"tunnel_network,omitempty"` //nolint:revive,staticcheck // XML field name requires underscore
Tunnel_networkv6 string `xml:"tunnel_networkv6,omitempty"` //nolint:revive,staticcheck // XML field name requires underscore
Remote_network string `xml:"remote_network,omitempty"` //nolint:revive,staticcheck // XML field name requires underscore
Remote_networkv6 string `xml:"remote_networkv6,omitempty"` //nolint:revive,staticcheck // XML field name requires underscore
Gwredir BoolFlag `xml:"gwredir,omitempty"`
Local_network string `xml:"local_network,omitempty"` //nolint:revive,staticcheck // XML field name requires underscore
Local_networkv6 string `xml:"local_networkv6,omitempty"` //nolint:revive,staticcheck // XML field name requires underscore
Maxclients string `xml:"maxclients,omitempty"`
Compression string `xml:"compression,omitempty"`
Passtos BoolFlag `xml:"passtos,omitempty"`
Client2client BoolFlag `xml:"client2client,omitempty"`
Dynamic_ip BoolFlag `xml:"dynamic_ip,omitempty"` //nolint:revive,staticcheck // XML field name requires underscore
Topology string `xml:"topology,omitempty"`
Serverbridge_dhcp BoolFlag `xml:"serverbridge_dhcp,omitempty"` //nolint:revive,staticcheck // XML field name requires underscore
DNS_domain string `xml:"dns_domain,omitempty"` //nolint:revive,staticcheck // XML field name requires underscore
DNS_server1 string `xml:"dns_server1,omitempty"` //nolint:revive,staticcheck // XML field name requires underscore
DNS_server2 string `xml:"dns_server2,omitempty"` //nolint:revive,staticcheck // XML field name requires underscore
DNS_server3 string `xml:"dns_server3,omitempty"` //nolint:revive,staticcheck // XML field name requires underscore
DNS_server4 string `xml:"dns_server4,omitempty"` //nolint:revive,staticcheck // XML field name requires underscore
Push_register_dns BoolFlag `xml:"push_register_dns,omitempty"` //nolint:revive,staticcheck // XML field name requires underscore
NTP_server1 string `xml:"ntp_server1,omitempty"` //nolint:revive,staticcheck // XML field name requires underscore
NTP_server2 string `xml:"ntp_server2,omitempty"` //nolint:revive,staticcheck // XML field name requires underscore
Netbios_enable BoolFlag `xml:"netbios_enable,omitempty"` //nolint:revive,staticcheck // XML field name requires underscore
Netbios_ntype string `xml:"netbios_ntype,omitempty"` //nolint:revive,staticcheck // XML field name requires underscore
Netbios_scope string `xml:"netbios_scope,omitempty"` //nolint:revive,staticcheck // XML field name requires underscore
Verbosity_level string `xml:"verbosity_level,omitempty"` //nolint:revive,staticcheck // XML field name requires underscore
Created string `xml:"created,omitempty"`
Updated string `xml:"updated,omitempty"`
}
OpenVPNServer represents an OpenVPN server configuration.
type OpenVPNSystem ¶
type OpenVPNSystem struct {
XMLName xml.Name `xml:"OpenVPN"`
Text string `xml:",chardata" json:"text,omitempty"`
Version string `xml:"version,attr" json:"version,omitempty"`
Overwrites string `xml:"Overwrites"`
Instances string `xml:"Instances"`
StaticKeys string `xml:"StaticKeys"`
}
OpenVPNSystem represents OpenVPN system configuration.
func NewOpenVPNSystem ¶
func NewOpenVPNSystem() *OpenVPNSystem
NewOpenVPNSystem returns a new, empty OpenVPNSystem configuration instance.
type OpnSenseDocument ¶
type OpnSenseDocument struct {
XMLName xml.Name `xml:"opnsense" json:"-" yaml:"-"`
Version string `` /* 132-byte string literal not displayed */
TriggerInitialWizard struct{} `xml:"trigger_initial_wizard,omitempty" json:"triggerInitialWizard" yaml:"triggerInitialWizard,omitempty"`
Theme string `` /* 162-byte string literal not displayed */
Sysctl []SysctlItem `xml:"sysctl,omitempty" json:"sysctl,omitempty" yaml:"sysctl,omitempty" validate:"dive"`
System System `xml:"system,omitempty" json:"system" yaml:"system,omitempty" validate:"required"`
Interfaces Interfaces `xml:"interfaces,omitempty" json:"interfaces" yaml:"interfaces,omitempty" validate:"required"`
Dhcpd Dhcpd `xml:"dhcpd,omitempty" json:"dhcpd" yaml:"dhcpd,omitempty"`
Unbound Unbound `xml:"unbound,omitempty" json:"unbound" yaml:"unbound,omitempty"`
Snmpd Snmpd `xml:"snmpd,omitempty" json:"snmpd" yaml:"snmpd,omitempty"`
Nat Nat `xml:"nat,omitempty" json:"nat" yaml:"nat,omitempty"`
Filter Filter `xml:"filter,omitempty" json:"filter" yaml:"filter,omitempty"`
Rrd Rrd `xml:"rrd,omitempty" json:"rrd" yaml:"rrd,omitempty"`
LoadBalancer LoadBalancer `xml:"load_balancer,omitempty" json:"loadBalancer" yaml:"loadBalancer,omitempty"`
Ntpd Ntpd `xml:"ntpd,omitempty" json:"ntpd" yaml:"ntpd,omitempty"`
Widgets Widgets `xml:"widgets,omitempty" json:"widgets" yaml:"widgets,omitempty"`
Revision Revision `xml:"revision,omitempty" json:"revision" yaml:"revision,omitempty"`
Gateways Gateways `xml:"gateways,omitempty" json:"gateways" yaml:"gateways,omitempty"`
HighAvailabilitySync HighAvailabilitySync `xml:"hasync,omitempty" json:"hasync" yaml:"hasync,omitempty"`
InterfaceGroups InterfaceGroups `xml:"ifgroups,omitempty" json:"ifgroups" yaml:"ifgroups,omitempty"`
GIFInterfaces GIFInterfaces `xml:"gifs,omitempty" json:"gifs" yaml:"gifs,omitempty"`
GREInterfaces GREInterfaces `xml:"gres,omitempty" json:"gres" yaml:"gres,omitempty"`
LAGGInterfaces LAGGInterfaces `xml:"laggs,omitempty" json:"laggs" yaml:"laggs,omitempty"`
VirtualIP VirtualIP `xml:"virtualip,omitempty" json:"virtualip" yaml:"virtualip,omitempty"`
VLANs VLANs `xml:"vlans,omitempty" json:"vlans" yaml:"vlans,omitempty"`
OpenVPN OpenVPN `xml:"openvpn,omitempty" json:"openvpn" yaml:"openvpn,omitempty"`
StaticRoutes StaticRoutes `xml:"staticroutes,omitempty" json:"staticroutes" yaml:"staticroutes,omitempty"`
Bridges BridgesConfig `xml:"bridges,omitempty" json:"bridges" yaml:"bridges,omitempty"`
PPPInterfaces PPPInterfaces `xml:"ppps,omitempty" json:"ppps" yaml:"ppps,omitempty"`
Wireless Wireless `xml:"wireless,omitempty" json:"wireless" yaml:"wireless,omitempty"`
CertificateAuthority CertificateAuthority `xml:"ca,omitempty" json:"ca" yaml:"ca,omitempty"`
DHCPv6Server DHCPv6Server `xml:"dhcpdv6,omitempty" json:"dhcpdv6" yaml:"dhcpdv6,omitempty"`
Cert Cert `xml:"cert,omitempty" json:"cert" yaml:"cert,omitempty"`
DNSMasquerade DNSMasq `xml:"dnsmasq,omitempty" json:"dnsmasq" yaml:"dnsmasq,omitempty"`
Syslog Syslog `xml:"syslog,omitempty" json:"syslog" yaml:"syslog,omitempty"`
OPNsense OPNsense `xml:"OPNsense,omitempty" json:"opnsense" yaml:"opnsense,omitempty"`
}
OpnSenseDocument is the root of the OPNsense configuration.
func NewOpnSenseDocument ¶
func NewOpnSenseDocument() *OpnSenseDocument
NewOpnSenseDocument returns a new OpnSenseDocument with all slice and map fields initialized for safe use.
func (*OpnSenseDocument) FilterRules ¶
func (o *OpnSenseDocument) FilterRules() []Rule
FilterRules returns a slice of all firewall filter rules configured in the system. This provides direct access to the firewall rules for analysis, processing, or iteration.
Returns:
- []Rule: Slice of all firewall rules, may be empty if no rules are configured
Example:
rules := config.FilterRules()
fmt.Printf("Found %d firewall rules\n", len(rules))
for i, rule := range rules {
fmt.Printf("Rule %d: %s %s on %s\n", i+1, rule.Type, rule.IPProtocol, rule.Interface)
}
func (*OpnSenseDocument) Hostname ¶
func (o *OpnSenseDocument) Hostname() string
Hostname returns the configured hostname from the system configuration. This is a convenience method that extracts the hostname field from the nested System struct.
Example:
hostname := config.Hostname()
fmt.Printf("Firewall hostname: %s\n", hostname)
func (*OpnSenseDocument) InterfaceByName ¶
func (o *OpnSenseDocument) InterfaceByName(name string) *Interface
InterfaceByName returns a network interface by its interface name (e.g., "em0", "igb0"). It searches through all interfaces in the map-based Interfaces struct and returns a pointer to the matching interface, or nil if no interface with the given name is found.
Parameters:
- name: The interface name to search for (e.g., "em0", "igb0", "vtnet0")
Returns:
- *Interface: Pointer to the matching interface, or nil if not found
Example:
iface := config.InterfaceByName("em0")
if iface != nil {
fmt.Printf("Interface %s has IP: %s\n", iface.If, iface.IPAddr)
}
func (*OpnSenseDocument) NetworkConfig ¶
func (o *OpnSenseDocument) NetworkConfig() NetworkConfig
NetworkConfig returns the network configuration grouped by functionality. This provides a focused view of network-related settings including all interface configurations.
Returns:
- NetworkConfig: Grouped network configuration containing interface definitions
Example:
netConfig := config.NetworkConfig()
fmt.Printf("WAN IP: %s\n", netConfig.Interfaces.Wan.IPAddr)
fmt.Printf("LAN IP: %s\n", netConfig.Interfaces.Lan.IPAddr)
func (*OpnSenseDocument) SecurityConfig ¶
func (o *OpnSenseDocument) SecurityConfig() SecurityConfig
SecurityConfig returns the security configuration grouped by functionality. This groups security-related settings including firewall rules and NAT configuration into a single structured object for security analysis and processing.
Returns:
- SecurityConfig: Grouped security configuration containing NAT and Filter settings
Example:
secConfig := config.SecurityConfig()
fmt.Printf("NAT mode: %s\n", secConfig.Nat.Outbound.Mode)
fmt.Printf("Filter rules: %d\n", len(secConfig.Filter.Rule))
func (*OpnSenseDocument) ServiceConfig ¶
func (o *OpnSenseDocument) ServiceConfig() ServiceConfig
ServiceConfig returns the service configuration grouped by functionality. This groups all service-related settings including DHCP, DNS, SNMP, monitoring, load balancing, and time services into a single structured object.
Returns:
- ServiceConfig: Grouped service configuration containing all service settings
Example:
svcConfig := config.ServiceConfig()
if lanDhcp, ok := svcConfig.Dhcpd.Get("lan"); ok && lanDhcp.Range.From != "" {
fmt.Printf("DHCP range: %s - %s\n", lanDhcp.Range.From, lanDhcp.Range.To)
}
fmt.Printf("SNMP community: %s\n", svcConfig.Snmpd.ROCommunity)
func (*OpnSenseDocument) SystemConfig ¶
func (o *OpnSenseDocument) SystemConfig() SystemConfig
SystemConfig returns the system configuration grouped by functionality. This groups system-level settings including core system configuration and sysctl tunables into a single structured object for easier access and processing.
Returns:
- SystemConfig: Grouped system configuration containing System and Sysctl fields
Example:
sysConfig := config.SystemConfig()
fmt.Printf("Hostname: %s\n", sysConfig.System.Hostname)
fmt.Printf("Sysctl items: %d\n", len(sysConfig.Sysctl))
type Options ¶
type Options struct {
Path string `xml:"path,omitempty"`
Host string `xml:"host,omitempty"`
Code string `xml:"code,omitempty"`
Send string `xml:"send,omitempty"`
Expect string `xml:"expect,omitempty"`
}
Options contains the options for a load balancer monitor type.
type PPPInterfaces ¶
type PPPInterfaces struct {
XMLName xml.Name `xml:"ppps" json:"-" yaml:"-"`
Ppp string `xml:"ppp,omitempty" json:"ppp,omitempty" yaml:"ppp,omitempty"`
}
PPPInterfaces represents PPP interface configuration.
type PerformanceFinding ¶
type PerformanceFinding struct {
Component string `json:"component"`
Issue string `json:"issue"`
Severity string `json:"severity"`
Description string `json:"description"`
Recommendation string `json:"recommendation"`
}
PerformanceFinding represents a performance finding.
type PerformanceMetrics ¶
type PerformanceMetrics struct {
ConfigComplexity int `json:"configComplexity"`
RuleEfficiency int `json:"ruleEfficiency"`
ResourceUsage int `json:"resourceUsage"`
}
PerformanceMetrics contains performance metrics.
type Revision ¶
type Revision struct {
Username string `xml:"username,omitempty" json:"username,omitempty" yaml:"username,omitempty"`
Time string `xml:"time,omitempty" json:"time,omitempty" yaml:"time,omitempty"`
Description string `xml:"description,omitempty" json:"description,omitempty" yaml:"description,omitempty"`
}
Revision represents configuration revision information.
type Rrd ¶
type Rrd struct {
Enable struct{} `xml:"enable"`
}
Rrd contains the RRDtool configuration.
type Rule ¶
type Rule struct {
XMLName xml.Name `xml:"rule"`
Type string `xml:"type"`
Descr string `xml:"descr,omitempty"`
Interface string `xml:"interface,omitempty"`
IPProtocol string `xml:"ipprotocol,omitempty"`
StateType string `xml:"statetype,omitempty"`
Direction string `xml:"direction,omitempty"`
Quick string `xml:"quick,omitempty"`
Protocol string `xml:"protocol,omitempty"`
Source Source `xml:"source"`
Destination Destination `xml:"destination"`
Target string `xml:"target,omitempty"`
SourcePort string `xml:"sourceport,omitempty"`
Disabled string `xml:"disabled,omitempty"`
Updated *Updated `xml:"updated,omitempty"`
Created *Created `xml:"created,omitempty"`
UUID string `xml:"uuid,attr,omitempty"`
}
Rule represents a firewall rule.
type RuleLocation ¶
type RuleLocation struct {
XMLName xml.Name `xml:",omitempty"`
Network string `xml:"network,omitempty"`
Address string `xml:"address,omitempty"`
Subnet string `xml:"subnet,omitempty"`
Port string `xml:"port,omitempty"`
Not BoolFlag `xml:"not,omitempty"`
}
RuleLocation provides granular source/destination address and port specification.
func (*RuleLocation) IsAny ¶
func (rl *RuleLocation) IsAny() bool
IsAny returns true if this location represents "any".
func (*RuleLocation) String ¶
func (rl *RuleLocation) String() string
String returns a human-readable representation of the rule location.
type SSHConfig ¶
type SSHConfig struct {
Group string `xml:"group" json:"group" yaml:"group" validate:"required"`
}
SSHConfig represents the SSH configuration.
type SecurityAssessment ¶
type SecurityAssessment struct {
OverallScore int `json:"overallScore"`
SecurityFeatures []string `json:"securityFeatures"`
Vulnerabilities []string `json:"vulnerabilities"`
Recommendations []string `json:"recommendations"`
}
SecurityAssessment contains security assessment data.
type SecurityConfig ¶
type SecurityConfig struct {
Nat Nat `json:"nat" yaml:"nat,omitempty"`
Filter Filter `json:"filter" yaml:"filter,omitempty"`
}
SecurityConfig groups security-related configuration.
func NewSecurityConfig ¶
func NewSecurityConfig() SecurityConfig
NewSecurityConfig returns a new SecurityConfig instance with an empty filter rule set.
type SecurityFinding ¶
type SecurityFinding struct {
Component string `json:"component"`
Issue string `json:"issue"`
Severity string `json:"severity"`
Description string `json:"description"`
Recommendation string `json:"recommendation"`
}
SecurityFinding represents a security finding.
type ServiceConfig ¶
type ServiceConfig struct {
Dhcpd Dhcpd `json:"dhcpd" yaml:"dhcpd,omitempty"`
Unbound Unbound `json:"unbound" yaml:"unbound,omitempty"`
Snmpd Snmpd `json:"snmpd" yaml:"snmpd,omitempty"`
Rrd Rrd `json:"rrd" yaml:"rrd,omitempty"`
LoadBalancer LoadBalancer `json:"loadBalancer" yaml:"loadBalancer,omitempty"`
Ntpd Ntpd `json:"ntpd" yaml:"ntpd,omitempty"`
}
ServiceConfig groups service-related configuration.
type ServiceStatistics ¶
type ServiceStatistics struct {
Name string `json:"name"`
Enabled bool `json:"enabled"`
Details map[string]string `json:"details,omitempty"`
}
ServiceStatistics contains statistics for a service.
type Snmpd ¶
type Snmpd struct {
SysLocation string `xml:"syslocation"`
SysContact string `xml:"syscontact"`
ROCommunity string `xml:"rocommunity"`
}
Snmpd contains the SNMP daemon configuration.
type StaticRoute ¶
type StaticRoute struct {
XMLName xml.Name `xml:"route"`
Network string `xml:"network,omitempty"`
Gateway string `xml:"gateway,omitempty"`
Descr string `xml:"descr,omitempty"`
Disabled BoolFlag `xml:"disabled,omitempty"`
Created string `xml:"created,omitempty"`
Updated string `xml:"updated,omitempty"`
}
StaticRoute struct for individual static route configuration.
type StaticRoutes ¶
type StaticRoutes struct {
XMLName xml.Name `xml:"staticroutes"`
Route []StaticRoute `xml:"route,omitempty"`
}
StaticRoutes represents static routing configuration.
func NewStaticRoutes ¶
func NewStaticRoutes() *StaticRoutes
NewStaticRoutes returns a pointer to a StaticRoutes struct with an initialized empty slice of StaticRoute.
type Statistics ¶
type Statistics struct {
// Interface statistics
TotalInterfaces int `json:"totalInterfaces"`
InterfacesByType map[string]int `json:"interfacesByType"`
InterfaceDetails []InterfaceStatistics `json:"interfaceDetails"`
// Firewall and NAT statistics
TotalFirewallRules int `json:"totalFirewallRules"`
RulesByInterface map[string]int `json:"rulesByInterface"`
RulesByType map[string]int `json:"rulesByType"`
NATEntries int `json:"natEntries"`
NATMode string `json:"natMode"`
// DHCP statistics
DHCPScopes int `json:"dhcpScopes"`
DHCPScopeDetails []DHCPScopeStatistics `json:"dhcpScopeDetails"`
// User and group statistics
TotalUsers int `json:"totalUsers"`
UsersByScope map[string]int `json:"usersByScope"`
TotalGroups int `json:"totalGroups"`
GroupsByScope map[string]int `json:"groupsByScope"`
// Service statistics
EnabledServices []string `json:"enabledServices"`
TotalServices int `json:"totalServices"`
ServiceDetails []ServiceStatistics `json:"serviceDetails"`
// System configuration statistics
SysctlSettings int `json:"sysctlSettings"`
LoadBalancerMonitors int `json:"loadBalancerMonitors"`
SecurityFeatures []string `json:"securityFeatures"`
// Summary counts for quick reference
Summary StatisticsSummary `json:"summary"`
}
Statistics contains calculated statistics about the configuration.
type StatisticsSummary ¶
type StatisticsSummary struct {
TotalConfigItems int `json:"totalConfigItems"`
SecurityScore int `json:"securityScore"`
ConfigComplexity int `json:"configComplexity"`
HasSecurityFeatures bool `json:"hasSecurityFeatures"`
}
StatisticsSummary contains summary statistics.
type Swanctl ¶
type Swanctl struct {
XMLName xml.Name `xml:"Swanctl"`
Text string `xml:",chardata" json:"text,omitempty"`
Version string `xml:"version,attr" json:"version,omitempty"`
Connections string `xml:"Connections"`
Locals string `xml:"locals"`
Remotes string `xml:"remotes"`
Children string `xml:"children"`
Pools string `xml:"Pools"`
VTIs string `xml:"VTIs"`
SPDs string `xml:"SPDs"`
}
Swanctl represents StrongSwan configuration.
func NewSwanctl ¶
func NewSwanctl() *Swanctl
NewSwanctl returns a new instance of the Swanctl configuration struct.
type SysctlItem ¶
type SysctlItem struct {
Descr string `xml:"descr" json:"description,omitempty" yaml:"description,omitempty"`
Tunable string `xml:"tunable" json:"tunable" yaml:"tunable" validate:"required"`
Value string `xml:"value" json:"value" yaml:"value" validate:"required"`
Key string `xml:"key,omitempty" json:"key,omitempty" yaml:"key,omitempty"`
Secret string `xml:"secret,omitempty" json:"secret,omitempty" yaml:"secret,omitempty"`
Item string `xml:"item,omitempty" json:"item,omitempty" yaml:"item,omitempty"`
}
SysctlItem represents a single sysctl item. This supports both the simple format (direct elements) and nested item format.
type Syslog ¶
type Syslog struct {
XMLName xml.Name `xml:"syslog"`
Reverse []string `xml:"reverse,omitempty"`
Nentries string `xml:"nentries,omitempty"`
Remoteserver string `xml:"remoteserver,omitempty"`
Remoteserver2 string `xml:"remoteserver2,omitempty"`
Remoteserver3 string `xml:"remoteserver3,omitempty"`
Sourceip string `xml:"sourceip,omitempty"`
IPProtocol string `xml:"ipprotocol,omitempty"`
Filter BoolFlag `xml:"filter,omitempty"`
Dhcp BoolFlag `xml:"dhcp,omitempty"`
Auth BoolFlag `xml:"auth,omitempty"`
Portalauth BoolFlag `xml:"portalauth,omitempty"`
VPN BoolFlag `xml:"vpn,omitempty"`
DPinger BoolFlag `xml:"dpinger,omitempty"`
Hostapd BoolFlag `xml:"hostapd,omitempty"`
System BoolFlag `xml:"system,omitempty"`
Resolver BoolFlag `xml:"resolver,omitempty"`
PPP BoolFlag `xml:"ppp,omitempty"`
Enable BoolFlag `xml:"enable,omitempty"`
LogFilesize string `xml:"logfilesize,omitempty"`
RotateCount string `xml:"rotatecount,omitempty"`
Format string `xml:"format,omitempty"`
IgmpProxy BoolFlag `xml:"igmpproxy,omitempty"`
Created string `xml:"created,omitempty"`
Updated string `xml:"updated,omitempty"`
}
Syslog represents system logging configuration.
type System ¶
type System struct {
Optimization string `` /* 200-byte string literal not displayed */
Hostname string `` /* 158-byte string literal not displayed */
Domain string `` /* 154-byte string literal not displayed */
DNSAllowOverride int `xml:"dnsallowoverride" json:"dnsAllowOverride,omitempty" yaml:"dnsAllowOverride,omitempty"`
DNSServer string `xml:"dnsserver" json:"dnsServer,omitempty" yaml:"dnsServer,omitempty"`
Language string `xml:"language" json:"language,omitempty" yaml:"language,omitempty"`
Firmware Firmware `xml:"firmware" json:"firmware" yaml:"firmware,omitempty"`
Group []Group `` /* 145-byte string literal not displayed */
User []User `` /* 145-byte string literal not displayed */
WebGUI WebGUIConfig `xml:"webgui" json:"webgui" yaml:"webgui,omitempty"`
SSH SSHConfig `xml:"ssh" json:"ssh" yaml:"ssh,omitempty"`
Timezone string `xml:"timezone" json:"timezone,omitempty" yaml:"timezone,omitempty"`
TimeServers string `xml:"timeservers" json:"timeServers,omitempty" yaml:"timeServers,omitempty"`
UseVirtualTerminal int `xml:"usevirtualterminal" json:"useVirtualTerminal,omitempty" yaml:"useVirtualTerminal,omitempty"`
DisableVLANHWFilter int `xml:"disablevlanhwfilter" json:"disableVlanHwFilter,omitempty" yaml:"disableVlanHwFilter,omitempty"`
DisableChecksumOffloading int `xml:"disablechecksumoffloading" json:"disableChecksumOffloading,omitempty" yaml:"disableChecksumOffloading,omitempty"`
DisableSegmentationOffloading int `` /* 129-byte string literal not displayed */
DisableLargeReceiveOffloading int `` /* 129-byte string literal not displayed */
IPv6Allow string `xml:"ipv6allow" json:"ipv6Allow,omitempty" yaml:"ipv6Allow,omitempty"`
DisableNATReflection string `xml:"disablenatreflection" json:"disableNatReflection,omitempty" yaml:"disableNatReflection,omitempty"`
DisableConsoleMenu struct{} `xml:"disableconsolemenu" json:"disableConsoleMenu" yaml:"disableConsoleMenu,omitempty"`
NextUID int `xml:"nextuid" json:"nextUid,omitempty" yaml:"nextUid,omitempty"`
NextGID int `xml:"nextgid" json:"nextGid,omitempty" yaml:"nextGid,omitempty"`
PowerdACMode string `` /* 192-byte string literal not displayed */
PowerdBatteryMode string `` /* 192-byte string literal not displayed */
PowerdNormalMode string `` /* 192-byte string literal not displayed */
Bogons struct {
Interval string `xml:"interval" json:"interval,omitempty" yaml:"interval,omitempty" validate:"omitempty,oneof=monthly weekly daily never"`
} `xml:"bogons" json:"bogons" yaml:"bogons,omitempty"`
LbUseSticky int `xml:"lb_use_sticky" json:"lbUseSticky,omitempty" yaml:"lbUseSticky,omitempty"`
RrdBackup int `xml:"rrdbackup" json:"rrdBackup,omitempty" yaml:"rrdBackup,omitempty"`
NetflowBackup int `xml:"netflowbackup" json:"netflowBackup,omitempty" yaml:"netflowBackup,omitempty"`
// Missing service configurations
NTPD struct {
Prefer string `xml:"prefer" json:"prefer,omitempty" yaml:"prefer,omitempty"`
} `xml:"ntpd" json:"ntpd" yaml:"ntpd,omitempty"`
SNMPD struct {
SysLocation string `xml:"syslocation"`
SysContact string `xml:"syscontact"`
ROCommunity string `xml:"rocommunity"`
} `xml:"snmpd" json:"snmpd" yaml:"snmpd,omitempty"`
RRD struct {
Enable struct{} `xml:"enable"`
} `xml:"rrd" json:"rrd" yaml:"rrd,omitempty"`
LoadBalancer struct {
MonitorType []MonitorType `xml:"monitor_type"`
} `xml:"load_balancer" json:"loadBalancer" yaml:"loadBalancer,omitempty"`
Unbound Unbound `xml:"unbound" json:"unbound" yaml:"unbound,omitempty"`
// System notes for additional configuration information
Notes []string `xml:"notes>note" json:"notes,omitempty" yaml:"notes,omitempty"`
}
System contains the system configuration.
type SystemConfig ¶
type SystemConfig struct {
System System `json:"system" yaml:"system,omitempty" validate:"required"`
Sysctl []SysctlItem `json:"sysctl,omitempty" yaml:"sysctl,omitempty"`
}
SystemConfig groups system-related configuration.
func NewSystemConfig ¶
func NewSystemConfig() SystemConfig
NewSystemConfig returns a SystemConfig instance with the Sysctl slice initialized as empty.
type Unbound ¶
type Unbound struct {
Enable string `xml:"enable" json:"enable" yaml:"enable"`
Dnssec string `xml:"dnssec,omitempty" json:"dnssec,omitempty" yaml:"dnssec,omitempty"`
Dnssecstripped string `xml:"dnssecstripped,omitempty" json:"dnssecstripped,omitempty" yaml:"dnssecstripped,omitempty"`
}
Unbound represents the Unbound DNS resolver configuration.
type UnusedInterfaceFinding ¶
type UnusedInterfaceFinding struct {
InterfaceName string `json:"interfaceName"`
Description string `json:"description"`
Recommendation string `json:"recommendation"`
}
UnusedInterfaceFinding represents an unused interface finding.
type Updated ¶
type Updated struct {
Username string `xml:"username"`
Time string `xml:"time"`
Description string `xml:"description"`
}
Updated represents update information.
type User ¶
type User struct {
Name string `xml:"name" json:"name" yaml:"name" validate:"required,alphanum"`
Disabled BoolFlag `xml:"disabled" json:"disabled" yaml:"disabled"`
Descr string `xml:"descr" json:"description,omitempty" yaml:"description,omitempty"`
Scope string `xml:"scope" json:"scope" yaml:"scope" validate:"required,oneof=system local"`
Groupname string `xml:"groupname" json:"groupname" yaml:"groupname" validate:"required"`
Password string `xml:"password" json:"password" yaml:"password" validate:"required"`
UID string `xml:"uid" json:"uid" yaml:"uid" validate:"required,numeric"`
APIKeys []APIKey `xml:"apikeys>item" json:"apiKeys,omitempty" yaml:"apiKeys,omitempty"`
Expires struct{} `xml:"expires" json:"expires" yaml:"expires,omitempty"`
AuthorizedKeys struct{} `xml:"authorizedkeys" json:"authorizedKeys" yaml:"authorizedKeys,omitempty"`
IPSecPSK struct{} `xml:"ipsecpsk" json:"ipsecPsk" yaml:"ipsecPsk,omitempty"`
OTPSeed struct{} `xml:"otp_seed" json:"otpSeed" yaml:"otpSeed,omitempty"`
}
User represents a user.
type VLAN ¶
type VLAN struct {
XMLName xml.Name `xml:"vlan"`
If string `xml:"if,omitempty"`
Tag string `xml:"tag,omitempty"`
Descr string `xml:"descr,omitempty"`
Vlanif string `xml:"vlanif,omitempty"`
Created string `xml:"created,omitempty"`
Updated string `xml:"updated,omitempty"`
}
VLAN represents a VLAN configuration in the OPNsense document.
type VLANConfig ¶
type VLANConfig struct {
Name string `xml:"vlanif,omitempty"`
Tag string `xml:"tag,omitempty"`
PhysicalInterface string `xml:"if,omitempty"`
Enable string `xml:"enable,omitempty"`
Description string `xml:"descr,omitempty"`
}
VLANConfig represents a Virtual Local Area Network configuration for network config.
type VirtualIP ¶
type VirtualIP struct {
XMLName xml.Name `xml:"virtualip" json:"-" yaml:"-"`
Version string `xml:"version,attr,omitempty" json:"version,omitempty" yaml:"version,omitempty"`
Vip string `xml:"vip,omitempty" json:"vip,omitempty" yaml:"vip,omitempty"`
}
VirtualIP represents virtual IP configuration.
type WebGUIConfig ¶
type WebGUIConfig struct {
Protocol string `xml:"protocol" json:"protocol" yaml:"protocol" validate:"required,oneof=http https"`
SSLCertRef string `xml:"ssl-certref,omitempty" json:"sslCertRef,omitempty" yaml:"sslCertRef,omitempty"`
}
WebGUIConfig represents the WebGUI configuration.
type Widgets ¶
type Widgets struct {
Sequence string `xml:"sequence" json:"sequence,omitempty" yaml:"sequence,omitempty"`
ColumnCount string `xml:"column_count" json:"columnCount,omitempty" yaml:"columnCount,omitempty"`
}
Widgets represents the dashboard widgets configuration.
type WireGuard ¶
type WireGuard struct {
XMLName xml.Name `xml:"wireguard"`
Text string `xml:",chardata" json:"text,omitempty"`
General struct {
Text string `xml:",chardata" json:"text,omitempty"`
Version string `xml:"version,attr" json:"version,omitempty"`
Enabled string `xml:"enabled" json:"enabled,omitempty"`
} `xml:"general" json:"general"`
Server struct {
Text string `xml:",chardata" json:"text,omitempty"`
Version string `xml:"version,attr" json:"version,omitempty"`
Servers struct {
Text string `xml:",chardata" json:"text,omitempty"`
Server []WireGuardServerItem `xml:"server" json:"server,omitempty"`
} `xml:"servers" json:"servers"`
} `xml:"server" json:"server"`
Client struct {
Text string `xml:",chardata" json:"text,omitempty"`
Version string `xml:"version,attr" json:"version,omitempty"`
Clients struct {
Text string `xml:",chardata" json:"text,omitempty"`
Client []WireGuardClientItem `xml:"client" json:"client,omitempty"`
} `xml:"clients" json:"clients"`
} `xml:"client" json:"client"`
}
WireGuard represents WireGuard VPN configuration.
func NewWireGuard ¶
func NewWireGuard() *WireGuard
NewWireGuard returns a new WireGuard configuration instance with default values.
type WireGuardClientItem ¶
type WireGuardClientItem struct {
Text string `xml:",chardata" json:"text,omitempty"`
UUID string `xml:"uuid,attr" json:"uuid,omitempty"`
Version string `xml:"version,attr" json:"version,omitempty"`
Enabled string `xml:"enabled" json:"enabled,omitempty"`
Name string `xml:"name" json:"name,omitempty"`
Pubkey string `xml:"pubkey" json:"pubkey,omitempty"`
PSK string `xml:"psk" json:"psk,omitempty"`
Tunneladdress string `xml:"tunneladdress" json:"tunneladdress,omitempty"`
Serveraddress string `xml:"serveraddress" json:"serveraddress,omitempty"`
Serverport string `xml:"serverport" json:"serverport,omitempty"`
Keepalive string `xml:"keepalive" json:"keepalive,omitempty"`
}
WireGuardClientItem represents a WireGuard client configuration.
type WireGuardServerItem ¶
type WireGuardServerItem struct {
Text string `xml:",chardata" json:"text,omitempty"`
UUID string `xml:"uuid,attr" json:"uuid,omitempty"`
Version string `xml:"version,attr" json:"version,omitempty"`
Enabled string `xml:"enabled" json:"enabled,omitempty"`
Name string `xml:"name" json:"name,omitempty"`
Instance string `xml:"instance" json:"instance,omitempty"`
Pubkey string `xml:"pubkey" json:"pubkey,omitempty"`
Privkey string `xml:"privkey" json:"privkey,omitempty"`
Port string `xml:"port" json:"port,omitempty"`
MTU string `xml:"mtu" json:"mtu,omitempty"`
DNS string `xml:"dns" json:"dns,omitempty"`
Tunneladdress string `xml:"tunneladdress" json:"tunneladdress,omitempty"`
Disableroutes string `xml:"disableroutes" json:"disableroutes,omitempty"`
Gateway string `xml:"gateway" json:"gateway,omitempty"`
Peers string `xml:"peers" json:"peers,omitempty"`
}
WireGuardServerItem represents a WireGuard server configuration.