diff --git a/lib.d/do-configure.pl b/lib.d/do-configure.pl index 0a43d1e..641d66f 100755 --- a/lib.d/do-configure.pl +++ b/lib.d/do-configure.pl @@ -512,7 +512,7 @@ sub DoProject { &SetEnv("drop_unrewritable_content", 1); &SetEnv("force_https", 1); &SetEnv("hard_mode", 1); -&SetEnv("lh_onion_re", "\\\\b"); +&SetEnv("left_tld_re", "\\\\b"); &SetEnv("nginx_action_abort", "return 500"); &SetEnv("nginx_block_busy_size", "16k"); &SetEnv("nginx_block_count", 8); diff --git a/lib.d/lint.pl b/lib.d/lint.pl index 9316f16..dfad78e 100755 --- a/lib.d/lint.pl +++ b/lib.d/lint.pl @@ -50,7 +50,7 @@ my %known = 'HOST_WHITELIST' => 1, 'HOST_WHITELIST_RE' => 1, 'IS_SOFTMAP' => 1, - 'LH_ONION_RE' => 1, + 'LEFT_TLD_RE' => 1, 'LOG_DIR' => 1, # where logs for the current project live 'NGINX_ACTION_ABORT' => 1, 'NGINX_BLOCK_BUSY_SIZE' => 1, diff --git a/templates.d/nginx.conf.txt b/templates.d/nginx.conf.txt index 443d6ba..b81dc25 100644 --- a/templates.d/nginx.conf.txt +++ b/templates.d/nginx.conf.txt @@ -144,26 +144,26 @@ http { %%BEGIN # map: %DNS_DOMAIN% -> %ONION_ADDRESS% subs_filter - (%LH_ONION_RE%)%DNS_DOMAIN_RE2%\\b + (%LEFT_TLD_RE%)%DNS_DOMAIN_RE2%\\b $1%ONION_ADDRESS% gir ; # map: %DNS_DOMAIN_RE% -> %ONION_ADDRESS_RE% subs_filter - (%LH_ONION_RE%)%DNS_DOMAIN_RE4%\\b + (%LEFT_TLD_RE%)%DNS_DOMAIN_RE4%\\b $1%ONION_ADDRESS_RE2% gir ; %%IF %HARD_MODE% > 1 # hard2 map: %DNS_DOMAIN_RE2% -> %ONION_ADDRESS_RE2% subs_filter - (%LH_ONION_RE%)%DNS_DOMAIN_RE8%\\b + (%LEFT_TLD_RE%)%DNS_DOMAIN_RE8%\\b $1%ONION_ADDRESS_RE4% gir ; # hard2 map: %DNS_DOMAIN_RE3% -> %ONION_ADDRESS_RE3% subs_filter - (%LH_ONION_RE%)%DNS_DOMAIN_RE12%\\b + (%LEFT_TLD_RE%)%DNS_DOMAIN_RE12%\\b $1%ONION_ADDRESS_RE6% gir ; @@ -176,7 +176,7 @@ http { %%CSV %FOREIGNMAP_CSV% # for %4% -> %1% subs_filter - (%LH_ONION_RE%)%6%\\b + (%LEFT_TLD_RE%)%6%\\b $1%1% gir ; @@ -262,7 +262,7 @@ http { end return result end - local o, num, errs = ngx.re.gsub(i, "(%LH_ONION_RE%)([a-z2-7]{16}(?:[a-z2-7]{40})?\\.onion)\\b", o_to_d_lookup, "io") + local o, num, errs = ngx.re.gsub(i, "(%LEFT_TLD_RE%)([a-z2-7]{16}(?:[a-z2-7]{40})?\\.onion)\\b", o_to_d_lookup, "io") return o end @@ -292,7 +292,7 @@ http { end local num, errs %%BEGIN - i, num, errs = ngx.re.gsub(i, "(%LH_ONION_RE%)%DNS_DOMAIN_RE2%\\b", "${1}%ONION_ADDRESS%", "io") + i, num, errs = ngx.re.gsub(i, "(%LEFT_TLD_RE%)%DNS_DOMAIN_RE2%\\b", "${1}%ONION_ADDRESS%", "io") %%END return i end @@ -613,7 +613,7 @@ http { set_by_lua_block $request_uri2 { local old = ngx.var.request_uri or "" -- onion_to_dns is potentially expensive at scale, so do a cheap test - local m, err = ngx.re.match(old, "(?:%LH_ONION_RE%)[a-z2-7]{16}(?:[a-z2-7]{40})?\\.onion\\b", "io") + local m, err = ngx.re.match(old, "(?:%LEFT_TLD_RE%)[a-z2-7]{16}(?:[a-z2-7]{40})?\\.onion\\b", "io") if not m then -- nothing to attempt to rewrite, quick return return old end