Skip to content

Commit

Permalink
add js stub impl
Browse files Browse the repository at this point in the history
  • Loading branch information
willscott committed Sep 10, 2020
1 parent 55bb74e commit 6263a1e
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions netroute_stub.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// A stub routing table conformant interface for js/wasm environments.

// +build js,wasm

package netroute

import (
"net"

"github.com/google/gopacket/routing"
)

func New() (routing.Router, error) {
rtr := &router{}
rtr.ifaces = make(map[int]net.Interface)
rtr.ifaces[0] = net.Interface{}
rtr.addrs = make(map[int]ipAddrs)
rtr.addrs[0] = ipAddrs{}
rtr.v4 = routeSlice{&rtInfo{}}
rtr.v6 = routeSlice{&rtInfo{}}
return rtr, nil
}

0 comments on commit 6263a1e

Please sign in to comment.