mirror of
				https://github.com/taigrr/godns
				synced 2025-01-18 04:03:25 -08:00 
			
		
		
		
	for V1.5.3
This commit is contained in:
		
							parent
							
								
									6daac3746c
								
							
						
					
					
						commit
						a500ad329f
					
				
							
								
								
									
										1
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							| @ -29,6 +29,7 @@ config.json | ||||
| *.swp | ||||
| *.gz | ||||
| cmd/godns/godns | ||||
| cmd/godns/config.json | ||||
| 
 | ||||
| /.idea | ||||
| /godns.iml | ||||
|  | ||||
| @ -1,6 +1,5 @@ | ||||
| { | ||||
|   "provider": "DNSPod", | ||||
|   "email": "example@gmail.com", | ||||
|   "password": "", | ||||
|   "login_token": "", | ||||
|   "domains": [ | ||||
| @ -29,4 +28,4 @@ | ||||
|     "smtp_port": 25, | ||||
|     "send_to": "" | ||||
|   } | ||||
| } | ||||
| } | ||||
|  | ||||
| @ -88,10 +88,8 @@ func (handler *DNSPodHandler) GenerateHeader(content url.Values) url.Values { | ||||
| 	header := url.Values{} | ||||
| 	if handler.Configuration.LoginToken != "" { | ||||
| 		header.Add("login_token", handler.Configuration.LoginToken) | ||||
| 	} else { | ||||
| 		header.Add("login_email", handler.Configuration.Email) | ||||
| 		header.Add("login_password", handler.Configuration.Password) | ||||
| 	} | ||||
| 
 | ||||
| 	header.Add("format", "json") | ||||
| 	header.Add("lang", "en") | ||||
| 	header.Add("error_on_empty", "no") | ||||
| @ -253,7 +251,7 @@ func (handler *DNSPodHandler) PostData(url string, content url.Values) (string, | ||||
| 	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("User-Agent", fmt.Sprintf("GoDNS/0.1 (%s)", handler.Configuration.Email)) | ||||
| 	req.Header.Set("User-Agent", fmt.Sprintf("GoDNS/0.1 (%s)", "")) | ||||
| 
 | ||||
| 	response, err := client.Do(req) | ||||
| 
 | ||||
|  | ||||
| @ -25,7 +25,6 @@ type Notify struct { | ||||
| // Settings struct | ||||
| type Settings struct { | ||||
| 	Provider    string   `json:"provider"` | ||||
| 	Email       string   `json:"email"` | ||||
| 	Password    string   `json:"password"` | ||||
| 	LoginToken  string   `json:"login_token"` | ||||
| 	Domains     []Domain `json:"domains"` | ||||
|  | ||||
							
								
								
									
										4
									
								
								utils.go
									
									
									
									
									
								
							
							
						
						
									
										4
									
								
								utils.go
									
									
									
									
									
								
							| @ -74,8 +74,8 @@ func GetCurrentIP(configuration *Settings) (string, error) { | ||||
| // CheckSettings check the format of settings | ||||
| func CheckSettings(config *Settings) error { | ||||
| 	if config.Provider == DNSPOD { | ||||
| 		if (config.Email == "" || config.Password == "") && config.LoginToken == "" { | ||||
| 			return errors.New("email/password or login token cannot be empty") | ||||
| 		if config.Password == "" && config.LoginToken == "" { | ||||
| 			return errors.New("password or login token cannot be empty") | ||||
| 		} | ||||
| 	} else if config.Provider == HE { | ||||
| 		if config.Password == "" { | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user