From 3601d1166ba612cb0e495ed5196535f54c4da387 Mon Sep 17 00:00:00 2001 From: Kr328 <39107975+Kr328@users.noreply.github.com> Date: Sat, 13 Jun 2020 11:11:55 +0800 Subject: [PATCH] fix default fake ip filter --- core/src/main/golang/config/patch.go | 6 +++--- core/src/main/golang/tun/tun.go | 22 ---------------------- 2 files changed, 3 insertions(+), 25 deletions(-) diff --git a/core/src/main/golang/config/patch.go b/core/src/main/golang/config/patch.go index 374ddb3..c345ec8 100644 --- a/core/src/main/golang/config/patch.go +++ b/core/src/main/golang/config/patch.go @@ -36,9 +36,9 @@ func init() { EnhancedMode: dns.FAKEIP, FakeIPRange: "198.18.0.0/16", FakeIPFilter: []string{ // default fake-ip filters for stun services - ".stun.*.*", - ".stun.*.*.*", - ".stun.*.*.*.*", + "+.stun.*.*", + "+.stun.*.*.*", + "+.stun.*.*.*.*", }, DefaultNameserver: defaultNameServers, } diff --git a/core/src/main/golang/tun/tun.go b/core/src/main/golang/tun/tun.go index bb54b64..89167c9 100644 --- a/core/src/main/golang/tun/tun.go +++ b/core/src/main/golang/tun/tun.go @@ -55,8 +55,6 @@ func StartTunDevice(fd, mtu int, gateway, mirror, dnsAddress string, onStop func file := os.NewFile(uintptr(fd), "/dev/tun") _ = syscall.SetNonblock(fd, true) - increaseMaxConnection() - adapter = tun2socket.NewTun2Socket(file, mtu, gatewayIP, mirrorIP.To4()) adapter.SetLogger(&ClashLogger{}) @@ -135,23 +133,3 @@ func StopTunDevice() { log.Infoln("Android tun stopped") } } - -func increaseMaxConnection() { - var limit syscall.Rlimit - - if err := syscall.Getrlimit(syscall.RLIMIT_NOFILE, &limit); err != nil { - return - } - - if limit.Max == limit.Cur { - return - } - - limit.Cur = limit.Max - - if err := syscall.Setrlimit(syscall.RLIMIT_NOFILE, &limit); err != nil { - return - } - - log.Infoln("Increase max connection to %d", limit.Cur) -} \ No newline at end of file