Initialize instance attributes to hold shared variables.
(self)
| 143 | return "" |
| 144 | |
| 145 | |
| 146 | def _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 | |
| 164 | class 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 = "" |
nothing calls this directly
no outgoing calls
no test coverage detected