dperson / torproxy

GNU Affero General Public License v3.0
515 stars 144 forks source link

Usage: change circuit more often #17

Closed konsumer closed 6 years ago

konsumer commented 6 years ago

This is a usage question, so feel free to send me to a forum or something. I couldn't find any for this docker container.

I want to refresh my IP more often. I tried making a docker-compose that looks like this:

version: '3'
services:
  tor:
    image: dperson/torproxy
    restart: unless-stopped
    environment:
      - TOR_MaxCircuitDirtiness=1
      - TOR_NewCircuitPeriod=1
      - TOR_EnforceDistinctSubnets=1
      - LOCATION=US
  app:
    build: .
    restart: unless-stopped
    environment:
      - PORT=3000
    ports:
      - 3000:3000

My app is a simple express service, like this:

// get info about running server
app.get('/info', (req, res) => {
  const { name, version } = pkg
  request({url: 'http://jsonip.com/', proxy: 'http://tor:8118'}, (err, response, body) => {
    if (err) {
      return res.status(500).json(err)
    }
    const { ip } = JSON.parse(body)
    res.json({
      name,
      version,
      ip
    })
  })
})

I get an IP that is different from my own, but it doesn't change between requests very often:

Example:

{
  "name": "data-proxy",
  "version": "1.0.0",
  "ip": "104.223.123.98"
}
dperson commented 6 years ago

I think this is what you want:

https://www.torproject.org/docs/faq.html.en#ChangePaths

konsumer commented 6 years ago

Yeh, I as far as I understand it MaxCircuitDirtiness controls that, which seems to be ignored.

So on fresh streams (requests) I should get different IPs (even in different subnets), right? I do get a new IP, but it's like every 10 minutes (so maybe MaxCircuitDirtiness is being ignored.)

Am I misunderstanding how it works?

dperson commented 6 years ago

I'm not really a Tor developer, I wanted to have it available in a container. So I built one from the Debian base image, and tried to make it easy to setup.

If it's running but not behaving as expected, you'll need to contact Debian and or the Tor developers.

konsumer commented 6 years ago

No prob, I appreciate your work. I will see if I can figure it out.

megabait1212 commented 4 years ago

@konsumer did you find a solution?

konsumer commented 4 years ago

@megabait1212 nope. I ended up using regular proxies, so didn't need tor any more.

megabait1212 commented 4 years ago

Thanks, yesterday after some experiments I also, decided to use regular proxies.