[fix] auto-route for android

This commit is contained in:
adlyq
2022-04-20 22:00:05 +08:00
parent f40c2eb71d
commit 4b79f8de93
6 changed files with 34 additions and 16 deletions

View File

@ -2,9 +2,11 @@ package proxy
import (
"fmt"
"github.com/Dreamacro/clash/common/cmd"
"github.com/Dreamacro/clash/listener/inner"
"net"
"os"
"runtime"
"strconv"
"sync"
@ -395,5 +397,8 @@ func genAddr(host string, port int, allowLan bool) string {
func Cleanup() {
if tunStackListener != nil {
_ = tunStackListener.Close()
if runtime.GOOS == "android" {
_, _ = cmd.ExecCmd("ip rule del pref 5000")
}
}
}