MCPcopy
hub / github.com/WireGuard/wireguard-go / Read

Method Read

tun/tun_darwin.go:204–220  ·  view source on GitHub ↗
(bufs [][]byte, sizes []int, offset int)

Source from the content-addressed store, hash-verified

202}
203
204func (tun *NativeTun) Read(bufs [][]byte, sizes []int, offset int) (int, error) {
205 // TODO: the BSDs look very similar in Read() and Write(). They should be
206 // collapsed, with platform-specific files containing the varying parts of
207 // their implementations.
208 select {
209 case err := <-tun.errors:
210 return 0, err
211 default:
212 buf := bufs[0][offset-4:]
213 n, err := tun.tunFile.Read(buf[:])
214 if n < 4 {
215 return 0, err
216 }
217 sizes[0] = n - 4
218 return 1, err
219 }
220}
221
222func (tun *NativeTun) Write(bufs [][]byte, offset int) (int, error) {
223 if offset < 4 {

Callers

nothing calls this directly

Calls 1

ReadMethod · 0.65

Tested by

no test coverage detected