464xlat.js 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. 'use strict';
  2. 'require form';
  3. 'require network';
  4. 'require tools.widgets as widgets';
  5. network.registerPatternVirtual(/^464-.+$/);
  6. network.registerErrorCode('CLAT_CONFIG_FAILED', _('CLAT configuration failed'));
  7. return network.registerProtocol('464xlat', {
  8. getI18n: function() {
  9. return _('464XLAT (CLAT)');
  10. },
  11. getIfname: function() {
  12. return this._ubus('l3_device') || '464-%s'.format(this.sid);
  13. },
  14. getOpkgPackage: function() {
  15. return '464xlat';
  16. },
  17. isFloating: function() {
  18. return true;
  19. },
  20. isVirtual: function() {
  21. return true;
  22. },
  23. getDevices: function() {
  24. return null;
  25. },
  26. containsDevice: function(ifname) {
  27. return (network.getIfnameOf(ifname) == this.getIfname());
  28. },
  29. renderFormOptions: function(s) {
  30. var o;
  31. o = s.taboption('general', form.Value, 'ip6prefix', _('NAT64 Prefix'), _('Leave empty to autodetect'));
  32. o.datatype = 'cidr6';
  33. o = s.taboption('advanced', widgets.NetworkSelect, 'tunlink', _('Tunnel Link'));
  34. o.nocreate = true;
  35. o.exclude = s.section;
  36. o = s.taboption('advanced', form.Value, 'mtu', _('Use MTU on tunnel interface'));
  37. o.placeholder = '1280';
  38. o.datatype = 'max(9200)';
  39. }
  40. });