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,80 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TunTapShowSchema = void 0;
|
|
4
|
+
const schemas_1 = require("../../common/constants/schemas");
|
|
5
|
+
const tuntap_constants_1 = require("../tuntap.constants");
|
|
6
|
+
exports.TunTapShowSchema = {
|
|
7
|
+
$id: schemas_1.SchemaIds.TunTapShow,
|
|
8
|
+
type: 'object',
|
|
9
|
+
required: [],
|
|
10
|
+
properties: {
|
|
11
|
+
dev: {
|
|
12
|
+
type: 'string',
|
|
13
|
+
minLength: 1,
|
|
14
|
+
nullable: true
|
|
15
|
+
},
|
|
16
|
+
mode: {
|
|
17
|
+
type: 'string',
|
|
18
|
+
enum: Object.values(tuntap_constants_1.TunTapTunnelModes),
|
|
19
|
+
nullable: true
|
|
20
|
+
},
|
|
21
|
+
user: {
|
|
22
|
+
type: ['string', 'integer'],
|
|
23
|
+
nullable: true,
|
|
24
|
+
anyOf: [
|
|
25
|
+
{
|
|
26
|
+
type: 'string',
|
|
27
|
+
minLength: 1,
|
|
28
|
+
nullable: true
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
type: 'integer',
|
|
32
|
+
minimum: 0,
|
|
33
|
+
nullable: true
|
|
34
|
+
}
|
|
35
|
+
]
|
|
36
|
+
},
|
|
37
|
+
group: {
|
|
38
|
+
type: ['string', 'integer'],
|
|
39
|
+
nullable: true,
|
|
40
|
+
anyOf: [
|
|
41
|
+
{
|
|
42
|
+
type: 'string',
|
|
43
|
+
minLength: 1,
|
|
44
|
+
nullable: true
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
type: 'integer',
|
|
48
|
+
minimum: 0,
|
|
49
|
+
nullable: true
|
|
50
|
+
}
|
|
51
|
+
]
|
|
52
|
+
},
|
|
53
|
+
one_queue: {
|
|
54
|
+
type: 'boolean',
|
|
55
|
+
enum: [true],
|
|
56
|
+
nullable: true
|
|
57
|
+
},
|
|
58
|
+
pi: {
|
|
59
|
+
type: 'boolean',
|
|
60
|
+
enum: [true],
|
|
61
|
+
nullable: true
|
|
62
|
+
},
|
|
63
|
+
vnet_hdr: {
|
|
64
|
+
type: 'boolean',
|
|
65
|
+
enum: [true],
|
|
66
|
+
nullable: true
|
|
67
|
+
},
|
|
68
|
+
multi_queue: {
|
|
69
|
+
type: 'boolean',
|
|
70
|
+
enum: [true],
|
|
71
|
+
nullable: true
|
|
72
|
+
},
|
|
73
|
+
name: {
|
|
74
|
+
type: 'string',
|
|
75
|
+
minLength: 1,
|
|
76
|
+
nullable: true
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
//# sourceMappingURL=show.schema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"show.schema.js","sourceRoot":"","sources":["../../../src/commands/tuntap/show.schema.ts"],"names":[],"mappings":";;;AAEA,4DAA2D;AAC3D,0DAAwD;AAG3C,QAAA,gBAAgB,GAA4C;IACvE,GAAG,EAAS,mBAAS,CAAC,UAAU;IAChC,IAAI,EAAQ,QAAQ;IACpB,QAAQ,EAAI,EAAE;IACd,UAAU,EAAE;QACV,GAAG,EAAU;YACX,IAAI,EAAO,QAAQ;YACnB,SAAS,EAAE,CAAC;YACZ,QAAQ,EAAG,IAAI;SAChB;QACD,IAAI,EAAS;YACX,IAAI,EAAM,QAAQ;YAClB,IAAI,EAAM,MAAM,CAAC,MAAM,CAAC,oCAAiB,CAAwB;YACjE,QAAQ,EAAE,IAAI;SACf;QACD,IAAI,EAAS;YACX,IAAI,EAAM,CAAC,QAAQ,EAAE,SAAS,CAAC;YAC/B,QAAQ,EAAE,IAAI;YACd,KAAK,EAAK;gBACR;oBACE,IAAI,EAAO,QAAQ;oBACnB,SAAS,EAAE,CAAC;oBACZ,QAAQ,EAAG,IAAI;iBAChB;gBACD;oBACE,IAAI,EAAM,SAAS;oBACnB,OAAO,EAAG,CAAC;oBACX,QAAQ,EAAE,IAAI;iBACf;aACF;SACF;QACD,KAAK,EAAQ;YACX,IAAI,EAAM,CAAC,QAAQ,EAAE,SAAS,CAAC;YAC/B,QAAQ,EAAE,IAAI;YACd,KAAK,EAAK;gBACR;oBACE,IAAI,EAAO,QAAQ;oBACnB,SAAS,EAAE,CAAC;oBACZ,QAAQ,EAAG,IAAI;iBAChB;gBACD;oBACE,IAAI,EAAM,SAAS;oBACnB,OAAO,EAAG,CAAC;oBACX,QAAQ,EAAE,IAAI;iBACf;aACF;SACF;QACD,SAAS,EAAI;YACX,IAAI,EAAM,SAAS;YACnB,IAAI,EAAM,CAAC,IAAI,CAAC;YAChB,QAAQ,EAAE,IAAI;SACf;QACD,EAAE,EAAW;YACX,IAAI,EAAM,SAAS;YACnB,IAAI,EAAM,CAAC,IAAI,CAAC;YAChB,QAAQ,EAAE,IAAI;SACf;QACD,QAAQ,EAAK;YACX,IAAI,EAAM,SAAS;YACnB,IAAI,EAAM,CAAC,IAAI,CAAC;YAChB,QAAQ,EAAE,IAAI;SACf;QACD,WAAW,EAAE;YACX,IAAI,EAAM,SAAS;YACnB,IAAI,EAAM,CAAC,IAAI,CAAC;YAChB,QAAQ,EAAE,IAAI;SACf;QACD,IAAI,EAAS;YACX,IAAI,EAAO,QAAQ;YACnB,SAAS,EAAE,CAAC;YACZ,QAAQ,EAAG,IAAI;SAChB;KACF;CACF,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TunTapTunnelModes = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Tunnel available modes.
|
|
6
|
+
* @category Constants
|
|
7
|
+
*/
|
|
8
|
+
var TunTapTunnelModes;
|
|
9
|
+
(function (TunTapTunnelModes) {
|
|
10
|
+
TunTapTunnelModes["Tun"] = "tun";
|
|
11
|
+
TunTapTunnelModes["Tap"] = "tap";
|
|
12
|
+
})(TunTapTunnelModes || (exports.TunTapTunnelModes = TunTapTunnelModes = {}));
|
|
13
|
+
//# sourceMappingURL=tuntap.constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tuntap.constants.js","sourceRoot":"","sources":["../../src/commands/tuntap.constants.ts"],"names":[],"mappings":";;;AAAA;;;GAGG;AACH,IAAY,iBAGX;AAHD,WAAY,iBAAiB;IAC3B,gCAAW,CAAA;IACX,gCAAW,CAAA;AACb,CAAC,EAHW,iBAAiB,iCAAjB,iBAAiB,QAG5B"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import Command from '../common/classes/command';
|
|
2
|
+
import { GlobalOptions } from '../common/interfaces/common';
|
|
3
|
+
import { TunTapTunnelAddOptions } from './tuntap/add.interfaces';
|
|
4
|
+
import { TunTapTunnelInfo } from './tuntap/show.interfaces';
|
|
5
|
+
import { TunTapTunnelShowOptions } from './tuntap/show.interfaces';
|
|
6
|
+
/**
|
|
7
|
+
* Add a new tunnel.
|
|
8
|
+
*
|
|
9
|
+
* @param options - Parameters options to be passed down to `ip`.
|
|
10
|
+
* @param globalOptions - Global parameters options that affects the command execution.
|
|
11
|
+
*
|
|
12
|
+
* @throws {@link ParametersError} - Throws when passed parameters are invalid.
|
|
13
|
+
* @throws {@link CommandError} - Throws when the executed command fails.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
*
|
|
17
|
+
* Import module
|
|
18
|
+
* ```
|
|
19
|
+
* import { tuntap } from 'iproutejs';
|
|
20
|
+
* ```
|
|
21
|
+
*
|
|
22
|
+
* Create a new tuntap device
|
|
23
|
+
* ```
|
|
24
|
+
* await tuntap.add({
|
|
25
|
+
* mode: TunTapTunnelModes.Tun
|
|
26
|
+
* });
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
export declare function add(options: TunTapTunnelAddOptions, globalOptions?: GlobalOptions): Promise<Command<TunTapTunnelAddOptions>>;
|
|
30
|
+
/**
|
|
31
|
+
* Destroy a tunnel.
|
|
32
|
+
*
|
|
33
|
+
* @param options - Parameters options to be passed down to `ip`.
|
|
34
|
+
* @param globalOptions - Global parameters options that affects the command execution.
|
|
35
|
+
*
|
|
36
|
+
* @throws {@link ParametersError} - Throws when passed parameters are invalid.
|
|
37
|
+
* @throws {@link CommandError} - Throws when the executed command fails.
|
|
38
|
+
*
|
|
39
|
+
* @example
|
|
40
|
+
*
|
|
41
|
+
* Import module
|
|
42
|
+
* ```
|
|
43
|
+
* import { tuntap } from 'iproutejs';
|
|
44
|
+
* ```
|
|
45
|
+
*
|
|
46
|
+
* Delete a tunnel
|
|
47
|
+
* ```
|
|
48
|
+
* await tuntap.del({
|
|
49
|
+
* mode: TunTapTunnelModes.Tun
|
|
50
|
+
* });
|
|
51
|
+
* ```
|
|
52
|
+
*/
|
|
53
|
+
export declare function del(options: TunTapTunnelAddOptions, globalOptions?: GlobalOptions): Promise<Command<TunTapTunnelAddOptions>>;
|
|
54
|
+
/**
|
|
55
|
+
* List tunnels.
|
|
56
|
+
*
|
|
57
|
+
* @param options - Parameters options to be passed down to `ip`.
|
|
58
|
+
* @param globalOptions - Global parameters options that affects the command execution.
|
|
59
|
+
*
|
|
60
|
+
* @throws {@link ParametersError} - Throws when passed parameters are invalid.
|
|
61
|
+
* @throws {@link CommandError} - Throws when the executed command fails.
|
|
62
|
+
*
|
|
63
|
+
* @example
|
|
64
|
+
*
|
|
65
|
+
* Import module
|
|
66
|
+
* ```
|
|
67
|
+
* import { tuntap } from 'iproutejs';
|
|
68
|
+
* ```
|
|
69
|
+
*
|
|
70
|
+
* Show tuntap devices
|
|
71
|
+
* ```
|
|
72
|
+
* const entries = await tuntap.show({});
|
|
73
|
+
* ```
|
|
74
|
+
*/
|
|
75
|
+
export declare function show(options?: TunTapTunnelShowOptions, globalOptions?: GlobalOptions): Promise<Command<TunTapTunnelShowOptions> | TunTapTunnelInfo[]>;
|
|
76
|
+
declare const _default: {
|
|
77
|
+
add: typeof add;
|
|
78
|
+
del: typeof del;
|
|
79
|
+
show: typeof show;
|
|
80
|
+
list: typeof show;
|
|
81
|
+
lst: typeof show;
|
|
82
|
+
};
|
|
83
|
+
export default _default;
|
|
@@ -0,0 +1,121 @@
|
|
|
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
|
+
exports.show = exports.del = exports.add = void 0;
|
|
16
|
+
const command_with_returned_data_1 = __importDefault(require("../common/classes/command-with-returned-data"));
|
|
17
|
+
const command_1 = __importDefault(require("../common/classes/command"));
|
|
18
|
+
const schemas_1 = require("../common/constants/schemas");
|
|
19
|
+
const add_schema_1 = require("./tuntap/add.schema");
|
|
20
|
+
const show_schema_1 = require("./tuntap/show.schema");
|
|
21
|
+
/**
|
|
22
|
+
* Add a new tunnel.
|
|
23
|
+
*
|
|
24
|
+
* @param options - Parameters options to be passed down to `ip`.
|
|
25
|
+
* @param globalOptions - Global parameters options that affects the command execution.
|
|
26
|
+
*
|
|
27
|
+
* @throws {@link ParametersError} - Throws when passed parameters are invalid.
|
|
28
|
+
* @throws {@link CommandError} - Throws when the executed command fails.
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
*
|
|
32
|
+
* Import module
|
|
33
|
+
* ```
|
|
34
|
+
* import { tuntap } from 'iproutejs';
|
|
35
|
+
* ```
|
|
36
|
+
*
|
|
37
|
+
* Create a new tuntap device
|
|
38
|
+
* ```
|
|
39
|
+
* await tuntap.add({
|
|
40
|
+
* mode: TunTapTunnelModes.Tun
|
|
41
|
+
* });
|
|
42
|
+
* ```
|
|
43
|
+
*/
|
|
44
|
+
function add(options, globalOptions = {}) {
|
|
45
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
46
|
+
const cmd = ['ip', 'tuntap', 'add'];
|
|
47
|
+
const ipCmd = new command_1.default(schemas_1.SchemaIds.TunTapAdd, add_schema_1.TunTapAddSchema, options, globalOptions, cmd);
|
|
48
|
+
return yield ipCmd.exec();
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
exports.add = add;
|
|
52
|
+
/**
|
|
53
|
+
* Destroy a tunnel.
|
|
54
|
+
*
|
|
55
|
+
* @param options - Parameters options to be passed down to `ip`.
|
|
56
|
+
* @param globalOptions - Global parameters options that affects the command execution.
|
|
57
|
+
*
|
|
58
|
+
* @throws {@link ParametersError} - Throws when passed parameters are invalid.
|
|
59
|
+
* @throws {@link CommandError} - Throws when the executed command fails.
|
|
60
|
+
*
|
|
61
|
+
* @example
|
|
62
|
+
*
|
|
63
|
+
* Import module
|
|
64
|
+
* ```
|
|
65
|
+
* import { tuntap } from 'iproutejs';
|
|
66
|
+
* ```
|
|
67
|
+
*
|
|
68
|
+
* Delete a tunnel
|
|
69
|
+
* ```
|
|
70
|
+
* await tuntap.del({
|
|
71
|
+
* mode: TunTapTunnelModes.Tun
|
|
72
|
+
* });
|
|
73
|
+
* ```
|
|
74
|
+
*/
|
|
75
|
+
function del(options, globalOptions = {}) {
|
|
76
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
77
|
+
const cmd = ['ip', 'tuntap', 'del'];
|
|
78
|
+
const ipCmd = new command_1.default(schemas_1.SchemaIds.TunTapAdd, add_schema_1.TunTapAddSchema, options, globalOptions, cmd);
|
|
79
|
+
return yield ipCmd.exec();
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
exports.del = del;
|
|
83
|
+
/**
|
|
84
|
+
* List tunnels.
|
|
85
|
+
*
|
|
86
|
+
* @param options - Parameters options to be passed down to `ip`.
|
|
87
|
+
* @param globalOptions - Global parameters options that affects the command execution.
|
|
88
|
+
*
|
|
89
|
+
* @throws {@link ParametersError} - Throws when passed parameters are invalid.
|
|
90
|
+
* @throws {@link CommandError} - Throws when the executed command fails.
|
|
91
|
+
*
|
|
92
|
+
* @example
|
|
93
|
+
*
|
|
94
|
+
* Import module
|
|
95
|
+
* ```
|
|
96
|
+
* import { tuntap } from 'iproutejs';
|
|
97
|
+
* ```
|
|
98
|
+
*
|
|
99
|
+
* Show tuntap devices
|
|
100
|
+
* ```
|
|
101
|
+
* const entries = await tuntap.show({});
|
|
102
|
+
* ```
|
|
103
|
+
*/
|
|
104
|
+
function show(options = {}, globalOptions = {}) {
|
|
105
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
106
|
+
const cmd = ['ip', 'tuntap', 'show'];
|
|
107
|
+
const ipCmd = new command_with_returned_data_1.default(schemas_1.SchemaIds.TunTapShow, show_schema_1.TunTapShowSchema, options, Object.assign(Object.assign({}, globalOptions), {
|
|
108
|
+
// Overrides for a better show.
|
|
109
|
+
'-details': true, '-statistics': true, '-json': true }), cmd);
|
|
110
|
+
return yield ipCmd.exec();
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
exports.show = show;
|
|
114
|
+
exports.default = {
|
|
115
|
+
add,
|
|
116
|
+
del,
|
|
117
|
+
show,
|
|
118
|
+
list: show,
|
|
119
|
+
lst: show
|
|
120
|
+
};
|
|
121
|
+
//# sourceMappingURL=tuntap.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tuntap.js","sourceRoot":"","sources":["../../src/commands/tuntap.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,8GAAmF;AACnF,wEAAgD;AAChD,yDAAwD;AAGxD,oDAAsD;AAGtD,sDAAwD;AAExD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,SAAsB,GAAG,CAAC,OAA+B,EAC/B,gBAA+B,EAAE;;QAEzD,MAAM,GAAG,GAAG,CAAC,IAAI,EAAE,QAAQ,EAAE,KAAK,CAAC,CAAC;QAEpC,MAAM,KAAK,GAAG,IAAI,iBAAO,CACvB,mBAAS,CAAC,SAAS,EACnB,4BAAe,EACf,OAAO,EACP,aAAa,EACb,GAAG,CAAC,CAAC;QAEP,OAAO,MAAM,KAAK,CAAC,IAAI,EAAE,CAAC;IAC5B,CAAC;CAAA;AAbD,kBAaC;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,SAAsB,GAAG,CAAC,OAA+B,EAC/B,gBAA+B,EAAE;;QAEzD,MAAM,GAAG,GAAG,CAAC,IAAI,EAAE,QAAQ,EAAE,KAAK,CAAC,CAAC;QAEpC,MAAM,KAAK,GAAG,IAAI,iBAAO,CACvB,mBAAS,CAAC,SAAS,EACnB,4BAAe,EACf,OAAO,EACP,aAAa,EACb,GAAG,CAAC,CAAC;QAEP,OAAO,MAAM,KAAK,CAAC,IAAI,EAAE,CAAC;IAC5B,CAAC;CAAA;AAbD,kBAaC;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,SAAsB,IAAI,CAAC,UAAmC,EAAE,EACrC,gBAAmC,EAAE;;QAE9D,MAAM,GAAG,GAAG,CAAC,IAAI,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC;QAErC,MAAM,KAAK,GAAG,IAAI,oCAAuB,CACvC,mBAAS,CAAC,UAAU,EACpB,8BAAgB,EAChB,OAAO,kCAEF,aAAa;YAChB,+BAA+B;YAC/B,UAAU,EAAK,IAAI,EACnB,aAAa,EAAE,IAAI,EACnB,OAAO,EAAQ,IAAI,KAErB,GAAG,CAAC,CAAC;QAEP,OAAO,MAAM,KAAK,CAAC,IAAI,EAAsB,CAAC;IAChD,CAAC;CAAA;AAnBD,oBAmBC;AAED,kBAAe;IACb,GAAG;IACH,GAAG;IACH,IAAI;IACJ,IAAI,EAAE,IAAI;IACV,GAAG,EAAG,IAAI;CACX,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { JSONSchemaType } from 'ajv';
|
|
2
|
+
import { SchemaIds } from '../constants/schemas';
|
|
3
|
+
import { GlobalOptionsWithRequiredFilePath } from '../interfaces/common';
|
|
4
|
+
import Command from './command';
|
|
5
|
+
export default class CommandWithFilepath<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: GlobalOptionsWithRequiredFilePath;
|
|
12
|
+
protected ipCmd: string[];
|
|
13
|
+
constructor(schemaId: SchemaIds, schema: JSONSchemaType<T_CommandOptions>, options: T_CommandOptions, globalOptions: GlobalOptionsWithRequiredFilePath, 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 CommandWithFilepath 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.FilePathGlobalOption, schemas_1.FilePathGlobalOptionSchema, globalOptions);
|
|
31
|
+
this.buildCmd();
|
|
32
|
+
}
|
|
33
|
+
buildCmd() {
|
|
34
|
+
super.buildCmd();
|
|
35
|
+
this._cmd = this.cmd.concat(...[`${this.globalOptions.filePath}`]);
|
|
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 = CommandWithFilepath;
|
|
53
|
+
//# sourceMappingURL=command-with-filepath.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"command-with-filepath.js","sourceRoot":"","sources":["../../../src/common/classes/command-with-filepath.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AACA,+BAAiC;AACjC,iDAAqC;AAErC,kDAA6E;AAC7E,+CAAiD;AAEjD,wDAAgC;AAChC,kCAAmC;AAEnC,MAAM,eAAe,GAAG,IAAA,gBAAS,EAAC,oBAAI,CAAC,CAAC;AAExC,MAAqB,mBAElB,SAAQ,iBAAyB;IAElC,YAAsB,QAAmB,EACnB,MAAwC,EACxC,OAAyB,EACzB,aAAgD,EAChD,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,CAAmC;QAChD,UAAK,GAAL,KAAK,CAAU;QAQnC,IAAA,eAAQ,EAAoC,mBAAS,CAAC,oBAAoB,EAAE,oCAA0B,EAAE,aAAa,CAAC,CAAC;QACvH,IAAI,CAAC,QAAQ,EAAE,CAAC;IAClB,CAAC;IAEkB,QAAQ;QACzB,KAAK,CAAC,QAAQ,EAAE,CAAC;QAEjB,IAAI,CAAC,IAAI,GAAS,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,GAAI,IAAI,CAAC,aAAa,CAAC,QAAS,EAAE,CAAC,CAAC,CAAC;QAC3E,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACvC,CAAC;IAEc,IAAI;;YACjB,IAAI,IAAI,CAAC,aAAa,CAAC,MAAM,EAAE;gBAC7B,OAAO,IAAI,CAAC;aACb;YAED,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,eAAe,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;YAE1D,IAAI,CAAC,MAAM,EAAE;gBACX,OAAO,IAAI,CAAC;aACb;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;AAzCD,sCAyCC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { JSONSchemaType } from 'ajv';
|
|
2
|
+
import { SchemaIds } from '../constants/schemas';
|
|
3
|
+
import { GlobalOptionsWithRequiredFilePath } from '../interfaces/common';
|
|
4
|
+
import CommandWithRedirectFromFilepath from './command-with-redirect-from-filepath';
|
|
5
|
+
export default class CommandWithRedirectFromFilepathAndReturnedData<T_CommandOptions extends {
|
|
6
|
+
[index: string]: any;
|
|
7
|
+
}> extends CommandWithRedirectFromFilepath<T_CommandOptions> {
|
|
8
|
+
protected schemaId: SchemaIds;
|
|
9
|
+
protected schema: JSONSchemaType<T_CommandOptions>;
|
|
10
|
+
protected options: T_CommandOptions;
|
|
11
|
+
protected globalOptions: GlobalOptionsWithRequiredFilePath;
|
|
12
|
+
protected ipCmd: string[];
|
|
13
|
+
constructor(schemaId: SchemaIds, schema: JSONSchemaType<T_CommandOptions>, options: T_CommandOptions, globalOptions: GlobalOptionsWithRequiredFilePath, ipCmd: string[]);
|
|
14
|
+
exec<T_ReturnData>(): Promise<this | T_ReturnData>;
|
|
15
|
+
}
|
|
@@ -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_with_redirect_from_filepath_1 = __importDefault(require("./command-with-redirect-from-filepath"));
|
|
19
|
+
const parse_output_1 = require("../parse-output");
|
|
20
|
+
const promisifiedExec = (0, util_1.promisify)(child_process_1.exec);
|
|
21
|
+
class CommandWithRedirectFromFilepathAndReturnedData extends command_with_redirect_from_filepath_1.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 = CommandWithRedirectFromFilepathAndReturnedData;
|
|
45
|
+
//# sourceMappingURL=command-with-redirect-from-filepath-and-returned-data.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"command-with-redirect-from-filepath-and-returned-data.js","sourceRoot":"","sources":["../../../src/common/classes/command-with-redirect-from-filepath-and-returned-data.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AACA,+BAAsC;AACtC,iDAA+C;AAG/C,+CAAsE;AAEtE,gHAA0F;AAC1F,kDAAoE;AAEpE,MAAM,eAAe,GAAG,IAAA,gBAAS,EAAC,oBAAI,CAAC,CAAC;AAExC,MAAqB,8CAElB,SAAQ,6CAAiD;IAE1D,YAAsB,QAAmB,EACnB,MAAwC,EACxC,OAAyB,EACzB,aAAgD,EAChD,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,CAAmC;QAChD,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;AAlCD,iEAkCC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { JSONSchemaType } from 'ajv';
|
|
2
|
+
import { SchemaIds } from '../constants/schemas';
|
|
3
|
+
import { GlobalOptionsWithRequiredFilePath } from '../interfaces/common';
|
|
4
|
+
import Command from './command';
|
|
5
|
+
export default class CommandWithRedirectFromFilepath<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: GlobalOptionsWithRequiredFilePath;
|
|
12
|
+
protected ipCmd: string[];
|
|
13
|
+
constructor(schemaId: SchemaIds, schema: JSONSchemaType<T_CommandOptions>, options: T_CommandOptions, globalOptions: GlobalOptionsWithRequiredFilePath, 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 CommandWithRedirectFromFilepath 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.FilePathGlobalOption, schemas_1.FilePathGlobalOptionSchema, globalOptions);
|
|
31
|
+
this.buildCmd();
|
|
32
|
+
}
|
|
33
|
+
buildCmd() {
|
|
34
|
+
super.buildCmd();
|
|
35
|
+
this._cmd = this.cmd.concat(...[`<`, `${this.globalOptions.filePath}`]);
|
|
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 = CommandWithRedirectFromFilepath;
|
|
53
|
+
//# sourceMappingURL=command-with-redirect-from-filepath.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"command-with-redirect-from-filepath.js","sourceRoot":"","sources":["../../../src/common/classes/command-with-redirect-from-filepath.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AACA,+BAAsC;AACtC,iDAA+C;AAE/C,kDAA6E;AAC7E,+CAA0E;AAE1E,wDAAkE;AAClE,kCAAgE;AAEhE,MAAM,eAAe,GAAG,IAAA,gBAAS,EAAC,oBAAI,CAAC,CAAC;AAExC,MAAqB,+BAAoF,SAAQ,iBAAyB;IACxI,YAAsB,QAAmB,EACnB,MAAwC,EACxC,OAAyB,EACzB,aAAgD,EAChD,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,CAAmC;QAChD,UAAK,GAAL,KAAK,CAAU;QAQnC,IAAA,eAAQ,EAAoC,mBAAS,CAAC,oBAAoB,EAAE,oCAA0B,EAAE,aAAa,CAAC,CAAC;QAEvH,IAAI,CAAC,QAAQ,EAAE,CAAC;IAClB,CAAC;IAEkB,QAAQ;QACzB,KAAK,CAAC,QAAQ,EAAE,CAAC;QAEjB,IAAI,CAAC,IAAI,GAAS,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,GAAG,CAAE,GAAG,EAAE,GAAI,IAAI,CAAC,aAAa,CAAC,QAAS,EAAE,CAAE,CAAC,CAAC;QAClF,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACvC,CAAC;IAEc,IAAI;;YACjB,IAAI,IAAI,CAAC,aAAa,CAAC,MAAM,EAAE;gBAC7B,OAAO,IAAI,CAAC;aACb;YAED,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,eAAe,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;YAE1D,IAAI,CAAC,MAAM,EAAE;gBACX,OAAO,IAAI,CAAC;aACb;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;AAvCD,kDAuCC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { JSONSchemaType } from 'ajv';
|
|
2
|
+
import { SchemaIds } from '../constants/schemas';
|
|
3
|
+
import { GlobalOptionsWithRequiredFilePath } from '../interfaces/common';
|
|
4
|
+
import Command from './command';
|
|
5
|
+
export default class CommandWithRedirectToFilepath<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: GlobalOptionsWithRequiredFilePath;
|
|
12
|
+
protected ipCmd: string[];
|
|
13
|
+
constructor(schemaId: SchemaIds, schema: JSONSchemaType<T_CommandOptions>, options: T_CommandOptions, globalOptions: GlobalOptionsWithRequiredFilePath, 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 CommandWithRedirectToFilepath 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.FilePathGlobalOption, schemas_1.FilePathGlobalOptionSchema, globalOptions);
|
|
31
|
+
this.buildCmd();
|
|
32
|
+
}
|
|
33
|
+
buildCmd() {
|
|
34
|
+
super.buildCmd();
|
|
35
|
+
this._cmd = this.cmd.concat(...[`>`, `${this.globalOptions.filePath}`]);
|
|
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 = CommandWithRedirectToFilepath;
|
|
53
|
+
//# sourceMappingURL=command-with-redirect-to-filepath.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"command-with-redirect-to-filepath.js","sourceRoot":"","sources":["../../../src/common/classes/command-with-redirect-to-filepath.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AACA,+BAAsC;AACtC,iDAA+C;AAE/C,kDAA6E;AAC7E,+CAA0E;AAE1E,wDAAkE;AAClE,kCAAgE;AAEhE,MAAM,eAAe,GAAG,IAAA,gBAAS,EAAC,oBAAI,CAAC,CAAC;AAExC,MAAqB,6BAAkF,SAAQ,iBAAyB;IACtI,YAAsB,QAAmB,EACnB,MAAwC,EACxC,OAAyB,EACzB,aAAgD,EAChD,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,CAAmC;QAChD,UAAK,GAAL,KAAK,CAAU;QAQnC,IAAA,eAAQ,EAAoC,mBAAS,CAAC,oBAAoB,EAAE,oCAA0B,EAAE,aAAa,CAAC,CAAC;QACvH,IAAI,CAAC,QAAQ,EAAE,CAAC;IAClB,CAAC;IAEkB,QAAQ;QACzB,KAAK,CAAC,QAAQ,EAAE,CAAC;QAEjB,IAAI,CAAC,IAAI,GAAS,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,GAAG,CAAE,GAAG,EAAE,GAAI,IAAI,CAAC,aAAa,CAAC,QAAS,EAAE,CAAE,CAAC,CAAC;QAClF,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACvC,CAAC;IAEc,IAAI;;YACjB,IAAI,IAAI,CAAC,aAAa,CAAC,MAAM,EAAE;gBAC7B,OAAO,IAAI,CAAC;aACb;YAED,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,eAAe,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;YAE1D,IAAI,CAAC,MAAM,EAAE;gBACX,OAAO,IAAI,CAAC;aACb;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;AAtCD,gDAsCC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { JSONSchemaType } from 'ajv';
|
|
2
|
+
import { SchemaIds } from '../constants/schemas';
|
|
3
|
+
import { GlobalOptions } from '../interfaces/common';
|
|
4
|
+
import Command from './command';
|
|
5
|
+
export default class CommandWithReturnedData<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: GlobalOptions;
|
|
12
|
+
protected ipCmd: string[];
|
|
13
|
+
constructor(schemaId: SchemaIds, schema: JSONSchemaType<T_CommandOptions>, options: T_CommandOptions, globalOptions: GlobalOptions, ipCmd: string[]);
|
|
14
|
+
exec<T_ReturnData>(): Promise<this | T_ReturnData>;
|
|
15
|
+
}
|