mirror of
				https://github.com/taigrr/godns
				synced 2025-01-18 04:03:25 -08:00 
			
		
		
		
	add customized user-agent
This commit is contained in:
		
							parent
							
								
									112b773ffb
								
							
						
					
					
						commit
						7ea034976a
					
				| @ -20,6 +20,7 @@ | ||||
|   ], | ||||
|   "ip_url": "https://myip.biturl.top", | ||||
|   "interval": 300, | ||||
|   "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/38.0.2125.111 Safari/537.36", | ||||
|   "ip_interface": "eth0", | ||||
|   "socks5_proxy": "", | ||||
|   "notify": { | ||||
|  | ||||
| @ -82,8 +82,12 @@ func (handler *Handler) UpdateIP(domain, subDomain, currentIP string) { | ||||
| 	values.Add("myip", currentIP) | ||||
| 
 | ||||
| 	client := godns.GetHttpClient(handler.Configuration) | ||||
| 
 | ||||
| 	req, _ := http.NewRequest("POST", GoogleUrl, strings.NewReader(values.Encode())) | ||||
| 
 | ||||
| 	if handler.Configuration.UserAgent != "" { | ||||
| 		req.Header.Add("User-Agent", handler.Configuration.UserAgent) | ||||
| 	} | ||||
| 
 | ||||
| 	resp, err := client.Do(req) | ||||
| 
 | ||||
| 	if err != nil { | ||||
|  | ||||
| @ -31,6 +31,7 @@ type Settings struct { | ||||
| 	Domains     []Domain `json:"domains"` | ||||
| 	IPUrl       string   `json:"ip_url"` | ||||
| 	Interval    int      `json:"interval"` | ||||
| 	UserAgent   string   `json:"user_agent,omitempty"` | ||||
| 	LogPath     string   `json:"log_path"` | ||||
| 	Socks5Proxy string   `json:"socks5_proxy"` | ||||
| 	Notify      Notify   `json:"notify"` | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user