fix default fake ip filter

This commit is contained in:
Kr328 committed 2020-06-13 11:11:55 +08:00
1 parent 7691a96996
commit 3601d1166b
2 files changed
+3 -25

No files matched your search

+3 -3
View File
@@ -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,
}
-22
View File
@@ -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)
}