Tuntap::Device
Inherits Tuntap::Interface / Reference / Object
Describes a TUN/TAP device. Some methods may need additional permissions, please make sure to read them before something "doesn't work".
Constants
Path to the clone device. May be different for non-Linux systems.
Constructors
Creates a brand new device or opens an existing one. To create a new one, the user needs to have one of these:
- root permissions (The effective UID is
0, or user is a system user) - the CAP_NET_ADMIN permission
To open an existing device, the requirements are these:
- The device already exists
- The device is owned by this process's UNIX user
- The user has read/write permissions on
/dev/net/tun - The flags match those used to create the device
If creation fails, an Errno is raised.
If the device_name is nil, one is automatically chosen by the system.
If given, its length must be <= 16. As for the flags, exactly one of
Tun or Tap must be set. If any of these are violated, an
ArgumentError is raised.
Instance methods
Reads from the device, putting the data into buffer. Returns the slice trimmed down to the size of the received packet.