summaryrefslogtreecommitdiffstats
path: root/applications/luci-app-bcp38/htdocs/luci-static/resources/view/bcp38/form.js
blob: 44797d421c2518c35099122d732099d234730cd7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
'use strict';
'require view';
'require form';
'require tools.widgets as widgets';

return view.extend({
	render: function() {
		let m, s, o;

		m = new form.Map('bcp38', _('BCP38'),
			_('This function blocks packets with private address destinations ' +
			'from going out onto the internet as per %s'.format('<a href="http://tools.ietf.org/html/bcp38">BCP 38</a>') + '<br/>' +
			_('For IPv6, only source specific default routes are installed, so ' +
			'no BCP38 firewall routes are needed.')));


		s = m.section(form.TypedSection, 'bcp38', _('BCP38 config'));
		s.anonymous = true;

		o = s.option(form.Flag, 'enabled', _('Enable'));
		o.default = '0';
		o.rmempty = false;

		o = s.option(form.Flag, 'detect_upstream', _('Auto-detect upstream IP'), 
			_('Automatically attempt to detect whether the upstream IP ' +
			'will be blocked by the configuration, adding an exception if so. ' +
			'If this does not work correctly, you can add exceptions manually below.')); 
		o.rmempty = false;

		o = s.option(widgets.DeviceSelect, 'interface', _('Interface name'),
			_('Interface to apply the blocking to (should be the upstream WAN interface).'));
		o.modalonly = true;
		o.noaliases = true;
		o.multiple = false;
		o.rmempty = false;

		o = s.option(form.DynamicList, 'match', _('Blocked IP ranges'));
		o.datatype = 'ip4addr';

		o = s.option(form.DynamicList, 'nomatch', _('Allowed IP ranges'),
			_('Takes precedence over blocked ranges. ' +
			'Use to whitelist your upstream network if you\'re behind a double NAT ' +
			'and the auto-detection doesn\'t work.'));
		o.datatype = 'ip4addr';

		return m.render();
	},
});