Add "IfTAPMode" configuration option to allow selecting TAP mode on supported platforms

This commit is contained in:
Neil Alexander 2018-02-11 21:45:44 +00:00
parent 869997e4c5
commit e9bd98d213
6 changed files with 34 additions and 12 deletions

View file

@ -205,14 +205,14 @@ func (c *Core) DEBUG_getAddr() *address {
return address_addrForNodeID(&c.dht.nodeID)
}
func (c *Core) DEBUG_startTun(ifname string) {
c.DEBUG_startTunWithMTU(ifname, 1280)
func (c *Core) DEBUG_startTun(ifname string, iftapmode bool) {
c.DEBUG_startTunWithMTU(ifname, iftapmode, 1280)
}
func (c *Core) DEBUG_startTunWithMTU(ifname string, mtu int) {
func (c *Core) DEBUG_startTunWithMTU(ifname string, iftapmode bool, mtu int) {
addr := c.DEBUG_getAddr()
straddr := fmt.Sprintf("%s/%v", net.IP(addr[:]).String(), 8*len(address_prefix))
err := c.tun.setup(ifname, straddr, mtu)
err := c.tun.setup(ifname, iftapmode, straddr, mtu)
if err != nil {
panic(err)
}