Documentation
¶
Overview ¶
Package water is a simple TUN/TAP interface library that efficiently works with standard packages like io, bufio, etc.. Use waterutil with it to work with TUN/TAP packets/frames.
Index ¶
Constants ¶
const ( TUN TAP )
TUN and TAP device types.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
// DeviceType specifies whether the device is a TUN or TAP interface. A
// zero-value is treated as TUN.
DeviceType DeviceType
// PlatformSpecificParams defines parameters that differ on different
// platforms. See comments for the type for more details.
PlatformSpecificParams
}
Config defines parameters required to create a TUN/TAP interface. It's only used when the device is initialized. A zero-value Config is a valid configuration.
type Interface ¶
type Interface struct {
io.ReadWriteCloser
// contains filtered or unexported fields
}
Interface is a TUN/TAP interface.
MultiQueue(Linux kernel > 3.8): With MultiQueue enabled, user should hold multiple interfaces to send/receive packet in parallel. Kernel document about MultiQueue: https://www.kernel.org/doc/Documentation/networking/tuntap.txt
type MacOSDriverProvider ¶
type MacOSDriverProvider int
MacOSDriverProvider enumerates possible MacOS TUN/TAP implementations
const ( // MacOSDriverSystem refers to the default P2P driver MacOSDriverSystem MacOSDriverProvider = 0 // MacOSDriverTunTapOSX refers to the third-party tuntaposx driver // see https://sourceforge.net/p/tuntaposx MacOSDriverTunTapOSX MacOSDriverProvider = 1 )
type PlatformSpecificParams ¶
type PlatformSpecificParams struct {
// Name is the name for the interface to be used.
//
// For TunTapOSXDriver, it should be something like "tap0".
// For SystemDriver, the name should match `utun[0-9]+`, e.g. utun233
Name string
// Driver should be set if an alternative driver is desired
// e.g. TunTapOSXDriver
Driver MacOSDriverProvider
}
PlatformSpecificParams defines parameters in Config that are specific to macOS. A zero-value of such type is valid, yielding an interface with OS defined name. Currently it is not possible to set the interface name in macOS.