| 28 | ) |
| 29 | |
| 30 | type NativeTun struct { |
| 31 | tunFile *os.File |
| 32 | index int32 // if index |
| 33 | errors chan error // async error handling |
| 34 | events chan Event // device related events |
| 35 | netlinkSock int |
| 36 | netlinkCancel *rwcancel.RWCancel |
| 37 | hackListenerClosed sync.Mutex |
| 38 | statusListenersShutdown chan struct{} |
| 39 | batchSize int |
| 40 | vnetHdr bool |
| 41 | udpGSO bool |
| 42 | |
| 43 | closeOnce sync.Once |
| 44 | |
| 45 | nameOnce sync.Once // guards calling initNameCache, which sets following fields |
| 46 | nameCache string // name of interface |
| 47 | nameErr error |
| 48 | |
| 49 | readOpMu sync.Mutex // readOpMu guards readBuff |
| 50 | readBuff [virtioNetHdrLen + 65535]byte // if vnetHdr every read() is prefixed by virtioNetHdr |
| 51 | |
| 52 | writeOpMu sync.Mutex // writeOpMu guards toWrite, tcpGROTable |
| 53 | toWrite []int |
| 54 | tcpGROTable *tcpGROTable |
| 55 | udpGROTable *udpGROTable |
| 56 | } |
| 57 | |
| 58 | func (tun *NativeTun) File() *os.File { |
| 59 | return tun.tunFile |
nothing calls this directly
no outgoing calls
no test coverage detected