The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

WGmeta::ValidAttributes - Supported attribute configurations

DESCRIPTION

In this module all supported attributes are configured (and as well their possible validation function). Attributes configured here affect how the parser stores them and which attributes are supported by the "set($interface, $identifier, $attribute, $value [, $allow_non_meta, $forward_function])" in Wireguard::WGmeta::Wrapper::Config.

SYNOPSIS

Add your own attributes to "WG_META_ADDITIONAL"

ATTRIBUTE TYPES

ATTR_TYPE_IS_WG_META

(Default) - wg-meta attributes

ATTR_TYPE_IS_WG_META_CUSTOM

Your custom wg-meta attributes

ATTR_TYPE_IS_WG_QUICK

wg-quick attribute

ATTR_TYPE_IS_WG_ORIG_INTERFACE

Original Wireguard attribute, valid for [Interface] sections.

ATTR_TYPE_IS_WG_ORIG_PEER

Original Wireguard attribute, valid for [Peer] sections.

ATTR_TYPE_IS_UNKNOWN

Any unknown attribute types

ATTRIBUTE SETS

General remark: If you want to add your own attributes add them to "WG_META_ADDITIONAL" - all other config sets should only be modified on (possible) future changes in attribute configurations in Wireguard or wg-quick!

WG_META_DEFAULT

wg-meta default attributes. Do not make changes here, they are expected to be present!

WG_META_ADDITIONAL

Define your custom attributes here in the following format (the wg meta prefix can be omitted here):

    'attribute-name-in-lower-case-and-separated-by-dashes' => {
        'in_config_name' => 'Pretty name as it appear in config',
        'validator'      => <function-reference to validator function>
    },
    'other-attributes' => {
        'in_config_name' => 'Other name'
        'validator'      => <function-reference to validator function>,
    }

Validator functions can be defined in Wireguard::WGmeta::Validator

WG_QUICK

wg-quick attribute set

WG_ORIG_INTERFACE

Attributes valid for Wireguard [Interface] sections

WG_ORIG_PEER

Attributes valid for Wireguard [Peer] sections

INVERSE_ATTR_TYPE_MAPPING

[Generated] Static mapping from attr_keyattr_key to attr_type.

NAME_2_KEYS_MAPPING

[Generated] Static mapping from in_config_name to attr_key.

METHODS

get_attr_config($attr_type)

Returns an attribute config set from "ATTRIBUTE SETS" given a valid attr type. Ideally obtained through "decide_attr_type($attr_name [, $allow_unknown = FALSE])".

Parameters

  • $attr_type A valid attribute type.

Raises

Exception is type is invalid (not known).

Returns

If the type is valid, the corresponding attribute config map.

decide_attr_type($attr_name [, $allow_unknown = FALSE])

Returns the attribute type given an attr_key.

Parameters

  • $attr_name An attribute key as defined in one "ATTRIBUTE SETS".

  • [$allow_unknown = FALSE] If set to true, unknown attributes result in the type L<>.

Raises

An Exception, if the attribute is unknown (and $allow_unknown = FALSE).

Returns

An attribute type from "ATTRIBUTE TYPES"

1 POD Error

The following errors were encountered while parsing the POD:

Around line 316:

An empty L<>