Documentation
¶
Overview ¶
Package tun implements TUN interface operations on system level.
Example (Create) ¶
package main
import (
"log"
"net"
"github.com/goxray/core/network/tun"
)
func main() {
ifc, err := tun.New("utun123", 1500)
if err != nil {
log.Fatal(err)
}
defer ifc.Close()
addr := &net.IPNet{IP: net.IPv4(192, 18, 0, 1)}
if err := ifc.Up(addr, addr.IP); err != nil {
log.Fatal(err)
}
// Interface will be destroyed upon exiting the program...
}
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Interface ¶
type Interface struct {
// contains filtered or unexported fields
}
Interface is a TUN/TAP interface.
func New ¶
New creates a new TUN interface.
On macOS the device name will be assigned dynamically if you pass an empty name string.
func (*Interface) Close ¶
Close closes fd. Close call is recommended to close the socket and destroy the interface.
Click to show internal directories.
Click to hide internal directories.