mirror of https://github.com/dnomd343/XProxy.git
dnomd343
2 years ago
3 changed files with 17 additions and 16 deletions
@ -1,19 +1,19 @@ |
|||
package network |
|||
|
|||
import ( |
|||
"XProxy/cmd/common" |
|||
log "github.com/sirupsen/logrus" |
|||
"XProxy/cmd/common" |
|||
log "github.com/sirupsen/logrus" |
|||
) |
|||
|
|||
func loadDns(dns []string) { |
|||
if len(dns) == 0 { // without dns server
|
|||
log.Info("Using system DNS server") |
|||
return |
|||
} |
|||
log.Infof("Setting up DNS server -> %v", dns) |
|||
dnsConfig := "" |
|||
for _, dnsAddr := range dns { |
|||
dnsConfig += "nameserver " + dnsAddr + "\n" |
|||
} |
|||
common.WriteFile("/etc/resolv.conf", dnsConfig, true) |
|||
if len(dns) == 0 { // without dns server
|
|||
log.Info("Using system DNS server") |
|||
return |
|||
} |
|||
log.Infof("Setting up DNS server -> %v", dns) |
|||
dnsConfig := "" |
|||
for _, dnsAddr := range dns { |
|||
dnsConfig += "nameserver " + dnsAddr + "\n" |
|||
} |
|||
common.WriteFile("/etc/resolv.conf", dnsConfig, true) |
|||
} |
|||
|
Loading…
Reference in new issue