opnsense

package
v1.9.0 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2026 License: Apache-2.0 Imports: 15 Imported by: ? modules, 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 opnsense provides an OPNsense-specific parser and converter that transforms schema.OpnSenseDocument (pkg/schema/opnsense) into the platform-agnostic common.CommonDevice (pkg/model). The bracketed names match the import aliases used in this file.

Registration

This package self-registers its Parser with the global parser.DefaultRegistry under the device type name "opnsense" from an init() function. Consumers that want the OPNsense parser available through parser.Factory must add a blank import:

import _ "github.com/EvilBit-Labs/opnDossier/pkg/parser/opnsense"

See parser for the full registration contract.

Dependencies

This package has no internal/ dependencies in production code; it depends only on other public pkg/ packages plus the standard library. The parser.OPNsenseXMLDecoder is injected at construction so this package can stay on the public pkg/ side of the import boundary while still using the internal/cfgparser decoder when wired from the CLI layer.

Index

Constants

This section is empty.

Variables

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

ErrNilDocument is returned when ToCommonDevice receives a nil document.

Functions

func ConvertDocument

ConvertDocument transforms a parsed OpnSenseDocument 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.OPNsenseXMLDecoder) parser.DeviceParser

NewParserFactory returns a new DeviceParser configured for OPNsense 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 OPNsense configuration files. The XML decoder is injected at construction to keep this package free of internal/ imports.

func NewParser

func NewParser(decoder parser.OPNsenseXMLDecoder) *Parser

NewParser returns a new OPNsense Parser backed by the given XML decoder. The decoder is typically cfgparser.NewXMLParser(), wired at the application layer.

func (*Parser) Parse

Parse reads an OPNsense 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 an OPNsense XML configuration from r, runs both structural parsing and semantic validation, and returns a platform-agnostic CommonDevice along with any non-fatal conversion warnings.

Jump to

Keyboard shortcuts

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