mirror of
				https://github.com/taigrr/godns
				synced 2025-01-18 04:03:25 -08:00 
			
		
		
		
	Better DNSPod error message handling and ip_type checking
DNSPod API now requires record type to be specified, so the "ip_type" setting becomes a must in config.json.
This commit is contained in:
		
							parent
							
								
									acbbe3158d
								
							
						
					
					
						commit
						06a7d2384a
					
				| @ -204,6 +204,7 @@ For DNSPod, you need to provide your API Token(you can create it [here](https:// | ||||
|     } | ||||
|   ], | ||||
|   "ip_url": "https://myip.biturl.top", | ||||
|   "ip_type": "IPV4", | ||||
|   "interval": 300, | ||||
|   "socks5_proxy": "" | ||||
| } | ||||
|  | ||||
| @ -216,6 +216,9 @@ func (handler *Handler) UpdateIP(domainID int64, subDomainID string, subDomainNa | ||||
| 		value.Add("record_type", "A") | ||||
| 	} else if strings.ToUpper(handler.Configuration.IPType) == godns.IPV6 { | ||||
| 		value.Add("record_type", "AAAA") | ||||
| 	} else { | ||||
| 		log.Println("Error: must specify \"ip_type\" in config for DNSPod."); | ||||
| 		return | ||||
| 	} | ||||
| 
 | ||||
| 	value.Add("record_line", "默认") | ||||
| @ -238,6 +241,8 @@ func (handler *Handler) UpdateIP(domainID int64, subDomainID string, subDomainNa | ||||
| 
 | ||||
| 	if sjson.Get("status").Get("code").MustString() == "1" { | ||||
| 		log.Println("New IP updated!") | ||||
| 	} else { | ||||
| 		log.Println("Failed to update IP record:", sjson.Get("status").Get("message").MustString()) | ||||
| 	} | ||||
| 
 | ||||
| } | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user