[Style] Add User-Agent for provider request

This commit is contained in:
Skyxim 2021-12-26 22:26:53 +08:00
parent a210ec4197
commit 82c8e02d02
2 changed files with 8 additions and 0 deletions

View file

@ -9,6 +9,7 @@ import (
"os"
"time"
netHttp "github.com/Dreamacro/clash/common/net"
"github.com/Dreamacro/clash/component/dialer"
types "github.com/Dreamacro/clash/constant/provider"
)
@ -56,6 +57,8 @@ func (h *HTTPVehicle) Read() ([]byte, error) {
}
req, err := http.NewRequest(http.MethodGet, uri.String(), nil)
req.Header.Set("user-agent", netHttp.UA)
if err != nil {
return nil, err
}

5
common/net/http.go Normal file
View file

@ -0,0 +1,5 @@
package net
const (
UA = "Clash"
)