Skip to content
Snippets Groups Projects
Unverified Commit bbe82d29 authored by kwadronaut's avatar kwadronaut :speech_balloon: Committed by Kali Kaneko
Browse files

[feat] add eip v4

- Closes: #16
parent b32696ea
Branches master
Tags 1.0
No related merge requests found
Pipeline #79165 canceled
CONFIG=config/demo.yaml
EIP_TEMPLATE=scripts/templates/eip-service.json.jinja
EIP_SERVICE=deploy/public/3/eip-service.json
EIP_TEMPLATE_3=scripts/templates/3/eip-service.json.jinja
EIP_TEMPLATE_4=scripts/templates/4/eip-service.json.jinja
EIP_SERVICE_3=deploy/public/3/eip-service.json
EIP_SERVICE_4=deploy/public/4/eip-service.json
PROVIDER_TEMPLATE=scripts/templates/provider.json.jinja
PROVIDER=deploy/public/provider.json
......@@ -17,7 +19,9 @@ gen-shapeshifter:
scripts/gen-shapeshifter-state.py deploy/shapeshifter-state
gen-provider:
mkdir -p deploy/public/3
@python3 scripts/simplevpn.py --file=eip --config=$(CONFIG) --template=$(EIP_TEMPLATE) --obfs4_state deploy/shapeshifter-state > $(EIP_SERVICE) || echo "ERROR: see $(EIP_SERVICE) for output"
mkdir -p deploy/public/4
@python3 scripts/simplevpn.py --file=eip --config=$(CONFIG) --template=$(EIP_TEMPLATE_3) --obfs4_state deploy/shapeshifter-state > $(EIP_SERVICE_3) || echo "ERROR: see $(EIP_SERVICE_3) for output"
@python3 scripts/simplevpn.py --file=eip --config=$(CONFIG) --template=$(EIP_TEMPLATE_4) --obfs4_state deploy/shapeshifter-state > $(EIP_SERVICE_4) || echo "ERROR: see $(EIP_SERVICE_4) for output"
@python3 scripts/simplevpn.py --file=provider --config=$(CONFIG) --template=$(PROVIDER_TEMPLATE) > $(PROVIDER) || echo "ERROR: see $(PROVIDER) for output"
rsync -ra deploy/public/ public/
populate:
......
# general variables
export VPNWEB_API_PATH="./public"
export VPNWEB_API_VERSION="4"
export VPNWEB_PROVIDER_CA="./public/ca.crt"
export VPNWEB_AUTH=sip2
export VPNWEB_CAKEY=test/files/ca.key
......
......@@ -29,11 +29,16 @@ func main() {
/* static files */
web.HttpFileHandler(srv, "/provider.json", filepath.Join(opts.ApiPath, "provider.json"))
web.HttpFileHandler(srv, "/ca.crt", opts.ProviderCaPath)
web.HttpFileHandler(srv, "/3/configs.json", filepath.Join(opts.ApiPath, "3", "configs.json"))
web.HttpFileHandler(srv, "/3/service.json", filepath.Join(opts.ApiPath, "3", "service.json"))
web.HttpFileHandler(srv, "/3/config/eip-service.json", filepath.Join(opts.ApiPath, "3", "eip-service.json"))
web.HttpFileHandler(srv, "/provider.json", filepath.Join(opts.ApiPath, "provider.json"))
web.HttpFileHandler(srv, "/ca.crt", opts.ProviderCaPath)
web.HttpFileHandler(srv, "/4/configs.json", filepath.Join(opts.ApiPath, "4", "configs.json"))
web.HttpFileHandler(srv, "/4/service.json", filepath.Join(opts.ApiPath, "4", "service.json"))
web.HttpFileHandler(srv, "/4/config/eip-service.json", filepath.Join(opts.ApiPath, "4", "eip-service.json"))
web.HttpFileHandler(srv, "/4/ca.crt", opts.ProviderCaPath)
mtr := http.NewServeMux()
mtr.Handle("/metrics", promhttp.Handler())
......
{
"serial": 4,
"version": 4,
"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"] }}",
"ip_address6": "{{ gateways[gw]["ip_address6"] }}",
"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 %}
],
"auth": "{{ auth }}",
"openvpn_configuration": {{ openvpn|tojson(indent=8) }}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment