Skip to content

Commit

Permalink
README.md added.
Browse files Browse the repository at this point in the history
  • Loading branch information
Vijay Rawat committed Jun 26, 2015
1 parent 2c989fe commit 7e9d70c
Show file tree
Hide file tree
Showing 3 changed files with 100 additions and 4 deletions.
97 changes: 97 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -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<String> 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<String> exclusions = new HashSet<>(Arrays.asList("^.*google.*$"));
Set<UrlProxyInfo> 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
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
```

Step 2. Add the dependency in the form

```xml
<dependency>
<groupId>com.github.vijayrawatsan</groupId>
<artifactId>easyproxy</artifactId>
<version>1.0</version>
</dependency>
```

# Contributing

Contributions welcome via Github pull requests.

Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,13 @@ public static void init(ProxyInfo defaultProxy, Set<String> exclude, Set<UrlProx
sIncludeSet = include;
}
sDefaultProxy = defaultProxy;
ProxySelector.setDefault(new CustomProxySelector(ProxySelector.getDefault()));
ProxySelector.setDefault(new EasyProxySelector(ProxySelector.getDefault()));
}

static class CustomProxySelector extends ProxySelector {
static class EasyProxySelector extends ProxySelector {
private final ProxySelector mDefaultProxySelector;

public CustomProxySelector(ProxySelector defaultProxySelector) {
public EasyProxySelector(ProxySelector defaultProxySelector) {
this.mDefaultProxySelector = defaultProxySelector;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ public class EasyProxyDemoApplication extends Application {
@Override
public void onCreate() {
EasyProxy.init(new ProxyInfo("10.125.24.28", 8080));
// EasyProxy.init(new ProxyInfo("10.1.85.64", 8080));
super.onCreate();
}
}

0 comments on commit 7e9d70c

Please sign in to comment.