Add Surge MITM and scripts

This commit is contained in:
世界
2025-03-20 09:12:48 +08:00
parent 276584be09
commit 82bc416985
85 changed files with 7309 additions and 355 deletions

18
script/jsc/array_test.go Normal file
View File

@@ -0,0 +1,18 @@
package jsc_test
import (
"testing"
"github.com/sagernet/sing-box/script/jsc"
"github.com/dop251/goja"
"github.com/stretchr/testify/require"
)
func TestNewUInt8Array(t *testing.T) {
runtime := goja.New()
runtime.Set("hello", jsc.NewUint8Array(runtime, []byte("world")))
result, err := runtime.RunString("hello instanceof Uint8Array")
require.NoError(t, err)
require.True(t, result.ToBoolean())
}