Skip to content
Pascal Craponne edited this page Apr 13, 2015 · 2 revisions

Blue Dwarf Tunnel in a nutshell

(or everywhere else you want to put it).

What is it

The Blue Dwarf tunnel is a simple wrapper to tunnel proxy servers. Its initial purpose was to get out of corporate proxy servers (the ones who decide what's best for you to watch). It can be also used for anonymization, to preserve freedom of speech in countries where such things are not appreciated by authorities.

How to use it

using BlueDwarf.Net.Proxy.Client;

// ...

var client = new TunnelProxyClient();
var route = client.CreateRoute("http=10.0.0.1:8080") // this is an example
using(var socket = route.Connect("mysite.com", 80))
{
   // now your socket is secure
}

Further documentation

There are basically two entities you need to know in the BlueDwarf tunnel:

  • TunnelProxyClient which implements IProxyClient (so you can configure dependency injection) is the class which creates routes, and creates the connections.
  • Route is a simple route to target, which may use an unlimited sequence of proxy servers (in protocol HTTP, using the CONNECT command or SOCKS4A).
  • Optionally there is a ProxyServer class used by TunnelProxyClient and Route, but it can be ignored, since there are transparent conversions for it.

The TunnelProxyClient has one public method:

  • Route CreateRoute(params ProxyServer[] proxyServers) which creates a route using a list of proxy servers.

The Route has more methods:

  • Socket Connect(IPAddress targetAddress, int targetPort), Socket Connect(EndPoint target) and Socket Connect(string hostOrAddress, int port) (this one being an extension method) allow to connect to a given target and return an established socket. It throws a ProxyRouteException in case of failure in the route, but may also throw IOException when hosts can not be resolved.
  • static Route operator +(Route route, ProxyServer proxyServer) allows to add a new proxy server relay in the current route.
Clone this wiki locally