wireguard-go/device
Jason A. Donenfeld 8cc99631d0 device: use linked list for per-peer allowed-ip traversal
This makes the IpcGet method much faster.

We also refactor the traversal API to use a callback so that we don't
need to allocate at all. Avoiding allocations we do self-masking on
insertion, which in turn means that split intermediate nodes require a
copy of the bits.

benchmark               old ns/op     new ns/op     delta
BenchmarkUAPIGet-16     3243          2659          -18.01%

benchmark               old allocs     new allocs     delta
BenchmarkUAPIGet-16     35             30             -14.29%

benchmark               old bytes     new bytes     delta
BenchmarkUAPIGet-16     1218          737           -39.49%

This benchmark is good, though it's only for a pair of peers, each with
only one allowedips. As this grows, the delta expands considerably.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2021-01-27 01:48:58 +01:00
..
allowedips.go device: use linked list for per-peer allowed-ip traversal 2021-01-27 01:48:58 +01:00
allowedips_rand_test.go all: use ++ to increment 2021-01-07 14:49:44 +01:00
allowedips_test.go device: remove unused trie test code 2021-01-20 20:03:40 +01:00
bind_test.go device: remove unused fields from DummyDatagram and DummyBind 2021-01-20 20:03:40 +01:00
constants.go replay: account for fqcodel reordering 2020-05-19 17:46:35 -06:00
cookie.go global: update header comments and modules 2020-05-02 02:08:26 -06:00
cookie_test.go global: update header comments and modules 2020-05-02 02:08:26 -06:00
device.go device: use linked list for per-peer allowed-ip traversal 2021-01-27 01:48:58 +01:00
device_test.go device: combine debug and info log levels into 'verbose' 2021-01-26 23:05:48 +01:00
endpoint_test.go global: update header comments and modules 2020-05-02 02:08:26 -06:00
indextable.go device: remove some unnecessary unsafe 2020-07-15 06:59:44 +10:00
ip.go global: update header comments and modules 2020-05-02 02:08:26 -06:00
kdf_test.go global: update header comments and modules 2020-05-02 02:08:26 -06:00
keypair.go device: fix races from changing private_key 2021-01-07 14:49:44 +01:00
logger.go device: combine debug and info log levels into 'verbose' 2021-01-26 23:05:48 +01:00
misc.go global: update header comments and modules 2020-05-02 02:08:26 -06:00
mobilequirks.go device: format a few things 2020-11-06 18:01:27 +01:00
noise-helpers.go global: update header comments and modules 2020-05-02 02:08:26 -06:00
noise-protocol.go device: combine debug and info log levels into 'verbose' 2021-01-26 23:05:48 +01:00
noise-types.go global: update header comments and modules 2020-05-02 02:08:26 -06:00
noise_test.go device: check returned errors from NewPeer in TestNoiseHandshake 2021-01-20 19:57:01 +01:00
peer.go device: use linked list for per-peer allowed-ip traversal 2021-01-27 01:48:58 +01:00
peer_test.go device: avoid copying lock in tests 2020-12-08 14:25:10 -08:00
pools.go all: use ++ to increment 2021-01-07 14:49:44 +01:00
queueconstants_android.go global: update header comments and modules 2020-05-02 02:08:26 -06:00
queueconstants_default.go global: update header comments and modules 2020-05-02 02:08:26 -06:00
queueconstants_ios.go global: update header comments and modules 2020-05-02 02:08:26 -06:00
receive.go device: combine debug and info log levels into 'verbose' 2021-01-26 23:05:48 +01:00
send.go device: combine debug and info log levels into 'verbose' 2021-01-26 23:05:48 +01:00
sticky_default.go device: do not include sticky sockets on android 2020-06-07 01:50:20 -06:00
sticky_linux.go device: use RTMGRP_IPV4_ROUTE to specify multicast groups mask 2020-07-13 17:58:10 -06:00
timers.go device: combine debug and info log levels into 'verbose' 2021-01-26 23:05:48 +01:00
tun.go device: combine debug and info log levels into 'verbose' 2021-01-26 23:05:48 +01:00
tun_test.go global: update header comments and modules 2020-05-02 02:08:26 -06:00
uapi.go device: use linked list for per-peer allowed-ip traversal 2021-01-27 01:48:58 +01:00
version.go version: bump snapshot 2020-11-18 14:24:17 +01:00