This repository contains implementation of G-RING: the resilient decentralized communication protocol and systems designs for distributed services.
- Install Go This repository is valided with, but not limited to, go1.16
wget https://golang.org/dl/go1.16.linux-amd64.tar.gz
sudo tar -C /usr/local -xzf go1.16.linux-amd64.tar.gz
distributed service applications can be implemented on G-RING.
Please refer to examples in G-RING/cmd
This is a G-RING core data structure that contains management resources such as event handling(e.g., connection management), message handler, overlay network.
node, err = GRING.NewNode(
GRING.WithNodeBindHost(net.ParseIP(host)),
GRING.WithNodeBindPort(uint16(port)),
GRING.WithNodeMaxRecvMessageSize(1<<24),
)
//Register the chatMessage structure to the node with an associated unmarshal function.
node.RegisterMessage(chatMessage{}, unmarshalChatMessage)
// Register a message handler to the node.
node.Handle(handle)
// This example uses Dual protocol.
events = dual.Events{
OnPeerAdmitted: func(id GRING.ID) {
fmt.Printf("Learned about a new peer %s(%s).\n", id.Address, id.ID.String()[:printedLength])
}
OnPeerEvicted: func(id GRING.ID) {
fmt.Printf("Forgotten a peer %s(%s).\n", id.Address, id.ID.String()[:printedLength])
},
}
// register above events handlers to Dual
overlay = dual.New(dual.WithProtocolEvents(events)
// Bind Dual Overlay to the node.
node.Bind(overlay.Protocol())
// Have the node start listening for new peers.
node.Listen()
G-RING provides below protocols. Please refer to below named directory on the top directory of G-RING
Default routing and messaging protocol for G-RING. It provides three communication protocols and two types of overlays.
Communication protocols
A. P2P Backbone Connection Management Protocol
B. P2P Backbone General Purpose Communication Protocol
C. P2P Application Communication Protocol
Overlays
A. Backbone overlay
B. Application overlay
Vanilla Kademlia
standard push based gossip protocol
Tested environment:
OS : Ubuntu 18.04 Hardware : Ethernet
The code is provided as is, without warranty or support.
Some of codes(e.g., Kademlia, gossip protocol) are from Noise https://github.com/perlin-network/noise
Federated Learning for face recognition with Kaggle VGG face2 dataset https://www.kaggle.com/greatgamedota/vggface2-test by Prabhy Omkar, Pawar Rohan, Okechukwu Chima, Dumay Alice Jeanne Mi and Sirpurkar Saurab
Visualization of overlay network on webbrowser interface by Prabhu Omkar