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

Update main.go #279

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Update main.go
Adding "ID" to create Node. Without Node having ID, it seems not possible to work with multiple nodes in the same machine.

Faced problems in transferring data using TCP, with the above fix, the issue is gone.
venugopv authored Apr 6, 2020

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
commit f1da0f856e19d9d0db4599b30e156c085ea1a4ff
9 changes: 8 additions & 1 deletion cmd/chat/main.go
Original file line number Diff line number Diff line change
@@ -47,12 +47,19 @@ const printedLength = 8
func main() {
// Parse flags/options.
pflag.Parse()


//create a Node ID and use while creating Node, so that multiple nodes can be created in same machine.
pub, _, err := noise.GenerateKeys(nil)
check(err)

id := noise.NewID(pub, *hostFlag, *portFlag)

// Create a new configured node.
node, err := noise.NewNode(
noise.WithNodeBindHost(*hostFlag),
noise.WithNodeBindPort(*portFlag),
noise.WithNodeAddress(*addressFlag),
noise.WithNodeID(id),
)
check(err)