mirror of
https://github.com/v2rayA/v2rayA.git
synced 2026-11-20 23:02:25 +03:00
fix: redirect method of transparent proxy
This commit is contained in:
1 parent
0a371df834
commit
942c87db2b
4 files changed
+20
-51
No files matched your search
+1
-23
@@ -153,30 +153,8 @@
|
||||
duration: 5000
|
||||
});
|
||||
} else {
|
||||
localStorage["transparentValid"] = res.data.data.transparentValid;
|
||||
localStorage["iptablesMode"] = res.data.data.iptablesMode;
|
||||
localStorage["dohValid"] = res.data.data.dohValid;
|
||||
if (
|
||||
typeof res.data.data.transparentValid == "boolean" && //兼容旧版本
|
||||
res.data.data.transparentValid === false
|
||||
) {
|
||||
this.$buefy.toast.open({
|
||||
message: "检测到v2ray-core版本低于4.19.1,不支持全局透明代理",
|
||||
type: "is-warning",
|
||||
position: "is-top",
|
||||
duration: 3000
|
||||
});
|
||||
}
|
||||
if (
|
||||
typeof res.data.data.transparentValid === "string" && //新版本
|
||||
res.data.data.transparentValid !== "yes"
|
||||
) {
|
||||
this.$buefy.toast.open({
|
||||
message: "不支持全局透明代理: " + res.data.data.transparentValid,
|
||||
type: "is-warning",
|
||||
position: "is-top",
|
||||
duration: 3000
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -39,11 +39,7 @@
|
||||
</b-button>
|
||||
</b-field>
|
||||
<hr class="dropdown-divider" style="margin: 1.25rem 0 1.25rem" />
|
||||
<b-field
|
||||
v-show="transparentValid"
|
||||
label-position="on-border"
|
||||
class="with-icon-alert"
|
||||
>
|
||||
<b-field label-position="on-border" class="with-icon-alert">
|
||||
<template slot="label">
|
||||
全局透明代理
|
||||
<b-tooltip
|
||||
@@ -308,13 +304,8 @@ export default {
|
||||
}
|
||||
return port;
|
||||
},
|
||||
transparentValid() {
|
||||
let val = localStorage["transparentValid"];
|
||||
return (
|
||||
val === "undefined" || //最早版本, 无法判断是否valid, 就默认valid了
|
||||
val === "true" || //boolean版本
|
||||
val === "yes" //最新string版本
|
||||
);
|
||||
iptablesMode() {
|
||||
return localStorage["iptablesMode"] || "tproxy";
|
||||
}
|
||||
},
|
||||
created() {
|
||||
|
||||
@@ -2,6 +2,7 @@ package controller
|
||||
|
||||
import (
|
||||
"V2RayA/global"
|
||||
"V2RayA/model/iptables"
|
||||
"V2RayA/model/v2ray"
|
||||
"V2RayA/service"
|
||||
"V2RayA/tools"
|
||||
@@ -10,28 +11,27 @@ import (
|
||||
)
|
||||
|
||||
func GetVersion(ctx *gin.Context) {
|
||||
err := v2ray.CheckTProxySupported()
|
||||
var transparentProxyValid string
|
||||
if err == nil {
|
||||
transparentProxyValid = "yes"
|
||||
} else {
|
||||
transparentProxyValid = err.Error()
|
||||
}
|
||||
err = v2ray.CheckDohSupported()
|
||||
err := v2ray.CheckDohSupported()
|
||||
var dohValid string
|
||||
var iptablesMode string
|
||||
if err == nil {
|
||||
dohValid = "yes"
|
||||
} else {
|
||||
dohValid = err.Error()
|
||||
}
|
||||
if iptables.UseTproxy {
|
||||
iptablesMode = "tproxy"
|
||||
} else {
|
||||
iptablesMode = "redirect"
|
||||
}
|
||||
tools.ResponseSuccess(ctx, gin.H{
|
||||
"version": global.Version,
|
||||
"dockerMode": global.ServiceControlMode == global.DockerMode,
|
||||
"foundNew": global.FoundNew,
|
||||
"remoteVersion": global.RemoteVersion,
|
||||
"serviceValid": v2ray.IsV2rayServiceValid(),
|
||||
"transparentValid": transparentProxyValid,
|
||||
"dohValid": dohValid,
|
||||
"version": global.Version,
|
||||
"dockerMode": global.ServiceControlMode == global.DockerMode,
|
||||
"foundNew": global.FoundNew,
|
||||
"remoteVersion": global.RemoteVersion,
|
||||
"serviceValid": v2ray.IsV2rayServiceValid(),
|
||||
"dohValid": dohValid,
|
||||
"iptablesMode": iptablesMode,
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ import (
|
||||
|
||||
// http://briteming.hatenablog.com/entry/2019/06/18/175518
|
||||
|
||||
var UseTproxy = false
|
||||
var UseTproxy = true
|
||||
|
||||
type SetupCommands string
|
||||
type CleanCommands string
|
||||
|
||||
Reference in new issue
Block a user