gdc

package module
v0.0.0-...-e8872e3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 7, 2020 License: MIT Imports: 4 Imported by: 0

README

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

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

Usage

Standard usage:

package main

import (
    "github.com/MrJoshLab/go-dns-changer"
    "log"
)

func main() {

    interfaces := []string{"Wi-Fi"}
    dnsServers := []string{"8.8.8.8", "8.8.4.4"}    

    // you can debug with SetDebugMode to true!
    gdc.SetDebugMode(true)

    if err := gdc.SetDnsServers(interfaces, dnsServers); err != nil {
    
        switch err.(type) {
        case *gdc.Error:
            log.Fatal(err.(*gdc.Error).CommandOutput())
            return
        }
        
        log.Fatal(err)
    }

}

Contributing

Thank you for considering contributing to the this project!

License

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	GoogleDnsServers            = []string{"8.8.8.8", "8.8.4.4"}
	CloudFlareDnsServers        = []string{"1.1.1.1", "1.1.4.4"}
	NortonConnectSafeDnsServers = []string{"199.85.126.10", "199.85.127.10"}
	OpenDnsServers              = []string{"208.67.222.222", "208.67.220.220"}
	DNSWatchDnsServers          = []string{"84.200.69.80", "84.200.70.40"}
	ComodoSecureDnsServers      = []string{"8.26.56.26", "8.20.247.20"}
	VerisignDnsServers          = []string{"64.6.64.6", "64.6.65.6"}
	OpenNICDnsServers           = []string{"192.95.54.3", "192.95.54.1"}
	GreenTeamDnsServers         = []string{"81.218.119.11", "209.88.198.133"}
)

Functions

func SetDebugMode

func SetDebugMode(mode bool)

func SetDnsServers

func SetDnsServers(interfaces, servers []string) error

Types

type Error

type Error struct {
	// contains filtered or unexported fields
}

func (Error) CommandOutput

func (e Error) CommandOutput() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL