From 13f4b57997047a375876dd1c177893478448b284 Mon Sep 17 00:00:00 2001 From: lgjint <78463565+lgjint@users.noreply.github.com> Date: Sat, 1 Jun 2024 01:41:54 +0800 Subject: [PATCH] Add KernelSU root permission detection for auto-redirect --- inbound/tun_auto_redirect.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/inbound/tun_auto_redirect.go b/inbound/tun_auto_redirect.go index 8ebc04d2..a7a97ce1 100644 --- a/inbound/tun_auto_redirect.go +++ b/inbound/tun_auto_redirect.go @@ -62,7 +62,16 @@ func newAutoRedirect(t *Tun) (*tunAutoRedirect, error) { err error ) if t.platformInterface != nil { - suPath, err = exec.LookPath("/bin/su") + suPaths := []string{ + "/bin/su", + "/system/bin/su", + } + for _, path := range suPaths { + suPath, err = exec.LookPath(path) + if err == nil { + break + } + } } else { suPath, err = exec.LookPath("su") }