项目作者: mrjosh

项目描述 :
🌎Golang DNS changer
高级语言: Go
项目地址: git://github.com/mrjosh/go-dns-changer.git
创建时间: 2020-03-07T00:03:54Z
项目社区:https://github.com/mrjosh/go-dns-changer

开源协议:MIT License

下载


This project is under construction.

Golang DNS Changer

This is a DNS changer library written in Golang.

Notes

  • IMPORTANT: Requires root/sudo/admin privileges to adjust any settings.
  • Tested on:
    • macOS (Sierra, High Sierra, mojave, catalina)

Installing

  1. $ go get github.com/MrJoshLab/go-dns-changer

Usage

Standard usage:

  1. package main
  2. import (
  3. "github.com/MrJoshLab/go-dns-changer"
  4. "log"
  5. )
  6. func main() {
  7. interfaces := []string{"Wi-Fi"}
  8. dnsServers := []string{"8.8.8.8", "8.8.4.4"}
  9. // you can debug with SetDebugMode to true!
  10. gdc.SetDebugMode(true)
  11. if err := gdc.SetDnsServers(interfaces, dnsServers); err != nil {
  12. switch err.(type) {
  13. case *gdc.Error:
  14. log.Fatal(err.(*gdc.Error).CommandOutput())
  15. return
  16. }
  17. log.Fatal(err)
  18. }
  19. }

Contributing

Thank you for considering contributing to the this project!

License

The go-dns-changer is open-source software licensed under the MIT license.