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

format code

This commit is contained in:
Timothy 2017-08-17 10:36:58 +08:00
parent f9bd43d299
commit e421c27afc
2 changed files with 12 additions and 11 deletions

View File

@ -9,8 +9,9 @@ import (
"net/url" "net/url"
"strconv" "strconv"
"strings" "strings"
"golang.org/x/net/proxy"
"github.com/bitly/go-simplejson" "github.com/bitly/go-simplejson"
"golang.org/x/net/proxy"
) )
func getCurrentIP(url string) (string, error) { func getCurrentIP(url string) (string, error) {
@ -193,7 +194,7 @@ func postData(url string, content url.Values) (string, error) {
} }
values := generateHeader(content) values := generateHeader(content)
req, _ := http.NewRequest("POST", "https://dnsapi.cn" + url, strings.NewReader(values.Encode())) req, _ := http.NewRequest("POST", "https://dnsapi.cn"+url, strings.NewReader(values.Encode()))
req.Header.Set("Content-Type", "application/x-www-form-urlencoded") req.Header.Set("Content-Type", "application/x-www-form-urlencoded")
req.Header.Set("User-Agent", fmt.Sprintf("GoDNS/0.1 (%s)", configuration.Email)) req.Header.Set("User-Agent", fmt.Sprintf("GoDNS/0.1 (%s)", configuration.Email))

View File

@ -14,15 +14,15 @@ type Domain struct {
//Settings struct //Settings struct
type Settings struct { type Settings struct {
Email string `json:"email"` Email string `json:"email"`
Password string `json:"password"` Password string `json:"password"`
LoginToken string `json:"login_token"` LoginToken string `json:"login_token"`
Domains []Domain `json:"domains"` Domains []Domain `json:"domains"`
IPUrl string `json:"ip_url"` IPUrl string `json:"ip_url"`
LogPath string `json:"log_path"` LogPath string `json:"log_path"`
LogSize int `json:"log_size"` LogSize int `json:"log_size"`
LogNum int `json:"log_num"` LogNum int `json:"log_num"`
Socks5Proxy string `json:"socks5_proxy"` Socks5Proxy string `json:"socks5_proxy"`
} }
//LoadSettings -- Load settings from config file //LoadSettings -- Load settings from config file