gistfile1.txt
· 732 B · Text
Brut
# Moved to the top of the function after rule::require_exists
local peer_name
peer_name=$(peers::find_by_ip "$client_ip")
local subtype
subtype=$(peers::get_meta "$peer_name" "subtype")
local subnet
subnet=$(config::subnet_for "$subtype")
# Changed this part from -n to -z
# Remove DNS redirect if applicable
local dns_redirect
dns_redirect=$(rule::get "$rule_name" "dns_redirect")
if [[ "$dns_redirect" == "true" ]]; then
if [[ -z "$subtype" ]]; then
local peer_type
peer_type=$(peers::get_type "$peer_name") || true
[[ -z "$peer_type" ]] && peer_type="phone" # fallback
subnet=$(config::subnet_for "$peer_type")
fi
rule::remove_dns_redirect "${subnet}.0/24"
fi
| 1 | # Moved to the top of the function after rule::require_exists |
| 2 | |
| 3 | local peer_name |
| 4 | peer_name=$(peers::find_by_ip "$client_ip") |
| 5 | |
| 6 | local subtype |
| 7 | subtype=$(peers::get_meta "$peer_name" "subtype") |
| 8 | |
| 9 | local subnet |
| 10 | subnet=$(config::subnet_for "$subtype") |
| 11 | |
| 12 | # Changed this part from -n to -z |
| 13 | # Remove DNS redirect if applicable |
| 14 | local dns_redirect |
| 15 | dns_redirect=$(rule::get "$rule_name" "dns_redirect") |
| 16 | if [[ "$dns_redirect" == "true" ]]; then |
| 17 | if [[ -z "$subtype" ]]; then |
| 18 | local peer_type |
| 19 | peer_type=$(peers::get_type "$peer_name") || true |
| 20 | [[ -z "$peer_type" ]] && peer_type="phone" # fallback |
| 21 | subnet=$(config::subnet_for "$peer_type") |
| 22 | fi |
| 23 | |
| 24 | rule::remove_dns_redirect "${subnet}.0/24" |
| 25 | fi |