Closed MathNodes closed 1 year ago
you can use the CloudFlare DNS 1.1.1.1
for all OSes
The change dns function currently is working on all branches / for each dedicated os? We need just to wrap in a class and handle the change based on the os?
It doesn't work on Windows and I had issues with OS X. I forgot the exact command to change DNS on OS X and im not at my box to look it up right now.
So far the code only works on Linux. You can submit the pull request to any branch and I'll merge it to the rest.
For Windows, I believe you can run a power shell command to change the DNS of the tunnel interface. You may have to query the interface first. There is a routine in sentinel.py
that searches the interface names in the Windows branch.
Can't be much more help now until.I get to a computer tomorrow.
For Windows, I believe you can run a power shell command to change the DNS of the tunnel interface. You may have to query the interface first. There is a routine in sentinel.py that searches the interface names in the Windows branch.
I can't find it :disappointed:
For Windows, I believe you can run a power shell command to change the DNS of the tunnel interface. You may have to query the interface first. There is a routine in sentinel.py that searches the interface names in the Windows branch.
I can't find it 😞
My bad. It was in wallet.py
for iface in psutil.net_if_addrs().keys():
if "tun" in iface:
TUNIFACE = True
break
And to answer an earlier question, I think you can add the ChangeDNS
class to src/adapters
I've done a POC and the class was created under the utils folder. Btw, it's not a problem to move between the folder
The Linux version use resolv conf The Mac OSX use networksetup
For windows should be netsh 🤔
I don't know if I'm in the right direction
Linux and OS X is right. I honestly dont know much about Windows, but I think netsh is the right command for my previous readings.
FYI, I thought I recall that for windows the DNS is set per network device. For wireguard this is the wg99 device created by th3 Wireguard exe. For v2ray, Meile creates a random tunnel interface, tunXXXX, where X is a number 0-9. It should be the only tunnel interface so that code I sent should work to properly identify the nic.
Line 52 has a typo it. You have self.dn
I think you mean self.dns
As for Windows I think you shouldn't execute a netsh for each interface. This will cause a lot gsudo executions which will be quite annoying to the user. Instead match the keys with
if "tun" in interface or "wg99" in interface:
Then run the Popen
command
Other than that it looks really good!!!
Change those things and make a pull request and I'll fulfill the bounty.
Thanks a ton!
Also, networksetup
for OS X can be run as the user as far as I have done it. If not I'll wrap it in an osascript and run that.
Line 52 has a typo it. You have
self.dn
I think you meanself.dns
As for Windows I think you shouldn't execute a netsh for each interface. This will cause a lot gsudo executions which will be quite annoying to the user. Instead match the keys with
if "tun" in interface or "wg99" in interface:
Then run the
Popen
commandOther than that it looks really good!!!
We should do the same for OSX? Filter only tun and wg99?
Yes we should. It is only tunX
on OS X for either wireguard or v2ray.
Yes we should. It is only
tunX
on OS X for either wireguard or v2ray.
I can't find any tunX
here 😕
Oh. utunX
Oh.
utunX
I'm not sure it's possible to change DNS for utun interfaces. I think the only allowed values are those shown in listinterfaces
ok. I already had this in the os/x repo. You'll want to do
networksetup -setdnsservers Wi-Fi dns
Where dns
is a variable as you have (1.1.1.1 for now until I add in settings to change)
I don't have a Mac with an ethernet port so i think it is just:
networksetup -setdnsservers Ethernet dns
Would be nice to check if they are using Wi-Fi or Ethernet, but for now just place those two commands in your code. It doesn't require Admin privileges, so we good.
With that commit, I think the pull request will be complete.
I confirmed this works on my system when connected to Meile
ok. I already had this in the os/x repo. You'll want to do
networksetup -setdnsservers Wi-Fi dns
Where
dns
is a variable as you have (1.1.1.1 for now until I add in settings to change)I don't have a Mac with an ethernet port so i think it is just:
networksetup -setdnsservers Ethernet dns
Would be nice to check if they are using Wi-Fi or Ethernet, but for now just place those two commands in your code. It doesn't require Admin privileges, so we good.
With that commit, I think the pull request will be complete.
My code firstly got all the interface and then trough iteration set the DNS for each device, we don't need to add the the two commands for WiFi and Ethernet, as you can see from my previous screen the devices in my case are WiFi, Ax-* etc
Okay. Very good. I'll review it and merge and then send the XMR if all is gravy.
In
src/ui/widgets.py
the classRecycleViewSubRow
contains a routinechange_dns()
I want the primary function of changing the DNS system resolver to be platform specific. If OS X, then handle OS X DNS Changing; if Windows - change the DNS of the adapter, if Linux - you can copy the code in this routine to use for linux.
Ideally, there should be a class called
ChangeDNS
with achange()
routine that includesos.platform
checks and properly handles the changing of the system name server.Keep the
yield
,self
andmw
lines in this function and call theChangeDNS
class to make a system DNS change.