Coder Social home page Coder Social logo

java-socks-proxy-server's Introduction

APACHE v2 License Latest Release Javadocs Codacy

java-socks-proxy-server

java-socks-proxy-server is a SOCKS 4/5 server for Java. Includes a JUnit Rule for easy testing with a SOCKS server.

It is a continuation of https://github.com/damico/java-socks-proxy-server.

<dependency>
  <groupId>com.github.bbottema</groupId>
  <artifactId>java-socks-proxy-server</artifactId>
  <version>3.0.1</version>
</dependency>

Usage:

// start serving clients on port 1234
SocksServer server = new SocksServer(1234).start();
...
server.stop(); // stop serving any new proxy requests

Or you can supply your own ServerSocketFactory:

// e.g. SSL on port 7132
SocksServer server = new SocksServer(1234, myCustomServerFactory).start();

By default, library uses NO_AUTH authentication mode

Username and Password Authentication

If you want to authenticate the clients, before proxying, you can set a UsernamePasswordAuthenticator, library supports standard Username/Password protocol.

    new SocksServer(1234)
        .setAuthenticator(new UsernamePasswordAuthenticator(false) {
          @Override
          public boolean validate(String username, String password) {
            // validate credentials here, e.g. check your local database
            return username.equals("mysecureusername") && password.equals("mysecurepassword");
          }
        }).start();

Supply a true value to constructor UsernamePasswordAuthenticator(), if you also want to prefer NO_AUTH mode over Username and password.

For use in junit 5 tests (for Junit 4 use a version < 3.0.0):

@RegisterExtension
static SockServerExtension sockServerRule = new SockServerExtension(PROXY_SERVER_PORT);

// or

@RegisterExtension
static SockServerExtension sockServerRule = new SockServerExtension(PROXY_SERVER_PORT, myServerSocketFactory);

And that's it!

Change history

v4.1.0 (15-May-2024)

  • #14: Enhanced dynamic username/password authentication support for custom validation strategies.
  • Minor performance improvements based on SpotBugs recommendations.

NOTE: the start methods have been marked deprecated. For serving clienst on multiple ports, create a new instance of the server for each port.

v4.0.0 (21-April-2024)

  • Maintenance release: upgraded parent POM version, switched to Junit5, updated dependencies, added SpotBugs checks.

v3.0.0 (22-Januray-2024)

  • #12: Added a more robust server adaptation with synchronous startup (including retries), shutdown closes all connections. With thanks to @kllbzz

v2.0.0 (26-December-2021)

  • Switched to Java 8 and included fix for recent log4j security issue

v1.1.0 (15-April-2021)

  • #4 added support for custom server socket factory (so you are free to configure SSL)

v1.0.2 (5-July-2020)

  • Bumped log4j-core from 2.6.1 to 2.13.2

v1.0.1 (6-December-2019)

  • Removed Jacoco instrumentation from production code

v1.0.0 (6-December-2019)

Initial release

4-December-2019

Initial upload

java-socks-proxy-server's People

Contributors

asbachb avatar bbottema avatar dependabot[bot] avatar kllbzz avatar xomadev avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

java-socks-proxy-server's Issues

License problem?

Hello!

I'm interested in using your project and I dug a little into the license and I see you licensed as Apache 2.0 but your code is based on another project that is GPL v2.

I am not expert but I don't think you can do that as GPL v2 mandates that you can only share or evolve the software mantaining the same license and Apache 2.0 is less restrictive so you are allowing others to do with the software things that the original author forbid.

SSL Connections

If possible, seeing support for SSL connections via this server would be a nice feature as currently, the certificates prevent an HTTPS connection from being made.

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.