aboutsummaryrefslogtreecommitdiffstats
path: root/tun/netstack (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Handle whole ICMP headerstp/icmp-fixestqbf2022-02-021-21/+3
| | | | | | | | | | Theoretically, this change would allow us to send ICMP replies from these sockets. In practice, netstack filters anything but EchoRequest, so this change mostly just adds annoyance right now. But in the future, netstack might fix this, and this API would then work for more than one use case. Signed-off-by: Thomas Ptacek <thomas@sockpuppet.org>
* fix addressing and deadlinestqbf2022-02-021-16/+61
| | | | | | | | | - setting a now deadline unblocks a blocked read - setting a specific deadline over a previous deadline honors the new one - WriteTo will accept a net.Addr, not just a PingAddr Signed-off-by: Thomas Ptacek <thomas@sockpuppet.org>
* tun/netstack: implement ICMP pingThomas H. Ptacek2022-02-012-24/+264
| | | | | | | | | | | | | | Provide a PacketConn interface for netstack's ICMP endpoint; netstack currently only provides EchoRequest/EchoResponse ICMP support, so this code exposes only an interface for doing ping. Currently is missing: - Write deadlines - Context support Signed-off-by: Thomas Ptacek <thomas@sockpuppet.org> [Jason: rework structure, match std go interfaces, add example code] Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* global: apply gofumptJason A. Donenfeld2021-12-091-2/+5
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* global: use netip where possible nowJason A. Donenfeld2021-11-235-67/+94
| | | | | | | | There are more places where we'll need to add it later, when Go 1.18 comes out with support for it in the "net" package. Also, allowedips still uses slices internally, which might be suboptimal. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* tun/netstack: update gvisorMikael Magnusson2021-10-223-22/+403
| | | | | | | | | | | | | Update gvisor to v0.0.0-20211020211948-f76a604701b6, which requires some changes to tun.go: WriteRawPacket: Add function with not implemented error. CreateNetTUN: Replace stack.AddAddress with stack.AddProtocolAddress, and fix IPv6 address in error message. Signed-off-by: Mikael Magnusson <mikma@users.sourceforge.net> Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* global: remove old-style build tagsJason A. Donenfeld2021-10-122-2/+0
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* global: add newer-style build tagsJason A. Donenfeld2021-10-122-0/+2
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* tun/netstack: update go mod and remove GSO argumentJason A. Donenfeld2021-05-063-16/+18
| | | | | Reported-by: John Xiong <xiaoyang1258@yeah.net> Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* tun/netstack: bump deps and apiJason A. Donenfeld2021-03-065-40/+257
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* device: return error from Up() and Down()Jason A. Donenfeld2021-02-101-1/+4
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* netstack: further sequester with own go.mod and go.sumJason A. Donenfeld2021-01-212-0/+400
| | | | | | | | In order to avoid even the flirtation with passing on these dependencies to ordinary consumers of wireguard-go, this commit makes a new go.mod that's entirely separate from the root one. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* netstack: introduce new module for gvisor tcp tun adapterJason A. Donenfeld2021-01-213-0/+916
The Go linker isn't smart enough to prevent gvisor from being pulled into modules that use other parts of tun/, due to the types exposed. So, we put this into its own standalone module. We use this as an opportunity to introduce some example code as well. I'm still not happy that this not only clutters this repo's go.sum, but all the other projects that consume it, but it seems like making a new module inside of this repo will lead to even greater confusion. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>