Skip to content

Commit

Permalink
testing bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
sairaj-mote committed Jan 15, 2024
1 parent 4253679 commit 0aa7ab5
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
17 changes: 11 additions & 6 deletions routes/is-tor.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,21 @@
const express = require('express');
const router = express.Router();
const axios = require('axios');

router.get('/', async (req, res) => {
try {
const ip = req.socket.remoteAddress;
const response = await axios.get(`https://check.torproject.org/cgi-bin/TorBulkExitList.py?ip=${ip}`);
const isTor = response.data.includes(ip);
res.json({ isTor, ip });
console.log(req.ip, req.socket.remoteAddress, req.connection.remoteAddress, req.headers['x-forwarded-for'])
const ip = req.ip;
const response = await axios.get(`https://check.torproject.org/api/ip?ip=${ip}`);
res.json({
...response.data,
reqIp: ip,
reqSocketRemoteAddress: req.socket.remoteAddress,
reqConnectionRemoteAddress: req.connection.remoteAddress,
reqHeadersXForwardedFor: req.headers['x-forwarded-for']
});
} catch (error) {
res.status(500).json({ error: error.message });
}
});

module.exports = router;
module.exports = router;
2 changes: 1 addition & 1 deletion routes/is-tor.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 0aa7ab5

Please sign in to comment.