Categorygithub.com/inetaf/netstack
module
0.0.0-20220214151720-7585b01ddccf
Repository: https://github.com/inetaf/netstack.git
Documentation: pkg.go.dev

# README

netstack

This was 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.

UPDATE

This repo is no longer maintained. As of Go 1.17 and its lazy module loading we no longer need it, so we now just use upstream gVisor directly.

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. (Update: as of Go 1.17, this appears to be fixed; see UPDATE above)

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.

# Packages

Package abi describes the interface between a kernel and userspace.
Package atomicbitops provides extensions to the sync/atomic package.
Package bits includes all bit related types and operations.
Package buffer provides the implementation of a buffer view.
Package context defines an internal context type.
Package errors holds the standardized error definition for gVisor.
Package hostarch contains host arch address operations for user memory.
Package linewriter provides an io.Writer which calls an emitter on each line.
Package log implements a library for logging.
Package marshal defines the Marshallable interface for serialize/deserializing go data structures to/from memory, according to the Linux ABI.
Package rand implements a cryptographically secure pseudorandom number generator.
Package refs defines an interface for reference counted objects.
Package refsvfs2 defines an interface for a reference-counted object.
Package safecopy provides an efficient implementation of functions to access memory that may result in SIGSEGV or SIGBUS being sent to the accessor.
Package sighandling contains helpers for handling signals to applications.
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 sync provides synchronization primitives.
Package syserr contains sandbox-internal errors.
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 waiter provides the implementation of a wait queue, where waiters can be enqueued to be notified when an event of interest happens.