feat: update mirror mapping schema for version 1.2
This commit is contained in:
parent
629993301a
commit
6e5adb8801
3 changed files with 73 additions and 14 deletions
|
@ -20,9 +20,10 @@ class MMMirror(BaseModel):
|
|||
origin_domain_root: str = Field(description="The registered domain name of the origin, excluding subdomains")
|
||||
valid_from: str = Field(description="The date on which the mirror was added to the system")
|
||||
valid_to: Optional[str] = Field(description="The date on which the mirror was decommissioned")
|
||||
# countries: List[Tuple[str, int]] = Field(description="A list mapping of risk levels to country")
|
||||
country: Optional[str] = Field(description="The country code of the country in which the origin is targeted")
|
||||
risk: int = Field(description="A risk score for the origin in the target country")
|
||||
countries: Dict[str, int] = Field(description="A list mapping of risk levels to country")
|
||||
country: Optional[str] = Field(
|
||||
description="The country code of the country with the highest risk level where the origin is targeted")
|
||||
risk: int = Field(description="The risk score for the highest risk country")
|
||||
|
||||
|
||||
class MirrorMapping(BaseModel):
|
||||
|
@ -37,7 +38,7 @@ class MirrorMapping(BaseModel):
|
|||
)
|
||||
|
||||
class Config:
|
||||
title = "Mirror Mapping Version 1.1"
|
||||
title = "Mirror Mapping Version 1.2"
|
||||
|
||||
|
||||
def mirror_mapping(_: Optional[Pool]) -> Dict[str, Union[str, Dict[str, str]]]:
|
||||
|
@ -67,7 +68,7 @@ def mirror_mapping(_: Optional[Pool]) -> Dict[str, Union[str, Dict[str, str]]]:
|
|||
origin_domain_root=extract(proxy.origin.domain_name).registered_domain,
|
||||
valid_from=proxy.added.isoformat(),
|
||||
valid_to=proxy.destroyed.isoformat() if proxy.destroyed is not None else None,
|
||||
# countries=[], # TODO: countries,
|
||||
countries=proxy.origin.risk_level,
|
||||
country=highest_risk_country_code,
|
||||
risk=highest_risk_level
|
||||
)
|
||||
|
|
|
@ -1,19 +1,22 @@
|
|||
{
|
||||
"title": "Bridgelines Version 2",
|
||||
"title": "Bridgelines Version 1",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"version": {
|
||||
"title": "Version",
|
||||
"description": "Version number of the bridgelines schema in use",
|
||||
"examples": [
|
||||
"1.0"
|
||||
],
|
||||
"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"
|
||||
"Bridge obfs4 71.73.124.31:8887 E81B1237F6D13497B166060F55861565593CFF8E cert=b54NsV6tK1g+LHaThPOTCibdpx3wHm9NFe0PzGF1nwz+4M/tq6SkfOaShzPnZsIRCFRIHg iat-mode=0",
|
||||
"Bridge obfs4 172.105.176.101:80 D18BC7E082D7EBF8E851029AC89A12A3F44A50BF cert=KHfAAUptXWRmLy3ehS9ETMO5luY06d0w7tEBDiAI0z62nC5Qo/APrzZxodkYWX2bNko/Mw iat-mode=0",
|
||||
"Bridge obfs4 141.101.36.55:9023 045EF272F08BC11CDB985889E4E9FE35DC6F9C67 cert=6KEdf/5aDSyuYEqvo14JE8Cks3i7PQtj9EFX2wTCiEaUPsp/I7eaOm4uSWdqwvV4vTVlFw iat-mode=0 "
|
||||
],
|
||||
"type": "array",
|
||||
"items": {
|
||||
|
|
|
@ -1,10 +1,34 @@
|
|||
{
|
||||
"title": "Mirror Mapping Version 1",
|
||||
"description": "The domain name for the mirror",
|
||||
"title": "Mirror Mapping Version 1.2",
|
||||
"type": "object",
|
||||
"additionalProperties": {
|
||||
"$ref": "#/definitions/MMMirror"
|
||||
"properties": {
|
||||
"version": {
|
||||
"title": "Version",
|
||||
"description": "Version number of the mirror mapping schema in use",
|
||||
"type": "string"
|
||||
},
|
||||
"mappings": {
|
||||
"title": "Mappings",
|
||||
"description": "The domain name for the mirror",
|
||||
"type": "object",
|
||||
"additionalProperties": {
|
||||
"$ref": "#/definitions/MMMirror"
|
||||
}
|
||||
},
|
||||
"s3_buckets": {
|
||||
"title": "S3 Buckets",
|
||||
"description": "The names of all S3 buckets used for CloudFront logs",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"version",
|
||||
"mappings",
|
||||
"s3_buckets"
|
||||
],
|
||||
"definitions": {
|
||||
"MMMirror": {
|
||||
"title": "MMMirror",
|
||||
|
@ -24,12 +48,43 @@
|
|||
"title": "Origin Domain Root",
|
||||
"description": "The registered domain name of the origin, excluding subdomains",
|
||||
"type": "string"
|
||||
},
|
||||
"valid_from": {
|
||||
"title": "Valid From",
|
||||
"description": "The date on which the mirror was added to the system",
|
||||
"type": "string"
|
||||
},
|
||||
"valid_to": {
|
||||
"title": "Valid To",
|
||||
"description": "The date on which the mirror was decommissioned",
|
||||
"type": "string"
|
||||
},
|
||||
"countries": {
|
||||
"title": "Countries",
|
||||
"description": "A list mapping of risk levels to country",
|
||||
"type": "object",
|
||||
"additionalProperties": {
|
||||
"type": "integer"
|
||||
}
|
||||
},
|
||||
"country": {
|
||||
"title": "Country",
|
||||
"description": "The country code of the country with the highest risk level where the origin is targeted",
|
||||
"type": "string"
|
||||
},
|
||||
"risk": {
|
||||
"title": "Risk",
|
||||
"description": "The risk score for the highest risk country",
|
||||
"type": "integer"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"origin_domain",
|
||||
"origin_domain_normalized",
|
||||
"origin_domain_root"
|
||||
"origin_domain_root",
|
||||
"valid_from",
|
||||
"countries",
|
||||
"risk"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue