MCPcopy Create free account
hub / github.com/compassvpn/agent / __init__

Method __init__

xray-config/config.py:145–167  ·  view source on GitHub ↗

Initialize instance attributes to hold shared variables.

(self)

Source from the content-addressed store, hash-verified

143 return ""
144
145
146def _cert_not_after(cert_file: str) -> Optional[datetime]:
147 """Return a PEM cert's notAfter (UTC), or None if it can't be determined."""
148 result = exec_command(
149 ["openssl", "x509", "-enddate", "-noout", "-in", cert_file],
150 capture_output=True,
151 )
152 if result.returncode != 0 or not result.stdout:
153 return None
154 # stdout looks like: "notAfter=Jun 18 12:00:00 2026 GMT"
155 raw = result.stdout.strip().split("=", 1)[-1].strip()
156 try:
157 return datetime.strptime(raw, "%b %d %H:%M:%S %Y %Z").replace(
158 tzinfo=timezone.utc
159 )
160 except ValueError:
161 return None
162
163
164class XrayConfig:
165 def __init__(self) -> None:
166 """Initialize instance attributes to hold shared variables."""
167 self.env_config: Dict[str, str] = {}
168 self.is_debug_enabled: bool = False
169 self.anti_abuse: bool = False
170 self.config_id: str = ""

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected