line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Wireguard::WGmeta::Cli::Commands::Apply; |
2
|
1
|
|
|
1
|
|
7
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
33
|
|
3
|
1
|
|
|
1
|
|
6
|
use warnings FATAL => 'all'; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
33
|
|
4
|
|
|
|
|
|
|
|
5
|
1
|
|
|
1
|
|
5
|
use experimental 'signatures'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
5
|
|
6
|
|
|
|
|
|
|
|
7
|
1
|
|
|
1
|
|
103
|
use parent 'Wireguard::WGmeta::Cli::Commands::Command'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
4
|
|
8
|
|
|
|
|
|
|
|
9
|
1
|
|
|
1
|
|
70
|
use Wireguard::WGmeta::Wrapper::Bridge; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
283
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
|
12
|
0
|
|
|
0
|
1
|
|
sub entry_point($self) { |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
13
|
0
|
0
|
|
|
|
|
if ($self->_retrieve_or_die($self->{input_args}, 0) eq 'help') { |
14
|
0
|
|
|
|
|
|
$self->cmd_help(); |
15
|
|
|
|
|
|
|
} |
16
|
0
|
|
|
|
|
|
$self->check_privileges(); |
17
|
0
|
|
|
|
|
|
$self->_run_command(); |
18
|
|
|
|
|
|
|
} |
19
|
|
|
|
|
|
|
|
20
|
0
|
|
|
0
|
|
|
sub _run_command($self) { |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
21
|
0
|
|
|
|
|
|
my $interface = $self->_retrieve_or_die($self->{input_args}, 0); |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
# please note that there ar potential problems with this commend as mentioned here: https://github.com/WireGuard/wireguard-tools/pull/3 |
24
|
0
|
|
|
|
|
|
my $cmd_line = "su -c 'wg syncconf $interface <(wg-quick strip $interface)'"; |
25
|
0
|
0
|
|
|
|
|
unless (defined $ENV{WGmeta_NO_WG}) { |
26
|
0
|
|
|
|
|
|
run_external($cmd_line); |
27
|
|
|
|
|
|
|
} else { |
28
|
0
|
|
|
|
|
|
print "Faked apply \n"; |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
0
|
|
|
0
|
1
|
|
sub cmd_help($self) { |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
33
|
0
|
|
|
|
|
|
print "Usage: wg-meta apply \n"; |
34
|
0
|
|
|
|
|
|
exit; |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
1; |