Git Product home page Git Product logo

jargyle's Introduction

Jargyle

CodeQL Java CI with Maven (Mac OS Latest) Java CI with Maven (Ubuntu Latest) Java CI with Maven (Windows Latest) Codacy Badge

Contents

Introduction

Jargyle is a Java SOCKS5 API and server.

Note: Currently Jargyle is still in development. Although implementation of the features is completed, breaking changes may occur such as the renaming of classes and methods for further clarity. Also, although the user guide is complete, the reference and Javadocs are incomplete at this time, but they will be complete in the future.

Client API Example:

package com.example;

import com.github.jh3nd3rs0n.jargyle.client.HostResolver;
import com.github.jh3nd3rs0n.jargyle.client.NetObjectFactory;

import java.io.IOException;

import java.net.DatagramSocket;
import java.net.ServerSocket;
import java.net.Socket;

public class ClientApp {
    public static void main(String[] args) throws IOException {
        /*
         * Configure the SOCKS client through system properties.
         */
        /*
         * Set the URI of the SOCKS server for the SOCKS client to 
         * connect.
         */
        System.setProperty("socksServerUri.scheme", "socks5");
        System.setProperty("socksServerUri.host", "jargyle.net");
        System.setProperty("socksServerUri.port", "8080");
        /*
         * Enable SSL/TLS for TCP traffic between the SOCKS client 
         * and the SOCKS server.
         */
        System.setProperty("socksClient.ssl.enabled", "true");
        System.setProperty("socksClient.ssl.trustStoreFile", "jargyle.jks");
        System.setProperty("socksClient.ssl.trustStorePassword", "password");
        /*
         * Enable DTLS for UDP traffic between the SOCKS client and 
         * the SOCKS server.
         */
        System.setProperty("socksClient.dtls.enabled", "true");
        System.setProperty("socksClient.dtls.trustStoreFile", "jargyle.jks");
        System.setProperty("socksClient.dtls.trustStorePassword", "password");
        /*
         * Use only the SOCKS5 username password authentication 
         * method as the SOCKS5 authentication method of choice.
         */
        System.setProperty("socksClient.socks5.methods", "USERNAME_PASSWORD");
        System.setProperty("socksClient.socks5.userpassmethod.username", "Aladdin");
        System.setProperty("socksClient.socks5.userpassmethod.password", "opensesame");
        /*
         * Have the HostResolver to send the RESOLVE command to the 
         * SOCKS server to resolve host names instead of having the 
         * HostResolver resolve host names from the local system.
         */
        System.setProperty("socksClient.socks5.useResolveCommand", "true");
        
        /*
         * Create networking objects whose traffic would be routed 
         * through the SOCKS server based on the system properties 
         * above. If no system properties for configuring the SOCKS 
         * client were provided, the created networking objects 
         * would be ordinary networking objects.
         */
        NetObjectFactory netObjectFactory = NetObjectFactory.newInstance();
        Socket socket = netObjectFactory.newSocket();
        ServerSocket serverSocket = netObjectFactory.newServerSocket();
        DatagramSocket datagramSocket = netObjectFactory.newDatagramSocket();
        HostResolver hostResolver = netObjectFactory.newHostResolver();
        
        /*
         * Use the created networking objects as if they were 
         * ordinary networking objects.
         */
        // ...
    }
}

Server API Example:

package com.example;

import com.github.jh3nd3rs0n.jargyle.server.Configuration;
import com.github.jh3nd3rs0n.jargyle.server.Setting;
import com.github.jh3nd3rs0n.jargyle.server.Settings;
import com.github.jh3nd3rs0n.jargyle.server.SocksServer;

import java.io.IOException;

public class ServerApp {
    public static void main(String[] args) throws IOException {
        new SocksServer(Configuration.newUnmodifiableInstance(Settings.of(
            Setting.newInstanceWithParsedValue(
                "port", "8080"),
            /*
             * Enable SSL/TLS for TCP traffic between the SOCKS 
             * server and the clients.
             */
            Setting.newInstanceWithParsedValue(
                "ssl.enabled", "true"),
            Setting.newInstanceWithParsedValue(
                "ssl.keyStoreFile", "server.jks"),
            Setting.newInstanceWithParsedValue(
                "ssl.keyStorePassword", "drowssap"),
            /*
             * Enable DTLS for UDP traffic between the SOCKS server 
             * and the clients.
             */
            Setting.newInstanceWithParsedValue(
                "dtls.enabled", "true"),
            Setting.newInstanceWithParsedValue(
                "dtls.keyStoreFile", "server.jks"),
            Setting.newInstanceWithParsedValue(
                "dtls.keyStorePassword", "drowssap"),
            /*
             * Use only the SOCKS5 username password authentication 
             * method as the SOCKS5 authentication method of choice.
             */
            Setting.newInstanceWithParsedValue(
                "socks5.methods", "USERNAME_PASSWORD"),
            Setting.newInstanceWithParsedValue(
                "socks5.userpassmethod.userRepository",
                "StringSourceUserRepository:Aladdin:opensesame")
        ))).start();
    }
}

Command Line Example:

jargyle start-server \
    --setting=port=8080 \
    --setting=ssl.enabled=true \
    --setting=ssl.keyStoreFile=server.jks \
    --setting=ssl.keyStorePassword=drowssap \
    --setting=dtls.enabled=true \
    --setting=dtls.keyStoreFile=server.jks \
    --setting=dtls.keyStorePassword=drowssap \
    --setting=socks5.methods=USERNAME_PASSWORD \
    --setting=socks5.userpassmethod.userRepository=StringSourceUserRepository:Aladdin:opensesame

Features

The client API has the following features:

  • Route traffic through a specified chain of SOCKS servers
  • Use SSL/TLS for TCP traffic to and from SOCKS servers
  • Use DTLS for UDP traffic to and from SOCKS servers
  • Resolve host names from SOCKS5 servers

The server API and the server have the following features:

  • Route traffic through multiple specified chains of SOCKS servers
  • Use SSL/TLS for TCP traffic to and from clients
  • Use DTLS for UDP traffic to and from clients
  • Use SSL/TLS for TCP traffic to and from SOCKS servers
  • Use DTLS for UDP traffic to and from SOCKS servers
  • Resolve host names for clients from the local system or from SOCKS5 servers

The server API and the server also have a rule system that allows you to manage traffic in the following ways:

  • Allow or deny traffic
  • Allow a limited number of simultaneous instances of traffic
  • Route traffic through a selection of multiple specified chains of SOCKS servers
  • Redirect the desired destination
  • Configure sockets
  • Configure relay settings
  • Limit relay bandwidth

License

Jargyle is licensed under the MIT license.

Releases

The following are the types of releases:

Build System Dependency

The build system dependency provides both the client API and the server API.

Requirements:

  • Java 9 or higher

To declare the dependency in your build system, the definition to declare the dependency can be found here.

To declare the dependency in your build system for only the client API, the definition to declare the dependency can be found here.

To declare the dependency in your build system for only the server API, the definition to declare the dependency can be found here.

Binary Distribution

The binary distribution contains the files to run Jargyle from the command line. The JAR files included in the distribution can also be used as an API for your project.

Requirements:

  • Java 9 or higher

Once you have installed the requirements for the binary distribution, be sure to have the environment variable JAVA_HOME set to the Java home directory.

Releases for the binary distribution can be found here.

Source Distribution

The source distribution contains the files to run automated testing and to build the binary distribution.

Requirements:

  • Java 9 or higher
  • Apache Maven 3.3.9 or higher

Once you have installed the requirements for the source distribution, be sure to have the environment variable JAVA_HOME set to the Java home directory.

Releases for the source distribution can be found here.

Automated Testing

To run automated testing, run the following commands:

cd jargyle
mvn clean verify

Building

To build and package the binary distribution, run the following command:

mvn clean package

After running the aforementioned command, the built binary distribution can be found as a directory and in multiple archive formats in the following path:

jargyle-distribution/target/

jargyle's People

Contributors

jh3nd3rs0n avatar dependabot[bot] 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.