From cc3b2fc832d1fe29964c97c303b26af68d480f40 Mon Sep 17 00:00:00 2001 From: Tianling Shen Date: Fri, 18 Aug 2023 12:59:34 +0800 Subject: [PATCH] fix(node): dont force override addr/port for direct --- htdocs/luci-static/resources/view/homeproxy/node.js | 12 ++++++++++++ root/etc/homeproxy/scripts/generate_client.uc | 8 ++++---- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/htdocs/luci-static/resources/view/homeproxy/node.js b/htdocs/luci-static/resources/view/homeproxy/node.js index c3bbc483..1fa43654 100644 --- a/htdocs/luci-static/resources/view/homeproxy/node.js +++ b/htdocs/luci-static/resources/view/homeproxy/node.js @@ -504,10 +504,12 @@ return view.extend({ so = ss.option(form.Value, 'address', _('Address')); so.datatype = 'host'; + so.depends({'type': 'direct', '!reverse': true}); so.rmempty = false; so = ss.option(form.Value, 'port', _('Port')); so.datatype = 'port'; + so.depends({'type': 'direct', '!reverse': true}); so.rmempty = false; so = ss.option(form.Value, 'username', _('Username')); @@ -549,6 +551,16 @@ return view.extend({ so.modalonly = true; /* Direct config */ + so = ss.option(form.Value, 'override_address', _('Override address'), + _('Override the connection destination address.')); + so.datatype = 'host'; + so.depends('type', 'direct'); + + so = ss.option(form.Value, 'override_port', _('Override port'), + _('Override the connection destination port.')); + so.datatype = 'port'; + so.depends('type', 'direct'); + so = ss.option(form.ListValue, 'proxy_protocol', _('Proxy protocol'), _('Write Proxy Protocol in the connection header.')); so.value('', _('Disable')); diff --git a/root/etc/homeproxy/scripts/generate_client.uc b/root/etc/homeproxy/scripts/generate_client.uc index d6301820..f84ec16c 100755 --- a/root/etc/homeproxy/scripts/generate_client.uc +++ b/root/etc/homeproxy/scripts/generate_client.uc @@ -123,15 +123,15 @@ function generate_outbound(node) { tag: 'cfg-' + node['.name'] + '-out', routing_mark: strToInt(self_mark), - server: (node.type !== 'direct') ? node.address : null, - server_port: (node.type !== 'direct') ? int(node.port) : null, + server: node.address, + server_port: int(node.port), username: node.username, password: node.password, /* Direct */ - override_address: (node.type === 'direct') ? node.address : null, - override_port: (node.type === 'direct') ? node.port : null, + override_address: node.override_address, + override_port: int(node.override_port), proxy_protocol: strToInt(node.proxy_protocol), /* Hysteria */ up_mbps: strToInt(node.hysteria_down_mbps),