Skip to content

Commit

Permalink
Use yaml instead json
Browse files Browse the repository at this point in the history
  • Loading branch information
deepjia committed Jul 30, 2018
1 parent 9edbfb2 commit 86e0dfc
Show file tree
Hide file tree
Showing 23 changed files with 179 additions and 160 deletions.
31 changes: 18 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ skip-proxy = 127.0.0.1, 192.168.0.0/16, 10.0.0.0/8, 172.16.0.0/12, 100.64.0.0/10

2. Enter/Create specific `Extension Directroy`

3. Modify/Create `extension.json`
3. Modify/Create `extension.yaml` (`extension.json` is okay too.)

*bin:* Main binary of extensions.

Expand All @@ -209,18 +209,23 @@ skip-proxy = 127.0.0.1, 192.168.0.0/16, 10.0.0.0/8, 172.16.0.0/12, 100.64.0.0/10

*default*: Default vaules to render.

```json
{
"bin": "{{ ExtensionDir }}/bin/mybinary",
"args": "-p {{ ExtensionPort }} -c '{{ TempDir }}/myconfig.ini'",
"exitargs": "",
"url": "http://127.0.0.1:{{ ExtensionPort }}",
"keys": ["ServerProtocol", "ServerAddress", "SeverPort", "ServerPassword"],
"http": false,
"socks5": true,
"render": {"{{ ExtensionDir }}/mytemplate.jinja": "{{ TempDir }}/myconfig.ini"},
"default": {"ServerAddress":"example.com"}
}
```yaml
# json is also supported
bin: "{{ ExtensionDir }}/bin/mybinary"
args: "-p {{ ExtensionPort }} -c '{{ TempDir }}/myconfig.ini'"
exitargs: ""
url: "http://127.0.0.1:{{ ExtensionPort }}"
keys:
- "ServerProtocol"
- "ServerAddress"
- "SeverPort"
- "ServerPassword"
http: false
socks5: true
render:
"{{ ExtensionDir }}/mytemplate.jinja": "{{ TempDir }}/myconfig.ini"
default:
ServerAddress: "example.com"
```
[jinja2](http://jinja.pocoo.org) is used as render engine, which render {{ *key* }} as *values* from the `profile.ini` as well as from *default* values, which also supports logic causes like {*% if %*} {*% endif %*}.
Expand Down
12 changes: 0 additions & 12 deletions extension/charles/extension.json

This file was deleted.

9 changes: 9 additions & 0 deletions extension/charles/extension.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
bin: "open"
args: "-a Charles.app"
kill: "pkill Charles"
keys:
- "Config"
http: true
socks5: false
render:
"{% if Config %}{{ ProfileDir }}/{{ Config }}{% else %}{{ ExtensionDir }}/template.jinja{% endif %}": "{{ HomeDir }}/Library/Preferences/com.xk72.charles.config"
12 changes: 0 additions & 12 deletions extension/glider/extension.json

This file was deleted.

15 changes: 15 additions & 0 deletions extension/glider/extension.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
bin: "{{ ExtensionDir }}/bin/glider"
args: "-config '{{ TempDir }}/glider.conf' -rulefile '{{ ProfileDir }}/{{ Bypass }}'"
keys:
- "ServerProtocol"
- "ServerAddress"
- "ServerPort"
- "Bypass"
- "URI2"
- "URI3"
http: true
socks5: true
render:
"{{ ExtensionDir }}/template.jinja": "{{ TempDir }}/glider.conf"
default:
ServerAddress: "127.0.0.1"
12 changes: 0 additions & 12 deletions extension/gost/extension.json

This file was deleted.

12 changes: 12 additions & 0 deletions extension/gost/extension.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
bin: "{{ ExtensionDir }}/bin/gost"
args: "-L=:{{ ExtensionPort }}{% if ServerPort %} -F={{ ServerProtocol }}://{{ ServerAddress }}:{{ ServerPort }}{% if Bypass %}?bypass='{{ ProfileDir }}/{{ Bypass }}'{% endif %}{% endif %} {{ Other }}"
keys:
- "ServerProtocol"
- "ServerAddress"
- "ServerPort"
- "Bypass"
- "Other"
http: true
socks5: true
default:
ServerAddress: "127.0.0.1"
12 changes: 0 additions & 12 deletions extension/mitmproxy/extension.json

This file was deleted.

10 changes: 10 additions & 0 deletions extension/mitmproxy/extension.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
bin: "open"
pre: "chmod +x '{{ TempDir }}/mitmproxy.command'"
args: "'{{ TempDir }}/mitmproxy.command'"
kill: "killall mitmproxy"
keys:
- "ExtraArgs"
http: true
socks5: false
render:
"{{ ExtensionDir }}/template.jinja": "{{ TempDir }}/mitmproxy.command"
13 changes: 0 additions & 13 deletions extension/mitmweb/extension.json

This file was deleted.

9 changes: 9 additions & 0 deletions extension/mitmweb/extension.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
bin: "mitmweb"
args: "-p {{ ExtensionPort }} --no-web-open-browser --web-port {{ WebPort }}{% if ServerProtocolHttp %} --mode upstream:http://127.0.0.1:{{ ServerPort }}{% endif %}"
url: "http://127.0.0.1:{{ WebPort }}"
keys:
- "WebPort"
http: true
socks5: false
default:
WebPort: "8081"
12 changes: 0 additions & 12 deletions extension/privoxy/extension.json

This file was deleted.

17 changes: 17 additions & 0 deletions extension/privoxy/extension.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
pre: "cat '{{ ProfileDir }}/{{Bypass}}' >> '{{ TempDir }}/privoxy.actionhead'; sed '1s/alias/{alias}/' '{{ TempDir }}/privoxy.actionhead' > '{{ TempDir }}/privoxy.action'"
bin: "privoxy"
arglist:
- "--no-daemon"
- "{{ TempDir }}/privoxy.config"
keys:
- "Protocol"
- "ServerAddress"
- "ServerPort"
- "Bypass"
http: true
socks5: false
render:
"{{ ExtensionDir }}/template_config.jinja": "{{ TempDir }}/privoxy.config"
"{{ ExtensionDir }}/template_actionhead.jinja":"{{ TempDir }}/privoxy.actionhead"
default:
ServerAddress: "127.0.0.1"
11 changes: 0 additions & 11 deletions extension/shell/extension.json

This file was deleted.

12 changes: 12 additions & 0 deletions extension/shell/extension.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
pre: "{{ PreCmd }}"
bin: "{{ Binary }}"
args: "{{ Args1 }}{{ ExtensionPort }}{{ Args2 }}"
exitargs: "{{ExitArgs}}"
keys:
- "Binary"
- "Args1"
- "Args2"
- "PreCmd"
- "ExitArgs"
http: true
socks5: true
14 changes: 0 additions & 14 deletions extension/ss-libev/extension.json

This file was deleted.

17 changes: 17 additions & 0 deletions extension/ss-libev/extension.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
bin: "ss-local"
args: "-c '{{ TempDir }}/ss-libev.json'"
keys:
- "ServerAddress"
- "ServerPort"
- "EncryptionMethod"
- "ServicePassword"
- "Timeout"
- "TFO"
http: false
socks5: true
render:
"{{ ExtensionDir }}/template.jinja": "{{ TempDir }}/ss-libev.json"
default:
ServerAddress: "127.0.0.1"
EncryptionMethod: "chacha20-ietf-poly1305"
Timeout: "60"
15 changes: 0 additions & 15 deletions extension/v2ray/extension.json

This file was deleted.

17 changes: 17 additions & 0 deletions extension/v2ray/extension.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
bin: "v2ray"
args: "-config '{{ TempDir }}/v2ray.json'"
keys:
- "ServerAddress"
- "ServerPort"
- "WSPath"
- "ServiceID"
- "AlterID"
http: false
socks5: true
render:
"{{ ExtensionDir }}/template.jinja": "{{ TempDir }}/v2ray.json"
default:
ServerAddress: "127.0.0.1"
ServerPort: "443"
WSPath: "/ws"
AlterID: "64"
11 changes: 0 additions & 11 deletions extension/whistle/extension.json

This file was deleted.

11 changes: 11 additions & 0 deletions extension/whistle/extension.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
bin: "w2"
args: "start -p {{ ExtensionPort }} -D '{{ ExtensionDir }}'"
url: "http://127.0.0.1:{{ ExtensionPort }}/#Network"
exitargs: "stop"
keys:
- "ServerProtocol"
- "Rule"
http: true
socks5: true
render:
"{% if Rule %}{{ ProfileDir }}/{{ Rule }}{% else %}{{ ExtensionDir }}/template.jinja{% endif %}": "{{ ExtensionDir }}/.whistle/rules/properties"
Loading

0 comments on commit 86e0dfc

Please sign in to comment.