We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 5ba1b8c commit ad792e2Copy full SHA for ad792e2
1 file changed
intra/tun2socks.go
@@ -27,6 +27,7 @@ import (
27
"context"
28
"os"
29
"runtime/debug"
30
+ "time"
31
32
x "github.com/celzero/firestack/intra/backend"
33
"github.com/celzero/firestack/intra/core"
@@ -300,6 +301,16 @@ func PanicAtRandom(y bool) {
300
301
log.I("tun: panic at random? %t", y)
302
}
303
304
+// Crash causes a crash by panicking on an out-of-bounds slice access. For testing only.
305
+func Crash(afterMs int64) {
306
+ go func() {
307
+ log.I("tun: crashing in %s", core.FmtMillis(afterMs))
308
+ time.Sleep(time.Duration(afterMs) * time.Millisecond)
309
+ var i []int
310
+ i[10] = 1 // panic: runtime error: index out of range [10] with length 10
311
+ }()
312
+}
313
+
314
func pipeCrashOutput(c Console) (ok bool) {
315
r, w, err := os.Pipe()
316
if err != nil {
0 commit comments