[Style] Add User-Agent for provider request
This commit is contained in:
parent
a210ec4197
commit
82c8e02d02
2 changed files with 8 additions and 0 deletions
|
@ -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
5
common/net/http.go
Normal file
|
@ -0,0 +1,5 @@
|
|||
package net
|
||||
|
||||
const (
|
||||
UA = "Clash"
|
||||
)
|
Loading…
Reference in a new issue