Skip to content
This repository was archived by the owner on Nov 21, 2019. It is now read-only.

Commit c911114

Browse files
author
icymind
committed
fix relayUDP
1 parent be38955 commit c911114

File tree

5 files changed

+24
-1
lines changed

5 files changed

+24
-1
lines changed

src/renderer/components/Manage.vue

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,8 @@ export default {
167167
// 这些值需要手动维护
168168
enableTunnelDns: false,
169169
isTunnelDnsRunning: false,
170+
enableRelayUDP: false,
171+
isRelayUDPRunning: false,
170172
enableSs: false,
171173
isSsRunning: false,
172174
enableSsr: false,
@@ -235,6 +237,9 @@ export default {
235237
getProxiesInfo: async function () {
236238
const proxiesInfo = this.vrouter.config.proxiesInfo
237239
240+
this.proxiesInfo.enableRelayUDP = this.activedProfile.enableRelayUDP
241+
this.proxiesInfo.isRelayUDPRunning = await this.vrouter.isRelayUDPRunning(this.activedProfile.proxies, proxiesInfo)
242+
238243
this.proxiesInfo.enableTunnelDns = this.activedProfile.enableTunnelDns
239244
this.proxiesInfo.isTunnelDnsRunning = await this.vrouter.isTunnelDnsRunning(this.activedProfile.proxies, proxiesInfo)
240245

src/renderer/components/Manage/ProfileEditor/ProxiesForm.vue

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
<input type="text"
3636
v-model="dnsServer"
3737
:placeholder="enableTunnelDns.length !== 0 ? '8.8.8.8:53' : '127.0.0.1'"
38+
vee-validate="'required'"
3839
>
3940
<div class="ui checkbox">
4041
<input type="checkbox" value="enableTunnelDns" v-model="enableTunnelDns">
@@ -60,9 +61,14 @@
6061
import SsForm from './ProxiesForm/SsForm'
6162
import SsrForm from './ProxiesForm/SsrForm'
6263
import KtForm from './ProxiesForm/KtForm'
64+
import Vue from 'vue'
65+
import VeeValidate from 'vee-validate'
66+
Vue.use(VeeValidate, { inject: false })
67+
6368
export default {
6469
name: 'proxies-form',
6570
props: ['editingClone'],
71+
inject: ['$validator'],
6672
components: {
6773
SsForm,
6874
SsrForm,

src/renderer/components/Manage/SystemTab.vue

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,11 @@ export default {
9999
value: this.proxiesInfo.enableTunnelDns ? (this.proxiesInfo.isTunnelDnsRunning ? '运行中' : '已停止') : '未启用',
100100
icon: this.proxiesInfo.enableTunnelDns ? (this.proxiesInfo.isTunnelDnsRunning ? 'check teal' : 'minus red') : 'toggle off'
101101
},
102+
{
103+
label: '转发 UDP 流量',
104+
value: this.proxiesInfo.enableRelayUDP ? (this.proxiesInfo.isRelayUDPRunning ? '运行中' : '已停止') : '未启用',
105+
icon: this.proxiesInfo.enableRelayUDP ? (this.proxiesInfo.isRelayUDPRunning ? 'check teal' : 'minus red') : 'toggle off'
106+
},
102107
{
103108
label: 'Shadowsocks 进程',
104109
value: this.proxiesInfo.enableSs ? (this.proxiesInfo.isSsRunning ? '运行中' : '已停止') : '未启用',

src/renderer/lib/generator.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ async function getTunnelDnsCfgFrom (profile, proxiesInfo) {
124124
}
125125
cfg.local_port = proxiesInfo.tunnelDns.localPort
126126
cfg.mode = 'udp_only'
127-
cfg.tunnel_address = profile.dnsServer
127+
cfg.tunnel_address = profile.dnsServer || '8.8.8.8:53'
128128
return cfg
129129
}
130130
async function getKtCfgFrom (profile, proxiesInfo) {

src/renderer/lib/openwrt.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,13 @@ class Openwrt {
247247
return output.trim() !== ''
248248
}
249249

250+
async isRelayUDPRunning (proxies, proxiesInfo) {
251+
const type = /ssr/ig.test(proxies) ? 'shadowsocksr' : 'shadowsocks'
252+
const cmd = `ps -w| grep "${proxiesInfo.relayUDP.binName[type]} -[c] .*${proxiesInfo.relayUDP.cfgName}"`
253+
const output = await this.execute(cmd)
254+
return output.trim() !== ''
255+
}
256+
250257
// kcptun
251258
async installKt (targzFPath) {
252259
const src = path.join(os.tmpdir(), path.basename(targzFPath))

0 commit comments

Comments
 (0)