[Style] Add User-Agent for provider request

This commit is contained in:
gVisor bot 2021-12-26 22:26:53 +08:00
parent 5317d6e3e6
commit e1a1f87dd4
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"
)