iproutejs 2.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +22 -0
- package/README.md +245 -0
- package/lib/commands/address/add.interfaces.d.ts +94 -0
- package/lib/commands/address/add.interfaces.js +3 -0
- package/lib/commands/address/add.interfaces.js.map +1 -0
- package/lib/commands/address/add.schema.d.ts +3 -0
- package/lib/commands/address/add.schema.js +121 -0
- package/lib/commands/address/add.schema.js.map +1 -0
- package/lib/commands/address/delete.interfaces.d.ts +56 -0
- package/lib/commands/address/delete.interfaces.js +3 -0
- package/lib/commands/address/delete.interfaces.js.map +1 -0
- package/lib/commands/address/delete.schema.d.ts +3 -0
- package/lib/commands/address/delete.schema.js +64 -0
- package/lib/commands/address/delete.schema.js.map +1 -0
- package/lib/commands/address/flush.interfaces.d.ts +89 -0
- package/lib/commands/address/flush.interfaces.js +3 -0
- package/lib/commands/address/flush.interfaces.js.map +1 -0
- package/lib/commands/address/flush.schema.d.ts +3 -0
- package/lib/commands/address/flush.schema.js +165 -0
- package/lib/commands/address/flush.schema.js.map +1 -0
- package/lib/commands/address/show.interfaces.d.ts +166 -0
- package/lib/commands/address/show.interfaces.js +3 -0
- package/lib/commands/address/show.interfaces.js.map +1 -0
- package/lib/commands/address/show.schema.d.ts +3 -0
- package/lib/commands/address/show.schema.js +176 -0
- package/lib/commands/address/show.schema.js.map +1 -0
- package/lib/commands/address.constants.d.ts +33 -0
- package/lib/commands/address.constants.js +39 -0
- package/lib/commands/address.constants.js.map +1 -0
- package/lib/commands/address.d.ts +179 -0
- package/lib/commands/address.js +265 -0
- package/lib/commands/address.js.map +1 -0
- package/lib/commands/addrlabel/add.interfaces.d.ts +12 -0
- package/lib/commands/addrlabel/add.interfaces.js +3 -0
- package/lib/commands/addrlabel/add.interfaces.js.map +1 -0
- package/lib/commands/addrlabel/add.schema.d.ts +3 -0
- package/lib/commands/addrlabel/add.schema.js +26 -0
- package/lib/commands/addrlabel/add.schema.js.map +1 -0
- package/lib/commands/addrlabel/del.interfaces.d.ts +6 -0
- package/lib/commands/addrlabel/del.interfaces.js +3 -0
- package/lib/commands/addrlabel/del.interfaces.js.map +1 -0
- package/lib/commands/addrlabel/del.schema.d.ts +3 -0
- package/lib/commands/addrlabel/del.schema.js +27 -0
- package/lib/commands/addrlabel/del.schema.js.map +1 -0
- package/lib/commands/addrlabel/list.interfaces.d.ts +9 -0
- package/lib/commands/addrlabel/list.interfaces.js +3 -0
- package/lib/commands/addrlabel/list.interfaces.js.map +1 -0
- package/lib/commands/addrlabel.d.ts +104 -0
- package/lib/commands/addrlabel.js +149 -0
- package/lib/commands/addrlabel.js.map +1 -0
- package/lib/commands/batch.d.ts +60 -0
- package/lib/commands/batch.js +90 -0
- package/lib/commands/batch.js.map +1 -0
- package/lib/commands/link/add.interfaces.d.ts +122 -0
- package/lib/commands/link/add.interfaces.js +4 -0
- package/lib/commands/link/add.interfaces.js.map +1 -0
- package/lib/commands/link/add.schema.d.ts +4 -0
- package/lib/commands/link/add.schema.js +172 -0
- package/lib/commands/link/add.schema.js.map +1 -0
- package/lib/commands/link/delete.interfaces.d.ts +22 -0
- package/lib/commands/link/delete.interfaces.js +3 -0
- package/lib/commands/link/delete.interfaces.js.map +1 -0
- package/lib/commands/link/delete.schema.d.ts +3 -0
- package/lib/commands/link/delete.schema.js +29 -0
- package/lib/commands/link/delete.schema.js.map +1 -0
- package/lib/commands/link/extended-virtual-link-types/bond-slave.interfaces.d.ts +8 -0
- package/lib/commands/link/extended-virtual-link-types/bond-slave.interfaces.js +3 -0
- package/lib/commands/link/extended-virtual-link-types/bond-slave.interfaces.js.map +1 -0
- package/lib/commands/link/extended-virtual-link-types/bond-slave.schema.d.ts +3 -0
- package/lib/commands/link/extended-virtual-link-types/bond-slave.schema.js +16 -0
- package/lib/commands/link/extended-virtual-link-types/bond-slave.schema.js.map +1 -0
- package/lib/commands/link/extended-virtual-link-types/bridge-slave.interfaces.d.ts +77 -0
- package/lib/commands/link/extended-virtual-link-types/bridge-slave.interfaces.js +3 -0
- package/lib/commands/link/extended-virtual-link-types/bridge-slave.interfaces.js.map +1 -0
- package/lib/commands/link/extended-virtual-link-types/bridge-slave.schema.d.ts +3 -0
- package/lib/commands/link/extended-virtual-link-types/bridge-slave.schema.js +126 -0
- package/lib/commands/link/extended-virtual-link-types/bridge-slave.schema.js.map +1 -0
- package/lib/commands/link/set.interfaces.d.ts +271 -0
- package/lib/commands/link/set.interfaces.js +4 -0
- package/lib/commands/link/set.interfaces.js.map +1 -0
- package/lib/commands/link/set.schema.d.ts +5 -0
- package/lib/commands/link/set.schema.js +284 -0
- package/lib/commands/link/set.schema.js.map +1 -0
- package/lib/commands/link/show.interfaces.d.ts +116 -0
- package/lib/commands/link/show.interfaces.js +3 -0
- package/lib/commands/link/show.interfaces.js.map +1 -0
- package/lib/commands/link/show.schema.d.ts +3 -0
- package/lib/commands/link/show.schema.js +43 -0
- package/lib/commands/link/show.schema.js.map +1 -0
- package/lib/commands/link/virtual-link-types/bareup.interfaces.d.ts +30 -0
- package/lib/commands/link/virtual-link-types/bareup.interfaces.js +3 -0
- package/lib/commands/link/virtual-link-types/bareup.interfaces.js.map +1 -0
- package/lib/commands/link/virtual-link-types/bareup.schema.d.ts +3 -0
- package/lib/commands/link/virtual-link-types/bareup.schema.js +43 -0
- package/lib/commands/link/virtual-link-types/bareup.schema.js.map +1 -0
- package/lib/commands/link/virtual-link-types/bridge.interfaces.d.ts +140 -0
- package/lib/commands/link/virtual-link-types/bridge.interfaces.js +3 -0
- package/lib/commands/link/virtual-link-types/bridge.interfaces.js.map +1 -0
- package/lib/commands/link/virtual-link-types/bridge.schema.d.ts +3 -0
- package/lib/commands/link/virtual-link-types/bridge.schema.js +186 -0
- package/lib/commands/link/virtual-link-types/bridge.schema.js.map +1 -0
- package/lib/commands/link/virtual-link-types/can.interfaces.d.ts +71 -0
- package/lib/commands/link/virtual-link-types/can.interfaces.js +3 -0
- package/lib/commands/link/virtual-link-types/can.interfaces.js.map +1 -0
- package/lib/commands/link/virtual-link-types/can.schema.d.ts +3 -0
- package/lib/commands/link/virtual-link-types/can.schema.js +141 -0
- package/lib/commands/link/virtual-link-types/can.schema.js.map +1 -0
- package/lib/commands/link/virtual-link-types/erspan-ip6erspan.interfaces.d.ts +58 -0
- package/lib/commands/link/virtual-link-types/erspan-ip6erspan.interfaces.js +3 -0
- package/lib/commands/link/virtual-link-types/erspan-ip6erspan.interfaces.js.map +1 -0
- package/lib/commands/link/virtual-link-types/erspan-ip6erspan.schema.d.ts +3 -0
- package/lib/commands/link/virtual-link-types/erspan-ip6erspan.schema.js +64 -0
- package/lib/commands/link/virtual-link-types/erspan-ip6erspan.schema.js.map +1 -0
- package/lib/commands/link/virtual-link-types/geneve.interfaces.d.ts +54 -0
- package/lib/commands/link/virtual-link-types/geneve.interfaces.js +3 -0
- package/lib/commands/link/virtual-link-types/geneve.interfaces.js.map +1 -0
- package/lib/commands/link/virtual-link-types/geneve.schema.d.ts +3 -0
- package/lib/commands/link/virtual-link-types/geneve.schema.js +93 -0
- package/lib/commands/link/virtual-link-types/geneve.schema.js.map +1 -0
- package/lib/commands/link/virtual-link-types/gre-gretap.interfaces.d.ts +106 -0
- package/lib/commands/link/virtual-link-types/gre-gretap.interfaces.js +3 -0
- package/lib/commands/link/virtual-link-types/gre-gretap.interfaces.js.map +1 -0
- package/lib/commands/link/virtual-link-types/gre-gretap.schema.d.ts +3 -0
- package/lib/commands/link/virtual-link-types/gre-gretap.schema.js +208 -0
- package/lib/commands/link/virtual-link-types/gre-gretap.schema.js.map +1 -0
- package/lib/commands/link/virtual-link-types/hsr.interfaces.d.ts +20 -0
- package/lib/commands/link/virtual-link-types/hsr.interfaces.js +3 -0
- package/lib/commands/link/virtual-link-types/hsr.interfaces.js.map +1 -0
- package/lib/commands/link/virtual-link-types/hsr.schema.d.ts +3 -0
- package/lib/commands/link/virtual-link-types/hsr.schema.js +36 -0
- package/lib/commands/link/virtual-link-types/hsr.schema.js.map +1 -0
- package/lib/commands/link/virtual-link-types/ip6gre-ip6gretap.interfaces.d.ts +80 -0
- package/lib/commands/link/virtual-link-types/ip6gre-ip6gretap.interfaces.js +3 -0
- package/lib/commands/link/virtual-link-types/ip6gre-ip6gretap.interfaces.js.map +1 -0
- package/lib/commands/link/virtual-link-types/ip6gre-ip6gretap.schema.d.ts +3 -0
- package/lib/commands/link/virtual-link-types/ip6gre-ip6gretap.schema.js +170 -0
- package/lib/commands/link/virtual-link-types/ip6gre-ip6gretap.schema.js.map +1 -0
- package/lib/commands/link/virtual-link-types/ipip-sit.interfaces.d.ts +51 -0
- package/lib/commands/link/virtual-link-types/ipip-sit.interfaces.js +3 -0
- package/lib/commands/link/virtual-link-types/ipip-sit.interfaces.js.map +1 -0
- package/lib/commands/link/virtual-link-types/ipip-sit.schema.d.ts +3 -0
- package/lib/commands/link/virtual-link-types/ipip-sit.schema.js +74 -0
- package/lib/commands/link/virtual-link-types/ipip-sit.schema.js.map +1 -0
- package/lib/commands/link/virtual-link-types/ipoib.interfaces.d.ts +11 -0
- package/lib/commands/link/virtual-link-types/ipoib.interfaces.js +3 -0
- package/lib/commands/link/virtual-link-types/ipoib.interfaces.js.map +1 -0
- package/lib/commands/link/virtual-link-types/ipoib.schema.d.ts +3 -0
- package/lib/commands/link/virtual-link-types/ipoib.schema.js +22 -0
- package/lib/commands/link/virtual-link-types/ipoib.schema.js.map +1 -0
- package/lib/commands/link/virtual-link-types/macsec.interfaces.d.ts +44 -0
- package/lib/commands/link/virtual-link-types/macsec.interfaces.js +3 -0
- package/lib/commands/link/virtual-link-types/macsec.interfaces.js.map +1 -0
- package/lib/commands/link/virtual-link-types/macsec.schema.d.ts +3 -0
- package/lib/commands/link/virtual-link-types/macsec.schema.js +87 -0
- package/lib/commands/link/virtual-link-types/macsec.schema.js.map +1 -0
- package/lib/commands/link/virtual-link-types/macvlan-macvtap.interfaces.d.ts +59 -0
- package/lib/commands/link/virtual-link-types/macvlan-macvtap.interfaces.js +3 -0
- package/lib/commands/link/virtual-link-types/macvlan-macvtap.interfaces.js.map +1 -0
- package/lib/commands/link/virtual-link-types/macvlan-macvtap.schema.d.ts +4 -0
- package/lib/commands/link/virtual-link-types/macvlan-macvtap.schema.js +60 -0
- package/lib/commands/link/virtual-link-types/macvlan-macvtap.schema.js.map +1 -0
- package/lib/commands/link/virtual-link-types/rmnet.interfaces.d.ts +8 -0
- package/lib/commands/link/virtual-link-types/rmnet.interfaces.js +3 -0
- package/lib/commands/link/virtual-link-types/rmnet.interfaces.js.map +1 -0
- package/lib/commands/link/virtual-link-types/rmnet.schema.d.ts +3 -0
- package/lib/commands/link/virtual-link-types/rmnet.schema.js +16 -0
- package/lib/commands/link/virtual-link-types/rmnet.schema.js.map +1 -0
- package/lib/commands/link/virtual-link-types/veth-vxcan.interfaces.d.ts +8 -0
- package/lib/commands/link/virtual-link-types/veth-vxcan.interfaces.js +3 -0
- package/lib/commands/link/virtual-link-types/veth-vxcan.interfaces.js.map +1 -0
- package/lib/commands/link/virtual-link-types/veth-vxcan.schema.d.ts +3 -0
- package/lib/commands/link/virtual-link-types/veth-vxcan.schema.js +16 -0
- package/lib/commands/link/virtual-link-types/veth-vxcan.schema.js.map +1 -0
- package/lib/commands/link/virtual-link-types/vlan.interfaces.d.ts +36 -0
- package/lib/commands/link/virtual-link-types/vlan.interfaces.js +3 -0
- package/lib/commands/link/virtual-link-types/vlan.interfaces.js.map +1 -0
- package/lib/commands/link/virtual-link-types/vlan.schema.d.ts +3 -0
- package/lib/commands/link/virtual-link-types/vlan.schema.js +65 -0
- package/lib/commands/link/virtual-link-types/vlan.schema.js.map +1 -0
- package/lib/commands/link/virtual-link-types/vrf.interfaces.d.ts +8 -0
- package/lib/commands/link/virtual-link-types/vrf.interfaces.js +3 -0
- package/lib/commands/link/virtual-link-types/vrf.interfaces.js.map +1 -0
- package/lib/commands/link/virtual-link-types/vrf.schema.d.ts +3 -0
- package/lib/commands/link/virtual-link-types/vrf.schema.js +16 -0
- package/lib/commands/link/virtual-link-types/vrf.schema.js.map +1 -0
- package/lib/commands/link/virtual-link-types/vxlan.interfaces.d.ts +127 -0
- package/lib/commands/link/virtual-link-types/vxlan.interfaces.js +3 -0
- package/lib/commands/link/virtual-link-types/vxlan.interfaces.js.map +1 -0
- package/lib/commands/link/virtual-link-types/vxlan.schema.d.ts +3 -0
- package/lib/commands/link/virtual-link-types/vxlan.schema.js +176 -0
- package/lib/commands/link/virtual-link-types/vxlan.schema.js.map +1 -0
- package/lib/commands/link/virtual-link-types/xfrm.interfaces.d.ts +16 -0
- package/lib/commands/link/virtual-link-types/xfrm.interfaces.js +3 -0
- package/lib/commands/link/virtual-link-types/xfrm.interfaces.js.map +1 -0
- package/lib/commands/link/virtual-link-types/xfrm.schema.d.ts +3 -0
- package/lib/commands/link/virtual-link-types/xfrm.schema.js +21 -0
- package/lib/commands/link/virtual-link-types/xfrm.schema.js.map +1 -0
- package/lib/commands/link/xdp-options/object.interfaces.d.ts +36 -0
- package/lib/commands/link/xdp-options/object.interfaces.js +3 -0
- package/lib/commands/link/xdp-options/object.interfaces.js.map +1 -0
- package/lib/commands/link/xdp-options/object.schema.d.ts +3 -0
- package/lib/commands/link/xdp-options/object.schema.js +25 -0
- package/lib/commands/link/xdp-options/object.schema.js.map +1 -0
- package/lib/commands/link/xdp-options/off.interfaces.d.ts +8 -0
- package/lib/commands/link/xdp-options/off.interfaces.js +3 -0
- package/lib/commands/link/xdp-options/off.interfaces.js.map +1 -0
- package/lib/commands/link/xdp-options/off.schema.d.ts +3 -0
- package/lib/commands/link/xdp-options/off.schema.js +15 -0
- package/lib/commands/link/xdp-options/off.schema.js.map +1 -0
- package/lib/commands/link/xdp-options/pinned.interfaces.d.ts +13 -0
- package/lib/commands/link/xdp-options/pinned.interfaces.js +3 -0
- package/lib/commands/link/xdp-options/pinned.interfaces.js.map +1 -0
- package/lib/commands/link/xdp-options/pinned.schema.d.ts +3 -0
- package/lib/commands/link/xdp-options/pinned.schema.js +15 -0
- package/lib/commands/link/xdp-options/pinned.schema.js.map +1 -0
- package/lib/commands/link.constants.d.ts +425 -0
- package/lib/commands/link.constants.js +366 -0
- package/lib/commands/link.constants.js.map +1 -0
- package/lib/commands/link.d.ts +113 -0
- package/lib/commands/link.js +159 -0
- package/lib/commands/link.js.map +1 -0
- package/lib/commands/maddress/add.interfaces.d.ts +10 -0
- package/lib/commands/maddress/add.interfaces.js +3 -0
- package/lib/commands/maddress/add.interfaces.js.map +1 -0
- package/lib/commands/maddress/add.schema.d.ts +3 -0
- package/lib/commands/maddress/add.schema.js +22 -0
- package/lib/commands/maddress/add.schema.js.map +1 -0
- package/lib/commands/maddress/show.interfaces.d.ts +25 -0
- package/lib/commands/maddress/show.interfaces.js +3 -0
- package/lib/commands/maddress/show.interfaces.js.map +1 -0
- package/lib/commands/maddress/show.schema.d.ts +3 -0
- package/lib/commands/maddress/show.schema.js +17 -0
- package/lib/commands/maddress/show.schema.js.map +1 -0
- package/lib/commands/maddress.d.ts +82 -0
- package/lib/commands/maddress.js +121 -0
- package/lib/commands/maddress.js.map +1 -0
- package/lib/commands/monitor/monitor.interfaces.d.ts +24 -0
- package/lib/commands/monitor/monitor.interfaces.js +3 -0
- package/lib/commands/monitor/monitor.interfaces.js.map +1 -0
- package/lib/commands/monitor/monitor.schema.d.ts +3 -0
- package/lib/commands/monitor/monitor.schema.js +33 -0
- package/lib/commands/monitor/monitor.schema.js.map +1 -0
- package/lib/commands/monitor.constants.d.ts +17 -0
- package/lib/commands/monitor.constants.js +22 -0
- package/lib/commands/monitor.constants.js.map +1 -0
- package/lib/commands/monitor.d.ts +52 -0
- package/lib/commands/monitor.js +75 -0
- package/lib/commands/monitor.js.map +1 -0
- package/lib/commands/mroute/show.interfaces.d.ts +26 -0
- package/lib/commands/mroute/show.interfaces.js +3 -0
- package/lib/commands/mroute/show.interfaces.js.map +1 -0
- package/lib/commands/mroute/show.schema.d.ts +3 -0
- package/lib/commands/mroute/show.schema.js +44 -0
- package/lib/commands/mroute/show.schema.js.map +1 -0
- package/lib/commands/mroute.d.ts +29 -0
- package/lib/commands/mroute.js +53 -0
- package/lib/commands/mroute.js.map +1 -0
- package/lib/commands/neighbour/add.interfaces.d.ts +34 -0
- package/lib/commands/neighbour/add.interfaces.js +3 -0
- package/lib/commands/neighbour/add.interfaces.js.map +1 -0
- package/lib/commands/neighbour/add.schema.d.ts +3 -0
- package/lib/commands/neighbour/add.schema.js +49 -0
- package/lib/commands/neighbour/add.schema.js.map +1 -0
- package/lib/commands/neighbour/del.interfaces.d.ts +23 -0
- package/lib/commands/neighbour/del.interfaces.js +3 -0
- package/lib/commands/neighbour/del.interfaces.js.map +1 -0
- package/lib/commands/neighbour/del.schema.d.ts +3 -0
- package/lib/commands/neighbour/del.schema.js +37 -0
- package/lib/commands/neighbour/del.schema.js.map +1 -0
- package/lib/commands/neighbour/get.interfaces.d.ts +12 -0
- package/lib/commands/neighbour/get.interfaces.js +3 -0
- package/lib/commands/neighbour/get.interfaces.js.map +1 -0
- package/lib/commands/neighbour/get.schema.d.ts +3 -0
- package/lib/commands/neighbour/get.schema.js +26 -0
- package/lib/commands/neighbour/get.schema.js.map +1 -0
- package/lib/commands/neighbour/show.interfaces.d.ts +37 -0
- package/lib/commands/neighbour/show.interfaces.js +3 -0
- package/lib/commands/neighbour/show.interfaces.js.map +1 -0
- package/lib/commands/neighbour/show.schema.d.ts +3 -0
- package/lib/commands/neighbour/show.schema.js +39 -0
- package/lib/commands/neighbour/show.schema.js.map +1 -0
- package/lib/commands/neighbour.constants.d.ts +34 -0
- package/lib/commands/neighbour.constants.js +39 -0
- package/lib/commands/neighbour.constants.js.map +1 -0
- package/lib/commands/neighbour.d.ts +169 -0
- package/lib/commands/neighbour.js +238 -0
- package/lib/commands/neighbour.js.map +1 -0
- package/lib/commands/ntable/change.interfaces.d.ts +42 -0
- package/lib/commands/ntable/change.interfaces.js +3 -0
- package/lib/commands/ntable/change.interfaces.js.map +1 -0
- package/lib/commands/ntable/change.schema.d.ts +3 -0
- package/lib/commands/ntable/change.schema.js +101 -0
- package/lib/commands/ntable/change.schema.js.map +1 -0
- package/lib/commands/ntable/show.interfaces.d.ts +59 -0
- package/lib/commands/ntable/show.interfaces.js +3 -0
- package/lib/commands/ntable/show.interfaces.js.map +1 -0
- package/lib/commands/ntable/show.schema.d.ts +3 -0
- package/lib/commands/ntable/show.schema.js +22 -0
- package/lib/commands/ntable/show.schema.js.map +1 -0
- package/lib/commands/ntable.d.ts +43 -0
- package/lib/commands/ntable.js +75 -0
- package/lib/commands/ntable.js.map +1 -0
- package/lib/commands/route/add.interfaces.d.ts +261 -0
- package/lib/commands/route/add.interfaces.js +4 -0
- package/lib/commands/route/add.interfaces.js.map +1 -0
- package/lib/commands/route/add.schema.d.ts +3 -0
- package/lib/commands/route/add.schema.js +366 -0
- package/lib/commands/route/add.schema.js.map +1 -0
- package/lib/commands/route/encap-types/bpf.interfaces.d.ts +14 -0
- package/lib/commands/route/encap-types/bpf.interfaces.js +3 -0
- package/lib/commands/route/encap-types/bpf.interfaces.js.map +1 -0
- package/lib/commands/route/encap-types/bpf.schema.d.ts +3 -0
- package/lib/commands/route/encap-types/bpf.schema.js +31 -0
- package/lib/commands/route/encap-types/bpf.schema.js.map +1 -0
- package/lib/commands/route/encap-types/ioam6.interfaces.d.ts +19 -0
- package/lib/commands/route/encap-types/ioam6.interfaces.js +3 -0
- package/lib/commands/route/encap-types/ioam6.interfaces.js.map +1 -0
- package/lib/commands/route/encap-types/ioam6.schema.d.ts +3 -0
- package/lib/commands/route/encap-types/ioam6.schema.js +30 -0
- package/lib/commands/route/encap-types/ioam6.schema.js.map +1 -0
- package/lib/commands/route/encap-types/ip.interfaces.d.ts +17 -0
- package/lib/commands/route/encap-types/ip.interfaces.js +3 -0
- package/lib/commands/route/encap-types/ip.interfaces.js.map +1 -0
- package/lib/commands/route/encap-types/ip.schema.d.ts +3 -0
- package/lib/commands/route/encap-types/ip.schema.js +48 -0
- package/lib/commands/route/encap-types/ip.schema.js.map +1 -0
- package/lib/commands/route/encap-types/mpls.interfaces.d.ts +11 -0
- package/lib/commands/route/encap-types/mpls.interfaces.js +3 -0
- package/lib/commands/route/encap-types/mpls.interfaces.js.map +1 -0
- package/lib/commands/route/encap-types/mpls.schema.d.ts +3 -0
- package/lib/commands/route/encap-types/mpls.schema.js +46 -0
- package/lib/commands/route/encap-types/mpls.schema.js.map +1 -0
- package/lib/commands/route/encap-types/seg6.interfaces.d.ts +20 -0
- package/lib/commands/route/encap-types/seg6.interfaces.js +3 -0
- package/lib/commands/route/encap-types/seg6.interfaces.js.map +1 -0
- package/lib/commands/route/encap-types/seg6.schema.d.ts +3 -0
- package/lib/commands/route/encap-types/seg6.schema.js +38 -0
- package/lib/commands/route/encap-types/seg6.schema.js.map +1 -0
- package/lib/commands/route/encap-types/seg6local.interfaces.d.ts +76 -0
- package/lib/commands/route/encap-types/seg6local.interfaces.js +3 -0
- package/lib/commands/route/encap-types/seg6local.interfaces.js.map +1 -0
- package/lib/commands/route/encap-types/seg6local.schema.d.ts +6 -0
- package/lib/commands/route/encap-types/seg6local.schema.js +181 -0
- package/lib/commands/route/encap-types/seg6local.schema.js.map +1 -0
- package/lib/commands/route/get.interfaces.d.ts +37 -0
- package/lib/commands/route/get.interfaces.js +3 -0
- package/lib/commands/route/get.interfaces.js.map +1 -0
- package/lib/commands/route/get.schema.d.ts +3 -0
- package/lib/commands/route/get.schema.js +86 -0
- package/lib/commands/route/get.schema.js.map +1 -0
- package/lib/commands/route/show.constants.d.ts +105 -0
- package/lib/commands/route/show.constants.js +112 -0
- package/lib/commands/route/show.constants.js.map +1 -0
- package/lib/commands/route/show.interfaces.d.ts +96 -0
- package/lib/commands/route/show.interfaces.js +3 -0
- package/lib/commands/route/show.interfaces.js.map +1 -0
- package/lib/commands/route/show.schema.d.ts +3 -0
- package/lib/commands/route/show.schema.js +161 -0
- package/lib/commands/route/show.schema.js.map +1 -0
- package/lib/commands/route.constants.d.ts +129 -0
- package/lib/commands/route.constants.js +136 -0
- package/lib/commands/route.constants.js.map +1 -0
- package/lib/commands/route.d.ts +268 -0
- package/lib/commands/route.js +362 -0
- package/lib/commands/route.js.map +1 -0
- package/lib/commands/rule/add.interfaces.d.ts +41 -0
- package/lib/commands/rule/add.interfaces.js +3 -0
- package/lib/commands/rule/add.interfaces.js.map +1 -0
- package/lib/commands/rule/add.schema.d.ts +3 -0
- package/lib/commands/rule/add.schema.js +182 -0
- package/lib/commands/rule/add.schema.js.map +1 -0
- package/lib/commands/rule/show.interfaces.d.ts +86 -0
- package/lib/commands/rule/show.interfaces.js +3 -0
- package/lib/commands/rule/show.interfaces.js.map +1 -0
- package/lib/commands/rule/show.schema.d.ts +3 -0
- package/lib/commands/rule/show.schema.js +157 -0
- package/lib/commands/rule/show.schema.js.map +1 -0
- package/lib/commands/rule.constants.d.ts +34 -0
- package/lib/commands/rule.constants.js +40 -0
- package/lib/commands/rule.constants.js.map +1 -0
- package/lib/commands/rule.d.ts +143 -0
- package/lib/commands/rule.js +205 -0
- package/lib/commands/rule.js.map +1 -0
- package/lib/commands/tunnel/6rd.interfaces.d.ts +17 -0
- package/lib/commands/tunnel/6rd.interfaces.js +3 -0
- package/lib/commands/tunnel/6rd.interfaces.js.map +1 -0
- package/lib/commands/tunnel/6rd.schema.d.ts +3 -0
- package/lib/commands/tunnel/6rd.schema.js +33 -0
- package/lib/commands/tunnel/6rd.schema.js.map +1 -0
- package/lib/commands/tunnel/add.interfaces.d.ts +124 -0
- package/lib/commands/tunnel/add.interfaces.js +3 -0
- package/lib/commands/tunnel/add.interfaces.js.map +1 -0
- package/lib/commands/tunnel/add.schema.d.ts +3 -0
- package/lib/commands/tunnel/add.schema.js +213 -0
- package/lib/commands/tunnel/add.schema.js.map +1 -0
- package/lib/commands/tunnel/prl.interfaces.d.ts +17 -0
- package/lib/commands/tunnel/prl.interfaces.js +3 -0
- package/lib/commands/tunnel/prl.interfaces.js.map +1 -0
- package/lib/commands/tunnel/prl.schema.d.ts +3 -0
- package/lib/commands/tunnel/prl.schema.js +34 -0
- package/lib/commands/tunnel/prl.schema.js.map +1 -0
- package/lib/commands/tunnel.constants.d.ts +23 -0
- package/lib/commands/tunnel.constants.js +24 -0
- package/lib/commands/tunnel.constants.js.map +1 -0
- package/lib/commands/tunnel.d.ts +151 -0
- package/lib/commands/tunnel.js +210 -0
- package/lib/commands/tunnel.js.map +1 -0
- package/lib/commands/tuntap/add.interfaces.d.ts +25 -0
- package/lib/commands/tuntap/add.interfaces.js +3 -0
- package/lib/commands/tuntap/add.interfaces.js.map +1 -0
- package/lib/commands/tuntap/add.schema.d.ts +3 -0
- package/lib/commands/tuntap/add.schema.js +77 -0
- package/lib/commands/tuntap/add.schema.js.map +1 -0
- package/lib/commands/tuntap/show.interfaces.d.ts +17 -0
- package/lib/commands/tuntap/show.interfaces.js +3 -0
- package/lib/commands/tuntap/show.interfaces.js.map +1 -0
- package/lib/commands/tuntap/show.schema.d.ts +3 -0
- package/lib/commands/tuntap/show.schema.js +80 -0
- package/lib/commands/tuntap/show.schema.js.map +1 -0
- package/lib/commands/tuntap.constants.d.ts +8 -0
- package/lib/commands/tuntap.constants.js +13 -0
- package/lib/commands/tuntap.constants.js.map +1 -0
- package/lib/commands/tuntap.d.ts +83 -0
- package/lib/commands/tuntap.js +121 -0
- package/lib/commands/tuntap.js.map +1 -0
- package/lib/common/classes/command-with-filepath.d.ts +16 -0
- package/lib/common/classes/command-with-filepath.js +53 -0
- package/lib/common/classes/command-with-filepath.js.map +1 -0
- package/lib/common/classes/command-with-redirect-from-filepath-and-returned-data.d.ts +15 -0
- package/lib/common/classes/command-with-redirect-from-filepath-and-returned-data.js +45 -0
- package/lib/common/classes/command-with-redirect-from-filepath-and-returned-data.js.map +1 -0
- package/lib/common/classes/command-with-redirect-from-filepath.d.ts +16 -0
- package/lib/common/classes/command-with-redirect-from-filepath.js +53 -0
- package/lib/common/classes/command-with-redirect-from-filepath.js.map +1 -0
- package/lib/common/classes/command-with-redirect-to-filepath.d.ts +16 -0
- package/lib/common/classes/command-with-redirect-to-filepath.js +53 -0
- package/lib/common/classes/command-with-redirect-to-filepath.js.map +1 -0
- package/lib/common/classes/command-with-returned-data.d.ts +15 -0
- package/lib/common/classes/command-with-returned-data.js +45 -0
- package/lib/common/classes/command-with-returned-data.js.map +1 -0
- package/lib/common/classes/command-with-stdin.d.ts +16 -0
- package/lib/common/classes/command-with-stdin.js +53 -0
- package/lib/common/classes/command-with-stdin.js.map +1 -0
- package/lib/common/classes/command.d.ts +26 -0
- package/lib/common/classes/command.js +144 -0
- package/lib/common/classes/command.js.map +1 -0
- package/lib/common/classes/monitor-command.d.ts +30 -0
- package/lib/common/classes/monitor-command.js +108 -0
- package/lib/common/classes/monitor-command.js.map +1 -0
- package/lib/common/constants/attribute-values.d.ts +33 -0
- package/lib/common/constants/attribute-values.js +41 -0
- package/lib/common/constants/attribute-values.js.map +1 -0
- package/lib/common/constants/regexes.d.ts +34 -0
- package/lib/common/constants/regexes.js +38 -0
- package/lib/common/constants/regexes.js.map +1 -0
- package/lib/common/constants/schemas.d.ts +52 -0
- package/lib/common/constants/schemas.js +296 -0
- package/lib/common/constants/schemas.js.map +1 -0
- package/lib/common/constants/tests.d.ts +4 -0
- package/lib/common/constants/tests.js +9 -0
- package/lib/common/constants/tests.js.map +1 -0
- package/lib/common/errors/command.d.ts +11 -0
- package/lib/common/errors/command.js +20 -0
- package/lib/common/errors/command.js.map +1 -0
- package/lib/common/errors/parameters.d.ts +16 -0
- package/lib/common/errors/parameters.js +21 -0
- package/lib/common/errors/parameters.js.map +1 -0
- package/lib/common/interfaces/common.d.ts +115 -0
- package/lib/common/interfaces/common.js +3 -0
- package/lib/common/interfaces/common.js.map +1 -0
- package/lib/common/interfaces/monitor.d.ts +17 -0
- package/lib/common/interfaces/monitor.js +3 -0
- package/lib/common/interfaces/monitor.js.map +1 -0
- package/lib/common/interfaces/tests.d.ts +33 -0
- package/lib/common/interfaces/tests.js +3 -0
- package/lib/common/interfaces/tests.js.map +1 -0
- package/lib/common/misc.d.ts +4 -0
- package/lib/common/misc.js +18 -0
- package/lib/common/misc.js.map +1 -0
- package/lib/common/parse-output.d.ts +14 -0
- package/lib/common/parse-output.js +51 -0
- package/lib/common/parse-output.js.map +1 -0
- package/lib/common/validator.d.ts +3 -0
- package/lib/common/validator.js +45 -0
- package/lib/common/validator.js.map +1 -0
- package/lib/index.d.ts +400 -0
- package/lib/index.js +189 -0
- package/lib/index.js.map +1 -0
- package/lib/utils/index.d.ts +33 -0
- package/lib/utils/index.js +40 -0
- package/lib/utils/index.js.map +1 -0
- package/lib/utils/ip-forwarding.constants.d.ts +21 -0
- package/lib/utils/ip-forwarding.constants.js +27 -0
- package/lib/utils/ip-forwarding.constants.js.map +1 -0
- package/lib/utils/ip-forwarding.d.ts +103 -0
- package/lib/utils/ip-forwarding.js +149 -0
- package/lib/utils/ip-forwarding.js.map +1 -0
- package/lib/utils/routing-tables.constants.d.ts +7 -0
- package/lib/utils/routing-tables.constants.js +11 -0
- package/lib/utils/routing-tables.constants.js.map +1 -0
- package/lib/utils/routing-tables.d.ts +134 -0
- package/lib/utils/routing-tables.interfaces.d.ts +16 -0
- package/lib/utils/routing-tables.interfaces.js +3 -0
- package/lib/utils/routing-tables.interfaces.js.map +1 -0
- package/lib/utils/routing-tables.js +243 -0
- package/lib/utils/routing-tables.js.map +1 -0
- package/lib/utils/routing-tables.schemas.d.ts +3 -0
- package/lib/utils/routing-tables.schemas.js +22 -0
- package/lib/utils/routing-tables.schemas.js.map +1 -0
- package/package.json +92 -0
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
const util_1 = require("util");
|
|
16
|
+
const child_process_1 = require("child_process");
|
|
17
|
+
const command_1 = require("../errors/command");
|
|
18
|
+
const command_2 = __importDefault(require("./command"));
|
|
19
|
+
const parse_output_1 = require("../parse-output");
|
|
20
|
+
const promisifiedExec = (0, util_1.promisify)(child_process_1.exec);
|
|
21
|
+
class CommandWithReturnedData extends command_2.default {
|
|
22
|
+
constructor(schemaId, schema, options, globalOptions, ipCmd) {
|
|
23
|
+
super(schemaId, schema, options, globalOptions, ipCmd);
|
|
24
|
+
this.schemaId = schemaId;
|
|
25
|
+
this.schema = schema;
|
|
26
|
+
this.options = options;
|
|
27
|
+
this.globalOptions = globalOptions;
|
|
28
|
+
this.ipCmd = ipCmd;
|
|
29
|
+
}
|
|
30
|
+
exec() {
|
|
31
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
32
|
+
if (this.globalOptions.dryRun) {
|
|
33
|
+
return this;
|
|
34
|
+
}
|
|
35
|
+
const { stderr, stdout } = yield promisifiedExec(this._cmdToExec);
|
|
36
|
+
if (!stderr) {
|
|
37
|
+
return (0, parse_output_1.parseCommandOutput)(stdout);
|
|
38
|
+
}
|
|
39
|
+
const message = stderr.replace(/\n/g, '');
|
|
40
|
+
throw new command_1.CommandError(message, this._cmdToExec);
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
exports.default = CommandWithReturnedData;
|
|
45
|
+
//# sourceMappingURL=command-with-returned-data.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"command-with-returned-data.js","sourceRoot":"","sources":["../../../src/common/classes/command-with-returned-data.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AACA,+BAAsC;AACtC,iDAA+C;AAG/C,+CAAkD;AAElD,wDAA0C;AAC1C,kDAAqD;AAErD,MAAM,eAAe,GAAG,IAAA,gBAAS,EAAC,oBAAI,CAAC,CAAC;AAExC,MAAqB,uBAA4E,SAAQ,iBAAyB;IAChI,YAAsB,QAAmB,EACnB,MAAwC,EACxC,OAAyB,EACzB,aAA4B,EAC5B,KAAe;QAEnC,KAAK,CAAC,QAAQ,EACZ,MAAM,EACN,OAAO,EACP,aAAa,EACb,KAAK,CAAC,CAAC;QAVW,aAAQ,GAAR,QAAQ,CAAW;QACnB,WAAM,GAAN,MAAM,CAAkC;QACxC,YAAO,GAAP,OAAO,CAAkB;QACzB,kBAAa,GAAb,aAAa,CAAe;QAC5B,UAAK,GAAL,KAAK,CAAU;IAOrC,CAAC;IAEc,IAAI;;YACjB,IAAI,IAAI,CAAC,aAAa,CAAC,MAAM,EAAE;gBAC7B,OAAO,IAAI,CAAC;aACb;YAED,MAAM,EACE,MAAM,EACN,MAAM,EACP,GAAG,MAAM,eAAe,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;YAEjD,IAAI,CAAC,MAAM,EAAE;gBACX,OAAO,IAAA,iCAAkB,EAAe,MAAM,CAAC,CAAC;aACjD;YAED,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;YAC1C,MAAM,IAAI,sBAAY,CAAC,OAAO,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;QACnD,CAAC;KAAA;CACF;AA/BD,0CA+BC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { JSONSchemaType } from 'ajv';
|
|
2
|
+
import { SchemaIds } from '../constants/schemas';
|
|
3
|
+
import { GlobalOptionsWithRequiredStdin } from '../interfaces/common';
|
|
4
|
+
import Command from './command';
|
|
5
|
+
export default class CommandWithStdin<T_CommandOptions extends {
|
|
6
|
+
[index: string]: any;
|
|
7
|
+
}> extends Command<T_CommandOptions> {
|
|
8
|
+
protected schemaId: SchemaIds;
|
|
9
|
+
protected schema: JSONSchemaType<T_CommandOptions>;
|
|
10
|
+
protected options: T_CommandOptions;
|
|
11
|
+
protected globalOptions: GlobalOptionsWithRequiredStdin;
|
|
12
|
+
protected ipCmd: string[];
|
|
13
|
+
constructor(schemaId: SchemaIds, schema: JSONSchemaType<T_CommandOptions>, options: T_CommandOptions, globalOptions: GlobalOptionsWithRequiredStdin, ipCmd: string[]);
|
|
14
|
+
protected buildCmd(): void;
|
|
15
|
+
exec(): Promise<this>;
|
|
16
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
const util_1 = require("util");
|
|
16
|
+
const child_process_1 = require("child_process");
|
|
17
|
+
const schemas_1 = require("../constants/schemas");
|
|
18
|
+
const command_1 = require("../errors/command");
|
|
19
|
+
const command_2 = __importDefault(require("./command"));
|
|
20
|
+
const misc_1 = require("../misc");
|
|
21
|
+
const promisifiedExec = (0, util_1.promisify)(child_process_1.exec);
|
|
22
|
+
class CommandWithStdin extends command_2.default {
|
|
23
|
+
constructor(schemaId, schema, options, globalOptions, ipCmd) {
|
|
24
|
+
super(schemaId, schema, options, globalOptions, ipCmd);
|
|
25
|
+
this.schemaId = schemaId;
|
|
26
|
+
this.schema = schema;
|
|
27
|
+
this.options = options;
|
|
28
|
+
this.globalOptions = globalOptions;
|
|
29
|
+
this.ipCmd = ipCmd;
|
|
30
|
+
(0, misc_1.validate)(schemas_1.SchemaIds.StdinGlobalOption, schemas_1.StdinGlobalOptionSchema, globalOptions);
|
|
31
|
+
this.buildCmd();
|
|
32
|
+
}
|
|
33
|
+
buildCmd() {
|
|
34
|
+
super.buildCmd();
|
|
35
|
+
this._cmd = this.cmd.concat('- <<EOF\n', ...[`${this.globalOptions.stdin}`], '\nEOF');
|
|
36
|
+
this._cmdToExec = this.cmd.join(' ');
|
|
37
|
+
}
|
|
38
|
+
exec() {
|
|
39
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
40
|
+
if (this.globalOptions.dryRun) {
|
|
41
|
+
return this;
|
|
42
|
+
}
|
|
43
|
+
const { stderr } = yield promisifiedExec(this._cmdToExec);
|
|
44
|
+
if (!stderr) {
|
|
45
|
+
return this;
|
|
46
|
+
}
|
|
47
|
+
const message = stderr.replace(/\n/g, '');
|
|
48
|
+
throw new command_1.CommandError(message, this._cmdToExec);
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
exports.default = CommandWithStdin;
|
|
53
|
+
//# sourceMappingURL=command-with-stdin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"command-with-stdin.js","sourceRoot":"","sources":["../../../src/common/classes/command-with-stdin.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AACA,+BAAiC;AACjC,iDAAqC;AAErC,kDAA0E;AAC1E,+CAAiD;AAEjD,wDAAgC;AAChC,kCAAm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CAAC,UAAU,CAAC,CAAC;QACnD,CAAC;KAAA;CACF;AAzCD,mCAyCC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { JSONSchemaType } from 'ajv';
|
|
2
|
+
import { SchemaIds } from '../constants/schemas';
|
|
3
|
+
import { GlobalOptions } from '../interfaces/common';
|
|
4
|
+
/**
|
|
5
|
+
* Class to group common behavior among commands.
|
|
6
|
+
*
|
|
7
|
+
* @category Classes
|
|
8
|
+
* @internal
|
|
9
|
+
*/
|
|
10
|
+
export default class Command<T_CommandOptions extends {
|
|
11
|
+
[index: string]: any;
|
|
12
|
+
}> {
|
|
13
|
+
protected schemaId: SchemaIds;
|
|
14
|
+
protected schema: JSONSchemaType<T_CommandOptions>;
|
|
15
|
+
protected options: T_CommandOptions;
|
|
16
|
+
protected globalOptions: GlobalOptions;
|
|
17
|
+
protected ipCmd: string[];
|
|
18
|
+
protected _cmd: Array<string | number>;
|
|
19
|
+
protected _cmdToExec: string;
|
|
20
|
+
get cmd(): Array<string | number>;
|
|
21
|
+
get cmdToExec(): string;
|
|
22
|
+
constructor(schemaId: SchemaIds, schema: JSONSchemaType<T_CommandOptions>, options: T_CommandOptions, globalOptions: GlobalOptions, ipCmd: string[]);
|
|
23
|
+
protected buildCmd(): void;
|
|
24
|
+
private getCmdFromOptions;
|
|
25
|
+
exec<T_ReturnData = {}>(): Promise<this | T_ReturnData>;
|
|
26
|
+
}
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
const lodash_isplainobject_1 = __importDefault(require("lodash.isplainobject"));
|
|
16
|
+
const util_1 = require("util");
|
|
17
|
+
const child_process_1 = require("child_process");
|
|
18
|
+
const schemas_1 = require("../constants/schemas");
|
|
19
|
+
const command_1 = require("../errors/command");
|
|
20
|
+
const misc_1 = require("../misc");
|
|
21
|
+
const promisifiedExec = (0, util_1.promisify)(child_process_1.exec);
|
|
22
|
+
/**
|
|
23
|
+
* Class to group common behavior among commands.
|
|
24
|
+
*
|
|
25
|
+
* @category Classes
|
|
26
|
+
* @internal
|
|
27
|
+
*/
|
|
28
|
+
class Command {
|
|
29
|
+
// Useful for testing.
|
|
30
|
+
get cmd() {
|
|
31
|
+
return this._cmd;
|
|
32
|
+
}
|
|
33
|
+
// Useful for testing.
|
|
34
|
+
get cmdToExec() {
|
|
35
|
+
return this._cmdToExec;
|
|
36
|
+
}
|
|
37
|
+
constructor(schemaId, schema, options, globalOptions, ipCmd) {
|
|
38
|
+
this.schemaId = schemaId;
|
|
39
|
+
this.schema = schema;
|
|
40
|
+
this.options = options;
|
|
41
|
+
this.globalOptions = globalOptions;
|
|
42
|
+
this.ipCmd = ipCmd;
|
|
43
|
+
this._cmd = [];
|
|
44
|
+
this._cmdToExec = '';
|
|
45
|
+
(0, misc_1.validate)(schemaId, schema, options);
|
|
46
|
+
(0, misc_1.validate)(schemas_1.SchemaIds.GlobalOptions, schemas_1.GlobalOptionsSchema, globalOptions);
|
|
47
|
+
this.buildCmd();
|
|
48
|
+
}
|
|
49
|
+
buildCmd() {
|
|
50
|
+
const hasSudo = (this.globalOptions.sudo)
|
|
51
|
+
? 'sudo'
|
|
52
|
+
: '';
|
|
53
|
+
let cmd = [hasSudo, ...this.ipCmd];
|
|
54
|
+
// Add specific `ip` options to cmd.
|
|
55
|
+
let ipOptions = [];
|
|
56
|
+
Object
|
|
57
|
+
.keys(this.globalOptions)
|
|
58
|
+
.forEach((key) => {
|
|
59
|
+
if (key.search(/^-/) === -1) {
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
ipOptions.push(...this.getCmdFromOptions(this.globalOptions[key], key, false));
|
|
63
|
+
});
|
|
64
|
+
cmd.splice(2, 0, ...ipOptions);
|
|
65
|
+
// Add regular arguments to cmd.
|
|
66
|
+
cmd.push(...this.getCmdFromOptions(this.options, '', true, this.schema));
|
|
67
|
+
this._cmd = cmd;
|
|
68
|
+
this._cmdToExec = cmd.join(' ');
|
|
69
|
+
}
|
|
70
|
+
getCmdFromOptions(value, key = '', orderKeysBySchema = true, schema) {
|
|
71
|
+
let cmd = [];
|
|
72
|
+
let isVisibleKey = !(schema === null || schema === void 0 ? void 0 : schema.keyless);
|
|
73
|
+
if (typeof value === 'string' || typeof value === 'number') {
|
|
74
|
+
if (isVisibleKey && key) {
|
|
75
|
+
cmd.push(key);
|
|
76
|
+
}
|
|
77
|
+
cmd.push(value);
|
|
78
|
+
return cmd;
|
|
79
|
+
}
|
|
80
|
+
if (typeof value === 'boolean') {
|
|
81
|
+
if (!isVisibleKey) {
|
|
82
|
+
// It doesn't make sense.
|
|
83
|
+
// TODO: Throw an error or skip? Skip for now.
|
|
84
|
+
return cmd;
|
|
85
|
+
}
|
|
86
|
+
if (value && key) {
|
|
87
|
+
cmd.push(key);
|
|
88
|
+
return cmd;
|
|
89
|
+
}
|
|
90
|
+
// Is `false`.
|
|
91
|
+
let invertedKey = (/^no/.test(key))
|
|
92
|
+
? key.replace(/^no/, '')
|
|
93
|
+
: `no${key}`;
|
|
94
|
+
cmd.push(invertedKey);
|
|
95
|
+
return cmd;
|
|
96
|
+
}
|
|
97
|
+
if (Array.isArray(value)) {
|
|
98
|
+
if (isVisibleKey && key) {
|
|
99
|
+
cmd.push(key);
|
|
100
|
+
}
|
|
101
|
+
value.forEach((nestedValue) => {
|
|
102
|
+
if ((0, lodash_isplainobject_1.default)(nestedValue) && (schema === null || schema === void 0 ? void 0 : schema.items)) {
|
|
103
|
+
cmd.push(...this.getCmdFromOptions(nestedValue, '', orderKeysBySchema, schema === null || schema === void 0 ? void 0 : schema.items));
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
cmd.push(...this.getCmdFromOptions(nestedValue));
|
|
107
|
+
});
|
|
108
|
+
return cmd;
|
|
109
|
+
}
|
|
110
|
+
if ((0, lodash_isplainobject_1.default)(value)) {
|
|
111
|
+
if (isVisibleKey && key) {
|
|
112
|
+
cmd.push(key);
|
|
113
|
+
}
|
|
114
|
+
let sourceForKeysOrdering = (orderKeysBySchema && schema)
|
|
115
|
+
? schema.properties
|
|
116
|
+
: value;
|
|
117
|
+
Object
|
|
118
|
+
.keys(sourceForKeysOrdering)
|
|
119
|
+
.forEach((schemaKey) => {
|
|
120
|
+
if (value.hasOwnProperty(schemaKey)) {
|
|
121
|
+
cmd.push(...this.getCmdFromOptions(value[schemaKey], schemaKey, orderKeysBySchema, schema === null || schema === void 0 ? void 0 : schema.properties[schemaKey]));
|
|
122
|
+
}
|
|
123
|
+
});
|
|
124
|
+
return cmd;
|
|
125
|
+
}
|
|
126
|
+
// TODO: What to do if value is `undefined` or `null`? For now do nothing.
|
|
127
|
+
return cmd;
|
|
128
|
+
}
|
|
129
|
+
exec() {
|
|
130
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
131
|
+
if (this.globalOptions.dryRun) {
|
|
132
|
+
return this;
|
|
133
|
+
}
|
|
134
|
+
const { stderr } = yield promisifiedExec(this._cmdToExec);
|
|
135
|
+
if (!stderr) {
|
|
136
|
+
return this;
|
|
137
|
+
}
|
|
138
|
+
const message = stderr.replace(/\n/g, '');
|
|
139
|
+
throw new command_1.CommandError(message, this._cmdToExec);
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
exports.default = Command;
|
|
144
|
+
//# sourceMappingURL=command.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"command.js","sourceRoot":"","sources":["../../../src/common/classes/command.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AACA,gFAAiD;AACjD,+BAAiC;AACjC,iDAAqC;AAErC,kDAAsE;AACtE,+CAAiD;AAEjD,kCAAmC;AAEnC,MAAM,eAAe,GAAG,IAAA,gBAAS,EAAC,oBAAI,CAAC,CAAC;AAExC;;;;;GAKG;AACH,MAAqB,OAAO;IAI1B,sBAAsB;IACtB,IAAI,GAAG;QACL,OAAO,IAAI,CAAC,IAAI,CAAC;IACnB,CAAC;IAED,sBAAsB;IACtB,IAAI,SAAS;QACX,OAAO,IAAI,CAAC,UAAU,CAAC;IACzB,CAAC;IAED,YAAsB,QAAmB,EACnB,MAAwC,EACxC,OAAyB,EACzB,aAA4B,EAC5B,KAAe;QAJf,aAAQ,GAAR,QAAQ,CAAW;QACnB,WAAM,GAAN,MAAM,CAAkC;QACxC,YAAO,GAAP,OAAO,CAAkB;QACzB,kBAAa,GAAb,aAAa,CAAe;QAC5B,UAAK,GAAL,KAAK,CAAU;QAjB3B,SAAI,GAA2B,EAAE,CAAC;QAClC,eAAU,GAAqB,EAAE,CAAC;QAkB1C,IAAA,eAAQ,EAAmB,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;QACtD,IAAA,eAAQ,EAAgB,mBAAS,CAAC,aAAa,EAAE,6BAAmB,EAAE,aAAa,CAAC,CAAC;QAErF,IAAI,CAAC,QAAQ,EAAE,CAAC;IAClB,CAAC;IAES,QAAQ;QAChB,MAAM,OAAO,GAAG,CAAC,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC;YACzB,CAAC,CAAC,MAAM;YACR,CAAC,CAAC,EAAE,CAAC;QAErB,IAAI,GAAG,GAA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+
import { GlobalOptions } from '../interfaces/common';
|
|
4
|
+
import Command from './command';
|
|
5
|
+
import { MonitorObjects } from '../../commands/monitor.constants';
|
|
6
|
+
import { MonitorEmittedData } from '../interfaces/monitor';
|
|
7
|
+
/**
|
|
8
|
+
* Class to group common behavior among monitor commands.
|
|
9
|
+
*
|
|
10
|
+
* @category Classes
|
|
11
|
+
* @internal
|
|
12
|
+
*/
|
|
13
|
+
export default class MonitorCommand<T_CommandOptions extends {
|
|
14
|
+
[index: string]: any;
|
|
15
|
+
}> extends Command<T_CommandOptions> {
|
|
16
|
+
protected schemaId: SchemaIds;
|
|
17
|
+
protected schema: JSONSchemaType<T_CommandOptions>;
|
|
18
|
+
protected options: T_CommandOptions;
|
|
19
|
+
protected globalOptions: GlobalOptions;
|
|
20
|
+
protected ipCmd: string[];
|
|
21
|
+
static parseLineOutput(eventLine: string): MonitorEmittedData;
|
|
22
|
+
private emitter;
|
|
23
|
+
private spawnedProcess;
|
|
24
|
+
constructor(schemaId: SchemaIds, schema: JSONSchemaType<T_CommandOptions>, options: T_CommandOptions, globalOptions: GlobalOptions, ipCmd: string[]);
|
|
25
|
+
exec(): Promise<this>;
|
|
26
|
+
/** Listens to the events triggered by the monitor. */
|
|
27
|
+
on(event: MonitorObjects | 'error', cb: (data?: any) => void): this;
|
|
28
|
+
/** Closes the monitor. */
|
|
29
|
+
close(): void;
|
|
30
|
+
}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
const child_process_1 = require("child_process");
|
|
16
|
+
const events_1 = require("events");
|
|
17
|
+
const command_1 = __importDefault(require("./command"));
|
|
18
|
+
const monitor_constants_1 = require("../../commands/monitor.constants");
|
|
19
|
+
/**
|
|
20
|
+
* Class to group common behavior among monitor commands.
|
|
21
|
+
*
|
|
22
|
+
* @category Classes
|
|
23
|
+
* @internal
|
|
24
|
+
*/
|
|
25
|
+
class MonitorCommand extends command_1.default {
|
|
26
|
+
static parseLineOutput(eventLine) {
|
|
27
|
+
const bracketsSectionRegex = /^\[.*?\](?: (\[.*?\])*)?/;
|
|
28
|
+
const textsInsideBracketsRegex = /\[([^\]]+)\]/g;
|
|
29
|
+
const bracketsSectionMatch = eventLine.match(bracketsSectionRegex);
|
|
30
|
+
const bracketsSection = (bracketsSectionMatch)
|
|
31
|
+
? bracketsSectionMatch[0]
|
|
32
|
+
: '';
|
|
33
|
+
const dataLines = eventLine
|
|
34
|
+
.split(/\\\s+/g)
|
|
35
|
+
.map((line) => line.trim());
|
|
36
|
+
const bracketMatches = dataLines[0].match(textsInsideBracketsRegex);
|
|
37
|
+
const brackets = (bracketMatches)
|
|
38
|
+
? bracketMatches.map(b => b.slice(1, -1))
|
|
39
|
+
: [];
|
|
40
|
+
// Extracting the rest of the line that isn't wrapped in [].
|
|
41
|
+
const firstLineRest = dataLines[0].replace(textsInsideBracketsRegex, '').trim();
|
|
42
|
+
return {
|
|
43
|
+
timestamp: brackets[0],
|
|
44
|
+
nsid: brackets[1].split(' ')[1],
|
|
45
|
+
object: (brackets[2] === 'ADDR')
|
|
46
|
+
? monitor_constants_1.MonitorObjects.Address
|
|
47
|
+
: brackets[2].toLowerCase(),
|
|
48
|
+
originalLine: eventLine,
|
|
49
|
+
lines: [
|
|
50
|
+
bracketsSection,
|
|
51
|
+
firstLineRest,
|
|
52
|
+
...dataLines.slice(1)
|
|
53
|
+
]
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
constructor(schemaId, schema, options, globalOptions, ipCmd) {
|
|
57
|
+
super(schemaId, schema, Object.assign(Object.assign({}, options), {
|
|
58
|
+
// Override options to maximize output.
|
|
59
|
+
label: true, 'all-nsid': true }), globalOptions, ipCmd);
|
|
60
|
+
this.schemaId = schemaId;
|
|
61
|
+
this.schema = schema;
|
|
62
|
+
this.options = options;
|
|
63
|
+
this.globalOptions = globalOptions;
|
|
64
|
+
this.ipCmd = ipCmd;
|
|
65
|
+
this.emitter = new events_1.EventEmitter();
|
|
66
|
+
}
|
|
67
|
+
exec() {
|
|
68
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
69
|
+
if (this.globalOptions.dryRun) {
|
|
70
|
+
return this;
|
|
71
|
+
}
|
|
72
|
+
let [command, ...args] = this._cmdToExec.trim().split(' ');
|
|
73
|
+
this.spawnedProcess = (0, child_process_1.spawn)(command, args);
|
|
74
|
+
this.spawnedProcess.stdout.setEncoding('utf8');
|
|
75
|
+
this.spawnedProcess.stdout.on('data', (data) => {
|
|
76
|
+
const output = data.split('\n');
|
|
77
|
+
for (let lineNumber = 0, outputLength = output.length - 1; lineNumber < outputLength; lineNumber++) {
|
|
78
|
+
let toEmit = MonitorCommand.parseLineOutput(output[lineNumber]);
|
|
79
|
+
this.emitter.emit(monitor_constants_1.MonitorObjects.All, toEmit);
|
|
80
|
+
if (this.options.object_ !== monitor_constants_1.MonitorObjects.All) {
|
|
81
|
+
this.emitter.emit(this.options.object_, toEmit);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
this.spawnedProcess.stderr.setEncoding('utf8');
|
|
86
|
+
this.spawnedProcess.stderr.on('data', (data) => {
|
|
87
|
+
this.emitter.emit('error', data);
|
|
88
|
+
this.close();
|
|
89
|
+
});
|
|
90
|
+
return this;
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
/** Listens to the events triggered by the monitor. */
|
|
94
|
+
on(event, cb) {
|
|
95
|
+
this.emitter.on.call(this.emitter, event, cb);
|
|
96
|
+
return this;
|
|
97
|
+
}
|
|
98
|
+
/** Closes the monitor. */
|
|
99
|
+
close() {
|
|
100
|
+
if (this.spawnedProcess) {
|
|
101
|
+
this.spawnedProcess.removeAllListeners();
|
|
102
|
+
this.spawnedProcess.kill('SIGKILL');
|
|
103
|
+
}
|
|
104
|
+
this.emitter.removeAllListeners();
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
exports.default = MonitorCommand;
|
|
108
|
+
//# sourceMappingURL=monitor-command.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"monitor-command.js","sourceRoot":"","sources":["../../../src/common/classes/monitor-command.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AACA,iDAAsE;AACtE,mCAAsC;AAItC,wDAAgC;AAChC,wEAAkE;AAGlE;;;;;GAKG;AACH,MAAqB,cAElB,SAAQ,iBAAyB;IAElC,MAAM,CAAC,eAAe,CAAC,SAAiB;QACtC,MAAM,oBAAoB,GAAO,0BAA0B,CAAC;QAC5D,MAAM,wBAAwB,GAAG,eAAe,CAAC;QAEjD,MAAM,oBAAoB,GAAG,SAAS,CAAC,KAAK,CAAC,oBAAoB,CAAC,CAAC;QACnE,MAAM,eAAe,GAAQ,CAAC,oBAAoB,CAAC;YACtB,CAAC,CAAC,oBAAoB,CAAC,CAAC,CAAC;YACzB,CAAC,CAAC,EAAE,CAAC;QAElC,MAAM,SAAS,GAAG,SAAS;aACxB,KAAK,CAAC,QAAQ,CAAC;aACf,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC;QAE9B,MAAM,c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AAM,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,EAAE;gBAC7C,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;gBACjC,IAAI,CAAC,KAAK,EAAE,CAAC;YACf,CAAC,CAAC,CAAC;YAEH,OAAO,IAAI,CAAC;QACd,CAAC;KAAA;IAED,sDAAsD;IACtD,EAAE,CAAC,KAA+B,EAAE,EAAwB;QAC1D,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC;QAC9C,OAAO,IAAI,CAAC;IACd,CAAC;IAED,0BAA0B;IAC1B,KAAK;QACH,IAAI,IAAI,CAAC,cAAc,EAAE;YACvB,IAAI,CAAC,cAAc,CAAC,kBAAkB,EAAE,CAAC;YACzC,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;SACrC;QACD,IAAI,CAAC,OAAO,CAAC,kBAAkB,EAAE,CAAC;IACpC,CAAC;CACF;AA/GD,iCA+GC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Represents a simple toggle state, either `on` or `off`.
|
|
3
|
+
* @category Constants
|
|
4
|
+
*/
|
|
5
|
+
export declare enum OnOffToggle {
|
|
6
|
+
On = "on",
|
|
7
|
+
Off = "off"
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Represents a binary state for enabling or disabling a feature or functionality.
|
|
11
|
+
* @category Constants
|
|
12
|
+
*/
|
|
13
|
+
export declare enum EnableDisableToggle {
|
|
14
|
+
Enable = 1,
|
|
15
|
+
Disable = 0
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Represents the state for enabling or disabling a feature, expressed as strings.
|
|
19
|
+
* @category Constants
|
|
20
|
+
*/
|
|
21
|
+
export declare enum EnableDisableAsStringToggle {
|
|
22
|
+
Enable = "enable",
|
|
23
|
+
Disable = "disable"
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Represents the state for enabling, disabling, or setting a feature to automatic mode.
|
|
27
|
+
* @category Constants
|
|
28
|
+
*/
|
|
29
|
+
export declare enum EnableDisableAutoToggle {
|
|
30
|
+
Enable = "enable",
|
|
31
|
+
Disable = "disable",
|
|
32
|
+
Auto = "auto"
|
|
33
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.EnableDisableAutoToggle = exports.EnableDisableAsStringToggle = exports.EnableDisableToggle = exports.OnOffToggle = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Represents a simple toggle state, either `on` or `off`.
|
|
6
|
+
* @category Constants
|
|
7
|
+
*/
|
|
8
|
+
var OnOffToggle;
|
|
9
|
+
(function (OnOffToggle) {
|
|
10
|
+
OnOffToggle["On"] = "on";
|
|
11
|
+
OnOffToggle["Off"] = "off";
|
|
12
|
+
})(OnOffToggle || (exports.OnOffToggle = OnOffToggle = {}));
|
|
13
|
+
/**
|
|
14
|
+
* Represents a binary state for enabling or disabling a feature or functionality.
|
|
15
|
+
* @category Constants
|
|
16
|
+
*/
|
|
17
|
+
var EnableDisableToggle;
|
|
18
|
+
(function (EnableDisableToggle) {
|
|
19
|
+
EnableDisableToggle[EnableDisableToggle["Enable"] = 1] = "Enable";
|
|
20
|
+
EnableDisableToggle[EnableDisableToggle["Disable"] = 0] = "Disable";
|
|
21
|
+
})(EnableDisableToggle || (exports.EnableDisableToggle = EnableDisableToggle = {}));
|
|
22
|
+
/**
|
|
23
|
+
* Represents the state for enabling or disabling a feature, expressed as strings.
|
|
24
|
+
* @category Constants
|
|
25
|
+
*/
|
|
26
|
+
var EnableDisableAsStringToggle;
|
|
27
|
+
(function (EnableDisableAsStringToggle) {
|
|
28
|
+
EnableDisableAsStringToggle["Enable"] = "enable";
|
|
29
|
+
EnableDisableAsStringToggle["Disable"] = "disable";
|
|
30
|
+
})(EnableDisableAsStringToggle || (exports.EnableDisableAsStringToggle = EnableDisableAsStringToggle = {}));
|
|
31
|
+
/**
|
|
32
|
+
* Represents the state for enabling, disabling, or setting a feature to automatic mode.
|
|
33
|
+
* @category Constants
|
|
34
|
+
*/
|
|
35
|
+
var EnableDisableAutoToggle;
|
|
36
|
+
(function (EnableDisableAutoToggle) {
|
|
37
|
+
EnableDisableAutoToggle["Enable"] = "enable";
|
|
38
|
+
EnableDisableAutoToggle["Disable"] = "disable";
|
|
39
|
+
EnableDisableAutoToggle["Auto"] = "auto";
|
|
40
|
+
})(EnableDisableAutoToggle || (exports.EnableDisableAutoToggle = EnableDisableAutoToggle = {}));
|
|
41
|
+
//# sourceMappingURL=attribute-values.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"attribute-values.js","sourceRoot":"","sources":["../../../src/common/constants/attribute-values.ts"],"names":[],"mappings":";;;AAAA;;;GAGG;AACH,IAAY,WAGX;AAHD,WAAY,WAAW;IACrB,wBAAU,CAAA;IACV,0BAAW,CAAA;AACb,CAAC,EAHW,WAAW,2BAAX,WAAW,QAGtB;AAED;;;GAGG;AACH,IAAY,mBAGX;AAHD,WAAY,mBAAmB;IAC7B,iEAAW,CAAA;IACX,mEAAW,CAAA;AACb,CAAC,EAHW,mBAAmB,mCAAnB,mBAAmB,QAG9B;AAED;;;GAGG;AACH,IAAY,2BAGX;AAHD,WAAY,2BAA2B;IACrC,gDAAkB,CAAA;IAClB,kDAAmB,CAAA;AACrB,CAAC,EAHW,2BAA2B,2CAA3B,2BAA2B,QAGtC;AAED;;;GAGG;AACH,IAAY,uBAIX;AAJD,WAAY,uBAAuB;IACjC,4CAAkB,CAAA;IAClB,8CAAmB,CAAA;IACnB,wCAAgB,CAAA;AAClB,CAAC,EAJW,uBAAuB,uCAAvB,uBAAuB,QAIlC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/** @category Regexes */
|
|
2
|
+
export declare const mac: RegExp;
|
|
3
|
+
/** @category Regexes */
|
|
4
|
+
export declare const hex4Digits: RegExp;
|
|
5
|
+
/** @category Regexes */
|
|
6
|
+
export declare const ipv4: RegExp;
|
|
7
|
+
/** @category Regexes */
|
|
8
|
+
export declare const ipv6: RegExp;
|
|
9
|
+
/** @category Regexes */
|
|
10
|
+
export declare const ip: RegExp;
|
|
11
|
+
/** @category Regexes */
|
|
12
|
+
export declare const ipWithOptionalMask: RegExp;
|
|
13
|
+
/** @category Regexes */
|
|
14
|
+
export declare const ipWithRequiredMask: RegExp;
|
|
15
|
+
/** @category Regexes */
|
|
16
|
+
export declare const ipOrAny: RegExp;
|
|
17
|
+
/** @category Regexes */
|
|
18
|
+
export declare const ipWithOptionalMaskAndAllAndDefaultValues: RegExp;
|
|
19
|
+
/** @category Regexes */
|
|
20
|
+
export declare const ipWithRequiredMaskAndAllAndDefaultValues: RegExp;
|
|
21
|
+
/** @category Regexes */
|
|
22
|
+
export declare const ipWithOptionalFamilyPrefix: RegExp;
|
|
23
|
+
/** @category Regexes */
|
|
24
|
+
export declare const slashSeparatedStrings: RegExp;
|
|
25
|
+
/** @category Regexes */
|
|
26
|
+
export declare const slashSeparatedNumbers: RegExp;
|
|
27
|
+
/** @category Regexes */
|
|
28
|
+
export declare const commaSeparatedIpv6Addresses: RegExp;
|
|
29
|
+
/** @category Regexes */
|
|
30
|
+
export declare const timeWithUnit: RegExp;
|
|
31
|
+
/** @category Regexes */
|
|
32
|
+
export declare const colonSeparatedNumbers: RegExp;
|
|
33
|
+
/** @category Regexes */
|
|
34
|
+
export declare const tos: RegExp;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.tos = exports.colonSeparatedNumbers = exports.timeWithUnit = exports.commaSeparatedIpv6Addresses = exports.slashSeparatedNumbers = exports.slashSeparatedStrings = exports.ipWithOptionalFamilyPrefix = exports.ipWithRequiredMaskAndAllAndDefaultValues = exports.ipWithOptionalMaskAndAllAndDefaultValues = exports.ipOrAny = exports.ipWithRequiredMask = exports.ipWithOptionalMask = exports.ip = exports.ipv6 = exports.ipv4 = exports.hex4Digits = exports.mac = void 0;
|
|
4
|
+
/** @category Regexes */
|
|
5
|
+
exports.mac = /^([0-9A-Fa-f]{2}:){5}[0-9A-Fa-f]{2}$/;
|
|
6
|
+
/** @category Regexes */
|
|
7
|
+
exports.hex4Digits = /^[0-9a-fA-F]{4}$/;
|
|
8
|
+
/** @category Regexes */
|
|
9
|
+
exports.ipv4 = /^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/;
|
|
10
|
+
/** @category Regexes */
|
|
11
|
+
exports.ipv6 = /^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i;
|
|
12
|
+
/** @category Regexes */
|
|
13
|
+
exports.ip = /^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$|^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i;
|
|
14
|
+
/** @category Regexes */
|
|
15
|
+
exports.ipWithOptionalMask = /^(?:(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)(?:\/(3[01]|[12]\d|\d))?$|^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(?:\/(12[0-8]|1[01]\d|\d{1,2}))?$)/i;
|
|
16
|
+
/** @category Regexes */
|
|
17
|
+
exports.ipWithRequiredMask = /^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\/[0-9]{1,2}|(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/[0-9]{1,3}$/i;
|
|
18
|
+
/** @category Regexes */
|
|
19
|
+
exports.ipOrAny = /(^any$)|^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$|^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i;
|
|
20
|
+
/** @category Regexes */
|
|
21
|
+
exports.ipWithOptionalMaskAndAllAndDefaultValues = /^(all|default)$|^(?:(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)(?:\/(3[01]|[12]\d|\d))?$|^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(?:\/(12[0-8]|1[01]\d|\d{1,2}))?$)/i;
|
|
22
|
+
/** @category Regexes */
|
|
23
|
+
exports.ipWithRequiredMaskAndAllAndDefaultValues = /^(all|default)$|^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\/[0-9]{1,2}|(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/[0-9]{1,3}$/i;
|
|
24
|
+
/** @category Regexes */
|
|
25
|
+
exports.ipWithOptionalFamilyPrefix = /^(?:inet|inet6|mpls|bridge|link)?\s?((?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))))$/i;
|
|
26
|
+
/** @category Regexes */
|
|
27
|
+
exports.slashSeparatedStrings = /^(?!\/)([^/]+(\/[^/]+)*[^/]|[^/])$/;
|
|
28
|
+
/** @category Regexes */
|
|
29
|
+
exports.slashSeparatedNumbers = /^(?!\/)(\d+)(\/\d+)*$/;
|
|
30
|
+
/** @category Regexes */
|
|
31
|
+
exports.commaSeparatedIpv6Addresses = /^((?:[0-9a-f]{1,4}:){7}[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4}|(?:[0-9a-f]{1,4}:){0,5}:?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})(?:,((?:[0-9a-f]{1,4}:){7}[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4}|(?:[0-9a-f]{1,4}:){0,5}:?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4}))*$/i;
|
|
32
|
+
/** @category Regexes */
|
|
33
|
+
exports.timeWithUnit = /^\d+(s|sec|secs|m|msec|msecs)$/;
|
|
34
|
+
/** @category Regexes */
|
|
35
|
+
exports.colonSeparatedNumbers = /^\d+:\d+$/;
|
|
36
|
+
/** @category Regexes */
|
|
37
|
+
exports.tos = /^(?:[a-zA-Z]+|[0-9a-fA-F]{2}|inherit(?:\/(?:[a-zA-Z]+|[0-9a-fA-F]{2}))?)$/;
|
|
38
|
+
//# sourceMappingURL=regexes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"regexes.js","sourceRoot":"","sources":["../../../src/common/constants/regexes.ts"],"names":[],"mappings":";;;AAAA,wBAAwB;AACX,QAAA,GAAG,GAAU,sCAAsC,CAAC;AACjE,wBAAwB;AACX,QAAA,UAAU,GAAG,kBAAkB,CAAC;AAE7C,wBAAwB;AACX,QAAA,IAAI,GAAG,2EAA2E,CAAC;AAChG,wBAAwB;AACX,QAAA,IAAI,GAAG,k/BAAk/B,CAAC;AACvgC,wBAAwB;AACX,QAAA,EAAE,GAAK,4jCAA4jC,CAAC;AAEjlC,wBAAwB;AACX,QAAA,kBAAkB,GAAG,wnCAAwnC,CAAC;AAC3pC,wBAAwB;AACX,QAAA,kBAAkB,GAAG,0wBAA0wB,CAAC;AAE7yB,wBAAwB;AACX,QAAA,OAAO,GAAG,okCAAokC,CAAC;AAE5lC,wBAAwB;AACX,QAAA,wCAAwC,GAAG,woCAAwoC,CAAC;AACjsC,wBAAwB;AACX,QAAA,wCAAwC,GAAG,0xBAA0xB,CAAC;AACn1B,wBAAwB;AACX,QAAA,0BAA0B,GAAiB,+lCAA+lC,CAAC;AAExpC,wBAAwB;AACX,QAAA,qBAAqB,GAAS,oCAAoC,CAAC;AAChF,wBAAwB;AACX,QAAA,qBAAqB,GAAS,uBAAuB,CAAC;AACnE,wBAAwB;AACX,QAAA,2BAA2B,GAAG,iXAAiX,CAAC;AAE7Z,wBAAwB;AACX,QAAA,YAAY,GAAY,gCAAgC,CAAC;AACtE,wBAAwB;AACX,QAAA,qBAAqB,GAAG,WAAW,CAAC;AAEjD,wBAAwB;AACX,QAAA,GAAG,GAAG,2EAA2E,CAAC"}
|