1
0
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:
Timothy
2019-09-02 19:05:35 +08:00
parent 112b773ffb
commit 7ea034976a
3 changed files with 7 additions and 1 deletions

View File

@@ -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 {