Add Surge MITM and scripts

This commit is contained in:
世界 2025-02-02 17:03:27 +08:00
parent b55bfca7de
commit 5e28a80e63
No known key found for this signature in database
GPG key ID: CD109927C34A63C4
53 changed files with 4437 additions and 15842 deletions

23
script/jsc/array.go Normal file
View file

@ -0,0 +1,23 @@
package jsc
import (
_ "unsafe"
"github.com/dop251/goja"
)
func NewUint8Array(runtime *goja.Runtime, data []byte) goja.Value {
buffer := runtime.NewArrayBuffer(data)
ctor, loaded := goja.AssertConstructor(runtimeGetUint8Array(runtime))
if !loaded {
panic(runtime.NewTypeError("missing UInt8Array constructor"))
}
array, err := ctor(nil, runtime.ToValue(buffer))
if err != nil {
panic(runtime.NewGoError(err))
}
return array
}
//go:linkname runtimeGetUint8Array github.com/dop251/goja.(*Runtime).getUint8Array
func runtimeGetUint8Array(r *goja.Runtime) *goja.Object