scoks経由のLWP::UserAgent
socks経由でLWP::UserAgentを使いたいときのメモ。
LWP::Protocol::https::SocksChainを使って指定してあげると良いようです。
use LWP::UserAgent; use LWP::Protocol::https::SocksChain; LWP::Protocol::implementor( https => 'LWP::Protocol::https::SocksChain' ); @LWP::Protocol::https::SocksChain::EXTRA_SOCK_OPTS = ( Chain_Len => 1, Debug => 0, Chain_File_Data => ['socks:1080:::4:383 b/s Argentina'], Random_Chain => 1, Auto_Save => 1, Restore_Type => 1 );
ホームディレクトリの~/.sc.confにこんな感じに書いておけば、Chain_File_Dataで指定する必要はないみたい。
socks:1080:::4:383 b/s Argentina