1
0
mirror of https://github.com/taigrr/godns synced 2025-01-18 04:03:25 -08:00

fix golint warnings

This commit is contained in:
Timothy 2017-10-27 11:57:54 +08:00
parent d4875c1064
commit e0bde61c5c
3 changed files with 9 additions and 4 deletions

View File

@ -22,6 +22,7 @@ type DNSPodHandler struct {
Configuration *godns.Settings
}
// SetConfiguration pass dns settings and store it to handler instance
func (handler *DNSPodHandler) SetConfiguration(conf *godns.Settings) {
handler.Configuration = conf
}

View File

@ -6,13 +6,13 @@ import (
"io/ioutil"
)
//Domain struct
// Domain struct
type Domain struct {
DomainName string `json:"domain_name"`
SubDomains []string `json:"sub_domains"`
}
//Settings struct
// Settings struct
type Settings struct {
Provider string `json:"provider"`
Email string `json:"email"`
@ -26,9 +26,9 @@ type Settings struct {
Socks5Proxy string `json:"socks5_proxy"`
}
//LoadSettings -- Load settings from config file
// LoadSettings -- Load settings from config file
func LoadSettings(configPath string, settings *Settings) error {
//LoadSettings from config file
// LoadSettings from config file
file, err := ioutil.ReadFile(configPath)
if err != nil {
fmt.Println("Error occurs while reading config file, please make sure config file exists!")

View File

@ -24,6 +24,7 @@ const (
HE = "HE"
)
// GetCurrentIP gets public IP from internet
func GetCurrentIP(configuration *Settings) (string, error) {
client := &http.Client{}
@ -55,6 +56,7 @@ func GetCurrentIP(configuration *Settings) (string, error) {
return string(body), nil
}
// IdentifyPanic identifies panic and output the detailed panic infomation
func IdentifyPanic() string {
var name, file string
var line int
@ -83,11 +85,13 @@ func IdentifyPanic() string {
return fmt.Sprintf("pc:%x", pc)
}
// Usage prints the usage of GoDNS
func Usage() {
log.Println("[command] -c=[config file path]")
flag.PrintDefaults()
}
// CheckSettings check the format of settings
func CheckSettings(config *Settings) error {
if config.Provider == DNSPOD {
if (config.Email == "" || config.Password == "") && config.LoginToken == "" {