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

Use "register_custom_attribute($ref_attr_config)" to register your own attributes

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

Raises

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

Returns

An attribute type from "ATTRIBUTE TYPES"

register_custom_attribute($ref_attr_config)

Register your custom attribute names.

Parameters

  • $ref_attr_config A reference to your attribute description. Expected to be in the following format:

    {
        'in_config_name' => 'in_config_attr_name',
        'validator'      => 'Function reference to a validator function'
    },

    For the validator function you can either create your own or use one defined in Wireguard::WGmeta::Validator

Raises

Exception if $ref_attr_config is malformed

Returns

1 on success, undef if the attribute is already defined