Giter Club home page Giter Club logo

socksashttp's Introduction

SocksAsHttp

This tool need to using socks(4/5) proxy as http proxy. The motivation for creating this tool was that many http clients in java do not support socks proxy support. And as I see it, no one is going to fix it. For example java.net.http.httpclient still not support socks proxy - https://bugs.openjdk.java.net/browse/JDK-8214516

This tool built on Netty and uses its handlers therefore, it should be fast and should not load resources. So far this is the first version and additional settings may be required, but it seemed to me that in this state it copes well.

In current moment this tool have only Java code interface.

Usage

First need build Config In the vast majority of cases, the default config will do, but in some cases, you will need to fine tune it. All configuration fields are trivial, except for one, which is described below.

The key feature of this tool from the rest is that it supports many SocksAsHttp in one process. And since a dedicated port is required for each instance, they may not be enough. Well, since most likely you will need to use this utility locally - just select a few local IPs to supplement the missing number of ports.

Therefore, for special cases there is this setting.

It’s easy to use:

final BindConfig bindConfig = BindConfig.of(InetAddress.getByName("127.0.0.2"), 10000, 60000);

final Config config = Config.builder()
	.bindConfigList(Collections.singletonList(bindConfig))
	.build();

This will create 50k ports.

Now can create SocksStore with with the config that was made above. This object have 3 public methods:

Optional addProxy(final SocksProxy socksProxy)

This method try create SocksAsHttp. Accepts SocksProxy. And return empty optional only if no have free ports with write log, or SocketAddress with http-proxy interface.

void releaseProxy(final SocksProxy socksProxy)

This method tries to release SocksProxy, for this it tries to find its channel and release it.

void releaseAll()

All the same as releaseProxy but for all.

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.