diff --git a/README.md b/README.md new file mode 100644 index 0000000..2fd23fc --- /dev/null +++ b/README.md @@ -0,0 +1,97 @@ +# Easy Proxy For Android & Java + +Easy Proxy for android & java apps. For those days when you want proxy for your app only. Supports different proxy for different urls. + +## Features + + - Setup single proxy for all the urls. + - Setup single proxy for all urls except some exclusion rules. + - Setup single proxy for all urls except some exclusion rules & some separate proxy rules for some url patterns. + - Lirary agnostic. You can use any library you want Volley, OkHttp, Ion or any other http library. + +## Example Usage + +Initialize EasyProxy in you application class like below. + +```java +package com.vijayrawatsan.easyproxy.demo; + +import android.app.Application; +import com.vijayrawatsan.easyproxy.EasyProxy; +import com.vijayrawatsan.easyproxy.ProxyInfo; + +public class EasyProxyDemoApplication extends Application { + @Override + public void onCreate() { + //This will set 10.125.24.28:8080 as proxy for all the urls from this app. + EasyProxy.init(new ProxyInfo("10.125.24.28", 8080)); + super.onCreate(); + } +} +``` +or + +```java +boolean isLogEnabled = true; +Set exclusions = new HashSet<>(Arrays.asList("^.*google*$")); +//This will set 10.125.24.28:8080 as proxy for all the urls from this app. +//Except any url that contains "google" in it. +EasyProxy.init(new ProxyInfo("10.125.24.28", 8080), exclusions, isLogEnabled); +``` +or + +```java +Set exclusions = new HashSet<>(Arrays.asList("^.*google.*$")); +Set inclusions = new HashSet<>(Arrays.asList( new UrlProxyInfo( "^.*yahoo.*$", new ProxyInfo("10.65.65.87", 8080)))); +//This will set 10.125.24.28:8080 as proxy for all the urls from this app. +//Except any url that contains "google" in it. +//And for any url containing "yahoo" it will set proxy to 10.65.65.87:8080 +EasyProxy.init(new ProxyInfo("10.125.24.28", 8080), exclusions, inclusions, true); +``` +# Including in your project + +gradle: + +Step 1. Add the JitPack repository to your build file + +```groovy +repositories { + maven { + url "https://jitpack.io" + } +} +``` + +Step 2. Add the dependency in the form + +```groovy +dependencies { + compile 'com.github.vijayrawatsan:easyproxy:1.0' +} +``` + +maven: + +Step 1. Add the JitPack repository to your build file + +```xml + + jitpack.io + https://jitpack.io + +``` + +Step 2. Add the dependency in the form + +```xml + + com.github.vijayrawatsan + easyproxy + 1.0 + +``` + +# Contributing + +Contributions welcome via Github pull requests. + diff --git a/easyproxy/src/main/java/com/vijayrawatsan/easyproxy/EasyProxy.java b/easyproxy/src/main/java/com/vijayrawatsan/easyproxy/EasyProxy.java index ceacd74..202c297 100644 --- a/easyproxy/src/main/java/com/vijayrawatsan/easyproxy/EasyProxy.java +++ b/easyproxy/src/main/java/com/vijayrawatsan/easyproxy/EasyProxy.java @@ -50,13 +50,13 @@ public static void init(ProxyInfo defaultProxy, Set exclude, Set