code: def open(self):
          
          if not self.closed:
              return
          self.outs = self.ins = open(
              "/dev/net/tun" if LINUX else ("/dev/%s" % self.iface), "r+b",
              buffering=0
          )
          if LINUX:
              from fcntl import ioctl
              # TUNSETIFF = 0x400454ca
              # IFF_TUN = 0x0001
              # IFF_TAP = 0x0002
              # IFF_NO_PI = 0x1000
              ioctl(self.ins, 0x400454ca, struct.pack(
                  "16sH", bytes_encode(self.iface),
                  0x0001 if self.mode_tun else 0x1002,
              ))
          self.closed = False
docs: Open the TUN or TAP device.