# auto-pod
Automatically choose tunneling or direct connection for `pod`. As easy as cocoapods itself.
Help you get rid of GFW of China.

## Installation

```bash
npm install -g auto-pod
```

## Usage

Create a UNIX/Linux virtual machine first. Or anything can provide you a socks proxy.
And connects to it by SSH:

```bash
ssh -D 1080 username@example.com
```

Create an `auto-pod.yaml` at your go project root, just like this:

```yaml
proxies:
  ## One or many proxies. Will be chosen randomly.
  - socks5://127.0.0.1:1080/

includes:
  ## Sites go through proxies.
  - "github.com"
  - "stats.cocoapods.org"

excludes:
  ## Sites go directly
  - cauchies.org
```

Then just call `auto-pod` just like `pod`:

```bash
auto-pod install
```

If you need arguments directly passed to `install`:

```bash
auto-pod install -- --verbose
```

## Complex Usages

You can setup more in `auto-pod.yaml`:

```yaml
## Whether force all packages go through the tunneling.
# Equal to `-t` command line option.
force-tunneling: false

## System will choose these proxies randomly.
proxies:
  ## Single line proxy is ok.
  - socks5://127.0.0.1:1080/

  ## Or optional, this way, complex declaration
  - host: 10.0.0.1
    port: 1080
    protocol: socks5
    # Whether do DNS lookup through Socks Tunnel.
    # For socks5, it is set to true as default.
    lookup: true

includes:
  ## Sites go through proxy.
  - "github.com"
  - "stats.cocoapods.org"

excludes:
  ## These entries have higher priority than `includes`
  # If you put any entry in `includes`, they will be ignored
  # as well.
  - cauchies.org
```

## Command line options

```
Usage: auto-pod [options]

Options:
  -V, --version          output the version number
  -c, --config [config]  read configs from file in json format
  -t, --tunneling        Force tunneling all traffic through proxies.
  --debug                Enable debug mode
  --level [level]        log level, vals: info, error
  -h, --help             output usage information
```
