Novage / wt-tracker

High-performance WebTorrent tracker
Apache License 2.0
248 stars 87 forks source link

peer.ip ? #19

Closed DenisFeedYT closed 4 years ago

DenisFeedYT commented 4 years ago

Hello how can i get ip of peer in FastTracker.processMessage(json, peer) ?

mrlika commented 4 years ago

To use less memory peer is stored directly in WebSocket object that has the following interface: https://github.com/uNetworking/uWebSockets.js/blob/master/docs/index.d.ts#L12

In wt-tracker source code you can treat a peer as WebSocket interface instance and call

/** Returns the remote IP address */
    getRemoteAddress() : ArrayBuffer;
DenisFeedYT commented 4 years ago

ok, works, thanks.