From 8f708072e818cef70618d6237f43a5ed6aace81c Mon Sep 17 00:00:00 2001 From: Iain Learmonth Date: Wed, 27 Apr 2022 13:39:08 +0100 Subject: [PATCH] schemas: import update script --- schemas/bridgelines.json | 28 ++++++++++++++++++++++++++++ schemas/mirror-mapping.json | 36 ++++++++++++++++++++++++++++++++++++ scripts/update_schemas.py | 17 +++++++++++++++++ 3 files changed, 81 insertions(+) create mode 100644 schemas/bridgelines.json create mode 100644 schemas/mirror-mapping.json create mode 100644 scripts/update_schemas.py diff --git a/schemas/bridgelines.json b/schemas/bridgelines.json new file mode 100644 index 0000000..427d896 --- /dev/null +++ b/schemas/bridgelines.json @@ -0,0 +1,28 @@ +{ + "title": "Bridgelines Version 2", + "type": "object", + "properties": { + "version": { + "title": "Version", + "description": "Version number of the bridgelines schema in use", + "type": "string" + }, + "bridgelines": { + "title": "Bridgelines", + "description": "List of bridgelines, ready for use in a torrc file", + "examples": [ + "obfs4 71.73.124.31:8887 E81B1237F6D13497B166060F55861565593CFF8E cert=b54NsV6tK1g+LHaThPOTCibdpx3wHm9NFe0PzGF1nwz+4M/tq6SkfOaShzPnZsIRCFRIHg iat-mode=0", + "obfs4 172.105.176.101:80 D18BC7E082D7EBF8E851029AC89A12A3F44A50BF cert=KHfAAUptXWRmLy3ehS9ETMO5luY06d0w7tEBDiAI0z62nC5Qo/APrzZxodkYWX2bNko/Mw iat-mode=0", + "obfs4 141.101.36.55:9023 045EF272F08BC11CDB985889E4E9FE35DC6F9C67 cert=6KEdf/5aDSyuYEqvo14JE8Cks3i7PQtj9EFX2wTCiEaUPsp/I7eaOm4uSWdqwvV4vTVlFw iat-mode=0" + ], + "type": "array", + "items": { + "type": "string" + } + } + }, + "required": [ + "version", + "bridgelines" + ] +} \ No newline at end of file diff --git a/schemas/mirror-mapping.json b/schemas/mirror-mapping.json new file mode 100644 index 0000000..5d656f8 --- /dev/null +++ b/schemas/mirror-mapping.json @@ -0,0 +1,36 @@ +{ + "title": "Mirror Mapping Version 1", + "description": "The domain name for the mirror", + "type": "object", + "additionalProperties": { + "$ref": "#/definitions/MMMirror" + }, + "definitions": { + "MMMirror": { + "title": "MMMirror", + "type": "object", + "properties": { + "origin_domain": { + "title": "Origin Domain", + "description": "The full origin domain name", + "type": "string" + }, + "origin_domain_normalized": { + "title": "Origin Domain Normalized", + "description": "The origin_domain with \"www.\" removed, if present", + "type": "string" + }, + "origin_domain_root": { + "title": "Origin Domain Root", + "description": "The registered domain name of the origin, excluding subdomains", + "type": "string" + } + }, + "required": [ + "origin_domain", + "origin_domain_normalized", + "origin_domain_root" + ] + } + } +} \ No newline at end of file diff --git a/scripts/update_schemas.py b/scripts/update_schemas.py new file mode 100644 index 0000000..75c814a --- /dev/null +++ b/scripts/update_schemas.py @@ -0,0 +1,17 @@ +import os +import sys + +sys.path.insert(0, os.path.abspath('..')) + +from app.lists.bc2 import BypassCensorship2 +from app.lists.bridgelines import Bridgelines +from app.lists.mirror_mapping import MirrorMapping + +with open("../schemas/bc2.json", "w") as out: + out.write(BypassCensorship2.schema_json(indent=2)) + +with open("../schemas/bridgelines.json", "w") as out: + out.write(Bridgelines.schema_json(indent=2)) + +with open("../schemas/mirror-mapping.json", "w") as out: + out.write(MirrorMapping.schema_json(indent=2))