我正在尝试使用tor-privoxy来切换我的IP地址。
我在大多数情况下从README中复制了代码:
require 'tor-privoxy'
agent ||= TorPrivoxy::Agent.new '127.0.0.1', '', {8123 => 9051} do |agent|
sleep 5
p agent
p "New IP is #{agent.ip}"
end
但是当我运行它时,我收到了这个错误:
C:/Ruby193/lib/ruby/gems/1.9.1/gems/net-http-persistent-2.9.4/lib/net/http/persistent.rb:641:in `rescue in connection_for': connection refused: 127.0.0.1:8123 (Net::HTTP::Persistent::Error)
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/net-http-persistent-2.9.4/lib/net/http/persistent.rb:589:in `connection_for'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/net-http-persistent-2.9.4/lib/net/http/persistent.rb:994:in `request'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/mechanize-2.7.3/lib/mechanize/http/agent.rb:259:in `fetch'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/mechanize-2.7.3/lib/mechanize.rb:440:in `get'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/tor-privoxy-0.1.1/lib/tor-privoxy/agent.rb:38:in `ip'
from C:/Users/Lap/Dropbox/Programming_Stuff/Ruby_Stuff/Code/tor and socksify stuff/torPrivoxyTest.rb:6:in `block in <main>'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/tor-privoxy-0.1.1/lib/tor-privoxy/agent.rb:11:in `call'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/tor-privoxy-0.1.1/lib/tor-privoxy/agent.rb:11:in `initialize'
from C:/Users/Lap/Dropbox/Programming_Stuff/Ruby_Stuff/Code/tor and socksify stuff/torPrivoxyTest.rb:3:in `new'
from C:/Users/Lap/Dropbox/Programming_Stuff/Ruby_Stuff/Code/tor and socksify stuff/torPrivoxyTest.rb:3:in `<main>'
[Finished in 8.5s with exit code 1]
我做错了什么?
答案 0 :(得分:1)
您似乎使用了错误的端口。 Privoxy使用端口8118(8123是polipo)。另一侧的Tor使用9050(普通Tor)或9150(Tor浏览器捆绑)。因此,如果您更改设置,通信应该可以正常工作。