matryer / xbar-plugins

Plugin repository for xbar (the BitBar reboot)
https://xbarapp.com
2.44k stars 1.04k forks source link

001-dnsswitcher.1d.sh: #2016

Open everykindofpeople opened 6 months ago

everykindofpeople commented 6 months ago

fao @saiqulhaq - I'm new to this and not familiar with scripts. I want to be able to toggle between Control D dns service and Cloudflare from bar. How do I enable this plugin? Any help is appreciated. Thanks

sprak3000 commented 6 months ago

@everykindofpeople

Looking at the plugin, you would need to edit the script as follows.

First, you need to define the list of DNS servers you want to use from Control D. Where you mention wanting to also use Cloudflare, look for this block in the script

# shellcheck disable=2034
cloudflare="1.1.1.1
            1.0.0.1"

and add your Control D IP addresses after it

# shellcheck disable=2034
cloudflare="1.1.1.1
            1.0.0.1"

# shellcheck disable=2034
controld="X.X.X.X
            Y.Y.Y.Y"

Where you just want these two, you want to change this line

enabled_dns_address=(cloudflare google level3 opendns norton default)

to be this

enabled_dns_address=(cloudflare controld default)

Once you have saved those changes, reload the plugin. Should see just Cloudflare and Control D servers as options.

everykindofpeople commented 6 months ago

Thanks for the quick reply! That worked great to edit the server list. And now the plugin displays the current dns settings in xbar. But it doesn't change to a different server when I click on it in xbar. I'm running Sonoma 14.3, in case that has anything to do with it.

saiqulhaq commented 6 months ago

I am not using this plugin anymore @everykindofpeople FYI the DNS switcher utilizes networksetup command to change the DNS, you may read the documentation here https://www.unix.com/man-page/osx/8/networksetup/ https://github.com/matryer/xbar-plugins/blob/584c6df923f59993e0fd24a340caa1c4a864efeb/Network/dnsswitcher.1d.sh#L101

I think you can try that it's still working fine with Sonoma or not by running the networksetup directly in your terminal, but try to close the Xbar app first.

This tutorial may helpful for you https://blog.kandji.io/managing-network-settings-on-macos-big-sur-and-mac-address-randomization-in-ios-14