diff --git a/CHANGES b/CHANGES index 71939bc..46c5887 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,7 @@ +0.1.2 2021-01-22 Tobias Bossert (tobib at cpan.org) +- fix: Required perl version in Makefile.PL +- changed: doc upgrades and fixes + 0.1.1 2021-01-21 Tobias Bossert (tobib at cpan.org) - Small QoL-changes (dist) diff --git a/Makefile.PL b/Makefile.PL index dbfe203..50384c5 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -26,7 +26,7 @@ WriteMakefile( "bin/wg-meta" ], META_MERGE => { - requires => { perl => '5.20' }, + requires => { perl => '5.020000' }, resources => { license => 'https://opensource.org/licenses/mit', repository => 'https://github.com/sirtoobii/wg-meta', diff --git a/VERSION b/VERSION index 6da28dd..8294c18 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.1.1 \ No newline at end of file +0.1.2 \ No newline at end of file diff --git a/bin/wg-meta b/bin/wg-meta index 1dea7e7..c647f02 100755 --- a/bin/wg-meta +++ b/bin/wg-meta @@ -2,7 +2,7 @@ =head1 NAME -wg-meta - A CLI interface to manage Wireguard using Perl +wg-meta - CLI interface to manage Wireguard using Perl =head1 DESCRIPTION diff --git a/lib/Wireguard/WGmeta.pm b/lib/Wireguard/WGmeta.pm index 9ff0bb1..d4b9756 100644 --- a/lib/Wireguard/WGmeta.pm +++ b/lib/Wireguard/WGmeta.pm @@ -8,8 +8,8 @@ An approach to add metadata to the main wireguard config, written in Perl. =head1 UNDER THE HOOD -The main advantage is that this tool is not dependent on any other storage, metadata is stored inside the corresponding -I file (Metadata is prefixed with I<#+>): +Unlike similar projects, this toolkit is not not dependent on any other storage system, metadata is stored dirctly inside the corresponding +C file (Metadata is prefixed with C<#+>): [Interface] #+Alias = some_alias diff --git a/lib/Wireguard/WGmeta/ValidAttributes.pm b/lib/Wireguard/WGmeta/ValidAttributes.pm index c3d0776..16c1d92 100644 --- a/lib/Wireguard/WGmeta/ValidAttributes.pm +++ b/lib/Wireguard/WGmeta/ValidAttributes.pm @@ -1,6 +1,6 @@ =head1 NAME -WGmeta::ValidAttributes - Supported attributes configurations +WGmeta::ValidAttributes - Supported attribute configurations =head1 DESCRIPTION diff --git a/lib/Wireguard/WGmeta/Wrapper/Bridge.pm b/lib/Wireguard/WGmeta/Wrapper/Bridge.pm index b12cd84..a9dea4c 100644 --- a/lib/Wireguard/WGmeta/Wrapper/Bridge.pm +++ b/lib/Wireguard/WGmeta/Wrapper/Bridge.pm @@ -1,6 +1,6 @@ =head1 NAME -WGmeta::Wrapper::Bridge - Interface with shell using (linux only!) +WGmeta::Wrapper::Bridge - Interface with shell using IPC::Open3 =head1 METHODS @@ -39,7 +39,7 @@ sub gen_keypair() { } =head2 get_pub_key($priv_key) -Runs I on C<$priv_key>. +Runs C on C<$priv_key>. B @@ -62,7 +62,7 @@ sub get_pub_key($priv_key){ return $out[0]; } -=head2 get_wg_show([$cmd]) +=head2 get_wg_show() Runs C and captures the output into str_out and str_err. @@ -75,11 +75,8 @@ B First array of STD_OUT =cut -sub get_wg_show($cmd = undef) { - unless (defined($cmd)) { - $cmd = 'wg show dump'; - - } +sub get_wg_show() { + my $cmd = 'wg show dump'; my (@out, undef) = run_external($cmd); chomp @out; return @out; @@ -99,7 +96,7 @@ C<$command_line> Complete commandline for the external program to execute. =item * -C<[$input = undef]> If defined, this is feed into STD_IN of the C<$command_line>. +C<[$input = undef]> If defined, this is feed into STD_IN of C<$command_line>. =item * @@ -113,7 +110,7 @@ Exception if return code is not 0 (if C<$soft_fail> is set to true, just a warni B -Returns two lists if all lines of I and I +Returns two lists with all lines of I and I =cut sub run_external($command_line, $input = undef, $soft_fail = FALSE) { diff --git a/lib/Wireguard/WGmeta/Wrapper/Config.pm b/lib/Wireguard/WGmeta/Wrapper/Config.pm index 9ce817c..099b440 100644 --- a/lib/Wireguard/WGmeta/Wrapper/Config.pm +++ b/lib/Wireguard/WGmeta/Wrapper/Config.pm @@ -18,8 +18,8 @@ WGmeta::Wrapper::Config - Class for interfacing the wireguard configs =head1 DESCRIPTION This class serves as wrapper around the Wireguard configurations files. -It is able to parse, modify, add and write Wireguard .conf files. In addition, support for metadata is built in. As a small -bonus, the parser and encoder are exported ar usable as standalone methods +It is able to parse, modify, add and write Wireguard I<.conf> files. In addition, support for metadata is built in. As a small +bonus, the parser and encoder are exported and usable as standalone methods =head1 EXAMPLES @@ -35,7 +35,7 @@ bonus, the parser and encoder are exported ar usable as standalone methods # disable peer (this comments out the peer in the configuration file wg_meta->disable_by_alias('wg0', 'some_fancy_alias'); - # write config (if parameter is set to True, the config is overwritten, if set to False the resulting file is suffixed with '_dryrun' + # write config (if parameter is set to True, the config is overwritten, if set to False the resulting file is suffixed with '_not_applied' wg_meta->commit(1); =head1 METHODS @@ -77,7 +77,7 @@ use constant IS_NORMAL => 3; =head3 new($wireguard_home [, $wg_meta_prefix = '#+', $wg_meta_disabled_prefix = '#-']) -Creates a new instance of this class. Default wg-meta attributes: 'Name' and 'Alias'. +Creates a new instance of this class. B @@ -155,8 +155,7 @@ C<$attribute> Attribute name (Case does not not matter) =item * -C<[$allow_non_meta = FALSE]> If set to TRUE, non wg-meta attributes are not forwarded to `wg set`. -However be extra careful when using this, just the attribute names are validated but not the data! +C<[$allow_non_meta = FALSE]> If set to TRUE, non wg-meta attributes are not forwarded to C<$forward_function>. =item * @@ -315,7 +314,7 @@ sub set_by_alias($self, $interface, $alias, $attribute, $value, $allow_non_meta =head3 disable($interface, $identifier) -Disables a peer +Disables an interface/peer (by prefixing C<$wg_meta_disabled_prefix>) and setting the wg-meta attribute `Disabled` to C<1>. B @@ -535,7 +534,7 @@ However, does only exist if this section has been enabled/disabled once. =item * -To check wether a file is actually a Wireguard interface config, the parser first checks the presence of the string +To check whether a file is actually a Wireguard interface config, the parser first checks the presence of the string I<[Interface]>. If not present, the file is skipped (without warning!). =back @@ -1110,8 +1109,6 @@ sub add_interface($self, $interface_name, $ip_address, $listen_port, $private_ke Adds a peer to an exiting interface. -B No validation is performed on the values! - B =over 1 diff --git a/lib/Wireguard/WGmeta/Wrapper/Show.pm b/lib/Wireguard/WGmeta/Wrapper/Show.pm index d325d47..b658cc5 100644 --- a/lib/Wireguard/WGmeta/Wrapper/Show.pm +++ b/lib/Wireguard/WGmeta/Wrapper/Show.pm @@ -17,8 +17,8 @@ WGmeta::Wrapper::Show - Class for parsing the `wg show dump` output =head1 DESCRIPTION This class contains a parser for the output of C together with an interface to retrieve the parsed data. -An important note tough: This class does not perform the necessary I/O by itself and therefore the actual output of the command -C has to be captured into a string externally (e.g using L). +An important note: This class does not perform the necessary I/O by itself and therefore the output of the command +C has to be captured into a string externally (e.g using L). =head1 EXAMPLES @@ -82,7 +82,7 @@ sub new($class, $wg_show_dump) { =head3 wg_show_dump_parser($input) -Parser for the output of C. Aims to create a compatible structure as +Parser for the output of C. Aims to create a compatible with: L: { @@ -126,6 +126,8 @@ A reference to a hash with the structure described above. sub wg_show_dump_parser($input) { my $interface = ''; my $parsed_show = {}; + + # ToDo: Make use of WGmeta::ValidAttributes my @keys_interface = qw(interface private-key public-key listen-port fwmark); my @keys_peer = qw(interface public-key preshared-key endpoint allowed-ips latest-handshake transfer-rx transfer-tx persistent-keepalive); for my $line (split /\n/, $input) { @@ -196,7 +198,7 @@ B =item -C<$interface> A valid interface name, optimally retrieved through L. +C<$interface> A valid interface name, ideally retrieved through L. =item @@ -228,7 +230,7 @@ B =item -C<$interface> A valid interface name, optimally retrieved through L. +C<$interface> A valid interface name, ideally retrieved through L. =back