MCPcopy Create free account
hub / github.com/SnapDrop/snapdrop / constructor

Method constructor

server/index.js:165–182  ·  view source on GitHub ↗
(socket, request)

Source from the content-addressed store, hash-verified

163class Peer {
164
165 constructor(socket, request) {
166 // set socket
167 this.socket = socket;
168
169
170 // set remote ip
171 this._setIP(request);
172
173 // set peer id
174 this._setPeerId(request)
175 // is WebRTC supported ?
176 this.rtcSupported = request.url.indexOf('webrtc') > -1;
177 // set name
178 this._setName(request);
179 // for keepalive
180 this.timerId = 0;
181 this.lastBeat = Date.now();
182 }
183
184 _setIP(request) {
185 if (request.headers['x-forwarded-for']) {

Callers

nothing calls this directly

Calls 3

_setIPMethod · 0.95
_setPeerIdMethod · 0.95
_setNameMethod · 0.95

Tested by

no test coverage detected