Perform major restructure of project files

parent 5c2f5217
package Wormhole::AppRouting;
use strict;
use warnings;
use Wormhole::Route::CreateSub;
use Wormhole::Route::ModifySub;
use Wormhole::Route::DeleteSub;
use Wormhole::Route::LockSub;
use Wormhole::Route::ChgKey;
use Wormhole::Route::ListSub;
use Wormhole::Route::Help;
use Wormhole::Route::UpdateSub;
use Wormhole::Route::ClearSub;
our %routes = (
"/create" => \&Wormhole::Route::CreateSub::create_subdomain,
"/modify" => \&Wormhole::Route::ModifySub::modify_subdomain,
"/delete" => \&Wormhole::Route::DeleteSub::delete_subdomain,
"/lock" => \&Wormhole::Route::LockSub::lock_subdomain,
"/chgkey" => \&Wormhole::Route::ChgKey::chgkey_subdomain,
"/list" => \&Wormhole::Route::ListSub::list_subdomains,
"/help" => \&Wormhole::Route::Help::get_help,
"/update" => \&Wormhole::Route::UpdateSub::update_ddns,
"/clear" => \&Wormhole::Route::ClearSub::clear_ddns,
);
1;
\ No newline at end of file
package conf;
package Wormhole::Config;
use strict;
use warnings;
......
package chgkey;
package Wormhole::Route::ChgKey;
use strict;
use warnings;
......@@ -7,16 +7,16 @@ use Exporter qw(import);
our @EXPORT_OK = qw(chgkey_subdomain);
use lib "..";
use checks qw(check_params check_key check_method subdomain_exists valid_subdomain);
use util qw(rand_pass);
use database;
use Wormhole::Util::Checks qw(check_params check_key check_method subdomain_exists valid_subdomain);
use Wormhole::Util::MiscUtils qw(rand_pass);
use Wormhole::Util::Database;
sub chgkey_subdomain {
my $req = shift;
my $c_method = check_method($req); if (defined $c_method) { return $c_method; }
my $c_params = check_params($req, ("key", "subdomain")); if (defined $c_params) { return $c_params; }
my $c_key = check_key($req, $conf::admin_key); if (defined $c_key) { return $c_key; }
my $c_key = check_key($req, $Wormhole::Config::admin_key); if (defined $c_key) { return $c_key; }
my $c_isvalid = valid_subdomain($req); if (defined $c_isvalid) { return $c_isvalid; }
my @subdomain_r = subdomain_exists($req); my $c_subexists = @subdomain_r;
if ($c_subexists == 1) { return $subdomain_r[0]->finalize; }
......@@ -25,7 +25,7 @@ sub chgkey_subdomain {
my $subdomain_key = rand_pass(64);
my $s_res = $database::DDNS_DB_UPD_KEY->execute($subdomain_key, $subdomain);
my $s_res = $Wormhole::Util::Database::DDNS_DB_UPD_KEY->execute($subdomain_key, $subdomain);
if (defined $s_res) {
my $res = $req->new_response(200, [],
......
package clearsub;
package Wormhole::Route::ClearSub;
use strict;
use warnings;
......@@ -7,9 +7,9 @@ use Exporter qw(import);
our @EXPORT_OK = qw(clear_ddns);
use lib "..";
use checks qw(check_params check_key check_method subdomain_exists valid_subdomain);
use util qw(ip_record_type execute_ddns);
use database;
use Wormhole::Util::Checks qw(check_params check_key check_method subdomain_exists valid_subdomain);
use Wormhole::Util::MiscUtils qw(ip_record_type execute_ddns);
use Wormhole::Util::Database;
use Net::DNS;
sub clear_ddns {
......@@ -34,19 +34,19 @@ sub clear_ddns {
return $res->finalize;
}
my $dns_update = new Net::DNS::Update($conf::NAMESERVER_DNS_ZONE);
$dns_update->push(update => rr_del("$subdomain.$conf::NAMESERVER_DNS_ZONE. $rec_type"));
$dns_update->sign_tsig($conf::NAMESERVER_DNSSEC_KEY);
my $dns_update = new Net::DNS::Update($Wormhole::Config::NAMESERVER_DNS_ZONE);
$dns_update->push(update => rr_del("$subdomain.$Wormhole::Config::NAMESERVER_DNS_ZONE. $rec_type"));
$dns_update->sign_tsig($Wormhole::Config::NAMESERVER_DNSSEC_KEY);
my ($r_code, $r_msg) = execute_ddns($dns_update);
if (!$r_code) {
my $res = $req->new_response(400, [],
"An attempt to clear $subdomain.$conf::NAMESERVER_DNS_ZONE failed.\n"); return $res->finalize;
"An attempt to clear $subdomain.$Wormhole::Config::NAMESERVER_DNS_ZONE failed.\n"); return $res->finalize;
} else {
my $time = time;
$database::DDNS_DB_UPD_ADR->execute("(unset)", "(unset)", $time, $subdomain_r[0]);
$Wormhole::Util::Database::DDNS_DB_UPD_ADR->execute("(unset)", "(unset)", $time, $subdomain_r[0]);
my $res = $req->new_response(200, [],
"Successfully cleared $subdomain.$conf::NAMESERVER_DNS_ZONE.\n"); return $res->finalize;
"Successfully cleared $subdomain.$Wormhole::Config::NAMESERVER_DNS_ZONE.\n"); return $res->finalize;
}
}
......
package createsub;
package Wormhole::Route::CreateSub;
use strict;
use warnings;
......@@ -7,16 +7,16 @@ use Exporter qw(import);
our @EXPORT_OK = qw(create_subdomain);
use lib "..";
use checks qw(check_params check_key check_method subdomain_exists valid_subdomain);
use util qw(rand_pass);
use database;
use Wormhole::Util::Checks qw(check_params check_key check_method subdomain_exists valid_subdomain);
use Wormhole::Util::MiscUtils qw(rand_pass);
use Wormhole::Util::Database;
sub create_subdomain {
my $req = shift;
my $c_method = check_method($req); if (defined $c_method) { return $c_method; }
my $c_params = check_params($req, ("key", "subdomain")); if (defined $c_params) { return $c_params; }
my $c_key = check_key($req, $conf::admin_key); if (defined $c_key) { return $c_key; }
my $c_key = check_key($req, $Wormhole::Config::admin_key); if (defined $c_key) { return $c_key; }
my $c_isvalid = valid_subdomain($req); if (defined $c_isvalid) { return $c_isvalid; }
my @subdomain_r = subdomain_exists($req); my $c_subexists = @subdomain_r;
if ($c_subexists == 0) {
......@@ -28,15 +28,15 @@ sub create_subdomain {
my $subdomain_key = rand_pass(64);
my $time = time;
my $s_res = $database::DDNS_DB_INS->execute($subdomain, $subdomain_key, "(unset)", "(unset)", 0, $time, 0, 0);
my $s_res = $Wormhole::Util::Database::DDNS_DB_INS->execute($subdomain, $subdomain_key, "(unset)", "(unset)", 0, $time, 0, 0);
if (defined $s_res) {
my $res = $req->new_response(200, [],
"Successfully created subdomain \"$subdomain.$conf::NAMESERVER_DNS_ZONE\"\nKey: $subdomain_key\n");
"Successfully created subdomain \"$subdomain.$Wormhole::Config::NAMESERVER_DNS_ZONE\"\nKey: $subdomain_key\n");
return $res->finalize;
} else {
my $res = $req->new_response(400, [],
"Failed to create subdomain \"$subdomain.$conf::NAMESERVER_DNS_ZONE\"\n");
"Failed to create subdomain \"$subdomain.$Wormhole::Config::NAMESERVER_DNS_ZONE\"\n");
return $res->finalize;
}
}
......
package deletesub;
package Wormhole::Route::DeleteSub;
use strict;
use warnings;
......@@ -7,9 +7,9 @@ use Exporter qw(import);
our @EXPORT_OK = qw(delete_subdomain);
use lib "..";
use checks qw(check_params check_key check_method subdomain_exists valid_subdomain);
use util qw(execute_ddns);
use database;
use Wormhole::Util::Checks qw(check_params check_key check_method subdomain_exists valid_subdomain);
use Wormhole::Util::MiscUtils qw(execute_ddns);
use Wormhole::Util::Database;
use Net::DNS;
sub delete_subdomain {
......@@ -17,35 +17,35 @@ sub delete_subdomain {
my $c_method = check_method($req); if (defined $c_method) { return $c_method; }
my $c_params = check_params($req, ("key", "subdomain")); if (defined $c_params) { return $c_params; }
my $c_key = check_key($req, $conf::admin_key); if (defined $c_key) { return $c_key; }
my $c_key = check_key($req, $Wormhole::Config::admin_key); if (defined $c_key) { return $c_key; }
my $c_isvalid = valid_subdomain($req); if (defined $c_isvalid) { return $c_isvalid; }
my @subdomain_r = subdomain_exists($req); my $c_subexists = @subdomain_r;
if ($c_subexists == 1) { return $subdomain_r[0]->finalize; }
my $subdomain = $req->body_parameters->get("subdomain");
my $dns_update = new Net::DNS::Update($conf::NAMESERVER_DNS_ZONE);
$dns_update->push(update => rr_del("$subdomain.$conf::NAMESERVER_DNS_ZONE. A"));
$dns_update->push(update => rr_del("$subdomain.$conf::NAMESERVER_DNS_ZONE. AAAA"));
$dns_update->sign_tsig($conf::NAMESERVER_DNSSEC_KEY);
my $dns_update = new Net::DNS::Update($Wormhole::Config::NAMESERVER_DNS_ZONE);
$dns_update->push(update => rr_del("$subdomain.$Wormhole::Config::NAMESERVER_DNS_ZONE. A"));
$dns_update->push(update => rr_del("$subdomain.$Wormhole::Config::NAMESERVER_DNS_ZONE. AAAA"));
$dns_update->sign_tsig($Wormhole::Config::NAMESERVER_DNSSEC_KEY);
my ($r_code, $r_msg) = execute_ddns($dns_update);
if (!$r_code) {
my $res = $req->new_response(400, [],
"Failed to delete subdomain \"$subdomain.$conf::NAMESERVER_DNS_ZONE\" from nameserver.\n");
"Failed to delete subdomain \"$subdomain.$Wormhole::Config::NAMESERVER_DNS_ZONE\" from nameserver.\n");
return $res->finalize;
}
my $s_res = $database::DDNS_DB_DEL->execute($subdomain);
my $s_res = $Wormhole::Util::Database::DDNS_DB_DEL->execute($subdomain);
if (defined $s_res) {
my $res = $req->new_response(200, [],
"Successfully deleted subdomain \"$subdomain.$conf::NAMESERVER_DNS_ZONE\"\n");
"Successfully deleted subdomain \"$subdomain.$Wormhole::Config::NAMESERVER_DNS_ZONE\"\n");
return $res->finalize;
} else {
my $res = $req->new_response(400, [],
"Failed to delete subdomain \"$subdomain.$conf::NAMESERVER_DNS_ZONE\" from database.\n");
"Failed to delete subdomain \"$subdomain.$Wormhole::Config::NAMESERVER_DNS_ZONE\" from database.\n");
return $res->finalize;
}
}
......
package help;
package Wormhole::Route::Help;
use strict;
use warnings;
use lib "..";
use conf;
use checks qw(check_params check_method);
use Wormhole::Config;
use Wormhole::Util::Checks qw(check_params check_method);
sub get_help {
my $req = shift;
......@@ -13,7 +13,7 @@ sub get_help {
my $c_method = check_method($req);
if (!defined $c_method) {
my $c_params = check_params($req, ("key"));
if (!defined $c_params && $req->body_parameters->get("key") eq $conf::admin_key) {
if (!defined $c_params && $req->body_parameters->get("key") eq $Wormhole::Config::admin_key) {
my $res = $req->new_response(200, [],
"-- Wormhole DynDNS Admin help --\n" .
"[POST] /create <key> <subdomain> - Create a subdomain with a random key\n" .
......
package listsub;
package Wormhole::Route::ListSub;
use strict;
use warnings;
use lib "..";
use conf;
use checks qw(check_params check_method check_key);
use database;
use Wormhole::Config;
use Wormhole::Util::Checks qw(check_params check_method check_key);
use Wormhole::Util::Database;
sub list_subdomains {
my $req = shift;
my $c_method = check_method($req); if (defined $c_method) { return $c_method; }
my $c_params = check_params($req, ("key")); if (defined $c_params) { return $c_params; }
my $c_key = check_key($req, $conf::admin_key); if (defined $c_key) { return $c_key; }
my $c_key = check_key($req, $Wormhole::Config::admin_key); if (defined $c_key) { return $c_key; }
my @states = ("unlocked", "locked");
my $restext = "-- Wormhole DynDNS Subdomains --\n";
$database::DDNS_DB_SEL_ALL->execute;
$Wormhole::Util::Database::DDNS_DB_SEL_ALL->execute;
my $rowcount = 0;
while (my @row = $database::DDNS_DB_SEL_ALL->fetchrow_array) {
while (my @row = $Wormhole::Util::Database::DDNS_DB_SEL_ALL->fetchrow_array) {
$rowcount += 1;
my $time = localtime $row[5];
my $lockstate = $row[4];
$restext .= "$row[0].$conf::NAMESERVER_DNS_ZONE:\n├── Key: $row[1]\n├── State: $states[$lockstate]\n├── Updated: $time\n" .
$restext .= "$row[0].$Wormhole::Config::NAMESERVER_DNS_ZONE:\n├── Key: $row[1]\n├── State: $states[$lockstate]\n├── Updated: $time\n" .
"├── IPv4: $row[2]\n└── IPv6: $row[3]\n\n";
}
......
package locksub;
package Wormhole::Route::LockSub;
use strict;
use warnings;
......@@ -7,15 +7,15 @@ use Exporter qw(import);
our @EXPORT_OK = qw(lock_subdomain);
use lib "..";
use checks qw(check_params check_key check_method subdomain_exists valid_subdomain);
use database;
use Wormhole::Util::Checks qw(check_params check_key check_method subdomain_exists valid_subdomain);
use Wormhole::Util::Database;
sub lock_subdomain {
my $req = shift;
my $c_method = check_method($req); if (defined $c_method) { return $c_method; }
my $c_params = check_params($req, ("key", "subdomain", "state")); if (defined $c_params) { return $c_params; }
my $c_key = check_key($req, $conf::admin_key); if (defined $c_key) { return $c_key; }
my $c_key = check_key($req, $Wormhole::Config::admin_key); if (defined $c_key) { return $c_key; }
my $c_isvalid = valid_subdomain($req); if (defined $c_isvalid) { return $c_isvalid; }
my @subdomain_r = subdomain_exists($req); my $c_subexists = @subdomain_r;
if ($c_subexists == 1) { return $subdomain_r[0]->finalize; }
......@@ -31,15 +31,15 @@ sub lock_subdomain {
return $res->finalize;
}
my $s_res = $database::DDNS_DB_UPD_LCK->execute($lock_state, $subdomain);
my $s_res = $Wormhole::Util::Database::DDNS_DB_UPD_LCK->execute($lock_state, $subdomain);
if (defined $s_res) {
my $res = $req->new_response(200, [],
"Successfully $states[$lock_state]ed subdomain \"$subdomain.$conf::NAMESERVER_DNS_ZONE\"\n");
"Successfully $states[$lock_state]ed subdomain \"$subdomain.$Wormhole::Config::NAMESERVER_DNS_ZONE\"\n");
return $res->finalize;
} else {
my $res = $req->new_response(400, [],
"Failed to $states[$lock_state] subdomain \"$subdomain.$conf::NAMESERVER_DNS_ZONE\"\n");
"Failed to $states[$lock_state] subdomain \"$subdomain.$Wormhole::Config::NAMESERVER_DNS_ZONE\"\n");
return $res->finalize;
}
}
......
package modifysub;
package Wormhole::Route::ModifySub;
use strict;
use warnings;
......@@ -7,9 +7,9 @@ use Exporter qw(import);
our @EXPORT_OK = qw(modify_subdomain);
use lib "..";
use checks qw(check_params check_key check_method subdomain_exists valid_subdomain);
use util qw(ip_record_type execute_ddns);
use database;
use Wormhole::Util::Checks qw(check_params check_key check_method subdomain_exists valid_subdomain);
use Wormhole::Util::MiscUtils qw(ip_record_type execute_ddns);
use Wormhole::Util::Database;
use Net::DNS;
sub modify_subdomain {
......@@ -20,7 +20,7 @@ sub modify_subdomain {
my $c_isvalid = valid_subdomain($req); if (defined $c_isvalid) { return $c_isvalid; }
my @subdomain_r = subdomain_exists($req); my $c_subexists = @subdomain_r;
if ($c_subexists == 1) { return $subdomain_r[0]->finalize; }
my $c_key = check_key($req, $conf::admin_key); if (defined $c_key) { return $c_key; }
my $c_key = check_key($req, $Wormhole::Config::admin_key); if (defined $c_key) { return $c_key; }
my $subdomain = $req->body_parameters->get('subdomain');
my $address = $req->body_parameters->get('ip');
......@@ -30,10 +30,10 @@ sub modify_subdomain {
my $res = $req->new_response(400, [], "Invalid IP address specified.\n"); return $res->finalize;
}
my $dns_update = new Net::DNS::Update($conf::NAMESERVER_DNS_ZONE);
$dns_update->push(update => rr_del("$subdomain.$conf::NAMESERVER_DNS_ZONE. $rec_type"));
$dns_update->push(update => rr_add("$subdomain.$conf::NAMESERVER_DNS_ZONE. $ttl $rec_type $address"));
$dns_update->sign_tsig($conf::NAMESERVER_DNSSEC_KEY);
my $dns_update = new Net::DNS::Update($Wormhole::Config::NAMESERVER_DNS_ZONE);
$dns_update->push(update => rr_del("$subdomain.$Wormhole::Config::NAMESERVER_DNS_ZONE. $rec_type"));
$dns_update->push(update => rr_add("$subdomain.$Wormhole::Config::NAMESERVER_DNS_ZONE. $ttl $rec_type $address"));
$dns_update->sign_tsig($Wormhole::Config::NAMESERVER_DNSSEC_KEY);
my ($r_code, $r_msg) = execute_ddns($dns_update);
if (!$r_code) {
......@@ -41,9 +41,9 @@ sub modify_subdomain {
} else {
my $time = time;
if ($rec_type eq "A") {
$database::DDNS_DB_UPD_ADR->execute($address, $subdomain_r[3], $time, $subdomain_r[0]);
$Wormhole::Util::Database::DDNS_DB_UPD_ADR->execute($address, $subdomain_r[3], $time, $subdomain_r[0]);
} elsif ($rec_type eq "AAAA") {
$database::DDNS_DB_UPD_ADR->execute($subdomain_r[2], $address, $time, $subdomain_r[0]);
$Wormhole::Util::Database::DDNS_DB_UPD_ADR->execute($subdomain_r[2], $address, $time, $subdomain_r[0]);
}
my $res = $req->new_response(200, [], "Modfication successful.\n"); return $res->finalize;
......
package updatesub;
package Wormhole::Route::UpdateSub;
use strict;
use warnings;
......@@ -7,9 +7,9 @@ use Exporter qw(import);
our @EXPORT_OK = qw(update_ddns);
use lib "..";
use checks qw(check_params check_key check_method subdomain_exists valid_subdomain);
use util qw(ip_record_type execute_ddns);
use database;
use Wormhole::Util::Checks qw(check_params check_key check_method subdomain_exists valid_subdomain);
use Wormhole::Util::MiscUtils qw(ip_record_type execute_ddns);
use Wormhole::Util::Database;
use Net::DNS;
sub update_ddns {
......@@ -34,10 +34,10 @@ sub update_ddns {
return $res->finalize;
}
my $dns_update = new Net::DNS::Update($conf::NAMESERVER_DNS_ZONE);
$dns_update->push(update => rr_del("$subdomain.$conf::NAMESERVER_DNS_ZONE. $rec_type"));
$dns_update->push(update => rr_add("$subdomain.$conf::NAMESERVER_DNS_ZONE. $ttl $rec_type $address"));
$dns_update->sign_tsig($conf::NAMESERVER_DNSSEC_KEY);
my $dns_update = new Net::DNS::Update($Wormhole::Config::NAMESERVER_DNS_ZONE);
$dns_update->push(update => rr_del("$subdomain.$Wormhole::Config::NAMESERVER_DNS_ZONE. $rec_type"));
$dns_update->push(update => rr_add("$subdomain.$Wormhole::Config::NAMESERVER_DNS_ZONE. $ttl $rec_type $address"));
$dns_update->sign_tsig($Wormhole::Config::NAMESERVER_DNSSEC_KEY);
my ($r_code, $r_msg) = execute_ddns($dns_update);
if (!$r_code) {
......@@ -45,9 +45,9 @@ sub update_ddns {
} else {
my $time = time;
if ($rec_type eq "A") {
$database::DDNS_DB_UPD_ADR->execute($address, $subdomain_r[3], $time, $subdomain_r[0]);
$Wormhole::Util::Database::DDNS_DB_UPD_ADR->execute($address, $subdomain_r[3], $time, $subdomain_r[0]);
} elsif ($rec_type eq "AAAA") {
$database::DDNS_DB_UPD_ADR->execute($subdomain_r[2], $address, $time, $subdomain_r[0]);
$Wormhole::Util::Database::DDNS_DB_UPD_ADR->execute($subdomain_r[2], $address, $time, $subdomain_r[0]);
}
my $res = $req->new_response(200, [], "Update successful.\n"); return $res->finalize;
......
package checks;
package Wormhole::Util::Checks;
use strict;
use warnings;
use Exporter qw(import);
our @EXPORT_OK = qw(check_params check_key check_method subdomain_exists valid_subdomain);
use database;
use Wormhole::Util::Database;
sub check_params {
my ($req, @param_list) = @_;
......@@ -55,8 +55,8 @@ sub check_method {
sub subdomain_exists {
my $req = shift;
$database::DDNS_DB_SEL->execute($req->body_parameters->get('subdomain'));
my @result = $database::DDNS_DB_SEL->fetchrow_array;
$Wormhole::Util::Database::DDNS_DB_SEL->execute($req->body_parameters->get('subdomain'));
my @result = $Wormhole::Util::Database::DDNS_DB_SEL->fetchrow_array;
if (!@result) {
my @res = ($req->new_response(404, [], "The specified subdomain was not found.\n"));
return @res;
......
package database;
package Wormhole::Util::Database;
use strict;
use warnings;
use DBI;
use Exporter qw(import);
our @EXPORT_OK = qw(prepare_database);
our ($DDNS_DB_INS, $DDNS_DB_SEL_ALL, $DDNS_DB_SEL, $DDNS_DB_UPD_ADR);
our ($DDNS_DB_DEL, $DDNS_DB_UPD_ATT, $DDNS_DB_UPD_KEY, $DDNS_DB_UPD_LCK);
my $DDNS_DB = DBI->connect("dbi:SQLite:ddns.db","","") or die "Could not connect to database\n";
......
package util;
package Wormhole::Util::MiscUtils;
use strict;
use warnings;
......@@ -37,7 +37,7 @@ sub execute_ddns {
my $dns_update = shift;
my $dns_resolv = new Net::DNS::Resolver;
$dns_resolv->nameserver($conf::NAMESERVER); # convert to list later
$dns_resolv->nameserver($Wormhole::Config::NAMESERVER); # convert to list later
my $reply = $dns_resolv->send($dns_update);
if ($reply) {
......
#!/usr/bin/perl
package Wormhole;
use strict;
use warnings;
use Data::Dumper qw(Dumper);
$Data::Dumper::Sortkeys = 1;
use lib '.';
use conf;
use checks qw(check_params check_key check_method subdomain_exists valid_subdomain);
use util qw(rand_pass ip_record_type);
use database;
use routes::createsub;
use routes::modifysub;
use routes::deletesub;
use routes::locksub;
use routes::chgkey;
use routes::listsub;
use routes::help;
use routes::updatesub;
use routes::clearsub;
use Wormhole::Config;
use Wormhole::Util::Database qw(prepare_database);
use Wormhole::AppRouting;
use DBI;
use Plack::Request;
use Net::DNS;
database::prepare_database();
my %routes = (
"/create" => \&createsub::create_subdomain,
"/modify" => \&modifysub::modify_subdomain,
"/delete" => \&deletesub::delete_subdomain,
"/lock" => \&locksub::lock_subdomain,
"/chgkey" => \&chgkey::chgkey_subdomain,
"/list" => \&listsub::list_subdomains,
"/help" => \&help::get_help,
"/update" => \&updatesub::update_ddns,
"/clear" => \&clearsub::clear_ddns,
);
my $app_or_middleware = sub {
prepare_database();
sub run_wormhole {
my $env = shift; # PSGI env
my $req = Plack::Request->new($env);
my $path_info = $req->path_info;
my $query = $req->body_parameters;
if (defined $routes{$path_info}) {
return $routes{$path_info}($req);
if (defined $Wormhole::AppRouting::routes{$path_info}) {
return $Wormhole::AppRouting::routes{$path_info}($req);
} else {
my $res = $req->new_response(404, [], "Invalid URL.\n" .
"For a full reference view /help or refer to the documentation.\n");
......
#!/usr/bin/perl
use strict;
use warnings;
use Wormhole::Wormhole;
my $app_or_middleware = \&Wormhole::run_wormhole;
\ No newline at end of file
......@@ -5,7 +5,7 @@ master = true
socket = /usr/local/www/ddns/dyndns.sock
uid = www
gid = www
psgi = /usr/local/www/ddns/ddns-update.psgi
psgi = /usr/local/www/ddns/app.psgi
processes = 4
die-on-term = true
vacuum = true
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment