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