NAME

WGmeta::Parser::Show - Parser for `wg show dump`

SYNOPSIS

use Wireguard::WGmeta::Parser::Show;

my $out = `wg show dump`;
my $ref_hash_parsed_show = wg_show_dump_parser($out);

DESCRIPTION

This class contains a parser for the output of wg show dump.

METHODS

wg_show_dump_parser($input)

Parser for the output of wg show dump:

{
    'interface_name' => {
        'a_peer_pub_key' => {
            'interface'     => <parent_interface>,
            'public-key'    => <interface_public_key>,
            'preshared-key' => <interface_preshared_key>,
            'and_so_on'     => <value_of_attr>
        },
        'an_interface_name => {
            'interface'     => <parent_interface>,
            'private-key'   => <interface_private_key>,
            'and_so_on'     => <value_of_attr>
        }
    },
    'an_other_interface' => {
        [...]
    }
}

An important remark: This parser is relatively intolerant when it comes to formatting due to the input is already in a "machine readable" format. It expects one peer/interface per line, the values in the exact same order as defined in @keys_peer/@keys_interface, separated by a whitespace character. Usually, you don't need to worry about this - it is just meant as word of warning.

Parameters

  • $input Output of wg show dump

Returns

A reference to a hash with the structure described above.