line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Wireguard::WGmeta::Cli::Commands::Remove; |
2
|
1
|
|
|
1
|
|
8
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
34
|
|
3
|
1
|
|
|
1
|
|
6
|
use warnings FATAL => 'all'; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
48
|
|
4
|
1
|
|
|
1
|
|
7
|
use experimental 'signatures'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
5
|
|
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
111
|
use Wireguard::WGmeta::Wrapper::Config; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
20
|
|
7
|
1
|
|
|
1
|
|
4
|
use parent 'Wireguard::WGmeta::Cli::Commands::Command'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
5
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
|
10
|
0
|
|
|
0
|
1
|
|
sub entry_point($self) { |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
11
|
0
|
0
|
|
|
|
|
if ($self->_retrieve_or_die($self->{input_args}, 0) eq 'help') { |
12
|
0
|
|
|
|
|
|
$self->cmd_help(); |
13
|
|
|
|
|
|
|
} |
14
|
0
|
|
|
|
|
|
$self->check_privileges(); |
15
|
0
|
|
|
|
|
|
$self->_run_command(); |
16
|
|
|
|
|
|
|
} |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
|
19
|
0
|
|
|
0
|
|
|
sub _run_command($self) { |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
20
|
0
|
|
|
|
|
|
my $interface = $self->_retrieve_or_die($self->{input_args}, 0); |
21
|
0
|
|
|
|
|
|
my $identifier = $self->_retrieve_or_die($self->{input_args}, 1); |
22
|
0
|
|
|
|
|
|
$identifier = $self->wg_meta->try_translate_alias($interface, $identifier); |
23
|
0
|
|
|
|
|
|
$self->wg_meta->remove_peer($interface, $identifier); |
24
|
|
|
|
|
|
|
|
25
|
0
|
0
|
|
|
|
|
if (defined $ENV{IS_TESTING}) { |
26
|
|
|
|
|
|
|
# omit header |
27
|
0
|
|
|
|
|
|
$self->wg_meta->commit(1, 1); |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
else { |
30
|
0
|
|
|
|
|
|
$self->wg_meta->commit(1, 0); |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
|
35
|
0
|
|
|
0
|
1
|
|
sub cmd_help($self) { |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
36
|
0
|
|
|
|
|
|
print "Usage: wg-meta removepeer {alias | public-key} \n"; |
37
|
0
|
|
|
|
|
|
exit; |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
1; |