Repository navigation
Can't switch between configurations #4
Description
Activity
It depends on whether the dnscrypt-proxy is actually running. You can check it with
pgrep -U 0 dnscrypt-proxy. If you start the proxy from the menu, it should automatically switch to your DNSCrypt setting, which is either "DNSCrypt" or "DNSCrypt + Fallback", depending on your choice. (You can choose your preferred DNSCrypt setting by clicking on the menu icon for menu dropdown, pressing ALT, then clicking on one of two "Set As Default…" commands.)If the proxy is running, then you can manually switch to "Default DNS", if you like. The proxy will continue to run in the background, but you won't use it, but since it's running, you can manually switch back to "DNSCrypt" or "DNSCrypt + Fallback". This means that switching to the latter two settings is not possible if the proxy is disabled.
If the proxy is not running (or if you stop the proxy from the menu), then DNSCrypt Menu should automatically load (or switch to) the "Default DNS" setting.
If you manually change the network settings, i.e. add
127.0.0.1in System Preferences > Network > [Service] > Advanced > DNS, but dnscrypt-proxy is not running, then you won't resolve any domain names to IP addresses, i.e. web browsing etc. will not work. In this case you can either start the dnscrypt-proxy manually in the Terminal withsudo brew services start dnscrypt-proxy, or simply remove127.0.0.1(and all other resolvers) from Network Preferences: DNSCrypt Menu will then notice this as a network reset to "empty", and it will consequently load your "Default DNS" setting again.dnscrypt-proxy is running (homebrew service, autostarted). And, as I originally wrote, I can't switch between configurations. No matter where I click the ticked item always stays the same.
I wonder if there's a way to debug this
@indeyets I'm not having any issues using the latest version of
DNSCryptMenu.30s.shcloned from master with the v2 beta 10 version of BitBar (not available via Homebrew; brew only has version 1.9.2).Could it be that
/etc/resolv.confdoesn't contain the IPs as expected byDNSCryptMenu.30s.sh?On macOS Mojave 10.14.4, the contents of
/etc/resolv.confis prefaced with:# # macOS Notice # # This file is not consulted for DNS hostname resolution, address # resolution, or the DNS query routing mechanism used by most # processes on this system. # # To view the DNS configuration used by this system, use: # scutil --dns # # SEE ALSO # dns-sd(1), scutil(8) # # This file is automatically generated. #
The
DNSCryptMenu.30s.shscript is reading/etc/resolv.confin the_current_resolversfunction:DNSCrypt-Menu/DNSCryptMenu.30s.sh
Lines 1506 to 1517 in cba6859
_current_resolvers () { confrs=$(cat /etc/resolv.conf | awk '/^nameserver /{print $2}' | awk '!seen[$0]++' | sort) [[ $confrs == "" ]] && exit 0 [[ $localdns ]] && confrs=$(echo "$confrs" | grep -v "$localdns") ips="" while read -r confr do [[ $ips ]] && ips="$ips " ips="$ips$confr" done < <(echo "$confrs") echo "$ips" } And checking the results in the
_displaynamefunction:DNSCrypt-Menu/DNSCryptMenu.30s.sh
Lines 1519 to 1536 in cba6859
_displayname () { resolvers="$1" if [[ $resolvers == $DNSCRYPT_PROXY_IPS ]] ; then echo "DNSCrypt" elif [[ $resolvers == "$DNSCRYPT_PROXY_IPS $ADDITIONAL_IPS" ]] ; then echo "DNSCrypt + Fallback" elif [[ $resolvers == $UDEFAULTS ]] ; then if [[ $UDEFAULTS == $DNSCRYPT_PROXY_IPS ]] ; then echo "DNSCrypt" elif [[ $UDEFAULTS == "$DNSCRYPT_PROXY_IPS $ADDITIONAL_IPS" ]] ; then echo "DNSCrypt + Fallback" else echo "Default DNS" fi else echo "Other DNS" fi } But as far as I can tell the
/etc/resolv.conffile never contains the$ADDITIONAL_IPS, so theDNSCryptMenu.30s.shscript is always succeeding on the[[ $resolvers == $DNSCRYPT_PROXY_IPS ]]and assuming"DNSCrypt"and never"DNSCrypt + Fallback".I don't really understand if and when (or by what program)
/etc/resolv.confis expected to be written to. It seems like theDNSCryptMenu.30s.shscript is relying on this file and perhaps making assumptions about what it will contain that may no longer be true, perhaps because of changes in macOS.@leoj3n it does not, unfortunately.
I moved to https://github.com/jedisct1/bitbar-dnscrypt-proxy-switcher since then and it's been great for me
Am I correct, that click on "DNSCrypt" should switch resolving to local proxy? That doesn't work for me. Nothing happens when I click on it.
If I chose 127.0.0.1 manually in my network settings it correctly shows "DNSCrypt", but, again, I can not switch to "Default DNS".
I am not sure if it is a bug or just my misunderstanding of how it is supposed to work