path: root/tun/netstack/tun.go (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-011-24/+207
| | | | | | | | | | | | | | 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-231-62/+81
| | | | | | | | 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-221-4/+16
| | | | | | | | | | | | | 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>
* tun/netstack: update go mod and remove GSO argumentJason A. Donenfeld2021-05-061-2/+2
| | | | | 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-061-4/+4
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* netstack: introduce new module for gvisor tcp tun adapterJason A. Donenfeld2021-01-211-0/+818
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>