2 Ext
.ns('Proxmox.Setup');
4 if (!Ext
.isDefined(Proxmox
.Setup
.auth_cookie_name
)) {
5 throw "Proxmox library not initialized";
8 // avoid errors related to Accessible Rich Internet Applications
9 // (access for people with disabilities)
10 // TODO reenable after all components are upgraded
11 Ext
.enableAria
= false;
12 Ext
.enableAriaButtons
= false;
13 Ext
.enableAriaPanels
= false;
15 // avoid errors when running without development tools
16 if (!Ext
.isDefined(Ext
.global
.console
)) {
28 Ext
.global
.console
= console
;
31 Ext
.Ajax
.defaultHeaders
= {
32 'Accept': 'application/json',
35 Ext
.Ajax
.on('beforerequest', function(conn
, options
) {
36 if (Proxmox
.CSRFPreventionToken
) {
37 if (!options
.headers
) {
40 options
.headers
.CSRFPreventionToken
= Proxmox
.CSRFPreventionToken
;
42 let storedAuth
= Proxmox
.Utils
.getStoredAuth();
43 if (storedAuth
.token
) {
44 options
.headers
.Authorization
= storedAuth
.token
;
48 Ext
.define('Proxmox.Utils', { // a singleton
51 yesText
: gettext('Yes'),
52 noText
: gettext('No'),
53 enabledText
: gettext('Enabled'),
54 disabledText
: gettext('Disabled'),
55 noneText
: gettext('none'),
56 NoneText
: gettext('None'),
57 errorText
: gettext('Error'),
58 unknownText
: gettext('Unknown'),
59 defaultText
: gettext('Default'),
60 daysText
: gettext('days'),
61 dayText
: gettext('day'),
62 runningText
: gettext('running'),
63 stoppedText
: gettext('stopped'),
64 neverText
: gettext('never'),
65 totalText
: gettext('Total'),
66 usedText
: gettext('Used'),
67 directoryText
: gettext('Directory'),
68 stateText
: gettext('State'),
69 groupText
: gettext('Group'),
74 zh_CN
: 'Chinese (Simplified)',
75 zh_TW
: 'Chinese (Traditional)',
79 eu
: 'Euskera (Basque)',
86 nb
: 'Norwegian (Bokmal)',
87 nn
: 'Norwegian (Nynorsk)',
88 fa
: 'Persian (Farsi)',
90 pt_BR
: 'Portuguese (Brazil)',
98 render_language: function(value
) {
100 return Proxmox
.Utils
.defaultText
+ ' (English)';
102 let text
= Proxmox
.Utils
.language_map
[value
];
104 return text
+ ' (' + value
+ ')';
109 language_array: function() {
110 let data
= [['__default__', Proxmox
.Utils
.render_language('')]];
111 Ext
.Object
.each(Proxmox
.Utils
.language_map
, function(key
, value
) {
112 data
.push([key
, Proxmox
.Utils
.render_language(value
)]);
118 bond_mode_gettext_map
: {
119 '802.3ad': 'LACP (802.3ad)',
120 'lacp-balance-slb': 'LACP (balance-slb)',
121 'lacp-balance-tcp': 'LACP (balance-tcp)',
124 render_bond_mode
: value
=> Proxmox
.Utils
.bond_mode_gettext_map
[value
] || value
|| '',
126 bond_mode_array: function(modes
) {
127 return modes
.map(mode
=> [mode
, Proxmox
.Utils
.render_bond_mode(mode
)]);
130 getNoSubKeyHtml: function(url
) {
131 // url http://www.proxmox.com/products/proxmox-ve/subscription-service-plans
132 return Ext
.String
.format('You do not have a valid subscription for this server. Please visit <a target="_blank" href="{0}">www.proxmox.com</a> to get a list of available options.', url
|| 'https://www.proxmox.com');
135 format_boolean_with_default: function(value
) {
136 if (Ext
.isDefined(value
) && value
!== '__default__') {
137 return value
? Proxmox
.Utils
.yesText
: Proxmox
.Utils
.noText
;
139 return Proxmox
.Utils
.defaultText
;
142 format_boolean: function(value
) {
143 return value
? Proxmox
.Utils
.yesText
: Proxmox
.Utils
.noText
;
146 format_neg_boolean: function(value
) {
147 return !value
? Proxmox
.Utils
.yesText
: Proxmox
.Utils
.noText
;
150 format_enabled_toggle: function(value
) {
151 return value
? Proxmox
.Utils
.enabledText
: Proxmox
.Utils
.disabledText
;
154 format_expire: function(date
) {
156 return Proxmox
.Utils
.neverText
;
158 return Ext
.Date
.format(date
, "Y-m-d");
161 // somewhat like a human would tell durations, omit zero values and do not
162 // give seconds precision if we talk days already
163 format_duration_human: function(ut
) {
164 let seconds
= 0, minutes
= 0, hours
= 0, days
= 0;
171 seconds
= Number((remaining
% 60).toFixed(1));
172 remaining
= Math
.trunc(remaining
/ 60);
174 minutes
= remaining
% 60;
175 remaining
= Math
.trunc(remaining
/ 60);
177 hours
= remaining
% 24;
178 remaining
= Math
.trunc(remaining
/ 24);
186 let add
= (t
, unit
) => {
187 if (t
> 0) res
.push(t
+ unit
);
191 let addSeconds
= !add(days
, 'd');
197 return res
.join(' ');
200 format_duration_long: function(ut
) {
201 let days
= Math
.floor(ut
/ 86400);
203 let hours
= Math
.floor(ut
/ 3600);
205 let mins
= Math
.floor(ut
/ 60);
208 let hours_str
= '00' + hours
.toString();
209 hours_str
= hours_str
.substr(hours_str
.length
- 2);
210 let mins_str
= "00" + mins
.toString();
211 mins_str
= mins_str
.substr(mins_str
.length
- 2);
212 let ut_str
= "00" + ut
.toString();
213 ut_str
= ut_str
.substr(ut_str
.length
- 2);
216 let ds
= days
> 1 ? Proxmox
.Utils
.daysText
: Proxmox
.Utils
.dayText
;
217 return days
.toString() + ' ' + ds
+ ' ' +
218 hours_str
+ ':' + mins_str
+ ':' + ut_str
;
220 return hours_str
+ ':' + mins_str
+ ':' + ut_str
;
224 format_subscription_level: function(level
) {
227 } else if (level
=== 'b') {
229 } else if (level
=== 's') {
231 } else if (level
=== 'p') {
234 return Proxmox
.Utils
.noneText
;
238 compute_min_label_width: function(text
, width
) {
239 if (width
=== undefined) { width
= 100; }
241 let tm
= new Ext
.util
.TextMetrics();
242 let min
= tm
.getWidth(text
+ ':');
244 return min
< width
? width
: min
;
247 getStoredAuth: function() {
248 let storedAuth
= JSON
.parse(window
.localStorage
.getItem('ProxmoxUser'));
249 return storedAuth
|| {};
252 setAuthData: function(data
) {
253 Proxmox
.UserName
= data
.username
;
254 Proxmox
.LoggedOut
= data
.LoggedOut
;
255 // creates a session cookie (expire = null)
256 // that way the cookie gets deleted after the browser window is closed
258 Proxmox
.CSRFPreventionToken
= data
.CSRFPreventionToken
;
259 Ext
.util
.Cookies
.set(Proxmox
.Setup
.auth_cookie_name
, data
.ticket
, null, '/', null, true);
263 window
.localStorage
.setItem('ProxmoxUser', JSON
.stringify(data
));
268 if (Proxmox
.LoggedOut
) {
271 let storedAuth
= Proxmox
.Utils
.getStoredAuth();
272 let cookie
= Ext
.util
.Cookies
.get(Proxmox
.Setup
.auth_cookie_name
);
273 if ((Proxmox
.UserName
!== '' && cookie
&& !cookie
.startsWith("PVE:tfa!")) || storedAuth
.token
) {
274 return cookie
|| storedAuth
.token
;
280 authClear: function() {
281 if (Proxmox
.LoggedOut
) {
284 Ext
.util
.Cookies
.clear(Proxmox
.Setup
.auth_cookie_name
);
285 window
.localStorage
.removeItem("ProxmoxUser");
288 // comp.setLoading() is buggy in ExtJS 4.0.7, so we
289 // use el.mask() instead
290 setErrorMask: function(comp
, msg
) {
297 } else if (msg
=== true) {
298 el
.mask(gettext("Loading..."));
304 getResponseErrorMessage
: (err
) => {
305 if (!err
.statusText
) {
306 return gettext('Connection error');
308 let msg
= [`${err.statusText} (${err.status})`];
309 if (err
.response
&& err
.response
.responseText
) {
310 let txt
= err
.response
.responseText
;
312 let res
= JSON
.parse(txt
);
313 if (res
.errors
&& typeof res
.errors
=== 'object') {
314 for (let [key
, value
] of Object
.entries(res
.errors
)) {
315 msg
.push(Ext
.String
.htmlEncode(`${key}: ${value}`));
319 // fallback to string
320 msg
.push(Ext
.String
.htmlEncode(txt
));
323 return msg
.join('<br>');
326 monStoreErrors: function(component
, store
, clearMaskBeforeLoad
) {
327 if (clearMaskBeforeLoad
) {
328 component
.mon(store
, 'beforeload', function(s
, operation
, eOpts
) {
329 Proxmox
.Utils
.setErrorMask(component
, false);
332 component
.mon(store
, 'beforeload', function(s
, operation
, eOpts
) {
333 if (!component
.loadCount
) {
334 component
.loadCount
= 0; // make sure it is nucomponent.ic
335 Proxmox
.Utils
.setErrorMask(component
, true);
340 // only works with 'proxmox' proxy
341 component
.mon(store
.proxy
, 'afterload', function(proxy
, request
, success
) {
342 component
.loadCount
++;
345 Proxmox
.Utils
.setErrorMask(component
, false);
349 let error
= request
._operation
.getError();
350 let msg
= Proxmox
.Utils
.getResponseErrorMessage(error
);
351 Proxmox
.Utils
.setErrorMask(component
, msg
);
355 extractRequestError: function(result
, verbose
) {
356 let msg
= gettext('Successful');
358 if (!result
.success
) {
359 msg
= gettext("Unknown error");
360 if (result
.message
) {
361 msg
= result
.message
;
363 msg
+= ' (' + result
.status
+ ')';
366 if (verbose
&& Ext
.isObject(result
.errors
)) {
368 Ext
.Object
.each(result
.errors
, function(prop
, desc
) {
369 msg
+= "<br><b>" + Ext
.htmlEncode(prop
) + "</b>: " +
370 Ext
.htmlEncode(desc
);
379 API2Request: function(reqOpts
) {
380 let newopts
= Ext
.apply({
381 waitMsg
: gettext('Please wait...'),
384 if (!newopts
.url
.match(/^\/api2/)) {
385 newopts
.url
= '/api2/extjs' + newopts
.url
;
387 delete newopts
.callback
;
389 let createWrapper = function(successFn
, callbackFn
, failureFn
) {
391 success: function(response
, options
) {
392 if (options
.waitMsgTarget
) {
393 if (Proxmox
.Utils
.toolkit
=== 'touch') {
394 options
.waitMsgTarget
.setMasked(false);
396 options
.waitMsgTarget
.setLoading(false);
399 let result
= Ext
.decode(response
.responseText
);
400 response
.result
= result
;
401 if (!result
.success
) {
402 response
.htmlStatus
= Proxmox
.Utils
.extractRequestError(result
, true);
403 Ext
.callback(callbackFn
, options
.scope
, [options
, false, response
]);
404 Ext
.callback(failureFn
, options
.scope
, [response
, options
]);
407 Ext
.callback(callbackFn
, options
.scope
, [options
, true, response
]);
408 Ext
.callback(successFn
, options
.scope
, [response
, options
]);
410 failure: function(response
, options
) {
411 if (options
.waitMsgTarget
) {
412 if (Proxmox
.Utils
.toolkit
=== 'touch') {
413 options
.waitMsgTarget
.setMasked(false);
415 options
.waitMsgTarget
.setLoading(false);
418 response
.result
= {};
420 response
.result
= Ext
.decode(response
.responseText
);
424 let msg
= gettext('Connection error') + ' - server offline?';
425 if (response
.aborted
) {
426 msg
= gettext('Connection error') + ' - aborted.';
427 } else if (response
.timedout
) {
428 msg
= gettext('Connection error') + ' - Timeout.';
429 } else if (response
.status
&& response
.statusText
) {
430 msg
= gettext('Connection error') + ' ' + response
.status
+ ': ' + response
.statusText
;
432 response
.htmlStatus
= msg
;
433 Ext
.callback(callbackFn
, options
.scope
, [options
, false, response
]);
434 Ext
.callback(failureFn
, options
.scope
, [response
, options
]);
439 createWrapper(reqOpts
.success
, reqOpts
.callback
, reqOpts
.failure
);
441 let target
= newopts
.waitMsgTarget
;
443 if (Proxmox
.Utils
.toolkit
=== 'touch') {
444 target
.setMasked({ xtype
: 'loadmask', message
: newopts
.waitMsg
});
446 // Note: ExtJS bug - this does not work when component is not rendered
447 target
.setLoading(newopts
.waitMsg
);
450 Ext
.Ajax
.request(newopts
);
453 checked_command: function(orig_cmd
) {
454 Proxmox
.Utils
.API2Request(
456 url
: '/nodes/localhost/subscription',
458 failure: function(response
, opts
) {
459 Ext
.Msg
.alert(gettext('Error'), response
.htmlStatus
);
461 success: function(response
, opts
) {
462 let res
= response
.result
;
463 if (res
=== null || res
=== undefined || !res
|| res
464 .data
.status
.toLowerCase() !== 'active') {
466 title
: gettext('No valid subscription'),
467 icon
: Ext
.Msg
.WARNING
,
468 message
: Proxmox
.Utils
.getNoSubKeyHtml(res
.data
.url
),
470 callback: function(btn
) {
485 assemble_field_data: function(values
, data
) {
486 if (!Ext
.isObject(data
)) {
489 Ext
.Object
.each(data
, function(name
, val
) {
490 if (Object
.prototype.hasOwnProperty
.call(values
, name
)) {
491 let bucket
= values
[name
];
492 if (!Ext
.isArray(bucket
)) {
493 bucket
= values
[name
] = [bucket
];
495 if (Ext
.isArray(val
)) {
496 values
[name
] = bucket
.concat(val
);
506 updateColumnWidth: function(container
) {
507 let mode
= Ext
.state
.Manager
.get('summarycolumns') || 'auto';
509 if (mode
!== 'auto') {
510 factor
= parseInt(mode
, 10);
511 if (Number
.isNaN(factor
)) {
515 factor
= container
.getSize().width
< 1600 ? 1 : 2;
518 if (container
.oldFactor
=== factor
) {
522 let items
= container
.query('>'); // direct childs
523 factor
= Math
.min(factor
, items
.length
);
524 container
.oldFactor
= factor
;
526 items
.forEach((item
) => {
527 item
.columnWidth
= 1 / factor
;
530 // we have to update the layout twice, since the first layout change
531 // can trigger the scrollbar which reduces the amount of space left
532 container
.updateLayout();
533 container
.updateLayout();
536 dialog_title: function(subject
, create
, isAdd
) {
539 return gettext('Add') + ': ' + subject
;
541 return gettext('Create') + ': ' + subject
;
544 return gettext('Edit') + ': ' + subject
;
548 network_iface_types
: {
549 eth
: gettext("Network Device"),
550 bridge
: 'Linux Bridge',
553 OVSBridge
: 'OVS Bridge',
556 OVSIntPort
: 'OVS IntPort',
559 render_network_iface_type: function(value
) {
560 return Proxmox
.Utils
.network_iface_types
[value
] ||
561 Proxmox
.Utils
.unknownText
;
565 aptupdate
: ['', gettext('Update package database')],
566 diskinit
: ['Disk', gettext('Initialize Disk with GPT')],
567 spiceshell
: ['', gettext('Shell') + ' (Spice)'],
568 srvreload
: ['SRV', gettext('Reload')],
569 srvrestart
: ['SRV', gettext('Restart')],
570 srvstart
: ['SRV', gettext('Start')],
571 srvstop
: ['SRV', gettext('Stop')],
572 termproxy
: ['', gettext('Console') + ' (xterm.js)'],
573 vncshell
: ['', gettext('Shell')],
576 // to add or change existing for product specific ones
577 override_task_descriptions: function(extra
) {
578 for (const [key
, value
] of Object
.entries(extra
)) {
579 Proxmox
.Utils
.task_desc_table
[key
] = value
;
583 format_task_description: function(type
, id
) {
584 let farray
= Proxmox
.Utils
.task_desc_table
[type
];
592 } else if (Ext
.isFunction(farray
)) {
593 return farray(type
, id
);
595 let prefix
= farray
[0];
597 if (prefix
&& id
!== undefined) {
598 return prefix
+ ' ' + id
+ ' - ' + text
;
603 format_size: function(size
) {
604 let units
= ['', 'Ki', 'Mi', 'Gi', 'Ti', 'Pi', 'Ei', 'Zi', 'Yi'];
606 while (size
>= 1024 && num
++ <= units
.length
) {
610 return size
.toFixed(num
> 0?2:0) + " " + units
[num
] + "B";
613 render_upid: function(value
, metaData
, record
) {
614 let task
= record
.data
;
615 let type
= task
.type
|| task
.worker_type
;
616 let id
= task
.id
|| task
.worker_id
;
618 return Proxmox
.Utils
.format_task_description(type
, id
);
621 render_uptime: function(value
) {
624 if (uptime
=== undefined) {
632 return Proxmox
.Utils
.format_duration_long(uptime
);
635 systemd_unescape: function(string_value
) {
636 const charcode_0
= '0'.charCodeAt(0);
637 const charcode_9
= '9'.charCodeAt(0);
638 const charcode_A
= 'A'.charCodeAt(0);
639 const charcode_F
= 'F'.charCodeAt(0);
640 const charcode_a
= 'a'.charCodeAt(0);
641 const charcode_f
= 'f'.charCodeAt(0);
642 const charcode_x
= 'x'.charCodeAt(0);
643 const charcode_minus
= '-'.charCodeAt(0);
644 const charcode_slash
= '/'.charCodeAt(0);
645 const charcode_backslash
= '\\'.charCodeAt(0);
647 let parse_hex_digit = function(d
) {
648 if (d
>= charcode_0
&& d
<= charcode_9
) {
649 return d
- charcode_0
;
651 if (d
>= charcode_A
&& d
<= charcode_F
) {
652 return d
- charcode_A
+ 10;
654 if (d
>= charcode_a
&& d
<= charcode_f
) {
655 return d
- charcode_a
+ 10;
657 throw "got invalid hex digit";
660 let value
= new TextEncoder().encode(string_value
);
661 let result
= new Uint8Array(value
.length
);
666 while (i
< value
.length
) {
668 if (c0
=== charcode_minus
) {
669 result
.set([charcode_slash
], result_len
);
674 if ((i
+ 4) < value
.length
) {
676 if (c0
=== charcode_backslash
&& c1
=== charcode_x
) {
677 let h1
= parse_hex_digit(value
[i
+2]);
678 let h0
= parse_hex_digit(value
[i
+3]);
680 result
.set([ord
], result_len
);
686 result
.set([c0
], result_len
);
691 return new TextDecoder().decode(result
.slice(0, result
.len
));
694 parse_task_upid: function(upid
) {
697 let res
= upid
.match(/^UPID:([^\s:]+):([0-9A-Fa-f]{8}):([0-9A-Fa-f]{8,9}):(([0-9A-Fa-f]{8,16}):)?([0-9A-Fa-f]{8}):([^:\s]+):([^:\s]*):([^:\s]+):$/);
699 throw "unable to parse upid '" + upid
+ "'";
702 task
.pid
= parseInt(res
[2], 16);
703 task
.pstart
= parseInt(res
[3], 16);
704 if (res
[5] !== undefined) {
705 task
.task_id
= parseInt(res
[5], 16);
707 task
.starttime
= parseInt(res
[6], 16);
709 task
.id
= Proxmox
.Utils
.systemd_unescape(res
[8]);
712 task
.desc
= Proxmox
.Utils
.format_task_description(task
.type
, task
.id
);
717 parse_task_status: function(status
) {
718 if (status
=== 'OK') {
722 if (status
=== 'unknown') {
726 let match
= status
.match(/^WARNINGS: (.*)$/);
734 render_duration: function(value
) {
735 if (value
=== undefined) {
738 return Proxmox
.Utils
.format_duration_human(value
);
741 render_timestamp: function(value
, metaData
, record
, rowIndex
, colIndex
, store
) {
742 let servertime
= new Date(value
* 1000);
743 return Ext
.Date
.format(servertime
, 'Y-m-d H:i:s');
746 render_zfs_health: function(value
) {
747 if (typeof value
=== 'undefined') {
750 var iconCls
= 'question-circle';
754 iconCls
= 'check-circle good';
758 iconCls
= 'exclamation-circle warning';
763 iconCls
= 'times-circle critical';
768 return '<i class="fa fa-' + iconCls
+ '"></i> ' + value
;
771 get_help_info: function(section
) {
773 if (typeof proxmoxOnlineHelpInfo
!== 'undefined') {
774 helpMap
= proxmoxOnlineHelpInfo
; // eslint-disable-line no-undef
775 } else if (typeof pveOnlineHelpInfo
!== 'undefined') {
776 // be backward compatible with older pve-doc-generators
777 helpMap
= pveOnlineHelpInfo
; // eslint-disable-line no-undef
779 throw "no global OnlineHelpInfo map declared";
782 if (helpMap
[section
]) {
783 return helpMap
[section
];
785 // try to normalize - and _ separators, to support asciidoc and sphinx
786 // references at the same time.
787 let section_minus_normalized
= section
.replace(/_
/, '-');
788 if (helpMap
[section_minus_normalized
]) {
789 return helpMap
[section_minus_normalized
];
791 let section_underscore_normalized
= section
.replace(/-/, '_');
792 return helpMap
[section_underscore_normalized
];
795 get_help_link: function(section
) {
796 let info
= Proxmox
.Utils
.get_help_info(section
);
800 return window
.location
.origin
+ info
.link
;
803 openXtermJsViewer: function(vmtype
, vmid
, nodename
, vmname
, cmd
) {
804 let url
= Ext
.Object
.toQueryString({
805 console
: vmtype
, // kvm, lxc, upgrade or shell
813 let nw
= window
.open("?" + url
, '_blank', 'toolbar=no,location=no,status=no,menubar=no,resizable=yes,width=800,height=420');
822 constructor: function() {
824 Ext
.apply(me
, me
.utilities
);
826 let IPV4_OCTET
= "(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9])";
827 let IPV4_REGEXP
= "(?:(?:" + IPV4_OCTET
+ "\\.){3}" + IPV4_OCTET
+ ")";
828 let IPV6_H16
= "(?:[0-9a-fA-F]{1,4})";
829 let IPV6_LS32
= "(?:(?:" + IPV6_H16
+ ":" + IPV6_H16
+ ")|" + IPV4_REGEXP
+ ")";
830 let IPV4_CIDR_MASK
= "([0-9]{1,2})";
831 let IPV6_CIDR_MASK
= "([0-9]{1,3})";
834 me
.IP4_match
= new RegExp("^(?:" + IPV4_REGEXP
+ ")$");
835 me
.IP4_cidr_match
= new RegExp("^(?:" + IPV4_REGEXP
+ ")/" + IPV4_CIDR_MASK
+ "$");
837 /* eslint-disable no-useless-concat,no-multi-spaces */
838 let IPV6_REGEXP
= "(?:" +
839 "(?:(?:" + "(?:" + IPV6_H16
+ ":){6})" + IPV6_LS32
+ ")|" +
840 "(?:(?:" + "::" + "(?:" + IPV6_H16
+ ":){5})" + IPV6_LS32
+ ")|" +
841 "(?:(?:(?:" + IPV6_H16
+ ")?::" + "(?:" + IPV6_H16
+ ":){4})" + IPV6_LS32
+ ")|" +
842 "(?:(?:(?:(?:" + IPV6_H16
+ ":){0,1}" + IPV6_H16
+ ")?::" + "(?:" + IPV6_H16
+ ":){3})" + IPV6_LS32
+ ")|" +
843 "(?:(?:(?:(?:" + IPV6_H16
+ ":){0,2}" + IPV6_H16
+ ")?::" + "(?:" + IPV6_H16
+ ":){2})" + IPV6_LS32
+ ")|" +
844 "(?:(?:(?:(?:" + IPV6_H16
+ ":){0,3}" + IPV6_H16
+ ")?::" + "(?:" + IPV6_H16
+ ":){1})" + IPV6_LS32
+ ")|" +
845 "(?:(?:(?:(?:" + IPV6_H16
+ ":){0,4}" + IPV6_H16
+ ")?::" + ")" + IPV6_LS32
+ ")|" +
846 "(?:(?:(?:(?:" + IPV6_H16
+ ":){0,5}" + IPV6_H16
+ ")?::" + ")" + IPV6_H16
+ ")|" +
847 "(?:(?:(?:(?:" + IPV6_H16
+ ":){0,7}" + IPV6_H16
+ ")?::" + ")" + ")" +
849 /* eslint-enable no-useless-concat,no-multi-spaces */
851 me
.IP6_match
= new RegExp("^(?:" + IPV6_REGEXP
+ ")$");
852 me
.IP6_cidr_match
= new RegExp("^(?:" + IPV6_REGEXP
+ ")/" + IPV6_CIDR_MASK
+ "$");
853 me
.IP6_bracket_match
= new RegExp("^\\[(" + IPV6_REGEXP
+ ")\\]");
855 me
.IP64_match
= new RegExp("^(?:" + IPV6_REGEXP
+ "|" + IPV4_REGEXP
+ ")$");
856 me
.IP64_cidr_match
= new RegExp("^(?:" + IPV6_REGEXP
+ "/" + IPV6_CIDR_MASK
+ ")|(?:" + IPV4_REGEXP
+ "/" + IPV4_CIDR_MASK
+ ")$");
858 let DnsName_REGEXP
= "(?:(?:(?:[a-zA-Z0-9](?:[a-zA-Z0-9\\-]*[a-zA-Z0-9])?)\\.)*(?:[A-Za-z0-9](?:[A-Za-z0-9\\-]*[A-Za-z0-9])?))";
859 me
.DnsName_match
= new RegExp("^" + DnsName_REGEXP
+ "$");
861 me
.HostPort_match
= new RegExp("^(" + IPV4_REGEXP
+ "|" + DnsName_REGEXP
+ ")(?::(\\d+))?$");
862 me
.HostPortBrackets_match
= new RegExp("^\\[(" + IPV6_REGEXP
+ "|" + IPV4_REGEXP
+ "|" + DnsName_REGEXP
+ ")\\](?::(\\d+))?$");
863 me
.IP6_dotnotation_match
= new RegExp("^(" + IPV6_REGEXP
+ ")(?:\\.(\\d+))?$");
864 me
.Vlan_match
= /^vlan(\\d+)/;
865 me
.VlanInterface_match
= /(\\w+)\\.(\\d+)/;