Skip to content
This repository has been archived by the owner on Sep 12, 2018. It is now read-only.
/ i2p.rb Public archive

[Retired] I2P.rb is a Ruby library for interacting with the I2P anonymity network.

License

Notifications You must be signed in to change notification settings

dryruby/i2p.rb

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

65 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

I2P.rb: Anonymous Networking for Ruby

This is a Ruby library for interacting with the I2P anonymity network.

Features

  • Supports checking whether I2P is installed in the user's current PATH and whether the I2P router is currently running.
  • Supports starting, restarting and stopping the I2P router daemon.
  • Implements the I2P Basic Open Bridge (BOB) protocol in full.
  • Implements the I2P Simple Anonymous Messaging (SAM) protocol basics.
  • Supports I2P name resolution using both hosts.txt as well as SAM.
  • Provides I2P tunnel creation and management using BOB.
  • Provides a standard socket class for easily connecting to I2P destinations and eepsites without any need for manual tunnel setup.
  • Compatible with Ruby 1.8.7+, Ruby 1.9.x, and JRuby 1.4/1.5.
  • Bundles the I2P 0.8 SDK and Streaming libraries for use with JRuby,

Examples

require 'rubygems'
require 'i2p'

Checking whether an I2P router is running locally

I2P.available?      #=> true, if the I2P router is installed
I2P.running?        #=> true, if the I2P router is running

Starting and stopping the local I2P router daemon

I2P.start!          #=> executes `i2prouter start`
I2P.restart!        #=> executes `i2prouter restart`
I2P.stop!           #=> executes `i2prouter stop`

Looking up the public key for an I2P name from hosts.txt

puts I2P::Hosts["forum.i2p"].to_base64

Looking up the public key for an I2P name using SAM

I2P::SAM::Client.open(:port => 7656) do |sam|
  puts sam.lookup_name("forum.i2p").to_base64
end

Generating a new key pair and I2P destination using SAM

I2P::SAM::Client.open(:port => 7656) do |sam|
  key_pair = sam.generate_destination
  puts key_pair.destination.to_base64
end

Opening a socket to an I2P destination using BOB

I2P::BOB::Socket.open("forum.i2p") do |socket|
  socket.write "HEAD / HTTP/1.1\r\n\r\n"
  socket.flush
  until (line = socket.readline).chomp.empty?
    puts line
  end
  socket.close
end

Creating an outproxy tunnel to your SSH daemon using BOB

tunnel = I2P::BOB::Tunnel.start({
  :nickname => :myssh,
  :outhost  => "127.0.0.1",
  :outport  => 22, # SSH port
  :quiet    => true,
})
puts tunnel.destination.to_base64

Using the I2P SDK and Streaming Library directly from JRuby

I2P.rb bundles the public-domain I2P SDK (i2p/sdk.jar) and Streaming Library (i2p/streaming.jar) archives, which means that to script the I2P Java client implementation from JRuby, you need only require these two files as follows:

require 'i2p/sdk.jar'
require 'i2p/streaming.jar'

Documentation

Dependencies

Installation

The recommended installation method is via RubyGems. To install the latest official release of I2P.rb, do:

% [sudo] gem install i2p                 # Ruby 1.8.7+ or 1.9.x
% [sudo] gem install backports i2p       # Ruby 1.8.1+

Environment

The following are the default values for environment variables that let you customize I2P.rb's implicit configuration:

$ export I2P_PATH=$PATH
$ export I2P_BOB_HOST=127.0.0.1
$ export I2P_BOB_PORT=2827
$ export I2P_SAM_HOST=127.0.0.1
$ export I2P_SAM_PORT=7656

Download

To get a local working copy of the development repository, do:

% git clone git://github.com/bendiken/i2p-ruby.git

Alternatively, you can download the latest development version as a tarball as follows:

% wget http://github.com/bendiken/i2p-ruby/tarball/master

Author

License

I2P.rb is free and unencumbered public domain software. For more information, see http://unlicense.org/ or the accompanying UNLICENSE file.

About

[Retired] I2P.rb is a Ruby library for interacting with the I2P anonymity network.

Topics

Resources

License

Security policy

Stars

Watchers

Forks

Packages

No packages published

Languages