diff --git a/.github/workflows/go-ossf-slsa3-publish.yml b/.github/workflows/go-ossf-slsa3-publish.yml new file mode 100644 index 0000000..3c1d7d5 --- /dev/null +++ b/.github/workflows/go-ossf-slsa3-publish.yml @@ -0,0 +1,38 @@ +# 此工作流程使用未经 GitHub 认证的操作。 +# 它们由第三方提供并受 +# 单独的服务条款、隐私政策和支持 +# 文档。 + +# 此工作流程允许您使用 SLSA3 兼容的构建器编译 Go 项目。 +# 此工作流程将生成一个所谓的“来源”文件,描述步骤 +# 执行这些操作是为了生成最终的二进制文件。 +# 该项目是 OpenSSF (openssf.org) 的一项倡议,开发于 +# https://github.com/slsa-framework/slsa-github-generator。 +# 来源文件可以使用 https://github.com/slsa-framework/slsa-verifier 进行验证。 +# 有关 SLSA 及其如何改进供应链的更多信息,请访问 slsa.dev。 + +姓名:名称: SLSA Go 发行者 +在: + 工作流程_调度: + 发布: + 类型:[已创建]] + +permissions: 权限:只读 + +jobs: + # =================================================== =================================================== =======================================# ======================================================================================================================================== + # 先决条件:在项目的根目录中创建一个 .slsa-goreleaser.yml。# Prerequesite: Create a .slsa-goreleaser.yml in the root directory of your project. + # 请参阅 https://github.com/slsa-framework/slsa-github-generator/blob/main/internal/builders/go/README.md#configuration-file 中的格式# See format in https://github.com/slsa-framework/slsa-github-generator/blob/main/internal/builders/go/README.md#configuration-file + #=================================================== =================================================== =======================================#========================================================================================================================================= + build: + permissions: + id-token: id-token:写#来签名。# To sign. + contents: 内容:写入 # 上传发布资产。# To upload release assets. + actions: actions: read # 读取工作流程路径。# To read workflow path. + uses: 使用:slsa-framework/slsa-github-generator/.github/workflows/builder_go_slsa3.yml@v1.4.0 + with: + go-version: 1.17 + # =================================================== =================================================== =========# ============================================================================================================= + # 可选:更多选项请参见 https://github.com/slsa-framework/slsa-github-generator#golang-projects# Optional: For more options, see https://github.com/slsa-framework/slsa-github-generator#golang-projects + # ============================================================================================================= + diff --git a/api.go b/api.go index 1b5dd6e..cefe33c 100644 --- a/api.go +++ b/api.go @@ -1,8 +1,8 @@ package requests import ( - "github.com/wangluozhe/requests/models" - "github.com/wangluozhe/requests/url" + "github.com/760644586/requests/models" + "github.com/760644586/requests/url" "net/http" ) @@ -46,4 +46,4 @@ func Connect(rawurl string, req *url.Request) (*models.Response, error) { func Trace(rawurl string, req *url.Request) (*models.Response, error) { return Request(http.MethodTrace, rawurl, req) -} \ No newline at end of file +} diff --git a/examples/body-test.go b/examples/body-test.go index 606a861..c0c3295 100644 --- a/examples/body-test.go +++ b/examples/body-test.go @@ -2,8 +2,8 @@ package main import ( "fmt" - "github.com/wangluozhe/requests" - "github.com/wangluozhe/requests/url" + "github.com/760644586/requests" + "github.com/760644586/requests/url" ) func main() { diff --git a/examples/cookies-test.go b/examples/cookies-test.go index a23f392..24755a2 100644 --- a/examples/cookies-test.go +++ b/examples/cookies-test.go @@ -2,8 +2,8 @@ package main import ( "fmt" - "github.com/wangluozhe/requests" - "github.com/wangluozhe/requests/url" + "github.com/760644586/requests" + "github.com/760644586/requests/url" ) func main() { diff --git a/examples/crypto-hmac.go b/examples/crypto-hmac.go index d1bcb76..a7c7b47 100644 --- a/examples/crypto-hmac.go +++ b/examples/crypto-hmac.go @@ -2,7 +2,7 @@ package main import ( "fmt" - "github.com/wangluozhe/requests/utils" + "github.com/760644586/requests/utils" ) func main() { diff --git a/examples/crypto-md5-test.go b/examples/crypto-md5-test.go index b90cabf..778349d 100644 --- a/examples/crypto-md5-test.go +++ b/examples/crypto-md5-test.go @@ -2,7 +2,7 @@ package main import ( "fmt" - "github.com/wangluozhe/requests/utils" + "github.com/760644586/requests/utils" ) func main() { diff --git a/examples/crypto-rc4-test.go b/examples/crypto-rc4-test.go index c0c39fe..5f731c6 100644 --- a/examples/crypto-rc4-test.go +++ b/examples/crypto-rc4-test.go @@ -2,7 +2,7 @@ package main import ( "fmt" - "github.com/wangluozhe/requests/utils" + "github.com/760644586/requests/utils" ) func main() { diff --git a/examples/crypto-sha-test.go b/examples/crypto-sha-test.go index 14fad08..34af65f 100644 --- a/examples/crypto-sha-test.go +++ b/examples/crypto-sha-test.go @@ -2,7 +2,7 @@ package main import ( "fmt" - "github.com/wangluozhe/requests/utils" + "github.com/760644586/requests/utils" ) func main() { diff --git a/examples/custom_settings.go b/examples/custom_settings.go index 654098f..ed09399 100644 --- a/examples/custom_settings.go +++ b/examples/custom_settings.go @@ -3,7 +3,7 @@ package main import ( "fmt" http "github.com/wangluozhe/chttp" - "github.com/wangluozhe/requests/transport" + "github.com/760644586/requests/transport" "io" "log" "strings" diff --git a/examples/data-test.go b/examples/data-test.go index e3bd920..4270766 100644 --- a/examples/data-test.go +++ b/examples/data-test.go @@ -2,8 +2,8 @@ package main import ( "fmt" - "github.com/wangluozhe/requests" - "github.com/wangluozhe/requests/url" + "github.com/760644586/requests" + "github.com/760644586/requests/url" ) func main() { diff --git a/examples/encode-test.go b/examples/encode-test.go index 4a074eb..67c77cf 100644 --- a/examples/encode-test.go +++ b/examples/encode-test.go @@ -2,7 +2,7 @@ package main import ( "fmt" - "github.com/wangluozhe/requests/utils" + "github.com/760644586/requests/utils" ) func main() { @@ -37,4 +37,4 @@ func main() { fmt.Println(escape) unescape := utils.UnEscape(escape) fmt.Println(unescape) -} \ No newline at end of file +} diff --git a/examples/get-test.go b/examples/get-test.go index a29d0d2..754bc70 100644 --- a/examples/get-test.go +++ b/examples/get-test.go @@ -2,8 +2,8 @@ package main import ( "fmt" - "github.com/wangluozhe/requests" - "github.com/wangluozhe/requests/url" + "github.com/760644586/requests" + "github.com/760644586/requests/url" ) func main() { diff --git a/examples/http2settings-test.go b/examples/http2settings-test.go index 135a032..f64c9c9 100644 --- a/examples/http2settings-test.go +++ b/examples/http2settings-test.go @@ -2,10 +2,10 @@ package main import ( "fmt" - http "github.com/wangluozhe/chttp" - "github.com/wangluozhe/requests" - "github.com/wangluozhe/requests/transport" - "github.com/wangluozhe/requests/url" + http "github.com/760644586/chttp" + "github.com/760644586/requests" + "github.com/760644586/requests/transport" + "github.com/760644586/requests/url" ) func main() { diff --git a/examples/ja3-test.go b/examples/ja3-test.go index d72d8e3..3d33ea9 100644 --- a/examples/ja3-test.go +++ b/examples/ja3-test.go @@ -2,8 +2,8 @@ package main import ( "fmt" - "github.com/wangluozhe/requests" - "github.com/wangluozhe/requests/url" + "github.com/760644586/requests" + "github.com/760644586/requests/url" ) func main() { diff --git a/examples/ja4-test.go b/examples/ja4-test.go index 75346f9..54cb5a6 100644 --- a/examples/ja4-test.go +++ b/examples/ja4-test.go @@ -2,10 +2,10 @@ package main import ( "fmt" - http "github.com/wangluozhe/chttp" - "github.com/wangluozhe/requests" - "github.com/wangluozhe/requests/transport" - "github.com/wangluozhe/requests/url" + http "github.com/760644586/chttp" + "github.com/760644586/requests" + "github.com/760644586/requests/transport" + "github.com/760644586/requests/url" ) func main() { diff --git a/examples/json-test.go b/examples/json-test.go index 82ade4d..58ca2c2 100644 --- a/examples/json-test.go +++ b/examples/json-test.go @@ -2,8 +2,8 @@ package main import ( "fmt" - "github.com/wangluozhe/requests" - "github.com/wangluozhe/requests/url" + "github.com/760644586/requests" + "github.com/760644586/requests/url" ) func main() { diff --git a/examples/orderHeader-test.go b/examples/orderHeader-test.go index f3715d9..1114a23 100644 --- a/examples/orderHeader-test.go +++ b/examples/orderHeader-test.go @@ -2,9 +2,9 @@ package main import ( "fmt" - http "github.com/wangluozhe/chttp" - "github.com/wangluozhe/requests" - "github.com/wangluozhe/requests/url" + http "github.com/760644586/chttp" + "github.com/760644586/requests" + "github.com/760644586/requests/url" ) func main() { diff --git a/examples/params-test.go b/examples/params-test.go index aa5dc10..98406bf 100644 --- a/examples/params-test.go +++ b/examples/params-test.go @@ -2,8 +2,8 @@ package main import ( "fmt" - "github.com/wangluozhe/requests" - "github.com/wangluozhe/requests/url" + "github.com/760644586/requests" + "github.com/760644586/requests/url" ) func main() { diff --git a/examples/postForm-test.go b/examples/postForm-test.go index cddd79f..ff898a8 100644 --- a/examples/postForm-test.go +++ b/examples/postForm-test.go @@ -2,8 +2,8 @@ package main import ( "fmt" - "github.com/wangluozhe/requests" - "github.com/wangluozhe/requests/url" + "github.com/760644586/requests" + "github.com/760644586/requests/url" ) func main() { diff --git a/examples/session-test.go b/examples/session-test.go index 78cf0b3..224e03e 100644 --- a/examples/session-test.go +++ b/examples/session-test.go @@ -2,7 +2,7 @@ package main import ( "fmt" - "github.com/wangluozhe/requests" + "github.com/760644586/requests" ) func main() { diff --git a/examples/tlsextensions-test.go b/examples/tlsextensions-test.go index 3dd9d70..e2cce0f 100644 --- a/examples/tlsextensions-test.go +++ b/examples/tlsextensions-test.go @@ -3,9 +3,9 @@ package main import ( "fmt" http "github.com/wangluozhe/chttp" - "github.com/wangluozhe/requests" - "github.com/wangluozhe/requests/transport" - "github.com/wangluozhe/requests/url" + "github.com/760644586/requests" + "github.com/760644586/requests/transport" + "github.com/760644586/requests/url" ) func main() { diff --git a/go.mod b/go.mod index b54a7b2..7d63353 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module github.com/wangluozhe/requests +module github.com/760644586/requests go 1.20 diff --git a/models/PrepareRequest.go b/models/PrepareRequest.go index 2f237a4..b557ba1 100644 --- a/models/PrepareRequest.go +++ b/models/PrepareRequest.go @@ -7,8 +7,8 @@ import ( "fmt" "github.com/wangluozhe/chttp" "github.com/wangluozhe/chttp/cookiejar" - "github.com/wangluozhe/requests/url" - "github.com/wangluozhe/requests/utils" + "github.com/760644586/requests/url" + "github.com/760644586/requests/utils" "io" "io/ioutil" "strconv" diff --git a/models/Request.go b/models/Request.go index bbc274d..a3ce24c 100644 --- a/models/Request.go +++ b/models/Request.go @@ -3,7 +3,7 @@ package models import ( "github.com/wangluozhe/chttp" "github.com/wangluozhe/chttp/cookiejar" - "github.com/wangluozhe/requests/url" + "github.com/760644586/requests/url" ) type Request struct { diff --git a/models/Response.go b/models/Response.go index 874953e..716ae73 100644 --- a/models/Response.go +++ b/models/Response.go @@ -6,7 +6,7 @@ import ( "fmt" "github.com/bitly/go-simplejson" "github.com/wangluozhe/chttp" - "github.com/wangluozhe/requests/url" + "github.com/760644586/requests/url" "io" ) diff --git a/sessions.go b/sessions.go index 043d8d4..9568991 100644 --- a/sessions.go +++ b/sessions.go @@ -13,10 +13,10 @@ import ( "github.com/wangluozhe/chttp" "github.com/wangluozhe/chttp/cookiejar" "github.com/wangluozhe/chttp/http2" - "github.com/wangluozhe/requests/models" - ja3 "github.com/wangluozhe/requests/transport" - "github.com/wangluozhe/requests/url" - "github.com/wangluozhe/requests/utils" + "github.com/760644586/requests/models" + ja3 "github.com/760644586/requests/transport" + "github.com/760644586/requests/url" + "github.com/760644586/requests/utils" "io/ioutil" "log" url2 "net/url" diff --git a/transport/utils.go b/transport/utils.go index c63338c..cfbd24d 100644 --- a/transport/utils.go +++ b/transport/utils.go @@ -48,27 +48,8 @@ func StringToSpec(ja3 string, userAgent string, tlsExtensions *TLSExtensions, fo } // parse curves var targetCurves []utls.CurveID - if parsedUserAgent == chrome && !tlsExtensions.NotUsedGREASE { - targetCurves = append(targetCurves, utls.CurveID(utls.GREASE_PLACEHOLDER)) //append grease for Chrome browsers - if supportedVersionsExt, ok := extMap["43"]; ok { - if supportedVersions, ok := supportedVersionsExt.(*utls.SupportedVersionsExtension); ok { - supportedVersions.Versions = append([]uint16{utls.GREASE_PLACEHOLDER}, supportedVersions.Versions...) - } - } - if keyShareExt, ok := extMap["51"]; ok { - if keyShare, ok := keyShareExt.(*utls.KeyShareExtension); ok { - keyShare.KeyShares = append([]utls.KeyShare{{Group: utls.CurveID(utls.GREASE_PLACEHOLDER), Data: []byte{0}}}, keyShare.KeyShares...) - } - } - } else { - if keyShareExt, ok := extMap["51"]; ok { - if keyShare, ok := keyShareExt.(*utls.KeyShareExtension); ok { - keyShare.KeyShares = append(keyShare.KeyShares, utls.KeyShare{Group: utls.CurveP256}) - } - } - } for _, c := range curves { - cid, err := strconv.ParseUint(c, 10, 16) + cid, err := strconv.ParseUint(c, 10, 0) if err != nil { return nil, err } @@ -133,19 +114,11 @@ func StringToSpec(ja3 string, userAgent string, tlsExtensions *TLSExtensions, fo // build extenions list var exts []utls.TLSExtension - //Optionally Add Chrome Grease Extension - if parsedUserAgent == chrome && !tlsExtensions.NotUsedGREASE { - exts = append(exts, &utls.UtlsGREASEExtension{}) - } for _, e := range extensions { te, ok := extMap[e] if !ok { return nil, raiseExtensionError(e) } - // //Optionally add Chrome Grease Extension - if e == "21" && parsedUserAgent == chrome && !tlsExtensions.NotUsedGREASE { - exts = append(exts, &utls.UtlsGREASEExtension{}) - } exts = append(exts, te) } @@ -153,7 +126,7 @@ func StringToSpec(ja3 string, userAgent string, tlsExtensions *TLSExtensions, fo var suites []uint16 //Optionally Add Chrome Grease Extension if parsedUserAgent == chrome && !tlsExtensions.NotUsedGREASE { - suites = append(suites, utls.GREASE_PLACEHOLDER) + suites = append(suites) } for _, c := range ciphers { cid, err := strconv.ParseUint(c, 10, 16) @@ -164,8 +137,6 @@ func StringToSpec(ja3 string, userAgent string, tlsExtensions *TLSExtensions, fo } _ = vid return &utls.ClientHelloSpec{ - // TLSVersMin: vid, - // TLSVersMax: vid, CipherSuites: suites, CompressionMethods: []byte{0}, Extensions: exts, @@ -177,27 +148,15 @@ func genMap() (extMap map[string]utls.TLSExtension) { extMap = map[string]utls.TLSExtension{ "0": &utls.SNIExtension{}, "5": &utls.StatusRequestExtension{}, - // These are applied later - // "10": &tls.SupportedCurvesExtension{...} - // "11": &tls.SupportedPointsExtension{...} "13": &utls.SignatureAlgorithmsExtension{ SupportedSignatureAlgorithms: []utls.SignatureScheme{ utls.ECDSAWithP256AndSHA256, utls.ECDSAWithP384AndSHA384, utls.ECDSAWithP521AndSHA512, utls.PSSWithSHA256, - utls.PSSWithSHA384, - utls.PSSWithSHA512, - utls.PKCS1WithSHA256, - utls.PKCS1WithSHA384, - utls.PKCS1WithSHA512, - utls.ECDSAWithSHA1, - utls.PKCS1WithSHA1, }, }, - "16": &utls.ALPNExtension{ - AlpnProtocols: []string{"h2", "http/1.1"}, - }, + "16": &utls.ALPNExtension{AlpnProtocols: []string{"h2", "h2-fb", "http/1.1"}}, "17": &utls.GenericExtension{Id: 17}, // status_request_v2 "18": &utls.SCTExtension{}, "21": &utls.UtlsPaddingExtension{GetPaddingLen: utls.BoringPaddingStyle}, @@ -222,7 +181,6 @@ func genMap() (extMap map[string]utls.TLSExtension) { "41": &utls.UtlsPreSharedKeyExtension{}, //FIXME pre_shared_key "43": &utls.SupportedVersionsExtension{Versions: []uint16{ utls.VersionTLS13, - utls.VersionTLS12, }}, "44": &utls.CookieExtension{}, "45": &utls.PSKKeyExchangeModesExtension{Modes: []uint8{ @@ -235,19 +193,10 @@ func genMap() (extMap map[string]utls.TLSExtension) { utls.ECDSAWithP384AndSHA384, utls.ECDSAWithP521AndSHA512, utls.PSSWithSHA256, - utls.PSSWithSHA384, - utls.PSSWithSHA512, - utls.PKCS1WithSHA256, - utls.PKCS1WithSHA384, - utls.PKCS1WithSHA512, - utls.ECDSAWithSHA1, - utls.PKCS1WithSHA1, }, }, // signature_algorithms_cert "51": &utls.KeyShareExtension{KeyShares: []utls.KeyShare{ {Group: utls.X25519}, - - // {Group: utls.CurveP384}, known bug missing correct extensions for handshake }}, "57": &utls.QUICTransportParametersExtension{}, "13172": &utls.NPNExtension{}, diff --git a/url/Request.go b/url/Request.go index 419c703..9717971 100644 --- a/url/Request.go +++ b/url/Request.go @@ -4,7 +4,7 @@ import ( "github.com/wangluozhe/chttp" "github.com/wangluozhe/chttp/cookiejar" "github.com/wangluozhe/chttp/http2" - ja3 "github.com/wangluozhe/requests/transport" + ja3 "github.com/760644586/requests/transport" "time" ) diff --git a/url/Values.go b/url/Values.go index 6b44ec7..2aab1a1 100644 --- a/url/Values.go +++ b/url/Values.go @@ -1,7 +1,7 @@ package url import ( - "github.com/wangluozhe/requests/utils" + "github.com/760644586/requests/utils" "strconv" "strings" "sync" diff --git a/version.go b/version.go index 3deb575..c2e9aea 100644 --- a/version.go +++ b/version.go @@ -2,6 +2,6 @@ package requests const ( NAME = "golang-requests" // 名称 - VERSION = "1.2.4" // 当前版本 + VERSION = "1.2.5" // 当前版本 USER_AGENT = NAME + VERSION // UA )