diff --git a/dialer_test.go b/dialer_test.go index b218fb3..00c5456 100644 --- a/dialer_test.go +++ b/dialer_test.go @@ -54,7 +54,7 @@ func ExampleDialer() { panic(err) } if n != len(msg) { - panic(err) + panic("short write") } buf := make([]byte, 1024) @@ -63,7 +63,7 @@ func ExampleDialer() { panic(err) } if n != len(msg) { - panic(err) + panic("short read") } fmt.Println(string(buf[:n])) diff --git a/examples/v0/watm/plain.go.wasm b/examples/v0/watm/plain.go.wasm index 1ddce8e..3347bda 100644 Binary files a/examples/v0/watm/plain.go.wasm and b/examples/v0/watm/plain.go.wasm differ diff --git a/examples/v0/watm/reverse.go.wasm b/examples/v0/watm/reverse.go.wasm index 195c439..223ac55 100644 Binary files a/examples/v0/watm/reverse.go.wasm and b/examples/v0/watm/reverse.go.wasm differ diff --git a/go.mod b/go.mod index 83e81e2..2acdf3b 100644 --- a/go.mod +++ b/go.mod @@ -7,10 +7,10 @@ retract ( v0.6.0 // bad LICENSE naming ) -replace github.com/tetratelabs/wazero v1.6.0 => github.com/refraction-networking/wazero v1.6.6-w +replace github.com/tetratelabs/wazero v1.7.0 => github.com/refraction-networking/wazero v1.7.0-w require ( - github.com/tetratelabs/wazero v1.6.0 + github.com/tetratelabs/wazero v1.7.0 golang.org/x/exp v0.0.0-20240119083558-1b970713d09a google.golang.org/protobuf v1.33.0 ) diff --git a/go.sum b/go.sum index 31dea71..106a890 100644 --- a/go.sum +++ b/go.sum @@ -1,6 +1,6 @@ github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg= -github.com/refraction-networking/wazero v1.6.6-w h1:GopGAQ5/Rah0vzGImewwOrOaXFR+FmgWlgGKs1JpVlw= -github.com/refraction-networking/wazero v1.6.6-w/go.mod h1:ytl6Zuh20R/eROuyDaGPkp82O9C/DJfXAwJfQ3X6/7Y= +github.com/refraction-networking/wazero v1.7.0-w h1:fFQO1VL+fhpFWIgfZN9FPnWYhf5DTyzwzJijqg/LUm4= +github.com/refraction-networking/wazero v1.7.0-w/go.mod h1:ytl6Zuh20R/eROuyDaGPkp82O9C/DJfXAwJfQ3X6/7Y= golang.org/x/exp v0.0.0-20240119083558-1b970713d09a h1:Q8/wZp0KX97QFTc2ywcOE0YRjZPVIx+MXInMzdvQqcA= golang.org/x/exp v0.0.0-20240119083558-1b970713d09a/go.mod h1:idGWGoKP1toJGkd5/ig9ZLuPcZBC3ewk7SzmH0uou08= google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI= diff --git a/listener_test.go b/listener_test.go index 0115579..96f574a 100644 --- a/listener_test.go +++ b/listener_test.go @@ -48,7 +48,7 @@ func ExampleListener() { panic(err) } if n != len(msg) { - panic(err) + panic("short write") } buf := make([]byte, 1024) @@ -57,7 +57,7 @@ func ExampleListener() { panic(err) } if n != len(msg) { - panic(err) + panic("short read") } fmt.Println(string(buf[:n])) diff --git a/relay_test.go b/relay_test.go index 93f9ee3..8331c43 100644 --- a/relay_test.go +++ b/relay_test.go @@ -66,7 +66,7 @@ func ExampleRelay() { panic(err) } if n != len(msg) { - panic(err) + panic("short write") } buf := make([]byte, 1024) @@ -75,7 +75,7 @@ func ExampleRelay() { panic(err) } if n != len(msg) { - panic(err) + panic("short read") } fmt.Println(string(buf[:n])) diff --git a/transport/v0/dialer_test.go b/transport/v0/dialer_test.go index 2e021a1..be724a0 100644 --- a/transport/v0/dialer_test.go +++ b/transport/v0/dialer_test.go @@ -50,7 +50,7 @@ func ExampleDialer() { panic(err) } if n != len(msg) { - panic(err) + panic("short write") } buf := make([]byte, 1024) @@ -59,7 +59,7 @@ func ExampleDialer() { panic(err) } if n != len(msg) { - panic(err) + panic("short read") } fmt.Println(string(buf[:n])) @@ -84,7 +84,8 @@ func TestDialer(t *testing.T) { func testDialerBadAddr(t *testing.T) { // Dial config := &water.Config{ - TransportModuleBin: wasmPlain, + TransportModuleBin: wasmPlain, + ModuleConfigFactory: water.NewWazeroModuleConfigFactory(), } dialer, err := v0.NewDialerWithContext(context.Background(), config) @@ -107,7 +108,8 @@ func testDialerPlain(t *testing.T) { // skipcq: GO-R1005 // Dial using water config := &water.Config{ - TransportModuleBin: wasmPlain, + TransportModuleBin: wasmPlain, + ModuleConfigFactory: water.NewWazeroModuleConfigFactory(), } dialer, err := v0.NewDialerWithContext(context.Background(), config) if err != nil { @@ -232,7 +234,8 @@ func testDialerReverse(t *testing.T) { // skipcq: GO-R1005 // Dial using water config := &water.Config{ - TransportModuleBin: wasmReverse, + TransportModuleBin: wasmReverse, + ModuleConfigFactory: water.NewWazeroModuleConfigFactory(), } dialer, err := v0.NewDialerWithContext(context.Background(), config) if err != nil { @@ -376,7 +379,8 @@ func BenchmarkDialerOutbound(b *testing.B) { // Dial config := &water.Config{ - TransportModuleBin: wasmPlain, + TransportModuleBin: wasmPlain, + ModuleConfigFactory: water.NewWazeroModuleConfigFactory(), } dialer, err := v0.NewDialerWithContext(context.Background(), config) if err != nil { @@ -432,7 +436,8 @@ func BenchmarkDialerOutboundReverse(b *testing.B) { // Dial config := &water.Config{ - TransportModuleBin: wasmReverse, + TransportModuleBin: wasmReverse, + ModuleConfigFactory: water.NewWazeroModuleConfigFactory(), } dialer, err := v0.NewDialerWithContext(context.Background(), config) if err != nil { diff --git a/transport/v0/listener_test.go b/transport/v0/listener_test.go index af6ee6e..507a92e 100644 --- a/transport/v0/listener_test.go +++ b/transport/v0/listener_test.go @@ -51,7 +51,7 @@ func ExampleListener() { panic(err) } if n != len(msg) { - panic(err) + panic("short write") } buf := make([]byte, 1024) @@ -60,7 +60,7 @@ func ExampleListener() { panic(err) } if n != len(msg) { - panic(err) + panic("short read") } fmt.Println(string(buf[:n])) @@ -85,7 +85,8 @@ func TestListener(t *testing.T) { func testListenerBadAddr(t *testing.T) { // prepare config := &water.Config{ - TransportModuleBin: wasmPlain, + TransportModuleBin: wasmPlain, + ModuleConfigFactory: water.NewWazeroModuleConfigFactory(), } _, err := config.ListenContext(context.Background(), "tcp", "256.267.278.289:2023") @@ -97,7 +98,8 @@ func testListenerBadAddr(t *testing.T) { func testListenerPlain(t *testing.T) { // skipcq: GO-R1005 // prepare config := &water.Config{ - TransportModuleBin: wasmPlain, + TransportModuleBin: wasmPlain, + ModuleConfigFactory: water.NewWazeroModuleConfigFactory(), } testLis, err := config.ListenContext(context.Background(), "tcp", "localhost:0") @@ -219,7 +221,8 @@ func testListenerPlain(t *testing.T) { // skipcq: GO-R1005 func testListenerReverse(t *testing.T) { // skipcq: GO-R1005 // prepare config := &water.Config{ - TransportModuleBin: wasmReverse, + TransportModuleBin: wasmReverse, + ModuleConfigFactory: water.NewWazeroModuleConfigFactory(), } testLis, err := config.ListenContext(context.Background(), "tcp", "localhost:0") @@ -359,7 +362,8 @@ func testListenerPartialWATM(t *testing.T) { func BenchmarkInboundListener(b *testing.B) { // prepare config := &water.Config{ - TransportModuleBin: wasmPlain, + TransportModuleBin: wasmPlain, + ModuleConfigFactory: water.NewWazeroModuleConfigFactory(), } testLis, err := config.ListenContext(context.Background(), "tcp", "localhost:0") @@ -407,7 +411,8 @@ func BenchmarkInboundListener(b *testing.B) { func BenchmarkInboundListenerReverse(b *testing.B) { // prepare config := &water.Config{ - TransportModuleBin: wasmReverse, + TransportModuleBin: wasmReverse, + ModuleConfigFactory: water.NewWazeroModuleConfigFactory(), } testLis, err := config.ListenContext(context.Background(), "tcp", "localhost:0") diff --git a/transport/v0/not_test.go b/transport/v0/not_test.go index 8c63856..14c7424 100644 --- a/transport/v0/not_test.go +++ b/transport/v0/not_test.go @@ -21,6 +21,15 @@ var ( wasmReverse []byte ) +//// Gaukas: uncomment the following code once we decide to require +//// go1.21 as minimum version +// func init() { +// var programLevel = new(slog.LevelVar) // Info by default +// h := slog.NewJSONHandler(os.Stderr, &slog.HandlerOptions{Level: programLevel}) +// slog.SetDefault(slog.New(h)) +// programLevel.Set(slog.LevelError) +// } + func benchmarkUnidirectionalStream(b *testing.B, wrConn, rdConn net.Conn) { var sendMsg []byte = make([]byte, 1024) _, err := rand.Read(sendMsg) diff --git a/transport/v0/relay_test.go b/transport/v0/relay_test.go index a4f3c2c..a65d0fc 100644 --- a/transport/v0/relay_test.go +++ b/transport/v0/relay_test.go @@ -62,7 +62,7 @@ func ExampleRelay() { panic(err) } if n != len(msg) { - panic(err) + panic("short write") } buf := make([]byte, 1024) @@ -71,7 +71,7 @@ func ExampleRelay() { panic(err) } if n != len(msg) { - panic(err) + panic("short read") } fmt.Println(string(buf[:n])) @@ -107,7 +107,8 @@ func testRelayPlain(t *testing.T) { // skipcq: GO-R1005 // setup relay config := &water.Config{ - TransportModuleBin: wasmPlain, + TransportModuleBin: wasmPlain, + ModuleConfigFactory: water.NewWazeroModuleConfigFactory(), } relay, err := v0.NewRelayWithContext(context.Background(), config) if err != nil { @@ -235,7 +236,8 @@ func testRelayReverse(t *testing.T) { // skipcq: GO-R1005 // setup relay config := &water.Config{ - TransportModuleBin: wasmReverse, + TransportModuleBin: wasmReverse, + ModuleConfigFactory: water.NewWazeroModuleConfigFactory(), } relay, err := water.NewRelayWithContext(context.Background(), config) if err != nil { diff --git a/transport/v0/testdata/plain.wasm b/transport/v0/testdata/plain.wasm index 1ddce8e..3347bda 100644 Binary files a/transport/v0/testdata/plain.wasm and b/transport/v0/testdata/plain.wasm differ diff --git a/transport/v0/testdata/reverse.wasm b/transport/v0/testdata/reverse.wasm index 195c439..223ac55 100644 Binary files a/transport/v0/testdata/reverse.wasm and b/transport/v0/testdata/reverse.wasm differ