Branch Coverage

lib/Wireguard/WGmeta/Parser/Middleware.pm
Criterion Covered Total %
branch 31 34 91.1


line true false branch
171 74 42 unless $config_file_content =~ /\[Interface\]/
185 459 32 if exists {"Address" => "address","Alias" => "alias","AllowedIPs" => "allowed-ips","Checksum" => "checksum","DNS" => "dns","Disabled" => "disabled","Endpoint" => "endpoint","Fwmark" => "fwmark","ListenPort" => "listen-port","MTU" => "mtu","PersistentKeepalive" => "persistent-keepalive","PostDown" => "post-down","PostUP" => "post-up","PreDown" => "pre-down","PreUp" => "pre-up","PresharedKey" => "preshared-key","PrivateKey" => "private-key","PublicKey" => "public-key","SaveConfig" => "save-config","Table" => "table"}->{$raw_key}
187 88 403 if $is_wg_meta
189 56 435 if $raw_key eq "Alias"
191 17 474 if ($raw_key eq "Checksum")
201 73 42 if $section_type eq "Peer"
204 56 59 if (defined $alias_to_consume)
205 0 56 if exists $alias_map{$alias_to_consume}
210 42 73 $section_type eq 'Interface' ? :
220 8 34 if ($use_checksum == 1 and defined $old_checksum)
222 0 8 unless $new_checksum eq $old_checksum
264 0 84 if (not ref $ref_interface_config->{$identifier} eq 'HASH') { }
271 2 82 exists $ref_interface_config->{$identifier}{'disabled'} && $ref_interface_config->{$identifier}{'disabled'} == 1 ? :
279 71 291 exists $ref_interface_config->{'int_observed_wg_meta_attrs'}{$attr_name} ? :
284 10 19 if ($no_checksum == 0)
294 9 353 if (substr($attr_name, 0, 7) eq 'comment') { }
298 321 32 exists {address => {in_config_name => 'Address', type => 12, validator => sub ($input) { package Wireguard::WGmeta::Validator; ; return 1; } }, alias => {in_config_name => 'Alias', type => 10, validator => sub ($input) { package Wireguard::WGmeta::Validator; ; return 1; } }, allowed-ips => {in_config_name => 'AllowedIPs', type => 14, validator => sub ($input) { package Wireguard::WGmeta::Validator; ; return 1; } }, checksum => {in_config_name => 'Checksum', type => 10, validator => sub ($input) { package Wireguard::WGmeta::Validator; ; return 1; } }, disabled => {in_config_name => 'Disabled', type => 10, validator => sub ($input) { package Wireguard::WGmeta::Validator; ; return 1; } }, dns => {in_config_name => 'DNS', type => 12, validator => sub ($input) { package Wireguard::WGmeta::Validator; ; return 1; } }, endpoint => {in_config_name => 'Endpoint', type => 14, validator => sub ($input) { package Wireguard::WGmeta::Validator; ; return 1; } }, fwmark => {in_config_name => 'Fwmark', type => 13, validator => sub ($input) { package Wireguard::WGmeta::Validator; ; return 1; } }, listen-port => {in_config_name => 'ListenPort', type => 13, validator => sub ($input) { package Wireguard::WGmeta::Validator; ; return &looks_like_number($input); } }, mtu => {in_config_name => 'MTU', type => 12, validator => sub ($input) { package Wireguard::WGmeta::Validator; ; return 1; } }, persistent-keepalive => {in_config_name => 'PersistentKeepalive', type => 14, validator => sub ($input) { package Wireguard::WGmeta::Validator; ; return 1; } }, post-down => {in_config_name => 'PostDown', type => 12, validator => sub ($input) { package Wireguard::WGmeta::Validator; ; return 1; } }, post-up => {in_config_name => 'PostUP', type => 12, validator => sub ($input) { package Wireguard::WGmeta::Validator; ; return 1; } }, pre-down => {in_config_name => 'PreDown', type => 12, validator => sub ($input) { package Wireguard::WGmeta::Validator; ; return 1; } }, pre-up => {in_config_name => 'PreUp', type => 12, validator => sub ($input) { package Wireguard::WGmeta::Validator; ; return 1; } }, preshared-key => {in_config_name => 'PresharedKey', type => 14, validator => sub ($input) { package Wireguard::WGmeta::Validator; ; return 1; } }, private-key => {in_config_name => 'PrivateKey', type => 13, validator => sub ($input) { package Wireguard::WGmeta::Validator; ; return 1; } }, public-key => {in_config_name => 'PublicKey', type => 14, validator => sub ($input) { package Wireguard::WGmeta::Validator; ; return 1; } }, save-config => {in_config_name => 'SaveConfig', type => 12, validator => sub ($input) { package Wireguard::WGmeta::Validator; ; return 1; } }, table => {in_config_name => 'Table', type => 12, validator => sub ($input) { package Wireguard::WGmeta::Validator; ; return 1; } }}->{$attr_name} ? :