replace cloudflare-bpc with utls (#58)

* replace cloudflare-bpc with utls

* fix test

* ci: skip utls test
This commit is contained in:
UUBulb
2024-08-28 23:21:25 +08:00
committed by GitHub
parent 42187f2bf2
commit c8134a8b86
9 changed files with 368 additions and 37 deletions
+11
View File
@@ -2,6 +2,7 @@ package util
import (
"fmt"
"net/http"
"os"
"time"
@@ -9,6 +10,8 @@ import (
"github.com/nezhahq/service"
)
const MacOSChromeUA = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36"
var (
Json = jsoniter.ConfigCompatibleWithStandardLibrary
Logger service.Logger = service.ConsoleLogger
@@ -29,3 +32,11 @@ func Printf(enabled bool, format string, v ...interface{}) {
Logger.Infof("NEZHA@%s>> "+format, append([]interface{}{time.Now().Format("2006-01-02 15:04:05")}, v...)...)
}
}
func BrowserHeaders() *http.Header {
return &http.Header{
"Accept": {"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8"},
"Accept-Language": {"en,zh-CN;q=0.9,zh;q=0.8"},
"User-Agent": {MacOSChromeUA},
}
}