UNPKG

493 BJavaScriptView Raw
1import iproute from 'iproute'
2
3let route = {
4 type: 'unicast',
5 to: '224.0.0.0/4',
6 scope: 'link'
7}
8
9export function add(args, callback) {
10 route.dev = args.interface
11 iproute.route.add(route, (err) => {
12 if (err) console.log(err)
13 if (typeof callback == 'function') callback()
14 })
15}
16
17export function del(args, callback) {
18 route.dev = args.interface
19 iproute.route.delete(route, (err) => {
20 if (err) console.log(err)
21 if (typeof callback == 'function') callback()
22 })
23}