tuntap

package
v0.0.0-...-7757972 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 15, 2016 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Overview

  • This program is free software: you can redistribute it and/or modify

  • it under the terms of the GNU General Public License as published by

  • the Free Software Foundation, either version 3 of the License, or

  • (at your option) any later version. *

  • This program is distributed in the hope that it will be useful,

  • but WITHOUT ANY WARRANTY; without even the implied warranty of

  • MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the

  • GNU General Public License for more details. *

  • You should have received a copy of the GNU General Public License

  • along with this program. If not, see <http://www.gnu.org/licenses/>. *

  • Author: FTwOoO <booobooob@gmail.com>

  • This program is free software: you can redistribute it and/or modify

  • it under the terms of the GNU General Public License as published by

  • the Free Software Foundation, either version 3 of the License, or

  • (at your option) any later version. *

  • This program is distributed in the hope that it will be useful,

  • but WITHOUT ANY WARRANTY; without even the implied warranty of

  • MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the

  • GNU General Public License for more details. *

  • You should have received a copy of the GNU General Public License

  • along with this program. If not, see <http://www.gnu.org/licenses/>. *

  • Author: FTwOoO <booobooob@gmail.com>

+build linux

  • This program is free software: you can redistribute it and/or modify
  • it under the terms of the GNU General Public License as published by
  • the Free Software Foundation, either version 3 of the License, or
  • (at your option) any later version. *
  • This program is distributed in the hope that it will be useful,
  • but WITHOUT ANY WARRANTY; without even the implied warranty of
  • MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  • GNU General Public License for more details. *
  • You should have received a copy of the GNU General Public License
  • along with this program. If not, see <http://www.gnu.org/licenses/>. *
  • Author: FTwOoO <booobooob@gmail.com>

+build linux

  • This program is free software: you can redistribute it and/or modify
  • it under the terms of the GNU General Public License as published by
  • the Free Software Foundation, either version 3 of the License, or
  • (at your option) any later version. *
  • This program is distributed in the hope that it will be useful,
  • but WITHOUT ANY WARRANTY; without even the implied warranty of
  • MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  • GNU General Public License for more details. *
  • You should have received a copy of the GNU General Public License
  • along with this program. If not, see <http://www.gnu.org/licenses/>. *
  • Author: FTwOoO <booobooob@gmail.com>
  • Modification Author: 1AD8BE38F271 <1AD8BE38F271@protonmail.com>

Index

Constants

View Source
const (
	DEFAULT_HWADDR_PREFIX = "01:02:03:04:05:"
	DEFUALT_HWADDR_BRD    = "ff:ff:ff:ff:ff:ff"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Interface

type Interface struct {
	io.ReadWriteCloser
	// contains filtered or unexported fields
}

Interface is a TUN/TAP interface.

func NewTAP

func NewTAP(ifName string) (ifce *Interface, err error)

Create a new TAP interface whose name is ifName. If ifName is empty, a default name (tap0, tap1, ... ) will be assigned. ifName should not exceed 16 bytes.

func NewTUN

func NewTUN(ifName string) (ifce *Interface, err error)

Create a new TUN interface whose name is ifName. If ifName is empty, a default name (tap0, tap1, ... ) will be assigned. ifName should not exceed 16 bytes.

func (*Interface) IP

func (ifce *Interface) IP() net.IP

func (*Interface) IsTAP

func (ifce *Interface) IsTAP() bool

Returns true if ifce is a TAP interface, otherwise returns false;

func (*Interface) IsTUN

func (ifce *Interface) IsTUN() bool

Returns true if ifce is a TUN interface, otherwise returns false;

func (*Interface) Name

func (ifce *Interface) Name() string

Returns the interface name of ifce, e.g. tun0, tap1, etc..

func (*Interface) Net

func (ifce *Interface) Net() net.IPNet

func (*Interface) PeerIP

func (ifce *Interface) PeerIP() net.IP

func (*Interface) ServerSetupNatRules

func (ifce *Interface) ServerSetupNatRules() (err error)

func (*Interface) SetupNetwork

func (ifce *Interface) SetupNetwork(ip net.IP, peer_ip net.IP, subnet net.IPNet, mtu int) (err error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL