From b15b36c04bf7ecb94530feb64fb1cfbee428d688 Mon Sep 17 00:00:00 2001 From: Kali Kaneko Date: Tue, 30 Jul 2019 20:19:51 +0200 Subject: expected list of gateways, make port string --- Makefile | 2 +- scripts/templates/eip-service.json | 32 -------------------------------- scripts/templates/eip-service.json.jinja | 32 ++++++++++++++++++++++++++++++++ 3 files changed, 33 insertions(+), 33 deletions(-) delete mode 100644 scripts/templates/eip-service.json create mode 100644 scripts/templates/eip-service.json.jinja diff --git a/Makefile b/Makefile index 023972c..d2b9fb2 100644 --- a/Makefile +++ b/Makefile @@ -9,7 +9,7 @@ gen-shapeshifter: scripts/gen-shapeshifter-state.py deploy/shapeshifter-state gen-provider: mkdir -p deploy/public/3 - python3 scripts/simplevpn.py config/demo.yaml scripts/templates/eip-service.json --obfs4_state deploy/shapeshifter-state > deploy/public/3/eip-service.json + python3 scripts/simplevpn.py config/demo.yaml scripts/templates/eip-service.json.jinja --obfs4_state deploy/shapeshifter-state > deploy/public/3/eip-service.json populate: cp test/1/* public/1/ cp test/files/ca.crt public/ diff --git a/scripts/templates/eip-service.json b/scripts/templates/eip-service.json deleted file mode 100644 index 18c7a07..0000000 --- a/scripts/templates/eip-service.json +++ /dev/null @@ -1,32 +0,0 @@ -{ - "serial": 3, - "version": 3, - "locations": { {% for loc in locations %} - "{{loc}}": { - "name": "{{ locations[loc]['name'] }}", - "country_code": "{{ locations[loc]['country_code'] }}", - "hemisphere": "{{ locations[loc]['hemisphere'] }}", - "timezone": "{{ locations[loc]['timezone'] }}" - }{{ "," if not loop.last }}{% endfor %} - }, - "gateways": { {% for gw in gateways %} - "{{gw}}": { - "host": "{{ gateways[gw]["host"] }}", - "ip_address": "{{ gateways[gw]["ip_address"] }}", - "location": "{{ gateways[gw]["location"] }}", - "capabilities": { - "adblock": false, - "filter_dns": false, - "limited": false, - "transport": [ {% for tr, proto, port, options in gateways[gw]["transports"] %} - {"type": "{{ tr }}", - "protocols": ["{{ proto }}"],{% if options %} - "options": {{ options | tojson }},{% endif %} - "ports": [{{ port }}] - }{{ "," if not loop.last }}{% endfor %} - ] - } - }{{ "," if not loop.last }}{% endfor %} - }, - "openvpn_configuration": {{ openvpn|tojson(indent=8) }} -} diff --git a/scripts/templates/eip-service.json.jinja b/scripts/templates/eip-service.json.jinja new file mode 100644 index 0000000..189a422 --- /dev/null +++ b/scripts/templates/eip-service.json.jinja @@ -0,0 +1,32 @@ +{ + "serial": 3, + "version": 3, + "locations": { {% for loc in locations %} + "{{loc}}": { + "name": "{{ locations[loc]['name'] }}", + "country_code": "{{ locations[loc]['country_code'] }}", + "hemisphere": "{{ locations[loc]['hemisphere'] }}", + "timezone": "{{ locations[loc]['timezone'] }}" + }{{ "," if not loop.last }}{% endfor %} + }, + "gateways": [ {% for gw in gateways %} + { + "host": "{{ gateways[gw]["host"] }}", + "ip_address": "{{ gateways[gw]["ip_address"] }}", + "location": "{{ gateways[gw]["location"] }}", + "capabilities": { + "adblock": false, + "filter_dns": false, + "limited": false, + "transport": [ {% for tr, proto, port, options in gateways[gw]["transports"] %} + {"type": "{{ tr }}", + "protocols": ["{{ proto }}"],{% if options %} + "options": {{ options | tojson }},{% endif %} + "ports": ["{{ port }}"] + }{{ "," if not loop.last }}{% endfor %} + ] + } + }{{ "," if not loop.last }}{% endfor %} + ], + "openvpn_configuration": {{ openvpn|tojson(indent=8) }} +} -- cgit v1.2.3