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,134 @@
|
|
|
1
|
+
import { GlobalOptions } from '../common/interfaces/common';
|
|
2
|
+
import { RoutingTable, RoutingTableOptions } from './routing-tables.interfaces';
|
|
3
|
+
/**
|
|
4
|
+
* List routing tables.
|
|
5
|
+
*
|
|
6
|
+
* @param options - Parameters options to be passed down to `ip`.
|
|
7
|
+
* @param globalOptions - Global parameters options that affects the command execution.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
*
|
|
11
|
+
* Import module
|
|
12
|
+
* ```
|
|
13
|
+
* import { utils } from 'iproutejs';
|
|
14
|
+
* ```
|
|
15
|
+
*
|
|
16
|
+
* Show all tables
|
|
17
|
+
* ```
|
|
18
|
+
* const tables = await utils.routingTables.show();
|
|
19
|
+
* ```
|
|
20
|
+
*
|
|
21
|
+
* Show table with `id` 255
|
|
22
|
+
* ```
|
|
23
|
+
* const tables = await utils.routingTables.show({
|
|
24
|
+
* id: 255
|
|
25
|
+
* });
|
|
26
|
+
* ```
|
|
27
|
+
*
|
|
28
|
+
* Show table with `name` `local`
|
|
29
|
+
* ```
|
|
30
|
+
* const tables = await show({
|
|
31
|
+
* name: RoutingTables.Local
|
|
32
|
+
* });
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
35
|
+
export declare function show(options?: RoutingTableOptions, globalOptions?: GlobalOptions): Promise<RoutingTable[]>;
|
|
36
|
+
/**
|
|
37
|
+
* Add a routing table.
|
|
38
|
+
*
|
|
39
|
+
* @param options - Parameters options to be passed down to `ip`.
|
|
40
|
+
* @param globalOptions - Global parameters options that affects the command execution.
|
|
41
|
+
*
|
|
42
|
+
* @example
|
|
43
|
+
*
|
|
44
|
+
* Import module
|
|
45
|
+
* ```
|
|
46
|
+
* import { utils } from 'iproutejs';
|
|
47
|
+
* ```
|
|
48
|
+
*
|
|
49
|
+
* Add a single table
|
|
50
|
+
* ```
|
|
51
|
+
* await utils.routingTables.add({
|
|
52
|
+
* id: 50,
|
|
53
|
+
* name: 'table_name'
|
|
54
|
+
* });
|
|
55
|
+
* ```
|
|
56
|
+
*
|
|
57
|
+
* Add more than one table
|
|
58
|
+
* ```
|
|
59
|
+
* await utils.routingTables.add([{
|
|
60
|
+
* id: 50,
|
|
61
|
+
* name: 'table_name'
|
|
62
|
+
* }, {
|
|
63
|
+
* id: 51,
|
|
64
|
+
* name: 'table_name2'
|
|
65
|
+
* }]);
|
|
66
|
+
* ```
|
|
67
|
+
*/
|
|
68
|
+
export declare function add(options: RoutingTableOptions | RoutingTableOptions[], globalOptions?: GlobalOptions): Promise<void>;
|
|
69
|
+
/**
|
|
70
|
+
* Delete a routing table.
|
|
71
|
+
*
|
|
72
|
+
* @param options - Parameters options to be passed down to `ip`.
|
|
73
|
+
* @param globalOptions - Global parameters options that affects the command execution.
|
|
74
|
+
*
|
|
75
|
+
* @example
|
|
76
|
+
*
|
|
77
|
+
* Import module
|
|
78
|
+
* ```
|
|
79
|
+
* import { utils } from 'iproutejs';
|
|
80
|
+
* ```
|
|
81
|
+
*
|
|
82
|
+
* It will remove the specified table if it exists
|
|
83
|
+
* ```
|
|
84
|
+
* await utils.routingTables.delete({
|
|
85
|
+
* id: 50
|
|
86
|
+
* });
|
|
87
|
+
* ```
|
|
88
|
+
*
|
|
89
|
+
* Delete more than one table
|
|
90
|
+
* ```
|
|
91
|
+
* await utils.routingTables.delete([{
|
|
92
|
+
* id: 51
|
|
93
|
+
* }, {
|
|
94
|
+
* id: 52
|
|
95
|
+
* }]);
|
|
96
|
+
* ```
|
|
97
|
+
*/
|
|
98
|
+
export declare function del(options: RoutingTableOptions | RoutingTableOptions[], globalOptions?: GlobalOptions): Promise<void>;
|
|
99
|
+
/**
|
|
100
|
+
* Delete all routing tables.
|
|
101
|
+
*
|
|
102
|
+
* @param globalOptions - Global parameters options that affects the command execution.
|
|
103
|
+
*
|
|
104
|
+
* @example
|
|
105
|
+
*
|
|
106
|
+
* Import module
|
|
107
|
+
* ```
|
|
108
|
+
* import { utils } from 'iproutejs';
|
|
109
|
+
* ```
|
|
110
|
+
*
|
|
111
|
+
* Clear all tables
|
|
112
|
+
* ```
|
|
113
|
+
* await utils.routingTables.clear();
|
|
114
|
+
* ```
|
|
115
|
+
*
|
|
116
|
+
* Flush route cache so the changes become active
|
|
117
|
+
* ```
|
|
118
|
+
* import { route } from 'iproutejs';
|
|
119
|
+
*
|
|
120
|
+
* await utils.routingTables.clear();
|
|
121
|
+
*
|
|
122
|
+
* await route.flush({
|
|
123
|
+
* table: RouteRoutingTables.Cache
|
|
124
|
+
* });
|
|
125
|
+
* ```
|
|
126
|
+
*/
|
|
127
|
+
export declare function clear(globalOptions?: GlobalOptions): Promise<void>;
|
|
128
|
+
declare const _default: {
|
|
129
|
+
show: typeof show;
|
|
130
|
+
add: typeof add;
|
|
131
|
+
del: typeof del;
|
|
132
|
+
clear: typeof clear;
|
|
133
|
+
};
|
|
134
|
+
export default _default;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Routing table.
|
|
3
|
+
* @category Interfaces
|
|
4
|
+
*/
|
|
5
|
+
export interface RoutingTable {
|
|
6
|
+
id: number;
|
|
7
|
+
name: string;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Routing table options
|
|
11
|
+
* @category Interfaces
|
|
12
|
+
*/
|
|
13
|
+
export interface RoutingTableOptions {
|
|
14
|
+
id?: number;
|
|
15
|
+
name?: string;
|
|
16
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"routing-tables.interfaces.js","sourceRoot":"","sources":["../../src/utils/routing-tables.interfaces.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,243 @@
|
|
|
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.clear = exports.del = exports.add = exports.show = void 0;
|
|
16
|
+
const fs_1 = require("fs");
|
|
17
|
+
const lodash_isplainobject_1 = __importDefault(require("lodash.isplainobject"));
|
|
18
|
+
const routing_tables_constants_1 = require("./routing-tables.constants");
|
|
19
|
+
const misc_1 = require("../common/misc");
|
|
20
|
+
const schemas_1 = require("../common/constants/schemas");
|
|
21
|
+
const routing_tables_schemas_1 = require("./routing-tables.schemas");
|
|
22
|
+
function parseTables(rawData) {
|
|
23
|
+
if (!rawData) {
|
|
24
|
+
return [];
|
|
25
|
+
}
|
|
26
|
+
const tables = [];
|
|
27
|
+
const output = rawData
|
|
28
|
+
.split('\n')
|
|
29
|
+
.filter(line => line && line.charAt(0) !== '#');
|
|
30
|
+
for (const line of output) {
|
|
31
|
+
const fields = line.trim().split(/\s+/);
|
|
32
|
+
const table = {
|
|
33
|
+
id: Number(fields[0]),
|
|
34
|
+
name: fields[1]
|
|
35
|
+
};
|
|
36
|
+
tables.push(table);
|
|
37
|
+
}
|
|
38
|
+
return tables;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* List routing tables.
|
|
42
|
+
*
|
|
43
|
+
* @param options - Parameters options to be passed down to `ip`.
|
|
44
|
+
* @param globalOptions - Global parameters options that affects the command execution.
|
|
45
|
+
*
|
|
46
|
+
* @example
|
|
47
|
+
*
|
|
48
|
+
* Import module
|
|
49
|
+
* ```
|
|
50
|
+
* import { utils } from 'iproutejs';
|
|
51
|
+
* ```
|
|
52
|
+
*
|
|
53
|
+
* Show all tables
|
|
54
|
+
* ```
|
|
55
|
+
* const tables = await utils.routingTables.show();
|
|
56
|
+
* ```
|
|
57
|
+
*
|
|
58
|
+
* Show table with `id` 255
|
|
59
|
+
* ```
|
|
60
|
+
* const tables = await utils.routingTables.show({
|
|
61
|
+
* id: 255
|
|
62
|
+
* });
|
|
63
|
+
* ```
|
|
64
|
+
*
|
|
65
|
+
* Show table with `name` `local`
|
|
66
|
+
* ```
|
|
67
|
+
* const tables = await show({
|
|
68
|
+
* name: RoutingTables.Local
|
|
69
|
+
* });
|
|
70
|
+
* ```
|
|
71
|
+
*/
|
|
72
|
+
function show(options = {}, globalOptions = {}) {
|
|
73
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
74
|
+
(0, misc_1.validate)(schemas_1.SchemaIds.RoutingTablesOptions, routing_tables_schemas_1.RoutingTableOptionsSchema, options);
|
|
75
|
+
(0, misc_1.validate)(schemas_1.SchemaIds.GlobalOptions, schemas_1.GlobalOptionsSchema, globalOptions);
|
|
76
|
+
const fileContent = yield fs_1.promises.readFile(routing_tables_constants_1.tablesPath, { encoding: 'utf8' });
|
|
77
|
+
let tables = parseTables(fileContent);
|
|
78
|
+
// Filter tables if options were given.
|
|
79
|
+
if (options.id) {
|
|
80
|
+
tables = tables.filter(item => item.id === options.id);
|
|
81
|
+
}
|
|
82
|
+
if (options.name) {
|
|
83
|
+
tables = tables.filter(item => item.name === options.name);
|
|
84
|
+
}
|
|
85
|
+
return tables;
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
exports.show = show;
|
|
89
|
+
/**
|
|
90
|
+
* Add a routing table.
|
|
91
|
+
*
|
|
92
|
+
* @param options - Parameters options to be passed down to `ip`.
|
|
93
|
+
* @param globalOptions - Global parameters options that affects the command execution.
|
|
94
|
+
*
|
|
95
|
+
* @example
|
|
96
|
+
*
|
|
97
|
+
* Import module
|
|
98
|
+
* ```
|
|
99
|
+
* import { utils } from 'iproutejs';
|
|
100
|
+
* ```
|
|
101
|
+
*
|
|
102
|
+
* Add a single table
|
|
103
|
+
* ```
|
|
104
|
+
* await utils.routingTables.add({
|
|
105
|
+
* id: 50,
|
|
106
|
+
* name: 'table_name'
|
|
107
|
+
* });
|
|
108
|
+
* ```
|
|
109
|
+
*
|
|
110
|
+
* Add more than one table
|
|
111
|
+
* ```
|
|
112
|
+
* await utils.routingTables.add([{
|
|
113
|
+
* id: 50,
|
|
114
|
+
* name: 'table_name'
|
|
115
|
+
* }, {
|
|
116
|
+
* id: 51,
|
|
117
|
+
* name: 'table_name2'
|
|
118
|
+
* }]);
|
|
119
|
+
* ```
|
|
120
|
+
*/
|
|
121
|
+
function add(options, globalOptions = {}) {
|
|
122
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
123
|
+
let tablesToAdd = [];
|
|
124
|
+
if ((0, lodash_isplainobject_1.default)(options)) {
|
|
125
|
+
tablesToAdd.push(options);
|
|
126
|
+
}
|
|
127
|
+
else {
|
|
128
|
+
tablesToAdd = options;
|
|
129
|
+
}
|
|
130
|
+
for (let newTable of tablesToAdd) {
|
|
131
|
+
(0, misc_1.validate)(schemas_1.SchemaIds.RoutingTablesOptions, routing_tables_schemas_1.RoutingTableOptionsSchema, newTable);
|
|
132
|
+
}
|
|
133
|
+
(0, misc_1.validate)(schemas_1.SchemaIds.GlobalOptions, schemas_1.GlobalOptionsSchema, globalOptions);
|
|
134
|
+
const tables = yield show();
|
|
135
|
+
let toAppend = '';
|
|
136
|
+
for (let newTable of tablesToAdd) {
|
|
137
|
+
const existingTable = tables.find(table => table.id === newTable.id || table.name === newTable.name);
|
|
138
|
+
if (existingTable) {
|
|
139
|
+
// The table is already there, so exit silently.
|
|
140
|
+
continue;
|
|
141
|
+
}
|
|
142
|
+
toAppend += `${newTable.id}\t${newTable.name}\n`;
|
|
143
|
+
}
|
|
144
|
+
yield fs_1.promises.appendFile(routing_tables_constants_1.tablesPath, toAppend);
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
exports.add = add;
|
|
148
|
+
/**
|
|
149
|
+
* Delete a routing table.
|
|
150
|
+
*
|
|
151
|
+
* @param options - Parameters options to be passed down to `ip`.
|
|
152
|
+
* @param globalOptions - Global parameters options that affects the command execution.
|
|
153
|
+
*
|
|
154
|
+
* @example
|
|
155
|
+
*
|
|
156
|
+
* Import module
|
|
157
|
+
* ```
|
|
158
|
+
* import { utils } from 'iproutejs';
|
|
159
|
+
* ```
|
|
160
|
+
*
|
|
161
|
+
* It will remove the specified table if it exists
|
|
162
|
+
* ```
|
|
163
|
+
* await utils.routingTables.delete({
|
|
164
|
+
* id: 50
|
|
165
|
+
* });
|
|
166
|
+
* ```
|
|
167
|
+
*
|
|
168
|
+
* Delete more than one table
|
|
169
|
+
* ```
|
|
170
|
+
* await utils.routingTables.delete([{
|
|
171
|
+
* id: 51
|
|
172
|
+
* }, {
|
|
173
|
+
* id: 52
|
|
174
|
+
* }]);
|
|
175
|
+
* ```
|
|
176
|
+
*/
|
|
177
|
+
function del(options, globalOptions = {}) {
|
|
178
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
179
|
+
let tablesToDelete = [];
|
|
180
|
+
if ((0, lodash_isplainobject_1.default)(options)) {
|
|
181
|
+
tablesToDelete.push(options);
|
|
182
|
+
}
|
|
183
|
+
else {
|
|
184
|
+
tablesToDelete = options;
|
|
185
|
+
}
|
|
186
|
+
for (let tableToDelete of tablesToDelete) {
|
|
187
|
+
(0, misc_1.validate)(schemas_1.SchemaIds.RoutingTablesOptions, routing_tables_schemas_1.RoutingTableOptionsSchema, tableToDelete);
|
|
188
|
+
}
|
|
189
|
+
(0, misc_1.validate)(schemas_1.SchemaIds.GlobalOptions, schemas_1.GlobalOptionsSchema, globalOptions);
|
|
190
|
+
const oldTables = yield show();
|
|
191
|
+
const newTables = oldTables.filter(oldTable => {
|
|
192
|
+
let foundIndex = tablesToDelete.findIndex((tableToDelete) => {
|
|
193
|
+
return tableToDelete.id === oldTable.id || tableToDelete.name === oldTable.name;
|
|
194
|
+
});
|
|
195
|
+
return foundIndex === -1;
|
|
196
|
+
});
|
|
197
|
+
const toWrite = newTables.map(table => `${table.id}\t${table.name}`).join('\n') + '\n';
|
|
198
|
+
yield fs_1.promises.writeFile(routing_tables_constants_1.tablesPath, toWrite);
|
|
199
|
+
});
|
|
200
|
+
}
|
|
201
|
+
exports.del = del;
|
|
202
|
+
/**
|
|
203
|
+
* Delete all routing tables.
|
|
204
|
+
*
|
|
205
|
+
* @param globalOptions - Global parameters options that affects the command execution.
|
|
206
|
+
*
|
|
207
|
+
* @example
|
|
208
|
+
*
|
|
209
|
+
* Import module
|
|
210
|
+
* ```
|
|
211
|
+
* import { utils } from 'iproutejs';
|
|
212
|
+
* ```
|
|
213
|
+
*
|
|
214
|
+
* Clear all tables
|
|
215
|
+
* ```
|
|
216
|
+
* await utils.routingTables.clear();
|
|
217
|
+
* ```
|
|
218
|
+
*
|
|
219
|
+
* Flush route cache so the changes become active
|
|
220
|
+
* ```
|
|
221
|
+
* import { route } from 'iproutejs';
|
|
222
|
+
*
|
|
223
|
+
* await utils.routingTables.clear();
|
|
224
|
+
*
|
|
225
|
+
* await route.flush({
|
|
226
|
+
* table: RouteRoutingTables.Cache
|
|
227
|
+
* });
|
|
228
|
+
* ```
|
|
229
|
+
*/
|
|
230
|
+
function clear(globalOptions = {}) {
|
|
231
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
232
|
+
(0, misc_1.validate)(schemas_1.SchemaIds.GlobalOptions, schemas_1.GlobalOptionsSchema, globalOptions);
|
|
233
|
+
yield fs_1.promises.writeFile(routing_tables_constants_1.tablesPath, '');
|
|
234
|
+
});
|
|
235
|
+
}
|
|
236
|
+
exports.clear = clear;
|
|
237
|
+
exports.default = {
|
|
238
|
+
show,
|
|
239
|
+
add,
|
|
240
|
+
del,
|
|
241
|
+
clear
|
|
242
|
+
};
|
|
243
|
+
//# sourceMappingURL=routing-tables.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"routing-tables.js","sourceRoot":"","sources":["../../src/utils/routing-tables.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2BAAoC;AACpC,gFAAiD;AAEjD,yEAAwD;AAOxD,yCAA0C;AAC1C,yDAA6E;AAC7E,qEAAqE;AAErE,SAAS,WAAW,CAAC,OAAe;IAClC,IAAI,CAAC,OAAO,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;;;;;;;;;;;;;;;;;;GA2BG;AACH,SAAsB,KAAK,CAAC,gBAA+B,EAAE;;QAC3D,IAAA,eAAQ,EAAgB,mBAAS,CAAC,aAAa,EAAE,6BAAmB,EAAE,aAAa,CAAC,CAAC;QAErF,MAAM,aAAE,CAAC,SAAS,CAAC,qCAAU,EAAE,EAAE,CAAC,CAAC;IACrC,CAAC;CAAA;AAJD,sBAIC;AAED,kBAAe;IACb,IAAI;IACJ,GAAG;IACH,GAAG;IACH,KAAK;CACN,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RoutingTableOptionsSchema = void 0;
|
|
4
|
+
const schemas_1 = require("../common/constants/schemas");
|
|
5
|
+
exports.RoutingTableOptionsSchema = {
|
|
6
|
+
$id: schemas_1.SchemaIds.RoutingTablesOptions,
|
|
7
|
+
type: 'object',
|
|
8
|
+
required: [],
|
|
9
|
+
properties: {
|
|
10
|
+
id: {
|
|
11
|
+
type: 'integer',
|
|
12
|
+
minimum: 0,
|
|
13
|
+
nullable: true
|
|
14
|
+
},
|
|
15
|
+
name: {
|
|
16
|
+
type: 'string',
|
|
17
|
+
minLength: 1,
|
|
18
|
+
nullable: true
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
//# sourceMappingURL=routing-tables.schemas.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"routing-tables.schemas.js","sourceRoot":"","sources":["../../src/utils/routing-tables.schemas.ts"],"names":[],"mappings":";;;AAEA,yDAAwD;AAG3C,QAAA,yBAAyB,GAAwC;IAC5E,GAAG,EAAS,mBAAS,CAAC,oBAAoB;IAC1C,IAAI,EAAQ,QAAQ;IACpB,QAAQ,EAAI,EAAE;IACd,UAAU,EAAE;QACV,EAAE,EAAI;YACJ,IAAI,EAAM,SAAS;YACnB,OAAO,EAAG,CAAC;YACX,QAAQ,EAAE,IAAI;SACf;QACD,IAAI,EAAE;YACJ,IAAI,EAAO,QAAQ;YACnB,SAAS,EAAE,CAAC;YACZ,QAAQ,EAAG,IAAI;SAChB;KACF;CACF,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "iproutejs",
|
|
3
|
+
"version": "2.3.0",
|
|
4
|
+
"description": "Show and manipulate network devices, addresses, routing, policy routing, tunnels, IP forwarding, address labels and other `iproute` objects.",
|
|
5
|
+
"main": "./lib/index.js",
|
|
6
|
+
"types": "./lib/index.d.ts",
|
|
7
|
+
"scripts": {
|
|
8
|
+
|
|
9
|
+
"build:ts": "npm run clean && npx tsc --project tsconfig.json",
|
|
10
|
+
"clean": "npx rimraf ./lib",
|
|
11
|
+
"test": "npm run test:safe",
|
|
12
|
+
"test:all": "npm run build && npx mocha --spec=./__tests__/**/*.ts",
|
|
13
|
+
"test:safe": "npm run build && npx mocha --spec=./__tests__/safe/**/*.ts",
|
|
14
|
+
"test:exec": "npm run build && npx mocha --spec=./__tests__/exec/**/*.ts",
|
|
15
|
+
"test:github-actions": "npm run build && npx mocha --spec='./__tests__/**/*.ts' --exclude='./__tests__/exec/utils/**/*.ts' --exclude='./__tests__/exec/commands/monitor.ts'",
|
|
16
|
+
"docs": "npx typedoc --options typedoc.config.json"
|
|
17
|
+
},
|
|
18
|
+
"keywords": [
|
|
19
|
+
"device",
|
|
20
|
+
"interface",
|
|
21
|
+
"address",
|
|
22
|
+
"route",
|
|
23
|
+
"routing",
|
|
24
|
+
"ip",
|
|
25
|
+
"iproute",
|
|
26
|
+
"iproute2",
|
|
27
|
+
"tunnel",
|
|
28
|
+
"network",
|
|
29
|
+
"monitor",
|
|
30
|
+
"link",
|
|
31
|
+
"vlan",
|
|
32
|
+
"rule",
|
|
33
|
+
"rpdb",
|
|
34
|
+
"table",
|
|
35
|
+
"monitor",
|
|
36
|
+
"network",
|
|
37
|
+
"networking",
|
|
38
|
+
"utils",
|
|
39
|
+
"forwarding",
|
|
40
|
+
"addrlabel",
|
|
41
|
+
"neighbour",
|
|
42
|
+
"neigh",
|
|
43
|
+
"neighbour",
|
|
44
|
+
"ntable",
|
|
45
|
+
"tuntap",
|
|
46
|
+
"maddress",
|
|
47
|
+
"mroute",
|
|
48
|
+
"batch"
|
|
49
|
+
],
|
|
50
|
+
"dependencies": {
|
|
51
|
+
"ajv": "^8.12.0",
|
|
52
|
+
"ajv-formats": "^2.1.1",
|
|
53
|
+
"lodash.isplainobject": "^4.0.6"
|
|
54
|
+
},
|
|
55
|
+
"engines": {
|
|
56
|
+
"node": ">=14.0.0"
|
|
57
|
+
},
|
|
58
|
+
"homepage": "https://github.com/jakguel/iproutejs",
|
|
59
|
+
"bugs": {
|
|
60
|
+
"url": "https://github.com/jakguel/iproutejs/issues"
|
|
61
|
+
},
|
|
62
|
+
"author": {
|
|
63
|
+
"name": "Diosney Sarmiento",
|
|
64
|
+
"email": "diosney.s@gmail.com"
|
|
65
|
+
},
|
|
66
|
+
"license": "MIT",
|
|
67
|
+
"repository": {
|
|
68
|
+
"type": "git",
|
|
69
|
+
"url": "https://github.com/jakguel/iproutejs.git"
|
|
70
|
+
},
|
|
71
|
+
"funding": {
|
|
72
|
+
"type": "ko-fi",
|
|
73
|
+
"url": "https://ko-fi.com/diosney"
|
|
74
|
+
},
|
|
75
|
+
"files": [
|
|
76
|
+
"lib/"
|
|
77
|
+
],
|
|
78
|
+
"devDependencies": {
|
|
79
|
+
"@types/ajv": "^1.0.0",
|
|
80
|
+
"@types/chai": "^4.3.5",
|
|
81
|
+
"@types/lodash.isplainobject": "^4.0.7",
|
|
82
|
+
"@types/mocha": "^10.0.1",
|
|
83
|
+
"@types/node": "^18.17.5",
|
|
84
|
+
"chai": "^4.3.7",
|
|
85
|
+
"mocha": "^10.2.0",
|
|
86
|
+
"rimraf": "^5.0.1",
|
|
87
|
+
"source-map-support": "^0.5.21",
|
|
88
|
+
"ts-node": "^10.9.1",
|
|
89
|
+
"typedoc": "^0.25.0",
|
|
90
|
+
"typescript": "^5.1.6"
|
|
91
|
+
}
|
|
92
|
+
}
|