return @free_addresses;
}
-sub generate_peer_configuration($) {
+sub generate_host_configuration($) {
my $key = shift;
# Load the peer
# Return if we could not find the peer
return undef unless (%peer);
+ # Return if this is not a roadwarrior peer
+ return undef unless ($peer{'TYPE'} eq 'host');
+
my @allowed_ips = ();
- my @dns = ();
# Convert all subnets into CIDR notation
foreach my $subnet ($peer{'LOCAL_SUBNETS'}) {
my $port = $settings{'PORT'};
# Fetch any DNS servers for hosts
- if ($peer{'TYPE'} eq 'host') {
- @dns = split(/\|/, $settings{'CLIENT_DNS'});
- }
+ my @dns = split(/\|/, $settings{'CLIENT_DNS'});
my @conf = (
"[Interface]",
my $filename = &Header::normalize($peer{'NAME'}) . ".conf";
# Generate the client configuration
- my $config = &Wireguard::generate_peer_configuration($key);
+ my $config = &Wireguard::generate_host_configuration($key);
# Send the configuration
if (defined $config) {
my %peer = &Wireguard::load_peer($key);
# Generate the client configuration
- my $config = &Wireguard::generate_peer_configuration($key);
+ my $config = &Wireguard::generate_host_configuration($key);
# Create a QR code generator
my $qrgen = Imager::QRCode->new(