Giter Club home page Giter Club logo

netlayer's Introduction

NetLayer

Come for the Proxy, stay for the Tor Bindings

This repository currently contains a Kotlin/Java8 Tor Library supporting

  • Tunnelling traffic through Tor using a custom Socket implementation
  • Stream isolation
  • Bridges and pluggable transports
  • Connecting to hidden services
  • Hosting of hidden services

This project was originally based on a previous fork of thaliproject/Tor_Onion_Proxy_Library, but deviated significatnly since.

Usage

This is essentially a Wrapper around the official Tor releases, pre-packaged for easiy use and convenient integration into Kotlin/Java Projects. As of you, simply add tor.native as dependency to your project (using JitPack):

    <repositories>
    <repository>
        <id>jitpack.io</id>
        <url>https://jitpack.io</url>
    </repository>
    </repositories>
<dependency>
    <groupId>com.github.bisq-network.netlayer</groupId>
    <artifactId>tor.native</artifactId>
          <version>${netlayer.version}</version>
      </dependency>

Tunneling Traffic through Tor

This library provides a plain TCP socket which can be used like any other:

Kotlin

    //set default instance, so it can be omitted whenever creating Tor (Server)Sockets
    //This will take some time
    Tor.default = NativeTor(/*Tor installation destination*/ File("tor-demo"))
    TorSocket("www.google.com", 80, streamId = "FOO" /*this one is optional*/) //clear web
    TorSocket("facebookcorewwwi.onion", 443, streamId = "BAR") //hidden service

Java

    //set default instance, so it can be omitted whenever creating Tor (Server)Sockets
    //This will take some time
    Tor.setDefault(new NativeTor(/*Tor installation destination*/ new File("tor-demo")));
    new TorSocket("www.google.com", 80, "FOO");
    new TorSocket("facebookcorewwwi.onion", 443, "BAR");

Using Bridges and Pluggable Transports

To use bridges, simply pass the contents of a bridge configuration obtained from https://bridges.torproject.org/ (line-by-line wrapped in a Collection) as second parameter to the constructor of the NativeTor class.

Hosting Hidden Services

Hidden services can be hosted by creating a torified ServerSocket.

Kotlin

    //create a hidden service in directory 'test' inside the tor installation directory
    HiddenServiceSocket(8080, "test")
    //optionally attack a ready listener to be notified as soon as the service becomes reachable
    hiddenServiceSocket.addReadyListener { socket -> /*your code here*/}

Java

    //create a hidden service in directory 'test' inside the tor installation directory
    HiddenServiceSocket hiddenServiceSocket = new HiddenServiceSocket(8080, "test");
    //it takes some time for a hidden service to be ready, so adding a listener only after creating the HS is not an issue
    hiddenServiceSocket.addReadyListener(socket -> { /*your code here*/ return null});

Verifying the Authenticity/Integrity of the Tor Distribution

This library ships the official Tor binaries. To verify their authenticity, simply rebuild the prepackaged Tor binaries (courtesy of cedric walter) and rebuild the tor.native

netlayer's People

Contributors

freimair avatar jesusmccloud avatar mrosseel avatar chimp1984 avatar bisq-github-admin-3 avatar ripcurlx avatar alvasw avatar gabernard avatar cd2357 avatar alejandrogarcia83 avatar sschuberth avatar

Stargazers

 avatar Paul avatar

Watchers

James Cloos avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.