This commit is contained in:
lesion 2018-08-10 00:31:44 +02:00
parent 7d559f9a31
commit 1e3fb44ea6
No known key found for this signature in database
GPG Key ID: 352918250B012177

View File

@ -9,7 +9,11 @@ module.exports = async (req, res, next) => {
const ip = source_ip.split('.').reverse().join('.')
const server_ip = '51.68.126.235'.split('.').reverse().join('.')
const domain = `${ip}.80.${server_ip}.ip-port.exitlist.torproject.org`
try {
const ret = await lookup(domain, {})
req.fromTor = (ret.address === '127.0.0.2')
} catch(e) {
req.fromTor = false
}
next()
}