netstack

module
v0.0.0-...-6a88ae7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 16, 2021 License: Apache-2.0, MIT

README

netstack

This is a "fork" of https://github.com/google/gvisor, extracting out just the "netstack" networking bits, which previously were self-contained at https://github.com/google/netstack.

Why?

Because gVisor's go.mod is gigantic and causes problems to people trying to use it as a library.

Arguably Go's tooling is also somewhat to blame: Go doesn't make it easy (or even possible) to use a subset (a few packages) out of a mega module like gVisor without getting impacted by otherwise-unrelated requirements of that dependent module.

Specifically, Tailscale wanted to use gVisor's tcpip networking packages, which worked fine for a while, but then one day we bumped our gVisor version to pull in a bug fix we needed (from the networking-related part of gVisor), and that ended up making us pull in new conflicting versions of etcd. Why? Because somewhere in that go.mod Docker or grpc or Kubernetes or whatever depended on etcd somehow. Who knows. We spent too long trying to fix it and gave up.

Our fix is this repo, pulling netstack out of gvisor like it used to be, with a small go.mod.

Contributing

We don't accept contributions. This repo isn't human-maintained. It's synced from gVisor's "go" branch. In fact, the flow looks like:

  • humans maintain gVisor inside Google's internal monorepo (let's call it googletree)
  • some scripts inside Google export //googletree/gvisor/... out into GitHub occasionally
  • oh, but googletree uses Bazel, not the cmd/go Go tool
  • so some other scripts rearrange the GitHub repo into the gVisor "go" branch (https://github.com/google/gvisor/#using-go-get)
  • some of our scripts then take that "go" rearrangement tree and delete all the Linux and Docker and container stuff, leaving behind only the networking stuff

License

Same as gVisor.

Directories

Path Synopsis
Package atomicbitops provides extensions to the sync/atomic package.
Package atomicbitops provides extensions to the sync/atomic package.
Package buffer provides the implementation of a buffer view.
Package buffer provides the implementation of a buffer view.
Package gohacks contains utilities for subverting the Go compiler.
Package gohacks contains utilities for subverting the Go compiler.
Package goid provides the Get function.
Package goid provides the Get function.
Package linewriter provides an io.Writer which calls an emitter on each line.
Package linewriter provides an io.Writer which calls an emitter on each line.
Package log implements a library for logging.
Package log implements a library for logging.
Package rand implements a cryptographically secure pseudorandom number generator.
Package rand implements a cryptographically secure pseudorandom number generator.
Package sleep allows goroutines to efficiently sleep on multiple sources of notifications (wakers).
Package sleep allows goroutines to efficiently sleep on multiple sources of notifications (wakers).
Package state provides functionality related to saving and loading object graphs.
Package state provides functionality related to saving and loading object graphs.
wire
Package wire contains a few basic types that can be composed to serialize graph information for the state package.
Package wire contains a few basic types that can be composed to serialize graph information for the state package.
Package sync provides synchronization primitives.
Package sync provides synchronization primitives.
Package tcpip provides the interfaces and related types that users of the tcpip stack will use in order to create endpoints used to send and receive data over the network stack.
Package tcpip provides the interfaces and related types that users of the tcpip stack will use in order to create endpoints used to send and receive data over the network stack.
adapters/gonet
Package gonet provides a Go net package compatible wrapper for a tcpip stack.
Package gonet provides a Go net package compatible wrapper for a tcpip stack.
buffer
Package buffer provides the implementation of a buffer view.
Package buffer provides the implementation of a buffer view.
faketime
Package faketime provides a fake clock that implements tcpip.Clock interface.
Package faketime provides a fake clock that implements tcpip.Clock interface.
hash/jenkins
Package jenkins implements Jenkins's one_at_a_time, non-cryptographic hash functions created by by Bob Jenkins.
Package jenkins implements Jenkins's one_at_a_time, non-cryptographic hash functions created by by Bob Jenkins.
header
Package header provides the implementation of the encoding and decoding of network protocol headers.
Package header provides the implementation of the encoding and decoding of network protocol headers.
header/parse
Package parse provides utilities to parse packets.
Package parse provides utilities to parse packets.
link/channel
Package channel provides the implemention of channel-based data-link layer endpoints.
Package channel provides the implemention of channel-based data-link layer endpoints.
link/ethernet
Package ethernet provides an implementation of an ethernet link endpoint that wraps an inner link endpoint.
Package ethernet provides an implementation of an ethernet link endpoint that wraps an inner link endpoint.
link/loopback
Package loopback provides the implemention of loopback data-link layer endpoints.
Package loopback provides the implemention of loopback data-link layer endpoints.
link/muxed
Package muxed provides a muxed link endpoints.
Package muxed provides a muxed link endpoints.
link/nested
Package nested provides helpers to implement the pattern of nested stack.LinkEndpoints.
Package nested provides helpers to implement the pattern of nested stack.LinkEndpoints.
link/packetsocket
Package packetsocket provides a link layer endpoint that provides the ability to loop outbound packets to any AF_PACKET sockets that may be interested in the outgoing packet.
Package packetsocket provides a link layer endpoint that provides the ability to loop outbound packets to any AF_PACKET sockets that may be interested in the outgoing packet.
link/pipe
Package pipe provides the implementation of pipe-like data-link layer endpoints.
Package pipe provides the implementation of pipe-like data-link layer endpoints.
link/qdisc/fifo
Package fifo provides the implementation of data-link layer endpoints that wrap another endpoint and queues all outbound packets and asynchronously dispatches them to the lower endpoint.
Package fifo provides the implementation of data-link layer endpoints that wrap another endpoint and queues all outbound packets and asynchronously dispatches them to the lower endpoint.
link/rawfile
Package rawfile contains utilities for using the netstack with raw host files on Linux hosts.
Package rawfile contains utilities for using the netstack with raw host files on Linux hosts.
link/sharedmem
Package sharedmem provides the implemention of data-link layer endpoints backed by shared memory.
Package sharedmem provides the implemention of data-link layer endpoints backed by shared memory.
link/sharedmem/pipe
Package pipe implements a shared memory ring buffer on which a single reader and a single writer can operate (read/write) concurrently.
Package pipe implements a shared memory ring buffer on which a single reader and a single writer can operate (read/write) concurrently.
link/sharedmem/queue
Package queue provides the implementation of transmit and receive queues based on shared memory ring buffers.
Package queue provides the implementation of transmit and receive queues based on shared memory ring buffers.
link/sniffer
Package sniffer provides the implementation of data-link layer endpoints that wrap another endpoint and logs inbound and outbound packets.
Package sniffer provides the implementation of data-link layer endpoints that wrap another endpoint and logs inbound and outbound packets.
link/waitable
Package waitable provides the implementation of data-link layer endpoints that wrap other endpoints, and can wait for inflight calls to WritePacket or DeliverNetworkPacket to finish (and new ones to be prevented).
Package waitable provides the implementation of data-link layer endpoints that wrap other endpoints, and can wait for inflight calls to WritePacket or DeliverNetworkPacket to finish (and new ones to be prevented).
network/arp
Package arp implements the ARP network protocol.
Package arp implements the ARP network protocol.
network/hash
Package hash contains utility functions for hashing.
Package hash contains utility functions for hashing.
network/internal/fragmentation
Package fragmentation contains the implementation of IP fragmentation.
Package fragmentation contains the implementation of IP fragmentation.
network/internal/ip
Package ip holds IPv4/IPv6 common utilities.
Package ip holds IPv4/IPv6 common utilities.
network/ipv4
Package ipv4 contains the implementation of the ipv4 network protocol.
Package ipv4 contains the implementation of the ipv4 network protocol.
network/ipv6
Package ipv6 contains the implementation of the ipv6 network protocol.
Package ipv6 contains the implementation of the ipv6 network protocol.
ports
Package ports provides PortManager that manages allocating, reserving and releasing ports.
Package ports provides PortManager that manages allocating, reserving and releasing ports.
seqnum
Package seqnum defines the types and methods for TCP sequence numbers such that they fit in 32-bit words and work properly when overflows occur.
Package seqnum defines the types and methods for TCP sequence numbers such that they fit in 32-bit words and work properly when overflows occur.
stack
Package stack provides the glue between networking protocols and the consumers of the networking stack.
Package stack provides the glue between networking protocols and the consumers of the networking stack.
transport/icmp
Package icmp contains the implementation of the ICMP and IPv6-ICMP transport protocols for use in ping.
Package icmp contains the implementation of the ICMP and IPv6-ICMP transport protocols for use in ping.
transport/packet
Package packet provides the implementation of packet sockets (see packet(7)).
Package packet provides the implementation of packet sockets (see packet(7)).
transport/raw
Package raw provides the implementation of raw sockets (see raw(7)).
Package raw provides the implementation of raw sockets (see raw(7)).
transport/tcp
Package tcp contains the implementation of the TCP transport protocol.
Package tcp contains the implementation of the TCP transport protocol.
transport/tcpconntrack
Package tcpconntrack implements a TCP connection tracking object.
Package tcpconntrack implements a TCP connection tracking object.
transport/udp
Package udp contains the implementation of the UDP transport protocol.
Package udp contains the implementation of the UDP transport protocol.
Package waiter provides the implementation of a wait queue, where waiters can be enqueued to be notified when an event of interest happens.
Package waiter provides the implementation of a wait queue, where waiters can be enqueued to be notified when an event of interest happens.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL