/GRING

Primary LanguageGoMIT LicenseMIT

Introduction

This repository contains implementation of G-RING: the resilient decentralized communication protocol and systems designs for distributed services.

Installation

  1. 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

Write your own distributed service example

distributed service applications can be implemented on G-RING.

Please refer to examples in G-RING/cmd

Node Creation

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 Message Handlers

//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)

Register Overlay Network Routing Protocol

// 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())

Start the node

// Have the node start listening for new peers.
node.Listen()

Setting parameters

G-RING provides below protocols. Please refer to below named directory on the top directory of G-RING

dual

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

kademlia

Vanilla Kademlia

gossip

standard push based gossip protocol

Supported Platforms

Tested environment:

OS : Ubuntu 18.04 Hardware : Ethernet

Status

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

Students Contributions

VGG_face_group FL application on GRING

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

d3disp

Visualization of overlay network on webbrowser interface by Prabhu Omkar