Merge pull request #92 from carroarmato0/master
Support passing multiple IP addresses
This commit is contained in:
commit
37eb135d4f
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"ips": {
|
"ips": {
|
||||||
"steam": "10.10.3.11",
|
"steam": ["10.10.3.10", "10.10.3.11"],
|
||||||
"origin": "10.10.3.12",
|
"origin": "10.10.3.12",
|
||||||
"blizzard": "10.10.3.13",
|
"blizzard": "10.10.3.13",
|
||||||
"windows": "10.10.3.14",
|
"windows": "10.10.3.14",
|
||||||
|
@ -16,7 +16,7 @@ fi
|
|||||||
cachenamedefault="disabled"
|
cachenamedefault="disabled"
|
||||||
|
|
||||||
while read line; do
|
while read line; do
|
||||||
ip=$(jq -r ".ips[\"${line}\"]" config.json)
|
ip=$(jq ".ips[\"${line}\"]" config.json)
|
||||||
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)
|
||||||
|
|
||||||
@ -39,7 +39,7 @@ while read entry; do
|
|||||||
continue;
|
continue;
|
||||||
fi
|
fi
|
||||||
cacheipname="cacheip${!cachename}"
|
cacheipname="cacheip${!cachename}"
|
||||||
cacheip=${!cacheipname}
|
cacheip=$(jq -r 'if type == "array" then .[] else . end' <<< ${!cacheipname} | xargs)
|
||||||
while read fileid; do
|
while read fileid; do
|
||||||
while read filename; do
|
while read filename; do
|
||||||
destfilename=$(echo $filename | sed -e 's/txt/conf/')
|
destfilename=$(echo $filename | sed -e 's/txt/conf/')
|
||||||
@ -54,7 +54,9 @@ while read entry; do
|
|||||||
if grep -q "$parsed" $outputfile; then
|
if grep -q "$parsed" $outputfile; then
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
echo "address=/${parsed}/${cacheip}" >> $outputfile
|
for i in ${cacheip}; do
|
||||||
|
echo "address=/${parsed}/${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)
|
||||||
|
@ -16,7 +16,7 @@ fi
|
|||||||
cachenamedefault="disabled"
|
cachenamedefault="disabled"
|
||||||
|
|
||||||
while read line; do
|
while read line; do
|
||||||
ip=$(jq -r ".ips[\"${line}\"]" config.json)
|
ip=$(jq ".ips[\"${line}\"]" config.json)
|
||||||
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)
|
||||||
|
|
||||||
@ -39,7 +39,7 @@ while read entry; do
|
|||||||
continue;
|
continue;
|
||||||
fi
|
fi
|
||||||
cacheipname="cacheip${!cachename}"
|
cacheipname="cacheip${!cachename}"
|
||||||
cacheip=${!cacheipname}
|
cacheip=$(jq -r 'if type == "array" then .[] else . end' <<< ${!cacheipname} | xargs)
|
||||||
while read fileid; do
|
while read fileid; do
|
||||||
while read filename; do
|
while read filename; do
|
||||||
destfilename=$(echo $filename | sed -e 's/txt/conf/')
|
destfilename=$(echo $filename | sed -e 's/txt/conf/')
|
||||||
@ -56,7 +56,9 @@ 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
|
for i in ${cacheip}; 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…
x
Reference in New Issue
Block a user