mirror of
https://github.com/uklans/cache-domains
synced 2025-08-03 23:01:23 +02:00
Added ability to include multiple IP Addresses for unbound
This commit is contained in:
parent
02b919e1eb
commit
227299f4fe
10
README.md
10
README.md
@ -57,6 +57,16 @@ The wildcard format shall be defined as per the below
|
|||||||
|
|
||||||
If you are using these files within a squid dst_domain acl you will need to reformat the wildcard entries to be compliant with the squid acl format. The following regex should suffice `s/*\./\./`
|
If you are using these files within a squid dst_domain acl you will need to reformat the wildcard entries to be compliant with the squid acl format. The following regex should suffice `s/*\./\./`
|
||||||
|
|
||||||
|
### Multiple IP Addresses
|
||||||
|
|
||||||
|
unbound supports assigning multiple IP addresses to a record (can be used if using multiple caches). Example config formatting:
|
||||||
|
```json
|
||||||
|
"ips": {
|
||||||
|
"steam": [ "10.10.3.11", "10.10.3.12", "10.10.3.13" ],
|
||||||
|
"generic": "10.10.3.16"
|
||||||
|
},
|
||||||
|
```
|
||||||
|
|
||||||
## Updates
|
## Updates
|
||||||
|
|
||||||
Please fork this repository and submit pull requests if you have any extra hostnames or services to add. We want this list to be definitive and collaborative!
|
Please fork this repository and submit pull requests if you have any extra hostnames or services to add. We want this list to be definitive and collaborative!
|
||||||
|
@ -15,8 +15,13 @@ fi
|
|||||||
|
|
||||||
cachenamedefault="disabled"
|
cachenamedefault="disabled"
|
||||||
|
|
||||||
while read line; do
|
while read line; do
|
||||||
ip=$(jq -r ".ips[\"${line}\"]" config.json)
|
linecount=$(jq -r ".ips[\"${line}\"]" config.json |wc -l)
|
||||||
|
if [[ $linecount -eq 1 ]]; then
|
||||||
|
ip=$(jq -r ".ips[\"${line}\"]" config.json)
|
||||||
|
else
|
||||||
|
ip=$(jq -r ".ips[\"${line}\"][]" config.json |tr '\n' ' ')
|
||||||
|
fi
|
||||||
declare "cacheip$line"="$ip"
|
declare "cacheip$line"="$ip"
|
||||||
done <<< $(jq -r '.ips | to_entries[] | .key' config.json)
|
done <<< $(jq -r '.ips | to_entries[] | .key' config.json)
|
||||||
|
|
||||||
@ -56,7 +61,10 @@ while read entry; do
|
|||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
echo " local-zone: \"${parsed}\" redirect" >> $outputfile
|
echo " local-zone: \"${parsed}\" redirect" >> $outputfile
|
||||||
echo " local-data: \"${parsed} 30 IN A ${cacheip}\"" >> $outputfile
|
cacheiplist=($cacheip)
|
||||||
|
for i in "${cacheiplist[@]}"; do
|
||||||
|
echo " local-data: \"${parsed} 30 IN A ${i}\"" >> $outputfile
|
||||||
|
done
|
||||||
done <<< $(cat ${basedir}/$filename);
|
done <<< $(cat ${basedir}/$filename);
|
||||||
done <<< $(jq -r ".cache_domains[$entry].domain_files[$fileid]" $path)
|
done <<< $(jq -r ".cache_domains[$entry].domain_files[$fileid]" $path)
|
||||||
done <<< $(jq -r ".cache_domains[$entry].domain_files | to_entries[] | .key" $path)
|
done <<< $(jq -r ".cache_domains[$entry].domain_files | to_entries[] | .key" $path)
|
||||||
|
Loading…
Reference in New Issue
Block a user