Skip to content

Commit

Permalink
feat(client): route.rules: Update description and add options
Browse files Browse the repository at this point in the history
Options:
  auth_user
  user_id
  clash_mode
  • Loading branch information
muink committed Nov 20, 2023
1 parent 251c07c commit 2e57dfc
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 17 deletions.
47 changes: 33 additions & 14 deletions htdocs/luci-static/resources/view/homeproxy/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -421,32 +421,28 @@ return view.extend({
so.rmempty = false;
so.editable = true;

so = ss.option(form.ListValue, 'ip_version', _('IP version'),
_('4 or 6. Not limited if empty.'));
so.value('4', _('IPv4'));
so.value('6', _('IPv6'));
so.value('', _('Both'));
so.modalonly = true;

so = ss.option(form.ListValue, 'mode', _('Mode'),
_('The default rule uses the following matching logic:<br/>' +
'<code>(domain || domain_suffix || domain_keyword || domain_regex || geosite || geoip || ip_cidr)</code> &&<br/>' +
'<code>(port || port_range)</code> &&<br/>' +
'<code>(source_geoip || source_ip_cidr)</code> &&<br/>' +
'<code>(source_port || source_port_range)</code> &&<br/>' +
'<code>other fields</code>.'));
so.value('default', _('Default'));
so.default = 'default';
so.rmempty = false;
so.readonly = true;

so = ss.option(form.Flag, 'invert', _('Invert'),
_('Invert match result.'));
so.default = so.disabled;
so = ss.option(form.ListValue, 'ip_version', _('IP version'),
_('4 or 6. Not limited if empty.'));
so.value('4', _('IPv4'));
so.value('6', _('IPv6'));
so.value('', _('Both'));
so.modalonly = true;

so = ss.option(form.ListValue, 'network', _('Network'));
so.value('tcp', _('TCP'));
so.value('udp', _('UDP'));
so.value('', _('Both'));
so = ss.option(form.DynamicList, 'auth_user', _('Auth user'),
_('Match auth user.'));
so.modalonly = true;

so = ss.option(form.MultiValue, 'protocol', _('Protocol'),
_('Sniffed protocol, see <a target="_blank" href="https://sing-box.sagernet.org/configuration/route/sniff/">Sniff</a> for details.'));
Expand All @@ -455,6 +451,11 @@ return view.extend({
so.value('quic', _('QUIC'));
so.value('stun', _('STUN'));

so = ss.option(form.ListValue, 'network', _('Network'));
so.value('tcp', _('TCP'));
so.value('udp', _('UDP'));
so.value('', _('Both'));

so = ss.option(form.DynamicList, 'domain', _('Domain name'),
_('Match full domain.'));
so.datatype = 'hostname';
Expand Down Expand Up @@ -526,6 +527,24 @@ return view.extend({
_('Match user name.'));
so.modalonly = true;

so = ss.option(form.DynamicList, 'user_id', _('User ID'),
_('Match user ID.'));
so.datatype = 'uinteger';
so.modalonly = true;

so = ss.option(form.ListValue, 'clash_mode', _('Clash mode'),
_('Match clash mode.'));
so.value('', _('None'));
so.value('global', _('Global'));
so.value('rule', _('Rule'));
so.value('direct', _('Direct'));
so.modalonly = true;

so = ss.option(form.Flag, 'invert', _('Invert'),
_('Invert match result.'));
so.default = so.disabled;
so.modalonly = true;

so = ss.option(form.ListValue, 'outbound', _('Outbound'),
_('Tag of the target outbound.'));
so.load = function(section_id) {
Expand Down
8 changes: 5 additions & 3 deletions root/etc/homeproxy/scripts/generate_client.uc
Original file line number Diff line number Diff line change
Expand Up @@ -579,10 +579,10 @@ if (!isEmpty(main_node)) {
return null;

push(config.route.rules, {
invert: cfg.invert,
ip_version: cfg.ip_version,
network: cfg.network,
ip_version: strToInt(cfg.ip_version),
auth_user: cfg.auth_user,
protocol: cfg.protocol,
network: cfg.network,
domain: cfg.domain,
domain_suffix: cfg.domain_suffix,
domain_keyword: cfg.domain_keyword,
Expand All @@ -599,6 +599,8 @@ if (!isEmpty(main_node)) {
process_name: cfg.process_name,
process_path: cfg.process_path,
user: cfg.user,
user_id: parse_uid(cfg.user_id),
clash_mode: cfg.clash_mode,
invert: (cfg.invert === '1'),
outbound: get_outbound(cfg.outbound)
});
Expand Down

0 comments on commit 2e57dfc

Please sign in to comment.