Age | Commit message (Collapse) | Author | |
---|---|---|---|
2019-03-07 | tun: linux: work out netpoll trick | Jason A. Donenfeld | |
2019-03-04 | tun: import mobile particularities | Jason A. Donenfeld | |
2019-03-01 | tun: allow special methods in NativeTun | Jason A. Donenfeld | |
2019-02-27 | tun: linux: netpoll is broken for tun's epoll | Jason A. Donenfeld | |
So this mostly reverts the switch to Sysconn for Linux. Issue: https://github.com/golang/go/issues/30426 | |||
2019-02-27 | tun: linux: netlink sock needs cleaning up but file will be gc'd | Jason A. Donenfeld | |
2019-02-27 | tun: use netpoll instead of rwcancel | Jason A. Donenfeld | |
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(&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(&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") } | |||
2019-02-27 | tun: use sysconn instead of .Fd with Go 1.12 | Jason A. Donenfeld | |
2019-02-18 | Change package path | Jason A. Donenfeld | |
2019-02-05 | Update copyright | Jason A. Donenfeld | |
2018-12-06 | tun: remove nonblock hack for linux | Jason A. Donenfeld | |
This is no longer necessary and actually breaks things Reported-by: Chris Branch <cbranch@cloudflare.com> | |||
2018-10-17 | tun: only call .Fd() once | Jason A. Donenfeld | |
Doing so tends to make the tunnel blocking, so we only retrieve it once before we call SetNonblock, and then cache the result. | |||
2018-09-16 | global: fix up copyright headers | Jason A. Donenfeld | |
2018-07-30 | Fix duplicate copyright line | Jason A. Donenfeld | |
2018-05-24 | Catch EINTR | Jason A. Donenfeld | |
2018-05-23 | Adopt GOPATH | Jason A. Donenfeld | |
GOPATH is annoying, but the Go community pushing me to adopt it is even more annoying. | |||
2018-05-23 | Move tun to subpackage | Jason A. Donenfeld | |