<feed xmlns='http://www.w3.org/2005/Atom'>
<title>wireguard-go/tun/tun.go, branch fw/codeQuality</title>
<subtitle>Go implementation of WireGuard</subtitle>
<id>https://git.zx2c4.com/wireguard-go/atom/tun/tun.go?h=fw%2FcodeQuality</id>
<link rel='self' href='https://git.zx2c4.com/wireguard-go/atom/tun/tun.go?h=fw%2FcodeQuality'/>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/wireguard-go/'/>
<updated>2020-05-02T08:08:26Z</updated>
<entry>
<title>global: update header comments and modules</title>
<updated>2020-05-02T08:08:26Z</updated>
<author>
<name>Jason A. Donenfeld</name>
<email>Jason@zx2c4.com</email>
</author>
<published>2020-05-02T08:08:26Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/wireguard-go/commit/?id=db0aa39b765243c6a4ac9a2e348311df9517c0bf'/>
<id>urn:sha1:db0aa39b765243c6a4ac9a2e348311df9517c0bf</id>
<content type='text'>
Signed-off-by: Jason A. Donenfeld &lt;Jason@zx2c4.com&gt;
</content>
</entry>
<entry>
<title>tun: remove TUN prefix from types to reduce stutter elsewhere</title>
<updated>2019-06-14T16:35:57Z</updated>
<author>
<name>Matt Layher</name>
<email>mdlayher@gmail.com</email>
</author>
<published>2019-06-10T21:33:40Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/wireguard-go/commit/?id=1f48971a80f48257e478e532f6971d0557026120'/>
<id>urn:sha1:1f48971a80f48257e478e532f6971d0557026120</id>
<content type='text'>
Signed-off-by: Matt Layher &lt;mdlayher@gmail.com&gt;
</content>
</entry>
<entry>
<title>receive: implement flush semantics</title>
<updated>2019-03-21T20:45:41Z</updated>
<author>
<name>Jason A. Donenfeld</name>
<email>Jason@zx2c4.com</email>
</author>
<published>2019-03-21T20:43:04Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/wireguard-go/commit/?id=6440f010eec82abb9c999771a8f493af44c6b937'/>
<id>urn:sha1:6440f010eec82abb9c999771a8f493af44c6b937</id>
<content type='text'>
</content>
</entry>
<entry>
<title>wintun: Use native Win32 API for I/O</title>
<updated>2019-03-20T23:56:45Z</updated>
<author>
<name>Simon Rozman</name>
<email>simon@rozman.si</email>
</author>
<published>2019-03-20T20:45:40Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/wireguard-go/commit/?id=91b4e909bb5fe6980ec56983247e2bfb9fb70ee6'/>
<id>urn:sha1:91b4e909bb5fe6980ec56983247e2bfb9fb70ee6</id>
<content type='text'>
Signed-off-by: Simon Rozman &lt;simon@rozman.si&gt;
</content>
</entry>
<entry>
<title>tun: allow special methods in NativeTun</title>
<updated>2019-02-28T23:05:57Z</updated>
<author>
<name>Jason A. Donenfeld</name>
<email>Jason@zx2c4.com</email>
</author>
<published>2019-02-28T23:05:57Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/wireguard-go/commit/?id=967d1a0f3d7aae4a0720895a2f6e35156b34214b'/>
<id>urn:sha1:967d1a0f3d7aae4a0720895a2f6e35156b34214b</id>
<content type='text'>
</content>
</entry>
<entry>
<title>tun: use netpoll instead of rwcancel</title>
<updated>2019-02-27T00:52:55Z</updated>
<author>
<name>Jason A. Donenfeld</name>
<email>Jason@zx2c4.com</email>
</author>
<published>2019-02-27T00:48:58Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/wireguard-go/commit/?id=366cbd11a40a6a3fde5d0dc803ca6895859ed188'/>
<id>urn:sha1:366cbd11a40a6a3fde5d0dc803ca6895859ed188</id>
<content type='text'>
The new sysconn function of Go 1.12 makes this possible:

package main

import "log"
import "os"
import "unsafe"
import "time"
import "syscall"
import "sync"
import "golang.org/x/sys/unix"

func main() {
	fd, err := os.OpenFile("/dev/net/tun", os.O_RDWR, 0)
	if err != nil {
		log.Fatal(err)
	}

	var ifr [unix.IFNAMSIZ + 64]byte
	copy(ifr[:], []byte("cheese"))
	*(*uint16)(unsafe.Pointer(&amp;ifr[unix.IFNAMSIZ])) = unix.IFF_TUN

	var errno syscall.Errno
	s, _ := fd.SyscallConn()
	s.Control(func(fd uintptr) {
		_, _, errno = unix.Syscall(
			unix.SYS_IOCTL,
			fd,
			uintptr(unix.TUNSETIFF),
			uintptr(unsafe.Pointer(&amp;ifr[0])),
		)
	})
	if errno != 0 {
		log.Fatal(errno)
	}

	b := [4]byte{}
	wait := sync.WaitGroup{}
	wait.Add(1)
	go func() {
		_, err := fd.Read(b[:])
		log.Print("Read errored: ", err)
		wait.Done()
	}()
	time.Sleep(time.Second)
	log.Print("Closing")
	err = fd.Close()
	if err != nil {
		log.Print("Close errored: " , err)
	}
	wait.Wait()
	log.Print("Exiting")
}
</content>
</entry>
<entry>
<title>tun: use sysconn instead of .Fd with Go 1.12</title>
<updated>2019-02-27T00:34:11Z</updated>
<author>
<name>Jason A. Donenfeld</name>
<email>Jason@zx2c4.com</email>
</author>
<published>2019-02-27T00:06:43Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/wireguard-go/commit/?id=ab0f442dafba417c3a13d883a447e882d7983690'/>
<id>urn:sha1:ab0f442dafba417c3a13d883a447e882d7983690</id>
<content type='text'>
</content>
</entry>
<entry>
<title>Update copyright</title>
<updated>2019-02-05T11:59:42Z</updated>
<author>
<name>Jason A. Donenfeld</name>
<email>Jason@zx2c4.com</email>
</author>
<published>2019-01-02T00:55:51Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/wireguard-go/commit/?id=dff424baf8acc4d2a5858d3947761c5090d8e640'/>
<id>urn:sha1:dff424baf8acc4d2a5858d3947761c5090d8e640</id>
<content type='text'>
</content>
</entry>
<entry>
<title>global: fix up copyright headers</title>
<updated>2018-09-16T16:49:19Z</updated>
<author>
<name>Jason A. Donenfeld</name>
<email>Jason@zx2c4.com</email>
</author>
<published>2018-09-05T21:54:31Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/wireguard-go/commit/?id=5be541d147562bf87f6a9ebd551412d4a6920b4b'/>
<id>urn:sha1:5be541d147562bf87f6a9ebd551412d4a6920b4b</id>
<content type='text'>
</content>
</entry>
<entry>
<title>Move tun to subpackage</title>
<updated>2018-05-23T01:58:27Z</updated>
<author>
<name>Jason A. Donenfeld</name>
<email>Jason@zx2c4.com</email>
</author>
<published>2018-05-23T00:10:54Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/wireguard-go/commit/?id=0a63188afab1dd49380f916963307f9b2efdcac1'/>
<id>urn:sha1:0a63188afab1dd49380f916963307f9b2efdcac1</id>
<content type='text'>
</content>
</entry>
</feed>
