Commit Graph

58 Commits

Author SHA1 Message Date
Kusakabe Si db8cf4710a reorder config, 3.3, genp2p 2021-12-10 00:09:50 +00:00
Kusakabe Si d555963227 fast spread, static gencfg 2021-12-09 07:46:15 +00:00
Kusakabe Si 0be4e84f8d DampingResistance 2021-12-07 20:39:19 +00:00
Kusakabe Si 18d019725c Fase generate and 2 new API 2021-12-05 22:02:49 +00:00
Kusakabe Si e3113149aa Set IP to interface via ioctl 2021-12-05 00:09:49 +00:00
Kusakabe Si c1133c9a69 http based pong_msg 2021-12-03 20:16:18 +00:00
KusakabeSi 06b7ea1edb Static mode for supernode,dump packet, update readme, add code of concept 2021-09-30 21:44:07 +00:00
KusakabeSi 2ac7c0547d std bind, http api, hole punching, domain endpoint, faster reaction, psk 2021-09-23 11:31:01 +00:00
KusakabeSi a26376cec5 add/del peer dynamically 2021-09-21 20:03:11 +00:00
KusakabeSi 29b53884ba shrink header to inc MTU to 1416 2021-09-21 01:31:11 +00:00
KusakabeSi d8f7cb1b60 First release 2021-08-26 12:40:53 +00:00
KusakabeSi 5fbb065897 no-vpp version 2021-08-26 11:20:54 +00:00
KusakabeSi 4443b8bddf Path solver and beta release 2021-08-25 18:20:35 +00:00
KusakabeSi d717d35f64 LinuxTap, not test yet 2021-08-24 12:37:37 +00:00
KusakabeSi 4939f9f0c4 Not test yet 2021-08-21 14:23:27 +00:00
KusakabeSi 87a62f873b TAP and routeing 2021-08-16 19:37:15 +00:00
KusakabeSi 7801b56b41 rename module 2021-08-16 19:36:46 +00:00
Jason A. Donenfeld 3988821442 main: print kernel warning on OpenBSD and FreeBSD too
More kernels!

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2021-04-15 23:35:45 -06:00
Jason A. Donenfeld a4f8e83d5d conn: make binds replacable
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2021-02-23 20:00:57 +01:00
Jason A. Donenfeld d4112d9096 global: bump copyright
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2021-01-28 17:52:15 +01:00
Jason A. Donenfeld bf3bb88851 device: remove version string
This is what modules are for, and Go binaries can introspect.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2021-01-28 17:23:39 +01:00
Jason A. Donenfeld d669c78c43 device: combine debug and info log levels into 'verbose'
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-26 23:05:48 +01:00
Josh Bleecher Snyder 7139279cd0 device: change logging interface to use functions
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>
2021-01-26 22:40:20 +01:00
Jason A. Donenfeld da9d300cf8 main: now that we're upstreamed, relax Linux warning
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2020-05-02 02:20:47 -06:00
Jason A. Donenfeld db0aa39b76 global: update header comments and modules
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2020-05-02 02:08:26 -06:00
Jason A. Donenfeld 84b5a4d83d main: simplify warnings 2019-09-08 10:56:00 -05:00
Matt Layher 1f48971a80 tun: remove TUN prefix from types to reduce stutter elsewhere
Signed-off-by: Matt Layher <mdlayher@gmail.com>
2019-06-14 18:35:57 +02:00
Jason A. Donenfeld 3bf41b06ae global: regroup all imports 2019-05-14 09:09:52 +02:00
Jason A. Donenfeld d9078fe772 main: revise warnings 2019-04-19 07:48:09 +09:00
Jason A. Donenfeld 69f0fe67b6 global: begin modularization 2019-03-03 05:00:40 +01:00
Jason A. Donenfeld 366cbd11a4 tun: use netpoll instead of rwcancel
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 01:52:55 +01:00
Jason A. Donenfeld 42c6d0e261 Change package path 2019-02-18 05:11:39 +01:00
Jason A. Donenfeld 6f76edd045 Import windows scafolding 2019-02-05 12:59:42 +01:00
Jason A. Donenfeld dff424baf8 Update copyright 2019-02-05 12:59:42 +01:00
Jason A. Donenfeld 5be541d147 global: fix up copyright headers 2018-09-16 18:49:19 +02:00
Jason A. Donenfeld 955e89839f Print version number in log 2018-05-30 01:09:18 +02:00
Jason A. Donenfeld 2f2eca8947 Catch EINTR 2018-05-24 15:36:29 +02:00
Jason A. Donenfeld 4a9de3218e Add undocumented --version flag 2018-05-24 02:25:36 +02:00
Jason A. Donenfeld 588b9f01ae Adopt GOPATH
GOPATH is annoying, but the Go community pushing me to adopt it is even
more annoying.
2018-05-23 05:18:13 +02:00
Jason A. Donenfeld 0a63188afa Move tun to subpackage 2018-05-23 03:58:27 +02:00
Filippo Valsorda bc05eb1c3c Minor main.go signal fixes
* 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-21 20:22:12 +02:00
Mathias Hall-Andersen 38accea986 Add copyright headers 2018-05-19 02:40:22 +02:00
Jason A. Donenfeld 115a2e3946 Use /dev/null as place holder 2018-05-14 20:06:33 +02:00
Jason A. Donenfeld a62c770a99 Ugly hack to suppress warning on backgrounded process 2018-05-14 16:01:58 +02:00
Jason A. Donenfeld 795f76cffa Netlink sockets can't be shutdown 2018-05-14 14:08:03 +02:00
Jason A. Donenfeld 355e9bd619 Clean more 2018-05-14 12:27:29 +02:00
Jason A. Donenfeld c1e097d6d0 Optional logging even in background 2018-05-14 03:38:06 +02:00
Jason A. Donenfeld 233f079a94 Rewrite timers and related state machines 2018-05-10 16:08:03 +02:00
Mathias Hall-Andersen abe2651ad5 Removed remaining signals from peer
1. Removed remaining signals from peer struct
2. Made needAnotherKeepalive local
3. Removed environment check from warning text (annoying when debugging)
2018-05-05 22:07:58 +02:00
Mathias Hall-Andersen 7a83f2565a Removed old signals 2018-05-05 04:15:07 +02:00