var httpfunc = require('topsin.httpfunc');
var REQ = httpfunc.argv().request;
var RES = httpfunc.argv().response;
var SinEror = require('topsin.error');
var result = new (require('topsin.responsedata'))();
var DB = require('topsin.database');
var DBNAME = REQ.pathCapture('DBNAME');
var Crypto = require('topsin.crypto');
var _ = require('lodash');

try {
  RES.body(JSON.stringify({
    peerAddr: REQ.peerAddr(),
    peerPort: REQ.peerPort(),
    localAddr: REQ.localAddr(),
    localPort: REQ.localPort()
  }, null, '  '));
} catch (err) {
  result.setErrText(_.toString(err));
  result.setErrCode(10);
  RES.body(result.toJson());
}