Documentation
¶
Overview ¶
Package dragon contains the core APIs for instantiating a DRAGON node.
DRAGON stands for Decentralized Routing Across Geographic Overlay Network. It is a peer-to-peer network built with the HyParView framework, with variations that encourage the network to naturally cluster where multiple nodes are present in nearby geography.
See the README for a more detailed specification.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultQUICConfig ¶
func DefaultQUICConfig() *quic.Config
DefaultQUICConfig is the default QUIC configuration for a NodeConfig.
Types ¶
type AlreadyConnectedToAddrError ¶
type AlreadyConnectedToAddrError struct {
Addr string
}
AlreadyConnectedToAddrError is returned from *Node.DialAndJoin if the given address is already connected to the current node.
func (AlreadyConnectedToAddrError) Error ¶
func (e AlreadyConnectedToAddrError) Error() string
type AlreadyConnectedToCertError ¶
func (AlreadyConnectedToCertError) Error ¶
func (e AlreadyConnectedToCertError) Error() string
type Node ¶
type Node struct {
// contains filtered or unexported fields
}
Node is a node in the p2p layer. It contains a QUIC listener, and a number of live connections to other nodes.
func NewNode ¶
NewNode returns a new Node with the given configuration. The ctx parameter controls the lifecycle of the Node; cancel the context to stop the node, and then use [(*Node).Wait] to block until all background work has completed.
NewNode returns runtime errors that happen during initialization. Configuration errors cause a panic.
func (*Node) ActiveViewSize ¶
func (*Node) DialAndJoin ¶
DialAndJoin attempts to join the p2p network by sending a Join mesage to addr.
If the contact node makes a neighbor request back and we successfully peer, the returned error is nil.
If the node already has a connection to the given address, the method returns AlreadyConnectedToAddrError.
If the contact node disconnects, we have no indication of whether they chose to forward the join message to their peers. TODO: we should have DisconnectedError or something to specifically indicate that semi-expected disconnect.
func (*Node) UpdateCAs ¶
func (n *Node) UpdateCAs(certs []*x509.Certificate)
UpdateCAs replaces the existing trusted CAs with the given list.
type NodeConfig ¶
type NodeConfig struct { UDPConn *net.UDPConn QUIC *quic.Config // The base TLS configuration to use. // The Node will clone it and modify the clone. TLS *tls.Config InitialTrustedCAs []*x509.Certificate // The address to advertise for this Node // when sending out a Join message. AdvertiseAddr string // The maximum number of incoming connections that can be live // but which have not yet resolved into a peering or have been closed. // If zero, a reasonable default will be used. IncomingPendingConnectionLimit uint8 // Manages the active and passive peers. ViewManager dview.Manager // Externally controlled channel to signal when // this node should initiate an outgoing shuffle. ShuffleSignal <-chan struct{} // Dragon internals write to this channel // to notify the application of connection changes in the active view. ConnectionChanges chan<- dconn.Change }
NodeConfig is the configuration for a Node.
Directories
¶
Path | Synopsis |
---|---|
Package breathcast contains the "breathcast" protocol, providing a gossiping broadcast optimized for dragon.
|
Package breathcast contains the "breathcast" protocol, providing a gossiping broadcast optimized for dragon. |
bcmerkle
Package bcmerkle contains types related to the Merkle trees required for the breathcast protocol.
|
Package bcmerkle contains types related to the Merkle trees required for the breathcast protocol. |
bcmerkle/bcmerkletest
Package bcmerkletest contains compliance tests for types satisyfing interfaces in the bcmerkle package.
|
Package bcmerkletest contains compliance tests for types satisyfing interfaces in the bcmerkle package. |
bcmerkle/bcsha256
Package bcsha256 contains a SHA256-backed implementation of bcmerkle.Hasher.
|
Package bcsha256 contains a SHA256-backed implementation of bcmerkle.Hasher. |
breathcasttest
Package breathcasttest contains utilities for writing tests against the breathcast broadcast protocol.
|
Package breathcasttest contains utilities for writing tests against the breathcast broadcast protocol. |
internal/bci
Package bci contains internal implementation details of the breathcast package.
|
Package bci contains internal implementation details of the breathcast package. |
internal/merkle/cbmt
Package cbmt contains an internal implementation of a "compact binary Merkle tree".
|
Package cbmt contains an internal implementation of a "compact binary Merkle tree". |
Package daddr contains types relevant to addresses for dragon.
|
Package daddr contains types relevant to addresses for dragon. |
Package dcert contains types for dealing with x509 certificates in the context of dragon.
|
Package dcert contains types for dealing with x509 certificates in the context of dragon. |
dcerttest
Package dcerttest contains test utilities for the dcert package.
|
Package dcerttest contains test utilities for the dcert package. |
Package dconn contains types for exposing QUIC connections to the application running on top of dragon.
|
Package dconn contains types for exposing QUIC connections to the application running on top of dragon. |
Package dpubsub contains types for in-application publish-subscribe patterns.
|
Package dpubsub contains types for in-application publish-subscribe patterns. |
Package dragontest contains utilties for testing the dragon package.
|
Package dragontest contains utilties for testing the dragon package. |
Package dview contains types for managing the active and passive views, i.e.
|
Package dview contains types for managing the active and passive views, i.e. |
dviewrand
Package dviewrand contains a Manager satisfying dview.Manager that attempts to have no bias in the active and passive peer set, thereby closely following the protocol as designed in the HyParView whitepaper.
|
Package dviewrand contains a Manager satisfying dview.Manager that attempts to have no bias in the active and passive peer set, thereby closely following the protocol as designed in the HyParView whitepaper. |
dviewtest
Package dviewtest contains test helpers for working with the dview package.
|
Package dviewtest contains test helpers for working with the dview package. |
internal
|
|
dbitset
Package dbitset contains dragon-specific utilities around bitsets.
|
Package dbitset contains dragon-specific utilities around bitsets. |
dcrypto
Package dcrypto contains cryptographic utilities for dragon.
|
Package dcrypto contains cryptographic utilities for dragon. |
dk
Package dk contains the Kernel for the node management.
|
Package dk contains the Kernel for the node management. |
dmsg
Package dmsg contains simple types relating to messages and the transport layer (such as dcert or QUIC connections and streams).
|
Package dmsg contains simple types relating to messages and the transport layer (such as dcert or QUIC connections and streams). |
dpeerset
Package dpeerset contains types for interacting with peer sets.
|
Package dpeerset contains types for interacting with peer sets. |
dpeerset/dfanout
Package dfanout contains types for managing fanout work from the peer sets.
|
Package dfanout contains types for managing fanout work from the peer sets. |
dpeerset/dpeersettest
Package dpeersettest contains helpers for testing the dpeerset package.
|
Package dpeersettest contains helpers for testing the dpeerset package. |
dprotoi
Package dprotoi contains internal protocol messages for dragon.
|
Package dprotoi contains internal protocol messages for dragon. |
dprotoi/dbootstrap
Package dbootstrap contains functionality that is shared between multiple, otherwise independent, other bootstrap-related packages.
|
Package dbootstrap contains functionality that is shared between multiple, otherwise independent, other bootstrap-related packages. |
dprotoi/dbootstrap/dbsacceptjoin
Package dbsacceptjoin contains the types for handling protocol bootstrap, specifically to accept a join message.
|
Package dbsacceptjoin contains the types for handling protocol bootstrap, specifically to accept a join message. |
dprotoi/dbootstrap/dbsacceptneighbor
Package dbsacceptneighbor contains the types for handling protocol bootstrap, specifically to accept a neighbor message.
|
Package dbsacceptneighbor contains the types for handling protocol bootstrap, specifically to accept a neighbor message. |
dprotoi/dbootstrap/dbsinbound
Package dbsinbound contains the types for handling protocol bootstrap, speifically accepting an inbound connection before we have received the first message on the bootstrap stream.
|
Package dbsinbound contains the types for handling protocol bootstrap, speifically accepting an inbound connection before we have received the first message on the bootstrap stream. |
dprotoi/dbootstrap/dbssendjoin
Package dbssendjoin contains the types for handling protocol bootstrap, specifically to send a join message to a contact node.
|
Package dbssendjoin contains the types for handling protocol bootstrap, specifically to send a join message to a contact node. |
dprotoi/dbootstrap/dbssendneighbor
Package dbssendneighbor contains the types for handling protocol bootstrap, specifically to send a neighbor message to a candidate node.
|
Package dbssendneighbor contains the types for handling protocol bootstrap, specifically to send a neighbor message to a candidate node. |
dprotoi/dpadmission
Package dpadmission is the protocol for the admission stream.
|
Package dpadmission is the protocol for the admission stream. |
dprotoi/dpdynamic
Package dpdynamic handles dynamic streams opened on-demand.
|
Package dpdynamic handles dynamic streams opened on-demand. |
dprotoi/dpshuffle
Package dpshuffle contains the protocol to initiate an outbound shuffle on a specific QUIC connection, using a dynamically created stream.
|
Package dpshuffle contains the protocol to initiate an outbound shuffle on a specific QUIC connection, using a dynamically created stream. |
dquic
Package dquic contains common functionality for QUIC types shared in both the root dragon package and some test packages around QUIC.
|
Package dquic contains common functionality for QUIC types shared in both the root dragon package and some test packages around QUIC. |
dquic/dquictest
Package dquictest contains stub implementations of quic interfaces.
|
Package dquictest contains stub implementations of quic interfaces. |
dquicwrap
Package dquicwrap declares QUIC wrapper types to ensure the quic.Connection values exposed to the application are able to interoperate with the low level streams managed internally by the dragon stack.
|
Package dquicwrap declares QUIC wrapper types to ensure the quic.Connection values exposed to the application are able to interoperate with the low level streams managed internally by the dragon stack. |
dtest
Package dtest contains general test helpers.
|
Package dtest contains general test helpers. |
Package wingspan contains the "wingspan" protocol, providing an epidemic-style gossip where the application controls "facts" that need to propagate through the network.
|
Package wingspan contains the "wingspan" protocol, providing an epidemic-style gossip where the application controls "facts" that need to propagate through the network. |
wingspantest
Package wingspantest contains utilities for testing the wingspan package.
|
Package wingspantest contains utilities for testing the wingspan package. |
wspacket
Package wspacket contains types related to managing packets for the [wingspan] package.
|
Package wspacket contains types related to managing packets for the [wingspan] package. |
wspacket/wspackettest
Package wspackettest contains types useful for tests involving the wspacket package.
|
Package wspackettest contains types useful for tests involving the wspacket package. |