Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sharing neighbors #1

Open
stefanocudini opened this issue Jul 17, 2022 · 1 comment
Open

sharing neighbors #1

stefanocudini opened this issue Jul 17, 2022 · 1 comment

Comments

@stefanocudini
Copy link

stefanocudini commented Jul 17, 2022

hi,

you did a great job with this little bookcase, congratulations!

how can I make the nodes share their neighbors with each other so that the network grows automatically

I had the following this steps in mind:

  1. one node start with some default nodes as a seeds, of which you know ip and port, hardcoded of by config file
  2. create a new type of message that sends the list of neighbors, for example it can be named 'discover'
  3. create a loop that interrogates your neighbors to ask them what their respective neighbors are and connect to them

I'm not sure how to start art code, can I ask you for a suggestion? are the above steps right?

@koteisaev
Copy link

Each node can respond to handshake message with some kind of hello message, but this will not be just nodes list. It must work like list list of

{
me: {
  name: "Display name?",
  alias: "this_node_unique_name",
   signature: "base64url-bytes",
   refifier: "base64Url-bytes" 
},
peers: [ { 
   name: "some readable name", 
   alias: "other_unique_name", 
   seen: 1670794121448,
   signature: "base64url-bytes",
   verifier: "base64Url-bytes" 
} ]
}

I placed here more data than necessary for your question, but I guess, that most important in that data is these parts:

  1. distinction between info about replying node (the me property) and its peers, in the peers property.
  2. the seen property is like last time any message received by this_node_unique_name from other_unique_name.
    But joining node more likely to be bombarded with lots of replies, hello messages like this.

Imagine nodes bob, alice, and mike. Here mary comes and broadcasts her handshake message. This means that eventually mary will get hello messages from all them, identical or not, it depends from situation, because bob and mike for example can know henry but not know julia known to alice who knows nothing about henry. Joining node, mary can include list of known nodes in her handshake message like peers field from example, but what if some node sorta popular and knows hundreds of other nodes? Should it broadcast all this large list?

May be spreading handshake to other peers and replying with own information in hello reply message is enough, and no need to spread whole lists across network.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants