Skip to content

Commit

Permalink
fix(node): dont force override addr/port for direct
Browse files Browse the repository at this point in the history
  • Loading branch information
1715173329 committed Aug 18, 2023
1 parent ef08e58 commit fcee168
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
12 changes: 12 additions & 0 deletions htdocs/luci-static/resources/view/homeproxy/node.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'));
Expand Down Expand Up @@ -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'));
Expand Down
8 changes: 4 additions & 4 deletions root/etc/homeproxy/scripts/generate_client.uc
Original file line number Diff line number Diff line change
Expand Up @@ -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: node.override_address,
proxy_protocol: strToInt(node.proxy_protocol),
/* Hysteria */
up_mbps: strToInt(node.hysteria_down_mbps),
Expand Down

0 comments on commit fcee168

Please sign in to comment.