mirror of
https://github.com/v2rayA/v2rayA.git
synced 2026-11-20 23:02:25 +03:00
fix: inappropriate log output #170
This commit is contained in:
1 parent
562342d90a
commit
99f2cdcd96
2 files changed
+18
-17
No files matched your search
@@ -63,6 +63,12 @@ func dnsPortValid() bool {
|
||||
2: redirect + fakedns
|
||||
*/
|
||||
func ShouldDnsPoisonOpen() int {
|
||||
setting := configure.GetSettingNotNil()
|
||||
if setting.Transparent == configure.TransparentClose ||
|
||||
setting.AntiPollution == configure.AntipollutionClosed ||
|
||||
(global.SupportTproxy && !setting.EnhancedMode) {
|
||||
return 0
|
||||
}
|
||||
ver, err := where.GetV2rayServiceVersion()
|
||||
if err != nil {
|
||||
ver = "0.0.0"
|
||||
@@ -72,20 +78,15 @@ func ShouldDnsPoisonOpen() int {
|
||||
fakednsValid = false
|
||||
}
|
||||
if fakednsValid && !dnsPortValid() {
|
||||
log.Println("[fakedns] unable to use fakedns: port 53 is occupied")
|
||||
if setting.EnhancedMode {
|
||||
log.Println("[fakedns] unable to use fakedns: port 53 is occupied")
|
||||
}
|
||||
fakednsValid = false
|
||||
}
|
||||
if setting := configure.GetSettingNotNil();
|
||||
setting.Transparent != configure.TransparentClose &&
|
||||
setting.AntiPollution != configure.AntipollutionClosed &&
|
||||
(!global.SupportTproxy || setting.EnhancedMode) {
|
||||
if fakednsValid {
|
||||
return 2
|
||||
} else {
|
||||
return 1
|
||||
}
|
||||
if !fakednsValid {
|
||||
return 1
|
||||
}
|
||||
return 0
|
||||
return 2
|
||||
}
|
||||
|
||||
func CheckAndSetupDnsPoisonWithExtraInfo(info *ExtraInfo) {
|
||||
|
||||
@@ -25,12 +25,6 @@ func DeleteTransparentProxyRules() {
|
||||
}
|
||||
|
||||
func WriteTransparentProxyRules(preprocess *func(c *iptables.SetupCommands)) error {
|
||||
if entity.ShouldDnsPoisonOpen() == 1 {
|
||||
if e := iptables.DropSpoofing.GetSetupCommands().Setup(preprocess); e != nil {
|
||||
log.Println(newError("[WARNING] DropSpoofing can't be enable").Base(e))
|
||||
iptables.DropSpoofing.GetCleanCommands().Clean()
|
||||
}
|
||||
}
|
||||
setting := configure.GetSettingNotNil()
|
||||
if global.SupportTproxy && !setting.EnhancedMode {
|
||||
if err := iptables.Tproxy.GetSetupCommands().Setup(preprocess); err == nil {
|
||||
@@ -47,6 +41,12 @@ func WriteTransparentProxyRules(preprocess *func(c *iptables.SetupCommands)) err
|
||||
global.SupportTproxy = false
|
||||
}
|
||||
} else {
|
||||
if entity.ShouldDnsPoisonOpen() == 1 {
|
||||
if e := iptables.DropSpoofing.GetSetupCommands().Setup(preprocess); e != nil {
|
||||
log.Println(newError("[WARNING] DropSpoofing can't be enable").Base(e))
|
||||
iptables.DropSpoofing.GetCleanCommands().Clean()
|
||||
}
|
||||
}
|
||||
if err := iptables.Redirect.GetSetupCommands().Setup(preprocess); err == nil {
|
||||
if setting.AntiPollution != configure.AntipollutionClosed {
|
||||
resetDnsHijacker()
|
||||
|
||||
Reference in new issue
Block a user