summaryrefslogtreecommitdiffhomepage
path: root/main.go
AgeCommit message (Collapse)Author
2021-02-23conn: make binds replacableJason A. Donenfeld
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2021-01-28global: bump copyrightJason A. Donenfeld
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2021-01-28device: remove version stringJason A. Donenfeld
This is what modules are for, and Go binaries can introspect. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2021-01-26device: combine debug and info log levels into 'verbose'Jason A. Donenfeld
There are very few cases, if any, in which a user only wants one of these levels, so combine it into a single level. While we're at it, reduce indirection on the loggers by using an empty function rather than a nil function pointer. It's not like we have retpolines anyway, and we were always calling through a function with a branch prior, so this seems like a net gain. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2021-01-26device: change logging interface to use functionsJosh Bleecher Snyder
This commit overhauls wireguard-go's logging. The primary, motivating change is to use a function instead of a *log.Logger as the basic unit of logging. Using functions provides a lot more flexibility for people to bring their own logging system. It also introduces logging helper methods on Device. These reduce line noise at the call site. They also allow for log functions to be nil; when nil, instead of generating a log line and throwing it away, we don't bother generating it at all. This spares allocation and pointless work. This is a breaking change, although the fix required of clients is fairly straightforward. Signed-off-by: Josh Bleecher Snyder <josh@tailscale.com>
2020-05-02main: now that we're upstreamed, relax Linux warningJason A. Donenfeld
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2020-05-02global: update header comments and modulesJason A. Donenfeld
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2019-09-08main: simplify warningsJason A. Donenfeld
2019-06-14tun: remove TUN prefix from types to reduce stutter elsewhereMatt Layher
Signed-off-by: Matt Layher <mdlayher@gmail.com>
2019-05-14global: regroup all importsJason A. Donenfeld
2019-04-19main: revise warningsJason A. Donenfeld
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