summaryrefslogtreecommitdiffhomepage
path: root/main.go
AgeCommit message (Collapse)Author
2019-03-03global: begin modularizationJason A. Donenfeld
2019-02-27tun: use netpoll instead of rwcancelJason 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-18Change package pathJason A. Donenfeld
2019-02-05Import windows scafoldingJason A. Donenfeld
2019-02-05Update copyrightJason A. Donenfeld
2018-09-16global: fix up copyright headersJason A. Donenfeld
2018-05-30Print version number in logJason A. Donenfeld
2018-05-24Catch EINTRJason A. Donenfeld
2018-05-24Add undocumented --version flagJason A. Donenfeld
2018-05-23Adopt GOPATHJason A. Donenfeld
GOPATH is annoying, but the Go community pushing me to adopt it is even more annoying.
2018-05-23Move tun to subpackageJason A. Donenfeld
2018-05-21Minor main.go signal fixesFilippo Valsorda
* Buffer the signal channel as it's non-blocking on the sender side * Notify on SIGTERM instead of the uncatchable SIGKILL License: MIT Signed-off-by: Filippo Valsorda <valsorda@google.com>
2018-05-19Add copyright headersMathias Hall-Andersen
2018-05-14Use /dev/null as place holderJason A. Donenfeld
2018-05-14Ugly hack to suppress warning on backgrounded processJason A. Donenfeld
2018-05-14Netlink sockets can't be shutdownJason A. Donenfeld
2018-05-14Clean moreJason A. Donenfeld
2018-05-14Optional logging even in backgroundJason A. Donenfeld
2018-05-10Rewrite timers and related state machinesJason A. Donenfeld
2018-05-05Removed remaining signals from peerMathias Hall-Andersen
1. Removed remaining signals from peer struct 2. Made needAnotherKeepalive local 3. Removed environment check from warning text (annoying when debugging)
2018-05-05Removed old signalsMathias Hall-Andersen
2018-05-04uapi: use kqueue for sock deletion on darwinJason A. Donenfeld
2018-05-04tun: allow darwin to auto assign namesJason A. Donenfeld
2018-05-04warning: put into mainJason A. Donenfeld
2018-05-03global: Add SPDX tags and copyright headerJason A. Donenfeld
Mathias should probably add his copyright headers to each file too.
2018-05-03Daemonize with environment variableJason A. Donenfeld
2018-05-03Start to dust off DarwinJason A. Donenfeld
2018-04-19We can determine the interface name ourselvesJason A. Donenfeld
2018-02-04Align with go library layoutMathias Hall-Andersen