Documentation
¶
Overview ¶
Package pfsense defines the data structures for pfSense configurations.
Package pfsense defines the data structures for pfSense configurations.
Package pfsense defines the data structures for pfSense configurations.
Package pfsense defines the data structures for pfSense configurations.
Package pfsense defines the data structures for pfSense configurations.
Package pfsense defines the data structures for pfSense configurations.
Package pfsense defines the data structures for pfSense configurations.
Index ¶
- type Cron
- type CronItem
- type DHCPv6
- type DHCPv6Interface
- 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 Diag
- type Document
- type Filter
- type FilterRule
- type Group
- type IPv6NAT
- type InboundRule
- type Interface
- 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(decoder *xml.Decoder, start xml.StartElement) error
- func (i *Interfaces) Wan() (Interface, bool)
- type Nat
- type SyslogConfig
- type System
- type UnboundConfig
- type User
- type WebGUI
- type Widgets
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cron ¶
type Cron struct {
Items []CronItem `xml:"item,omitempty" json:"items,omitempty" yaml:"items,omitempty"`
}
Cron represents the pfSense cron configuration.
type CronItem ¶
type CronItem struct {
Minute string `xml:"minute" json:"minute" yaml:"minute"`
Hour string `xml:"hour" json:"hour" yaml:"hour"`
MDay string `xml:"mday" json:"mday" yaml:"mday"`
Month string `xml:"month" json:"month" yaml:"month"`
WDay string `xml:"wday" json:"wday" yaml:"wday"`
Who string `xml:"who" json:"who" yaml:"who"`
Command string `xml:"command" json:"command" yaml:"command"`
}
CronItem represents a single pfSense cron job entry.
type DHCPv6 ¶
type DHCPv6 struct {
Items map[string]DHCPv6Interface `xml:",any" json:"dhcpv6,omitempty" yaml:"dhcpv6,omitempty"`
}
DHCPv6 contains the DHCPv6 server configuration for all interfaces. Uses a map-based representation identical to Dhcpd, supporting wan, lan, opt0, etc.
func (*DHCPv6) Get ¶
func (d *DHCPv6) Get(key string) (DHCPv6Interface, bool)
Get returns a DHCPv6 interface configuration by its key name (e.g., "lan", "opt0"). Returns the DHCPv6 interface configuration and a boolean indicating if it was found.
func (*DHCPv6) MarshalXML ¶
MarshalXML implements custom XML marshaling for the DHCPv6 map.
func (*DHCPv6) Names ¶
Names returns a slice of all DHCPv6 interface key names in the configuration.
func (*DHCPv6) UnmarshalXML ¶
UnmarshalXML implements custom XML unmarshaling for the DHCPv6 map.
type DHCPv6Interface ¶
type DHCPv6Interface struct {
Enable string `xml:"enable,omitempty" json:"enable,omitempty" yaml:"enable,omitempty"`
Range opnsense.Range `xml:"range,omitempty" json:"range" yaml:"range,omitempty"`
RAMode string `xml:"ramode,omitempty" json:"raMode,omitempty" yaml:"raMode,omitempty"`
RAPriority string `xml:"rapriority,omitempty" json:"raPriority,omitempty" yaml:"raPriority,omitempty"`
}
DHCPv6Interface contains the DHCPv6 server configuration for a specific interface. It includes pfSense-specific fields for Router Advertisement mode and priority.
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 pfSense interfaces. Uses a map-based representation where keys are interface identifiers (wan, lan, opt0, etc.).
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.
func (*Dhcpd) Lan ¶
func (d *Dhcpd) Lan() (DhcpdInterface, bool)
Lan returns the LAN DHCP configuration if it exists, otherwise returns a zero-value DhcpdInterface and false.
func (*Dhcpd) MarshalXML ¶
MarshalXML implements custom XML marshaling for the Dhcpd map.
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 configuration if it exists, otherwise returns a zero-value DhcpdInterface and false.
type DhcpdInterface ¶
type DhcpdInterface struct {
Enable opnsense.BoolFlag `xml:"enable,omitempty" json:"enable,omitempty" yaml:"enable,omitempty"`
Range opnsense.Range `xml:"range,omitempty" json:"range" yaml:"range,omitempty"`
Gateway string `xml:"gateway,omitempty" json:"gateway,omitempty" yaml:"gateway,omitempty"`
DdnsDomainAlgorithm string `xml:"ddnsdomainalgorithm,omitempty" json:"ddnsdomainalgorithm,omitempty" yaml:"ddnsdomainalgorithm,omitempty"`
NumberOptions []opnsense.DHCPNumberOption `xml:"numberoptions>item,omitempty" json:"numberOptions,omitempty" yaml:"numberOptions,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"`
Staticmap []opnsense.DHCPStaticLease `xml:"staticmap,omitempty" json:"staticmap,omitempty" yaml:"staticmap,omitempty"`
// Advanced DHCP fields
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"`
// Advanced DHCP options
AdvDHCPPTTimeout string `` /* 131-byte string literal not displayed */
AdvDHCPPTRetry string `` /* 129-byte string literal not displayed */
AdvDHCPPTSelectTimeout string `` /* 137-byte string literal not displayed */
AdvDHCPPTReboot string `` /* 130-byte string literal not displayed */
AdvDHCPPTBackoffCutoff string `` /* 137-byte string literal not displayed */
AdvDHCPPTInitialInterval string `` /* 139-byte string literal not displayed */
AdvDHCPPTValues string `` /* 130-byte string literal not displayed */
AdvDHCPSendOptions string `` /* 133-byte string literal not displayed */
AdvDHCPRequestOptions string `` /* 136-byte string literal not displayed */
AdvDHCPRequiredOptions string `` /* 137-byte string literal not displayed */
AdvDHCPOptionModifiers string `` /* 137-byte string literal not displayed */
AdvDHCPConfigAdvanced string `` /* 136-byte string literal not displayed */
AdvDHCPConfigFileOverride string `` /* 140-byte string literal not displayed */
AdvDHCPConfigFileOverridePath string `` /* 144-byte string literal not displayed */
// Advanced DHCPv6 fields
Track6Interface string `` /* 167-byte string literal not displayed */
Track6PrefixID string `` /* 166-byte string literal not displayed */
AdvDHCP6InterfaceStatementSendOptions string `` /* 189-byte string literal not displayed */
AdvDHCP6InterfaceStatementRequestOptions string `` /* 192-byte string literal not displayed */
AdvDHCP6InterfaceStatementInformationOnlyEnable string `` /* 199-byte string literal not displayed */
AdvDHCP6InterfaceStatementScript string `` /* 184-byte string literal not displayed */
AdvDHCP6IDAssocStatementAddressEnable string `` /* 189-byte string literal not displayed */
AdvDHCP6IDAssocStatementAddress string `` /* 183-byte string literal not displayed */
AdvDHCP6IDAssocStatementAddressID string `` /* 185-byte string literal not displayed */
AdvDHCP6IDAssocStatementAddressPLTime string `` /* 189-byte string literal not displayed */
AdvDHCP6IDAssocStatementAddressVLTime string `` /* 189-byte string literal not displayed */
AdvDHCP6IDAssocStatementPrefixEnable string `` /* 188-byte string literal not displayed */
AdvDHCP6IDAssocStatementPrefix string `` /* 182-byte string literal not displayed */
AdvDHCP6IDAssocStatementPrefixID string `` /* 184-byte string literal not displayed */
AdvDHCP6IDAssocStatementPrefixPLTime string `` /* 188-byte string literal not displayed */
AdvDHCP6IDAssocStatementPrefixVLTime string `` /* 188-byte string literal not displayed */
AdvDHCP6PrefixInterfaceStatementSLALen string `` /* 190-byte string literal not displayed */
AdvDHCP6AuthenticationStatementAuthName string `` /* 191-byte string literal not displayed */
AdvDHCP6AuthenticationStatementProtocol string `` /* 191-byte string literal not displayed */
AdvDHCP6AuthenticationStatementAlgorithm string `` /* 192-byte string literal not displayed */
AdvDHCP6AuthenticationStatementRDM string `` /* 186-byte string literal not displayed */
AdvDHCP6KeyInfoStatementKeyName string `` /* 183-byte string literal not displayed */
AdvDHCP6KeyInfoStatementRealm string `` /* 181-byte string literal not displayed */
AdvDHCP6KeyInfoStatementKeyID string `` /* 181-byte string literal not displayed */
AdvDHCP6KeyInfoStatementSecret string `` /* 182-byte string literal not displayed */
AdvDHCP6KeyInfoStatementExpire string `` /* 182-byte string literal not displayed */
AdvDHCP6ConfigAdvanced string `` /* 174-byte string literal not displayed */
AdvDHCP6ConfigFileOverride string `` /* 178-byte string literal not displayed */
AdvDHCP6ConfigFileOverridePath string `` /* 182-byte string literal not displayed */
}
DhcpdInterface contains the DHCP server configuration for a specific pfSense interface. It is a copy-on-write fork of opnsense.DhcpdInterface with Enable changed from string to BoolFlag, because pfSense uses presence-based <enable/> elements.
func (DhcpdInterface) MarshalXML ¶
func (d DhcpdInterface) MarshalXML(e *xml.Encoder, start xml.StartElement) error
MarshalXML implements custom XML marshaling for DhcpdInterface, ensuring that the Enable BoolFlag field is addressable so (*BoolFlag).MarshalXML is invoked. Without this, direct xml.Marshal calls on DhcpdInterface values would fall back to default bool serialization instead of producing pfSense-compatible <enable/> elements. Uses a value receiver so both value and pointer marshaling work correctly.
type Diag ¶
type Diag struct {
IPv6NAT IPv6NAT `xml:"ipv6nat,omitempty" json:"ipv6nat" yaml:"ipv6nat,omitempty"`
}
Diag represents the pfSense diagnostics configuration.
type Document ¶
type Document struct {
XMLName xml.Name `xml:"pfsense" json:"-" yaml:"-"`
Version string `xml:"version,omitempty" json:"version,omitempty" yaml:"version,omitempty"`
LastChange string `xml:"lastchange,omitempty" json:"lastChange,omitempty" yaml:"lastChange,omitempty"`
System System `xml:"system,omitempty" json:"system" yaml:"system,omitempty"`
Interfaces Interfaces `xml:"interfaces,omitempty" json:"interfaces" yaml:"interfaces,omitempty"`
Dhcpd Dhcpd `xml:"dhcpd,omitempty" json:"dhcpd" yaml:"dhcpd,omitempty"`
DHCPv6Server DHCPv6 `xml:"dhcpdv6,omitempty" json:"dhcpdv6" yaml:"dhcpdv6,omitempty"`
Snmpd opnsense.Snmpd `xml:"snmpd,omitempty" json:"snmpd" yaml:"snmpd,omitempty"`
Diag Diag `xml:"diag,omitempty" json:"diag" yaml:"diag,omitempty"`
Syslog SyslogConfig `xml:"syslog,omitempty" json:"syslog" yaml:"syslog,omitempty"`
Nat Nat `xml:"nat,omitempty" json:"nat" yaml:"nat,omitempty"`
Filter Filter `xml:"filter,omitempty" json:"filter" yaml:"filter,omitempty"`
Cron Cron `xml:"cron,omitempty" json:"cron" yaml:"cron,omitempty"`
Rrd opnsense.Rrd `xml:"rrd,omitempty" json:"rrd" yaml:"rrd,omitempty"`
LoadBalancer opnsense.LoadBalancer `xml:"load_balancer,omitempty" json:"loadBalancer" yaml:"loadBalancer,omitempty"`
Widgets Widgets `xml:"widgets,omitempty" json:"widgets" yaml:"widgets,omitempty"`
OpenVPN opnsense.OpenVPN `xml:"openvpn,omitempty" json:"openvpn" yaml:"openvpn,omitempty"`
Unbound UnboundConfig `xml:"unbound,omitempty" json:"unbound" yaml:"unbound,omitempty"`
Revision opnsense.Revision `xml:"revision,omitempty" json:"revision" yaml:"revision,omitempty"`
StaticRoutes opnsense.StaticRoutes `xml:"staticroutes,omitempty" json:"staticroutes" yaml:"staticroutes,omitempty"`
PPPs opnsense.PPPInterfaces `xml:"ppps,omitempty" json:"ppps" yaml:"ppps,omitempty"`
Gateways opnsense.Gateways `xml:"gateways,omitempty" json:"gateways" yaml:"gateways,omitempty"`
CAs []opnsense.CertificateAuthority `xml:"ca,omitempty" json:"ca,omitempty" yaml:"ca,omitempty"`
Certs []opnsense.Cert `xml:"cert,omitempty" json:"cert,omitempty" yaml:"cert,omitempty"`
VLANs opnsense.VLANs `xml:"vlans,omitempty" json:"vlans" yaml:"vlans,omitempty"`
}
Document is the root of the pfSense configuration.
func NewDocument ¶
func NewDocument() *Document
NewDocument returns a new Document with all slice and map fields initialized for safe use.
func (*Document) FilterRules ¶
func (p *Document) FilterRules() []FilterRule
FilterRules returns a slice of all firewall filter rules configured in the system.
type Filter ¶
type Filter struct {
Separator string `xml:"separator,omitempty" json:"separator,omitempty" yaml:"separator,omitempty"`
Rule []FilterRule `xml:"rule" json:"rules,omitempty" yaml:"rules,omitempty"`
}
Filter represents the pfSense firewall filter configuration.
type FilterRule ¶
type FilterRule struct {
XMLName xml.Name `xml:"rule"`
Type string `xml:"type" json:"type" yaml:"type"`
Descr string `xml:"descr,omitempty" json:"description,omitempty" yaml:"description,omitempty"`
Interface opnsense.InterfaceList `xml:"interface,omitempty" json:"interface,omitempty" yaml:"interface,omitempty"`
IPProtocol string `xml:"ipprotocol,omitempty" json:"ipProtocol,omitempty" yaml:"ipProtocol,omitempty"`
StateType string `xml:"statetype,omitempty" json:"stateType,omitempty" yaml:"stateType,omitempty"`
Direction string `xml:"direction,omitempty" json:"direction,omitempty" yaml:"direction,omitempty"`
Floating string `xml:"floating,omitempty" json:"floating,omitempty" yaml:"floating,omitempty"`
Quick opnsense.BoolFlag `xml:"quick,omitempty" json:"quick" yaml:"quick,omitempty"`
Protocol string `xml:"protocol,omitempty" json:"protocol,omitempty" yaml:"protocol,omitempty"`
Source opnsense.Source `xml:"source" json:"source" yaml:"source"`
Destination opnsense.Destination `xml:"destination" json:"destination" yaml:"destination"`
Target string `xml:"target,omitempty" json:"target,omitempty" yaml:"target,omitempty"`
Gateway string `xml:"gateway,omitempty" json:"gateway,omitempty" yaml:"gateway,omitempty"`
SourcePort string `xml:"sourceport,omitempty" json:"sourcePort,omitempty" yaml:"sourcePort,omitempty"`
Log opnsense.BoolFlag `xml:"log,omitempty" json:"log" yaml:"log,omitempty"`
Disabled opnsense.BoolFlag `xml:"disabled,omitempty" json:"disabled" yaml:"disabled,omitempty"`
Tracker string `xml:"tracker,omitempty" json:"tracker,omitempty" yaml:"tracker,omitempty"`
// Rate-limiting fields (DoS protection)
MaxSrcNodes string `xml:"max-src-nodes,omitempty" json:"maxSrcNodes,omitempty" yaml:"maxSrcNodes,omitempty"`
MaxSrcConn string `xml:"max-src-conn,omitempty" json:"maxSrcConn,omitempty" yaml:"maxSrcConn,omitempty"`
MaxSrcConnRate string `xml:"max-src-conn-rate,omitempty" json:"maxSrcConnRate,omitempty" yaml:"maxSrcConnRate,omitempty"`
MaxSrcConnRates string `xml:"max-src-conn-rates,omitempty" json:"maxSrcConnRates,omitempty" yaml:"maxSrcConnRates,omitempty"`
// TCP/ICMP fields
TCPFlags1 string `xml:"tcpflags1,omitempty" json:"tcpFlags1,omitempty" yaml:"tcpFlags1,omitempty"`
TCPFlags2 string `xml:"tcpflags2,omitempty" json:"tcpFlags2,omitempty" yaml:"tcpFlags2,omitempty"`
TCPFlagsAny opnsense.BoolFlag `xml:"tcpflags_any,omitempty" json:"tcpFlagsAny" yaml:"tcpFlagsAny,omitempty"`
ICMPType string `xml:"icmptype,omitempty" json:"icmpType,omitempty" yaml:"icmpType,omitempty"`
ICMP6Type string `xml:"icmp6-type,omitempty" json:"icmp6Type,omitempty" yaml:"icmp6Type,omitempty"`
// State and advanced fields
StateTimeout string `xml:"statetimeout,omitempty" json:"stateTimeout,omitempty" yaml:"stateTimeout,omitempty"`
AllowOpts opnsense.BoolFlag `xml:"allowopts,omitempty" json:"allowOpts" yaml:"allowOpts,omitempty"`
DisableReplyTo opnsense.BoolFlag `xml:"disablereplyto,omitempty" json:"disableReplyTo" yaml:"disableReplyTo,omitempty"`
NoPfSync opnsense.BoolFlag `xml:"nopfsync,omitempty" json:"noPfSync" yaml:"noPfSync,omitempty"`
NoSync opnsense.BoolFlag `xml:"nosync,omitempty" json:"noSync" yaml:"noSync,omitempty"`
Updated *opnsense.Updated `xml:"updated,omitempty" json:"updated,omitempty" yaml:"updated,omitempty"`
Created *opnsense.Created `xml:"created,omitempty" json:"created,omitempty" yaml:"created,omitempty"`
UUID string `xml:"uuid,attr,omitempty" json:"uuid,omitempty" yaml:"uuid,omitempty"`
// pfSense-specific fields
ID string `xml:"id,omitempty" json:"id,omitempty" yaml:"id,omitempty"`
Tag string `xml:"tag,omitempty" json:"tag,omitempty" yaml:"tag,omitempty"`
Tagged string `xml:"tagged,omitempty" json:"tagged,omitempty" yaml:"tagged,omitempty"`
Max string `xml:"max,omitempty" json:"max,omitempty" yaml:"max,omitempty"`
MaxSrcStates string `xml:"max-src-states,omitempty" json:"maxSrcStates,omitempty" yaml:"maxSrcStates,omitempty"`
OS string `xml:"os,omitempty" json:"os,omitempty" yaml:"os,omitempty"`
AssociatedRuleID string `xml:"associated-rule-id,omitempty" json:"associatedRuleID,omitempty" yaml:"associatedRuleID,omitempty"`
}
FilterRule represents a pfSense firewall rule. It extends the base OPNsense Rule fields with pfSense-specific attributes such as rule ID, pf tags, state limits, OS fingerprinting, and NAT association.
type Group ¶
type Group struct {
Name string `xml:"name" json:"name" yaml:"name"`
Description string `xml:"description" json:"description,omitempty" yaml:"description,omitempty"`
Scope string `xml:"scope" json:"scope" yaml:"scope"`
//nolint:staticcheck // Field name matches pfSense schema
Gid string `xml:"gid" json:"gid" yaml:"gid"`
Member []string `xml:"member" json:"members,omitempty" yaml:"members,omitempty"`
Priv []string `xml:"priv" json:"privileges,omitempty" yaml:"privileges,omitempty"`
}
Group represents a pfSense group. Forked from opnsense.Group because pfSense supports multiple <priv> elements per group (copy-on-write per AGENTS.md §6.1).
type IPv6NAT ¶
type IPv6NAT struct {
IPAddr string `xml:"ipaddr,omitempty" json:"ipaddr,omitempty" yaml:"ipaddr,omitempty"`
}
IPv6NAT represents the pfSense IPv6 NAT diagnostics configuration.
type InboundRule ¶
type InboundRule struct {
XMLName xml.Name `xml:"rule"`
Interface opnsense.InterfaceList `xml:"interface,omitempty" json:"interface,omitempty" yaml:"interface,omitempty"`
IPProtocol string `xml:"ipprotocol,omitempty" json:"ipProtocol,omitempty" yaml:"ipProtocol,omitempty"`
Protocol string `xml:"protocol,omitempty" json:"protocol,omitempty" yaml:"protocol,omitempty"`
Source opnsense.Source `xml:"source" json:"source" yaml:"source"`
Destination opnsense.Destination `xml:"destination" json:"destination" yaml:"destination"`
ExternalPort string `xml:"externalport,omitempty" json:"externalPort,omitempty" yaml:"externalPort,omitempty"`
Target string `xml:"target,omitempty" json:"target,omitempty" yaml:"target,omitempty"`
InternalIP string `xml:"internalip,omitempty" json:"internalIP,omitempty" yaml:"internalIP,omitempty"`
InternalPort string `xml:"internalport,omitempty" json:"internalPort,omitempty" yaml:"internalPort,omitempty"`
LocalPort string `xml:"local-port,omitempty" json:"localPort,omitempty" yaml:"localPort,omitempty"`
Reflection string `xml:"reflection,omitempty" json:"reflection,omitempty" yaml:"reflection,omitempty"`
NATReflection string `xml:"natreflection,omitempty" json:"natReflection,omitempty" yaml:"natReflection,omitempty"`
AssociatedRuleID string `xml:"associated-rule-id,omitempty" json:"associatedRuleID,omitempty" yaml:"associatedRuleID,omitempty"`
Priority int `xml:"priority,omitempty" json:"priority,omitempty" yaml:"priority,omitempty"`
NoRDR opnsense.BoolFlag `xml:"nordr,omitempty" json:"noRDR,omitempty" yaml:"noRDR,omitempty"`
NoSync opnsense.BoolFlag `xml:"nosync,omitempty" json:"noSync,omitempty" yaml:"noSync,omitempty"`
Disabled opnsense.BoolFlag `xml:"disabled,omitempty" json:"disabled,omitempty" yaml:"disabled,omitempty"`
Log opnsense.BoolFlag `xml:"log,omitempty" json:"log,omitempty" yaml:"log,omitempty"`
Descr string `xml:"descr,omitempty" json:"description,omitempty" yaml:"description,omitempty"`
Updated *opnsense.Updated `xml:"updated,omitempty" json:"updated,omitempty" yaml:"updated,omitempty"`
Created *opnsense.Created `xml:"created,omitempty" json:"created,omitempty" yaml:"created,omitempty"`
UUID string `xml:"uuid,attr,omitempty" json:"uuid,omitempty" yaml:"uuid,omitempty"`
}
InboundRule represents a pfSense inbound NAT rule (port forwarding). This is a copy-on-write fork of opnsense.InboundRule because pfSense uses a <target> element for the internal redirect IP, whereas OPNsense uses <internalip>.
type Interface ¶
type Interface struct {
Enable opnsense.BoolFlag `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 []opnsense.DhcpOption `xml:"numberoptions,omitempty" json:"numberoptions,omitempty" yaml:"numberoptions,omitempty"`
Range opnsense.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 pfSense network interface configuration. It is a copy-on-write fork of opnsense.Interface with Enable changed from string to BoolFlag, because pfSense uses presence-based <enable/> elements.
func (Interface) MarshalXML ¶
MarshalXML implements custom XML marshaling for Interface, ensuring that the Enable BoolFlag field is addressable so (*BoolFlag).MarshalXML is invoked. Without this, direct xml.Marshal calls on Interface values would fall back to default bool serialization instead of producing pfSense-compatible <enable/> elements. Uses a value receiver so both value and pointer marshaling work correctly.
type Interfaces ¶
type Interfaces struct {
Items map[string]Interface `xml:",any" json:"interfaces,omitempty" yaml:"interfaces,omitempty"`
}
Interfaces contains the network interface configurations for a pfSense device. Uses a map-based representation where keys are interface identifiers (wan, lan, opt0, etc.).
func (*Interfaces) Get ¶
func (i *Interfaces) Get(key string) (Interface, bool)
Get returns an interface configuration by its key name (e.g., "wan", "lan", "opt0"). Returns the interface configuration and a boolean indicating if it was found.
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.
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 sorted list of all interface names.
func (*Interfaces) UnmarshalXML ¶
func (i *Interfaces) UnmarshalXML(decoder *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.
type Nat ¶
type Nat struct {
Outbound opnsense.Outbound `xml:"outbound" json:"outbound" yaml:"outbound"`
Inbound []InboundRule `xml:"rule" json:"inbound,omitempty" yaml:"inbound,omitempty"`
Separator string `xml:"separator,omitempty" json:"separator,omitempty" yaml:"separator,omitempty"`
}
Nat represents the pfSense NAT configuration. The key structural difference from OPNsense is that inbound (port-forward) rules are direct children of <nat> rather than nested under <nat><inbound>.
type SyslogConfig ¶
type SyslogConfig struct {
FilterDescriptions string `xml:"filterdescriptions,omitempty" json:"filterDescriptions,omitempty" yaml:"filterDescriptions,omitempty"`
}
SyslogConfig represents the pfSense syslog configuration. It differs from OPNsense by including a filterdescriptions field.
type System ¶
type System struct {
Optimization string `xml:"optimization" json:"optimization,omitempty" yaml:"optimization,omitempty"`
Hostname string `xml:"hostname" json:"hostname" yaml:"hostname"`
Domain string `xml:"domain" json:"domain" yaml:"domain"`
DNSAllowOverride int `xml:"dnsallowoverride" json:"dnsAllowOverride,omitempty" yaml:"dnsAllowOverride,omitempty"`
DNSServers []string `xml:"dnsserver" json:"dnsServers,omitempty" yaml:"dnsServers,omitempty"`
DNS1GW string `xml:"dns1gw,omitempty" json:"dns1gw,omitempty" yaml:"dns1gw,omitempty"`
DNS2GW string `xml:"dns2gw,omitempty" json:"dns2gw,omitempty" yaml:"dns2gw,omitempty"`
Language string `xml:"language" json:"language,omitempty" yaml:"language,omitempty"`
Group []Group `xml:"group" json:"groups,omitempty" yaml:"groups,omitempty"`
User []User `xml:"user" json:"users,omitempty" yaml:"users,omitempty"`
WebGUI WebGUI `xml:"webgui" json:"webgui" yaml:"webgui,omitempty"`
SSH opnsense.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"`
DisableNATReflection string `` /* 127-byte string literal not displayed */
DisableSegmentationOffloading int `` /* 136-byte string literal not displayed */
DisableLargeReceiveOffloading int `` /* 136-byte string literal not displayed */
IPv6Allow string `xml:"ipv6allow" json:"ipv6Allow,omitempty" yaml:"ipv6Allow,omitempty"`
MaximumTableEntries string `` /* 126-byte string literal not displayed */
CryptoHardware string `xml:"crypto_hardware,omitempty" json:"cryptoHardware,omitempty" yaml:"cryptoHardware,omitempty"`
EnableSerial opnsense.BoolFlag `xml:"enableserial,omitempty" json:"enableSerial" yaml:"enableSerial,omitempty"`
AlreadyRunConfigUpgrade opnsense.BoolFlag `` /* 130-byte string literal not displayed */
NextUID int `xml:"nextuid" json:"nextUid,omitempty" yaml:"nextUid,omitempty"`
NextGID int `xml:"nextgid" json:"nextGid,omitempty" yaml:"nextGid,omitempty"`
PowerdACMode string `xml:"powerd_ac_mode" json:"powerdAcMode,omitempty" yaml:"powerdAcMode,omitempty"`
PowerdBatteryMode string `xml:"powerd_battery_mode" json:"powerdBatteryMode,omitempty" yaml:"powerdBatteryMode,omitempty"`
PowerdNormalMode string `xml:"powerd_normal_mode" json:"powerdNormalMode,omitempty" yaml:"powerdNormalMode,omitempty"`
Bogons struct {
Interval string `xml:"interval" json:"interval,omitempty" yaml:"interval,omitempty"`
} `xml:"bogons" json:"bogons" yaml:"bogons,omitempty"`
}
System contains the pfSense system configuration. It mirrors the OPNsense System struct but with pfSense-specific differences: multiple DNS servers, bcrypt-hash user passwords, and additional system fields.
type UnboundConfig ¶
type UnboundConfig struct {
Enable opnsense.BoolFlag `xml:"enable,omitempty" json:"enable" yaml:"enable,omitempty"`
DNSSEC opnsense.BoolFlag `xml:"dnssec,omitempty" json:"dnssec" yaml:"dnssec,omitempty"`
ActiveInterface string `xml:"active_interface,omitempty" json:"activeInterface,omitempty" yaml:"activeInterface,omitempty"`
OutgoingInterface string `xml:"outgoing_interface,omitempty" json:"outgoingInterface,omitempty" yaml:"outgoingInterface,omitempty"`
CustomOptions string `xml:"custom_options,omitempty" json:"customOptions,omitempty" yaml:"customOptions,omitempty"`
HideIdentity opnsense.BoolFlag `xml:"hideidentity,omitempty" json:"hideIdentity" yaml:"hideIdentity,omitempty"`
HideVersion opnsense.BoolFlag `xml:"hideversion,omitempty" json:"hideVersion" yaml:"hideVersion,omitempty"`
DNSSECStripped opnsense.BoolFlag `xml:"dnssecstripped,omitempty" json:"dnssecStripped" yaml:"dnssecStripped,omitempty"`
Port string `xml:"port,omitempty" json:"port,omitempty" yaml:"port,omitempty"`
SSLPort string `xml:"sslport,omitempty" json:"sslPort,omitempty" yaml:"sslPort,omitempty"`
SSLCertRef string `xml:"sslcertref,omitempty" json:"sslCertRef,omitempty" yaml:"sslCertRef,omitempty"`
SystemDomainLocalZoneType string `` /* 131-byte string literal not displayed */
}
UnboundConfig represents the pfSense Unbound DNS resolver configuration. It includes more fields than the OPNsense Unbound type, covering interface bindings, security options, and port configuration.
type User ¶
type User struct {
Name string `xml:"name" json:"name" yaml:"name"`
Disabled opnsense.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"`
Groupname string `xml:"groupname" json:"groupname" yaml:"groupname"`
BcryptHash string `xml:"bcrypt-hash" json:"bcryptHash" yaml:"bcryptHash"`
UID string `xml:"uid" json:"uid" yaml:"uid"`
Priv []string `xml:"priv,omitempty" json:"priv,omitempty" yaml:"priv,omitempty"`
Expires string `xml:"expires" json:"expires,omitempty" yaml:"expires,omitempty"`
AuthorizedKeys string `xml:"authorizedkeys" json:"authorizedKeys,omitempty" yaml:"authorizedKeys,omitempty"`
}
User represents a pfSense user. The critical difference from OPNsense is the use of bcrypt-hash instead of password, and user-level privileges via the Priv field.
type WebGUI ¶
type WebGUI struct {
Protocol string `xml:"protocol" json:"protocol" yaml:"protocol"`
SSLCertRef string `xml:"ssl-certref,omitempty" json:"sslCertRef,omitempty" yaml:"sslCertRef,omitempty"`
LoginAutocomplete opnsense.BoolFlag `xml:"loginautocomplete,omitempty" json:"loginAutocomplete" yaml:"loginAutocomplete,omitempty"`
MaxProcesses string `xml:"max_procs,omitempty" json:"maxProcesses,omitempty" yaml:"maxProcesses,omitempty"`
DashboardColumns string `xml:"dashboardcolumns,omitempty" json:"dashboardColumns,omitempty" yaml:"dashboardColumns,omitempty"`
WebGUICSS string `xml:"webguicss,omitempty" json:"webguiCss,omitempty" yaml:"webguiCss,omitempty"`
LoginCSS string `xml:"logincss,omitempty" json:"loginCss,omitempty" yaml:"loginCss,omitempty"`
AltHostnames string `xml:"althostnames,omitempty" json:"altHostnames,omitempty" yaml:"altHostnames,omitempty"`
}
WebGUI represents the pfSense WebGUI configuration. It extends the OPNsense WebGUIConfig with pfSense-specific fields such as dashboard columns, CSS theme, login CSS, and alternate hostnames.
type Widgets ¶
type Widgets struct {
Sequence string `xml:"sequence,omitempty" json:"sequence,omitempty" yaml:"sequence,omitempty"`
ColumnCount string `xml:"column_count,omitempty" json:"columnCount,omitempty" yaml:"columnCount,omitempty"`
Period string `xml:"period,omitempty" json:"period,omitempty" yaml:"period,omitempty"`
}
Widgets represents the pfSense dashboard widgets configuration. It extends the OPNsense Widgets with a pfSense-specific refresh period field.