2 Ext
.ns('Proxmox.Setup');
4 if (!Ext
.isDefined(Proxmox
.Setup
.auth_cookie_name
)) {
5 throw "Proxmox library not initialized";
8 // avoid errors when running without development tools
9 if (!Ext
.isDefined(Ext
.global
.console
)) {
21 Ext
.global
.console
= console
;
24 Ext
.Ajax
.defaultHeaders
= {
25 'Accept': 'application/json',
28 Ext
.Ajax
.on('beforerequest', function(conn
, options
) {
29 if (Proxmox
.CSRFPreventionToken
) {
30 if (!options
.headers
) {
33 options
.headers
.CSRFPreventionToken
= Proxmox
.CSRFPreventionToken
;
35 let storedAuth
= Proxmox
.Utils
.getStoredAuth();
36 if (storedAuth
.token
) {
37 options
.headers
.Authorization
= storedAuth
.token
;
41 Ext
.define('Proxmox.Utils', { // a singleton
44 yesText
: gettext('Yes'),
45 noText
: gettext('No'),
46 enabledText
: gettext('Enabled'),
47 disabledText
: gettext('Disabled'),
48 noneText
: gettext('none'),
49 NoneText
: gettext('None'),
50 errorText
: gettext('Error'),
51 unknownText
: gettext('Unknown'),
52 defaultText
: gettext('Default'),
53 daysText
: gettext('days'),
54 dayText
: gettext('day'),
55 runningText
: gettext('running'),
56 stoppedText
: gettext('stopped'),
57 neverText
: gettext('never'),
58 totalText
: gettext('Total'),
59 usedText
: gettext('Used'),
60 directoryText
: gettext('Directory'),
61 stateText
: gettext('State'),
62 groupText
: gettext('Group'),
67 zh_CN
: 'Chinese (Simplified)',
68 zh_TW
: 'Chinese (Traditional)',
72 eu
: 'Euskera (Basque)',
79 nb
: 'Norwegian (Bokmal)',
80 nn
: 'Norwegian (Nynorsk)',
81 fa
: 'Persian (Farsi)',
83 pt_BR
: 'Portuguese (Brazil)',
91 render_language: function(value
) {
93 return Proxmox
.Utils
.defaultText
+ ' (English)';
95 let text
= Proxmox
.Utils
.language_map
[value
];
97 return text
+ ' (' + value
+ ')';
102 language_array: function() {
103 let data
= [['__default__', Proxmox
.Utils
.render_language('')]];
104 Ext
.Object
.each(Proxmox
.Utils
.language_map
, function(key
, value
) {
105 data
.push([key
, Proxmox
.Utils
.render_language(value
)]);
111 bond_mode_gettext_map
: {
112 '802.3ad': 'LACP (802.3ad)',
113 'lacp-balance-slb': 'LACP (balance-slb)',
114 'lacp-balance-tcp': 'LACP (balance-tcp)',
117 render_bond_mode
: value
=> Proxmox
.Utils
.bond_mode_gettext_map
[value
] || value
|| '',
119 bond_mode_array: function(modes
) {
120 return modes
.map(mode
=> [mode
, Proxmox
.Utils
.render_bond_mode(mode
)]);
123 getNoSubKeyHtml: function(url
) {
124 // url http://www.proxmox.com/products/proxmox-ve/subscription-service-plans
125 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');
128 format_boolean_with_default: function(value
) {
129 if (Ext
.isDefined(value
) && value
!== '__default__') {
130 return value
? Proxmox
.Utils
.yesText
: Proxmox
.Utils
.noText
;
132 return Proxmox
.Utils
.defaultText
;
135 format_boolean: function(value
) {
136 return value
? Proxmox
.Utils
.yesText
: Proxmox
.Utils
.noText
;
139 format_neg_boolean: function(value
) {
140 return !value
? Proxmox
.Utils
.yesText
: Proxmox
.Utils
.noText
;
143 format_enabled_toggle: function(value
) {
144 return value
? Proxmox
.Utils
.enabledText
: Proxmox
.Utils
.disabledText
;
147 format_expire: function(date
) {
149 return Proxmox
.Utils
.neverText
;
151 return Ext
.Date
.format(date
, "Y-m-d");
154 // somewhat like a human would tell durations, omit zero values and do not
155 // give seconds precision if we talk days already
156 format_duration_human: function(ut
) {
157 let seconds
= 0, minutes
= 0, hours
= 0, days
= 0;
164 seconds
= Number((remaining
% 60).toFixed(1));
165 remaining
= Math
.trunc(remaining
/ 60);
167 minutes
= remaining
% 60;
168 remaining
= Math
.trunc(remaining
/ 60);
170 hours
= remaining
% 24;
171 remaining
= Math
.trunc(remaining
/ 24);
179 let add
= (t
, unit
) => {
180 if (t
> 0) res
.push(t
+ unit
);
184 let addSeconds
= !add(days
, 'd');
190 return res
.join(' ');
193 format_duration_long: function(ut
) {
194 let days
= Math
.floor(ut
/ 86400);
196 let hours
= Math
.floor(ut
/ 3600);
198 let mins
= Math
.floor(ut
/ 60);
201 let hours_str
= '00' + hours
.toString();
202 hours_str
= hours_str
.substr(hours_str
.length
- 2);
203 let mins_str
= "00" + mins
.toString();
204 mins_str
= mins_str
.substr(mins_str
.length
- 2);
205 let ut_str
= "00" + ut
.toString();
206 ut_str
= ut_str
.substr(ut_str
.length
- 2);
209 let ds
= days
> 1 ? Proxmox
.Utils
.daysText
: Proxmox
.Utils
.dayText
;
210 return days
.toString() + ' ' + ds
+ ' ' +
211 hours_str
+ ':' + mins_str
+ ':' + ut_str
;
213 return hours_str
+ ':' + mins_str
+ ':' + ut_str
;
217 format_subscription_level: function(level
) {
220 } else if (level
=== 'b') {
222 } else if (level
=== 's') {
224 } else if (level
=== 'p') {
227 return Proxmox
.Utils
.noneText
;
231 compute_min_label_width: function(text
, width
) {
232 if (width
=== undefined) { width
= 100; }
234 let tm
= new Ext
.util
.TextMetrics();
235 let min
= tm
.getWidth(text
+ ':');
237 return min
< width
? width
: min
;
240 getStoredAuth: function() {
241 let storedAuth
= JSON
.parse(window
.localStorage
.getItem('ProxmoxUser'));
242 return storedAuth
|| {};
245 setAuthData: function(data
) {
246 Proxmox
.UserName
= data
.username
;
247 Proxmox
.LoggedOut
= data
.LoggedOut
;
248 // creates a session cookie (expire = null)
249 // that way the cookie gets deleted after the browser window is closed
251 Proxmox
.CSRFPreventionToken
= data
.CSRFPreventionToken
;
252 Ext
.util
.Cookies
.set(Proxmox
.Setup
.auth_cookie_name
, data
.ticket
, null, '/', null, true);
256 window
.localStorage
.setItem('ProxmoxUser', JSON
.stringify(data
));
261 if (Proxmox
.LoggedOut
) {
264 let storedAuth
= Proxmox
.Utils
.getStoredAuth();
265 let cookie
= Ext
.util
.Cookies
.get(Proxmox
.Setup
.auth_cookie_name
);
266 if ((Proxmox
.UserName
!== '' && cookie
&& !cookie
.startsWith("PVE:tfa!")) || storedAuth
.token
) {
267 return cookie
|| storedAuth
.token
;
273 authClear: function() {
274 if (Proxmox
.LoggedOut
) {
277 Ext
.util
.Cookies
.clear(Proxmox
.Setup
.auth_cookie_name
);
278 window
.localStorage
.removeItem("ProxmoxUser");
281 // comp.setLoading() is buggy in ExtJS 4.0.7, so we
282 // use el.mask() instead
283 setErrorMask: function(comp
, msg
) {
290 } else if (msg
=== true) {
291 el
.mask(gettext("Loading..."));
297 getResponseErrorMessage
: (err
) => {
298 if (!err
.statusText
) {
299 return gettext('Connection error');
301 let msg
= [`${err.statusText} (${err.status})`];
302 if (err
.response
&& err
.response
.responseText
) {
303 let txt
= err
.response
.responseText
;
305 let res
= JSON
.parse(txt
);
306 if (res
.errors
&& typeof res
.errors
=== 'object') {
307 for (let [key
, value
] of Object
.entries(res
.errors
)) {
308 msg
.push(Ext
.String
.htmlEncode(`${key}: ${value}`));
312 // fallback to string
313 msg
.push(Ext
.String
.htmlEncode(txt
));
316 return msg
.join('<br>');
319 monStoreErrors: function(component
, store
, clearMaskBeforeLoad
) {
320 if (clearMaskBeforeLoad
) {
321 component
.mon(store
, 'beforeload', function(s
, operation
, eOpts
) {
322 Proxmox
.Utils
.setErrorMask(component
, false);
325 component
.mon(store
, 'beforeload', function(s
, operation
, eOpts
) {
326 if (!component
.loadCount
) {
327 component
.loadCount
= 0; // make sure it is nucomponent.ic
328 Proxmox
.Utils
.setErrorMask(component
, true);
333 // only works with 'proxmox' proxy
334 component
.mon(store
.proxy
, 'afterload', function(proxy
, request
, success
) {
335 component
.loadCount
++;
338 Proxmox
.Utils
.setErrorMask(component
, false);
342 let error
= request
._operation
.getError();
343 let msg
= Proxmox
.Utils
.getResponseErrorMessage(error
);
344 Proxmox
.Utils
.setErrorMask(component
, msg
);
348 extractRequestError: function(result
, verbose
) {
349 let msg
= gettext('Successful');
351 if (!result
.success
) {
352 msg
= gettext("Unknown error");
353 if (result
.message
) {
354 msg
= result
.message
;
356 msg
+= ' (' + result
.status
+ ')';
359 if (verbose
&& Ext
.isObject(result
.errors
)) {
361 Ext
.Object
.each(result
.errors
, function(prop
, desc
) {
362 msg
+= "<br><b>" + Ext
.htmlEncode(prop
) + "</b>: " +
363 Ext
.htmlEncode(desc
);
372 API2Request: function(reqOpts
) {
373 let newopts
= Ext
.apply({
374 waitMsg
: gettext('Please wait...'),
377 if (!newopts
.url
.match(/^\/api2/)) {
378 newopts
.url
= '/api2/extjs' + newopts
.url
;
380 delete newopts
.callback
;
382 let createWrapper = function(successFn
, callbackFn
, failureFn
) {
384 success: function(response
, options
) {
385 if (options
.waitMsgTarget
) {
386 if (Proxmox
.Utils
.toolkit
=== 'touch') {
387 options
.waitMsgTarget
.setMasked(false);
389 options
.waitMsgTarget
.setLoading(false);
392 let result
= Ext
.decode(response
.responseText
);
393 response
.result
= result
;
394 if (!result
.success
) {
395 response
.htmlStatus
= Proxmox
.Utils
.extractRequestError(result
, true);
396 Ext
.callback(callbackFn
, options
.scope
, [options
, false, response
]);
397 Ext
.callback(failureFn
, options
.scope
, [response
, options
]);
400 Ext
.callback(callbackFn
, options
.scope
, [options
, true, response
]);
401 Ext
.callback(successFn
, options
.scope
, [response
, options
]);
403 failure: function(response
, options
) {
404 if (options
.waitMsgTarget
) {
405 if (Proxmox
.Utils
.toolkit
=== 'touch') {
406 options
.waitMsgTarget
.setMasked(false);
408 options
.waitMsgTarget
.setLoading(false);
411 response
.result
= {};
413 response
.result
= Ext
.decode(response
.responseText
);
417 let msg
= gettext('Connection error') + ' - server offline?';
418 if (response
.aborted
) {
419 msg
= gettext('Connection error') + ' - aborted.';
420 } else if (response
.timedout
) {
421 msg
= gettext('Connection error') + ' - Timeout.';
422 } else if (response
.status
&& response
.statusText
) {
423 msg
= gettext('Connection error') + ' ' + response
.status
+ ': ' + response
.statusText
;
425 response
.htmlStatus
= msg
;
426 Ext
.callback(callbackFn
, options
.scope
, [options
, false, response
]);
427 Ext
.callback(failureFn
, options
.scope
, [response
, options
]);
432 createWrapper(reqOpts
.success
, reqOpts
.callback
, reqOpts
.failure
);
434 let target
= newopts
.waitMsgTarget
;
436 if (Proxmox
.Utils
.toolkit
=== 'touch') {
437 target
.setMasked({ xtype
: 'loadmask', message
: newopts
.waitMsg
});
439 // Note: ExtJS bug - this does not work when component is not rendered
440 target
.setLoading(newopts
.waitMsg
);
443 Ext
.Ajax
.request(newopts
);
446 checked_command: function(orig_cmd
) {
447 Proxmox
.Utils
.API2Request(
449 url
: '/nodes/localhost/subscription',
451 failure: function(response
, opts
) {
452 Ext
.Msg
.alert(gettext('Error'), response
.htmlStatus
);
454 success: function(response
, opts
) {
455 let res
= response
.result
;
456 if (res
=== null || res
=== undefined || !res
|| res
457 .data
.status
.toLowerCase() !== 'active') {
459 title
: gettext('No valid subscription'),
460 icon
: Ext
.Msg
.WARNING
,
461 message
: Proxmox
.Utils
.getNoSubKeyHtml(res
.data
.url
),
463 callback: function(btn
) {
478 assemble_field_data: function(values
, data
) {
479 if (!Ext
.isObject(data
)) {
482 Ext
.Object
.each(data
, function(name
, val
) {
483 if (Object
.prototype.hasOwnProperty
.call(values
, name
)) {
484 let bucket
= values
[name
];
485 if (!Ext
.isArray(bucket
)) {
486 bucket
= values
[name
] = [bucket
];
488 if (Ext
.isArray(val
)) {
489 values
[name
] = bucket
.concat(val
);
499 updateColumnWidth: function(container
) {
500 let mode
= Ext
.state
.Manager
.get('summarycolumns') || 'auto';
502 if (mode
!== 'auto') {
503 factor
= parseInt(mode
, 10);
504 if (Number
.isNaN(factor
)) {
508 factor
= container
.getSize().width
< 1600 ? 1 : 2;
511 if (container
.oldFactor
=== factor
) {
515 let items
= container
.query('>'); // direct childs
516 factor
= Math
.min(factor
, items
.length
);
517 container
.oldFactor
= factor
;
519 items
.forEach((item
) => {
520 item
.columnWidth
= 1 / factor
;
523 // we have to update the layout twice, since the first layout change
524 // can trigger the scrollbar which reduces the amount of space left
525 container
.updateLayout();
526 container
.updateLayout();
529 dialog_title: function(subject
, create
, isAdd
) {
532 return gettext('Add') + ': ' + subject
;
534 return gettext('Create') + ': ' + subject
;
537 return gettext('Edit') + ': ' + subject
;
541 network_iface_types
: {
542 eth
: gettext("Network Device"),
543 bridge
: 'Linux Bridge',
546 OVSBridge
: 'OVS Bridge',
549 OVSIntPort
: 'OVS IntPort',
552 render_network_iface_type: function(value
) {
553 return Proxmox
.Utils
.network_iface_types
[value
] ||
554 Proxmox
.Utils
.unknownText
;
558 aptupdate
: ['', gettext('Update package database')],
559 diskinit
: ['Disk', gettext('Initialize Disk with GPT')],
560 spiceshell
: ['', gettext('Shell') + ' (Spice)'],
561 srvreload
: ['SRV', gettext('Reload')],
562 srvrestart
: ['SRV', gettext('Restart')],
563 srvstart
: ['SRV', gettext('Start')],
564 srvstop
: ['SRV', gettext('Stop')],
565 termproxy
: ['', gettext('Console') + ' (xterm.js)'],
566 vncshell
: ['', gettext('Shell')],
569 // to add or change existing for product specific ones
570 override_task_descriptions: function(extra
) {
571 for (const [key
, value
] of Object
.entries(extra
)) {
572 Proxmox
.Utils
.task_desc_table
[key
] = value
;
576 format_task_description: function(type
, id
) {
577 let farray
= Proxmox
.Utils
.task_desc_table
[type
];
585 } else if (Ext
.isFunction(farray
)) {
586 return farray(type
, id
);
588 let prefix
= farray
[0];
590 if (prefix
&& id
!== undefined) {
591 return prefix
+ ' ' + id
+ ' - ' + text
;
596 format_size: function(size
) {
597 let units
= ['', 'Ki', 'Mi', 'Gi', 'Ti', 'Pi', 'Ei', 'Zi', 'Yi'];
599 while (size
>= 1024 && num
++ <= units
.length
) {
603 return size
.toFixed(num
> 0?2:0) + " " + units
[num
] + "B";
606 render_upid: function(value
, metaData
, record
) {
607 let task
= record
.data
;
608 let type
= task
.type
|| task
.worker_type
;
609 let id
= task
.id
|| task
.worker_id
;
611 return Proxmox
.Utils
.format_task_description(type
, id
);
614 render_uptime: function(value
) {
617 if (uptime
=== undefined) {
625 return Proxmox
.Utils
.format_duration_long(uptime
);
628 systemd_unescape: function(string_value
) {
629 const charcode_0
= '0'.charCodeAt(0);
630 const charcode_9
= '9'.charCodeAt(0);
631 const charcode_A
= 'A'.charCodeAt(0);
632 const charcode_F
= 'F'.charCodeAt(0);
633 const charcode_a
= 'a'.charCodeAt(0);
634 const charcode_f
= 'f'.charCodeAt(0);
635 const charcode_x
= 'x'.charCodeAt(0);
636 const charcode_minus
= '-'.charCodeAt(0);
637 const charcode_slash
= '/'.charCodeAt(0);
638 const charcode_backslash
= '\\'.charCodeAt(0);
640 let parse_hex_digit = function(d
) {
641 if (d
>= charcode_0
&& d
<= charcode_9
) {
642 return d
- charcode_0
;
644 if (d
>= charcode_A
&& d
<= charcode_F
) {
645 return d
- charcode_A
+ 10;
647 if (d
>= charcode_a
&& d
<= charcode_f
) {
648 return d
- charcode_a
+ 10;
650 throw "got invalid hex digit";
653 let value
= new TextEncoder().encode(string_value
);
654 let result
= new Uint8Array(value
.length
);
659 while (i
< value
.length
) {
661 if (c0
=== charcode_minus
) {
662 result
.set([charcode_slash
], result_len
);
667 if ((i
+ 4) < value
.length
) {
669 if (c0
=== charcode_backslash
&& c1
=== charcode_x
) {
670 let h1
= parse_hex_digit(value
[i
+2]);
671 let h0
= parse_hex_digit(value
[i
+3]);
673 result
.set([ord
], result_len
);
679 result
.set([c0
], result_len
);
684 return new TextDecoder().decode(result
.slice(0, result
.len
));
687 parse_task_upid: function(upid
) {
690 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]+):$/);
692 throw "unable to parse upid '" + upid
+ "'";
695 task
.pid
= parseInt(res
[2], 16);
696 task
.pstart
= parseInt(res
[3], 16);
697 if (res
[5] !== undefined) {
698 task
.task_id
= parseInt(res
[5], 16);
700 task
.starttime
= parseInt(res
[6], 16);
702 task
.id
= Proxmox
.Utils
.systemd_unescape(res
[8]);
705 task
.desc
= Proxmox
.Utils
.format_task_description(task
.type
, task
.id
);
710 parse_task_status: function(status
) {
711 if (status
=== 'OK') {
715 if (status
=== 'unknown') {
719 let match
= status
.match(/^WARNINGS: (.*)$/);
727 render_duration: function(value
) {
728 if (value
=== undefined) {
731 return Proxmox
.Utils
.format_duration_human(value
);
734 render_timestamp: function(value
, metaData
, record
, rowIndex
, colIndex
, store
) {
735 let servertime
= new Date(value
* 1000);
736 return Ext
.Date
.format(servertime
, 'Y-m-d H:i:s');
739 render_zfs_health: function(value
) {
740 if (typeof value
=== 'undefined') {
743 var iconCls
= 'question-circle';
747 iconCls
= 'check-circle good';
751 iconCls
= 'exclamation-circle warning';
756 iconCls
= 'times-circle critical';
761 return '<i class="fa fa-' + iconCls
+ '"></i> ' + value
;
764 get_help_info: function(section
) {
766 if (typeof proxmoxOnlineHelpInfo
!== 'undefined') {
767 helpMap
= proxmoxOnlineHelpInfo
; // eslint-disable-line no-undef
768 } else if (typeof pveOnlineHelpInfo
!== 'undefined') {
769 // be backward compatible with older pve-doc-generators
770 helpMap
= pveOnlineHelpInfo
; // eslint-disable-line no-undef
772 throw "no global OnlineHelpInfo map declared";
775 if (helpMap
[section
]) {
776 return helpMap
[section
];
778 // try to normalize - and _ separators, to support asciidoc and sphinx
779 // references at the same time.
780 let section_minus_normalized
= section
.replace(/_
/g
, '-');
781 if (helpMap
[section_minus_normalized
]) {
782 return helpMap
[section_minus_normalized
];
784 let section_underscore_normalized
= section
.replace(/-/g
, '_');
785 return helpMap
[section_underscore_normalized
];
788 get_help_link: function(section
) {
789 let info
= Proxmox
.Utils
.get_help_info(section
);
793 return window
.location
.origin
+ info
.link
;
796 openXtermJsViewer: function(vmtype
, vmid
, nodename
, vmname
, cmd
) {
797 let url
= Ext
.Object
.toQueryString({
798 console
: vmtype
, // kvm, lxc, upgrade or shell
806 let nw
= window
.open("?" + url
, '_blank', 'toolbar=no,location=no,status=no,menubar=no,resizable=yes,width=800,height=420');
815 constructor: function() {
817 Ext
.apply(me
, me
.utilities
);
819 let IPV4_OCTET
= "(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9])";
820 let IPV4_REGEXP
= "(?:(?:" + IPV4_OCTET
+ "\\.){3}" + IPV4_OCTET
+ ")";
821 let IPV6_H16
= "(?:[0-9a-fA-F]{1,4})";
822 let IPV6_LS32
= "(?:(?:" + IPV6_H16
+ ":" + IPV6_H16
+ ")|" + IPV4_REGEXP
+ ")";
823 let IPV4_CIDR_MASK
= "([0-9]{1,2})";
824 let IPV6_CIDR_MASK
= "([0-9]{1,3})";
827 me
.IP4_match
= new RegExp("^(?:" + IPV4_REGEXP
+ ")$");
828 me
.IP4_cidr_match
= new RegExp("^(?:" + IPV4_REGEXP
+ ")/" + IPV4_CIDR_MASK
+ "$");
830 /* eslint-disable no-useless-concat,no-multi-spaces */
831 let IPV6_REGEXP
= "(?:" +
832 "(?:(?:" + "(?:" + IPV6_H16
+ ":){6})" + IPV6_LS32
+ ")|" +
833 "(?:(?:" + "::" + "(?:" + IPV6_H16
+ ":){5})" + IPV6_LS32
+ ")|" +
834 "(?:(?:(?:" + IPV6_H16
+ ")?::" + "(?:" + IPV6_H16
+ ":){4})" + IPV6_LS32
+ ")|" +
835 "(?:(?:(?:(?:" + IPV6_H16
+ ":){0,1}" + IPV6_H16
+ ")?::" + "(?:" + IPV6_H16
+ ":){3})" + IPV6_LS32
+ ")|" +
836 "(?:(?:(?:(?:" + IPV6_H16
+ ":){0,2}" + IPV6_H16
+ ")?::" + "(?:" + IPV6_H16
+ ":){2})" + IPV6_LS32
+ ")|" +
837 "(?:(?:(?:(?:" + IPV6_H16
+ ":){0,3}" + IPV6_H16
+ ")?::" + "(?:" + IPV6_H16
+ ":){1})" + IPV6_LS32
+ ")|" +
838 "(?:(?:(?:(?:" + IPV6_H16
+ ":){0,4}" + IPV6_H16
+ ")?::" + ")" + IPV6_LS32
+ ")|" +
839 "(?:(?:(?:(?:" + IPV6_H16
+ ":){0,5}" + IPV6_H16
+ ")?::" + ")" + IPV6_H16
+ ")|" +
840 "(?:(?:(?:(?:" + IPV6_H16
+ ":){0,7}" + IPV6_H16
+ ")?::" + ")" + ")" +
842 /* eslint-enable no-useless-concat,no-multi-spaces */
844 me
.IP6_match
= new RegExp("^(?:" + IPV6_REGEXP
+ ")$");
845 me
.IP6_cidr_match
= new RegExp("^(?:" + IPV6_REGEXP
+ ")/" + IPV6_CIDR_MASK
+ "$");
846 me
.IP6_bracket_match
= new RegExp("^\\[(" + IPV6_REGEXP
+ ")\\]");
848 me
.IP64_match
= new RegExp("^(?:" + IPV6_REGEXP
+ "|" + IPV4_REGEXP
+ ")$");
849 me
.IP64_cidr_match
= new RegExp("^(?:" + IPV6_REGEXP
+ "/" + IPV6_CIDR_MASK
+ ")|(?:" + IPV4_REGEXP
+ "/" + IPV4_CIDR_MASK
+ ")$");
851 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])?))";
852 me
.DnsName_match
= new RegExp("^" + DnsName_REGEXP
+ "$");
854 me
.HostPort_match
= new RegExp("^(" + IPV4_REGEXP
+ "|" + DnsName_REGEXP
+ ")(?::(\\d+))?$");
855 me
.HostPortBrackets_match
= new RegExp("^\\[(" + IPV6_REGEXP
+ "|" + IPV4_REGEXP
+ "|" + DnsName_REGEXP
+ ")\\](?::(\\d+))?$");
856 me
.IP6_dotnotation_match
= new RegExp("^(" + IPV6_REGEXP
+ ")(?:\\.(\\d+))?$");
857 me
.Vlan_match
= /^vlan(\d+)/;
858 me
.VlanInterface_match
= /(\w+)\.(\d+)/;