File tree 2 files changed +5
-3
lines changed
2 files changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -205,7 +205,7 @@ func main() {
205
205
206
206
LogMsgf ("PeerID: %s" , h .ID ().String ())
207
207
for _ , addr := range h .Addrs () {
208
- LogMsgf ("Listening on: %s" , addr .String ())
208
+ LogMsgf ("Listening on: %s/p2p/%s " , addr .String (), h . ID ())
209
209
}
210
210
211
211
// draw the UI
Original file line number Diff line number Diff line change 7
7
"time"
8
8
9
9
"github.com/gdamore/tcell/v2"
10
+ "github.com/libp2p/go-libp2p/core/peer"
10
11
"github.com/rivo/tview"
11
12
)
12
13
@@ -20,7 +21,7 @@ type ChatUI struct {
20
21
peersList * tview.TextView
21
22
22
23
msgW io.Writer
23
- sysW io.Writer
24
+ sysW io.Writer
24
25
inputCh chan string
25
26
doneCh chan struct {}
26
27
}
@@ -151,7 +152,8 @@ func (ui *ChatUI) refreshPeers() {
151
152
// displayChatMessage writes a ChatMessage from the room to the message window,
152
153
// with the sender's nick highlighted in green.
153
154
func (ui * ChatUI ) displayChatMessage (cm * ChatMessage ) {
154
- prompt := withColor ("green" , fmt .Sprintf ("<%s>:" , cm .SenderNick ))
155
+ p := peer .ID (cm .SenderID )
156
+ prompt := withColor ("green" , fmt .Sprintf ("<%s>:" , shortID (p )))
155
157
fmt .Fprintf (ui .msgW , "%s %s\n " , prompt , cm .Message )
156
158
}
157
159
You can’t perform that action at this time.
0 commit comments