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

support api token login

This commit is contained in:
gao 2016-05-26 11:09:10 +08:00
parent 773a91f37c
commit 3e36845495
4 changed files with 12 additions and 2 deletions

4
.gitignore vendored
View File

@ -26,3 +26,7 @@ config.json
godns
vendor/*
/.idea
/godns.iml
/godns.ipr
/godns.iws

View File

@ -1,6 +1,7 @@
{
"email": "",
"password": "",
"loginToken": "",
"domain": "",
"sub_domain": "",
"ip_url": "http://members.3322.org/dyndns/getip",

View File

@ -29,8 +29,12 @@ func get_currentIP(url string) (string, error) {
func generate_header(content url.Values) url.Values {
header := url.Values{}
if(Configuration.LoginToken!=""){
header.Add("login_token", Configuration.LoginToken)
}else{
header.Add("login_email", Configuration.Email)
header.Add("login_password", Configuration.Password)
}
header.Add("format", "json")
header.Add("lang", "en")
header.Add("error_on_empty", "no")

View File

@ -10,6 +10,7 @@ import (
type Settings struct {
Email string
Password string
LoginToken string
Domain string
Sub_domain string
IP_Url string