EricGEGE commited on
Commit
1f53197
·
verified ·
1 Parent(s): 2a8bf34

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -3
app.py CHANGED
@@ -19,11 +19,10 @@ import gradio as gr
19
  import asyncio
20
  from telegram import Bot
21
 
22
- import os
23
 
24
  def set_dns_resolver(dns_server):
25
- with open('/etc/resolv.conf', 'w') as resolv_conf:
26
- resolv_conf.write(f"nameserver {dns_server}\n")
27
 
28
  # Example usage with Cloudflare DNS (1.1.1.1)
29
  set_dns_resolver('1.1.1.1')
 
19
  import asyncio
20
  from telegram import Bot
21
 
22
+ import subprocess
23
 
24
  def set_dns_resolver(dns_server):
25
+ subprocess.run(['sudo', 'resolvectl', 'dns', 'eth0', dns_server])
 
26
 
27
  # Example usage with Cloudflare DNS (1.1.1.1)
28
  set_dns_resolver('1.1.1.1')