Categorygithub.com/weaveworks/mesh
modulepackage
0.0.0-20191105120815-58dbcc3e8e63
Repository: https://github.com/weaveworks/mesh.git
Documentation: pkg.go.dev

# README

mesh GoDoc Circle CI

Mesh is a tool for building distributed applications.

Mesh implements a gossip protocol that provide membership, unicast, and broadcast functionality with eventually-consistent semantics. In CAP terms, it is AP: highly-available and partition-tolerant.

Mesh works in a wide variety of network setups, including thru NAT and firewalls, and across clouds and datacenters. It works in situations where there is only partial connectivity, i.e. data is transparently routed across multiple hops when there is no direct connection between peers. It copes with partitions and partial network failure. It can be easily bootstrapped, typically only requiring knowledge of a single existing peer in the mesh to join. It has built-in shared-secret authentication and encryption. It scales to on the order of 100 peers, and has no dependencies.

Using

Mesh is currently distributed as a Go package. See the API documentation.

We plan to offer Mesh as a standalone service + an easy-to-use API. We will support multiple deployment scenarios, including as a standalone binary, as a container, as an ambassador or sidecar component to an existing container, and as an infrastructure service in popular platforms.

Developing

Mesh builds with the standard Go tooling. You will need to put the repository in Go's expected directory structure; i.e., $GOPATH/src/github.com/weaveworks/mesh.

Building

If necessary, you may fetch the latest version of all of the dependencies into your GOPATH via

go get -d -u -t ./...

Build the code with the usual

go install ./...

Testing

Assuming you've fetched dependencies as above,

go test ./...

Dependencies

Mesh is a library, designed to be imported into a binary package. Vendoring is currently the best way for binary package authors to ensure reliable, reproducible builds. Therefore, we strongly recommend our users use vendoring for all of their dependencies, including Mesh. To avoid compatibility and availability issues, Mesh doesn't vendor its own dependencies, and doesn't recommend use of third-party import proxies.

There are several tools to make vendoring easier, including gb, gvt, glide, and govendor.

Workflow

Mesh follows a typical PR workflow. All contributions should be made as pull requests that satisfy the guidelines, below.

Guidelines

  • All code must abide Go Code Review Comments
  • Names should abide What's in a name
  • Code must build on both Linux and Darwin, via plain go build
  • Code should have appropriate test coverage, invoked via plain go test

In addition, several mechanical checks are enforced. See the lint script for details.

Getting Help

If you have any questions about, feedback for or problems with mesh:

Your feedback is always welcome!

# Packages

No description provided by the author
No description provided by the author

# Functions

NewRouter returns a new router.
NewStatus returns a Status object, taken as a snapshot from the router.
PeerNameFromBin parses PeerName from a byte slice.
PeerNameFromString parses PeerName from a generic string.
PeerNameFromUserInput parses PeerName from a user-provided string.

# Constants

NameSize is the number of bytes in a peer name.
PeerNameFlavour is the type of peer names we use.
Protocol identifies a sort of major version of the protocol.
ProtocolGossip identifies a pure gossip msg.
ProtocolGossipBroadcast identifies a gossip (broadcast) msg.
ProtocolGossipUnicast identifies a gossip (unicast) msg.
ProtocolHeartbeat identifies a heartbeat msg.
ProtocolMaxVersion establishes the highest protocol version among peers that we're willing to try to communicate with.
ProtocolMinVersion establishes the lowest protocol version among peers that we're willing to try to communicate with.
ProtocolOverlayControlMsg identifies a control msg.
ProtocolReserved1 is a legacy overly control message.
ProtocolReserved2 is a legacy overly control message.
ProtocolReserved3 is a legacy overly control message.
UnknownPeerName is used as a sentinel value.

# Variables

ChannelSize is the buffer size used by so-called actor goroutines throughout mesh.
Port is the port used for all mesh communication.

# Structs

Config defines dimensions of configuration for the router.
LocalConnection is the local (our) side of a connection.
LocalConnectionStatus is the current state of a physical connection to a peer.
NullOverlay implements Overlay and OverlayConnection with no-ops.
OverlayConnectionParams are used to set up overlay connections.
Peer is a local representation of a peer, including connections to other peers.
PeerDescription collects information about peers that is useful to clients.
Peers collects all of the known peers in the mesh, including ourself.
PeerStatus is the current state of a peer in the mesh.
Router manages communication between this peer and the rest of the mesh.
Status is our current state as a peer, as taken from a router.

# Interfaces

Connection describes a link between peers.
Gossip is the sending interface.
GossipData is a merge-able dataset.
Gossiper is the receiving interface.
Logger is a simple interface used by mesh to do logging.
Overlay yields OverlayConnections.
OverlayConnection describes all of the machinery to manage overlay connectivity to a particular peer.

# Type aliases

PeerName is used as a map key.
PeerShortID exists for the sake of fast datapath.
PeerUID uniquely identifies a peer in a mesh.