mirror of
https://github.com/clash-verge-rev/clash-verge-rev.git
synced 2024-11-16 11:42:21 +08:00
chore: optimised the logic of dns processing
This commit is contained in:
parent
a127cd6444
commit
014829e69a
|
@ -49,10 +49,9 @@ hardware_port=$(networksetup -listallhardwareports | awk -v dev="$nic" '
|
|||
|
||||
original_dns=$(networksetup -getdnsservers "$hardware_port")
|
||||
|
||||
if [ ${#original_dns} -gt 15 ]; then
|
||||
echo "Empty" >original_dns.txt
|
||||
else
|
||||
echo $original_dns >original_dns.txt
|
||||
if [ ${#original_dns} -le 15 ]; then
|
||||
if [ -n "$original_dns" ]; then
|
||||
echo $original_dns >original_dns.txt
|
||||
networksetup -setdnsservers "$hardware_port" "$1"
|
||||
fi
|
||||
fi
|
||||
|
||||
networksetup -setdnsservers "$hardware_port" "$1"
|
||||
|
|
|
@ -15,8 +15,6 @@ hardware_port=$(networksetup -listallhardwareports | awk -v dev="$nic" '
|
|||
|
||||
if [ -f original_dns.txt ]; then
|
||||
original_dns=$(cat original_dns.txt)
|
||||
else
|
||||
original_dns=$(networksetup -getdnsservers "$hardware_port")
|
||||
networksetup -setdnsservers "$hardware_port" $original_dns
|
||||
rm -rf original_dns.txt
|
||||
fi
|
||||
|
||||
networksetup -setdnsservers "$hardware_port" $original_dns
|
||||
|
|
Loading…
Reference in New Issue
Block a user