pfsense

package
v1.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 23, 2026 License: Apache-2.0 Imports: 11 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package pfsense provides a pfSense-specific parser and converter that transforms pfsense.Document into the platform-agnostic CommonDevice.

Package pfsense provides a pfSense-specific parser and converter that transforms pfsense.Document into the platform-agnostic CommonDevice.

Index

Constants

This section is empty.

Variables

View Source
var ErrNilDocument = errors.New("pfsense converter: received nil document")

ErrNilDocument is returned when ToCommonDevice receives a nil document.

View Source
var ValidateFunc func(doc *pfsense.Document) error

ValidateFunc is a function that validates a parsed pfSense document and returns an error if validation fails. Set this package-level variable from the cmd layer to inject internal/validator without violating pkg/ purity. When nil, ParseAndValidate falls back to structural parsing only.

Functions

func ConvertDocument

func ConvertDocument(doc *pfsense.Document) (*common.CommonDevice, []common.ConversionWarning, error)

ConvertDocument transforms a parsed pfSense Document into a platform-agnostic CommonDevice along with any non-fatal conversion warnings. This is a convenience function that creates a fresh converter internally.

func NewParserFactory

func NewParserFactory(decoder parser.XMLDecoder) parser.DeviceParser

NewParserFactory returns a new DeviceParser configured for pfSense devices. It satisfies the factory function signature required by DeviceParserRegistry.

Types

type Parser

type Parser struct {
	// contains filtered or unexported fields
}

Parser implements the DeviceParser interface for pfSense configuration files. It manages its own XML decoding because the shared XMLDecoder returns *schema.OpnSenseDocument which is incompatible with pfsense.Document.

func NewParser

func NewParser(_ parser.XMLDecoder) *Parser

NewParser returns a new pfSense Parser. The decoder parameter is accepted for compatibility with the ConstructorFunc signature but is not used because pfSense requires its own XML decoding pipeline.

func (*Parser) Parse

Parse reads a pfSense XML configuration from r (structural parsing only, no semantic validation) and returns a platform-agnostic CommonDevice along with any non-fatal conversion warnings.

func (*Parser) ParseAndValidate

func (p *Parser) ParseAndValidate(
	ctx context.Context,
	r io.Reader,
) (*common.CommonDevice, []common.ConversionWarning, error)

ParseAndValidate reads a pfSense XML configuration from r, runs structural parsing and semantic validation, and returns a platform-agnostic CommonDevice along with any non-fatal conversion warnings. If ValidateFunc has not been set (e.g., by cmd/root.go), falls back to structural parsing only.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL