-
Notifications
You must be signed in to change notification settings - Fork 9
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
Test tcp #12
base: master
Are you sure you want to change the base?
Test tcp #12
Conversation
@@ -82,7 +82,11 @@ func (p *peer) answer(wm *waddell.MessageIn) { | |||
} | |||
|
|||
log.Printf("Got five tuple: %s", ft) | |||
go readUDP(p.id, traversalId, ft) | |||
if ft.Proto == "tcp" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Check indentation. Also, please run gofmt on this.
@ed2k Have you found a situation in which natty returns a TCP 5-tuple? |
@ed2k Did a little digging, looks like it's theoretically possible to get a TCP 5-tuple. |
@@ -107,11 +111,38 @@ func readUDP(peerId waddell.PeerId, traversalId uint32, ft *natty.FiveTuple) { | |||
if err != nil { | |||
log.Fatalf("Unable to read from UDP: %s", err) | |||
} | |||
msg := string(b[:n]) | |||
log.Printf("Got UDP message from %s: '%s'", addr, msg) | |||
msg := hex.Dump(b[:n]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why this change? The message being sent is a UTF-8 string, why hex encode it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I saw case that it affected the terminal display.
@ed2k Thanks for submitting this! Please see my comments inline with the code. |
No description provided.