← Về thư mục
openai4s/share/relay.py
- RelayConfig · class · L81-L151 — class RelayConfig
- init · method · L82-L107 — def init( self, *, base_domain: str, tunnel_host: str | None = None, tokens: dict[str, str] | None = None, tokens_file: str | Path | None = None, trust_proxy: bool = False, max_inflight: int = p.DEFAULT_MAX_INFLIGHT, rate_per_sec: float = 10.0, rate_burst: int = 30, max_conns_per_ip: int = 32, ) -> None
- _load_tokens · method · L109-L137 — def _load_tokens(self, *, force: bool = False) -> None
- principal_for · method · L139-L146 — def principal_for(self, token: str) -> str | None
- allowed_fingerprints · method · L148-L151 — def allowed_fingerprints(self) -> set[str]
- _Pending · class · L154-L158 — class _Pending
- init · method · L157-L158 — def init(self) -> None
- _TunnelConn · class · L161-L217 — class _TunnelConn
- init · method · L162-L171 — def init(self, wfile, principal_fp: str, conn_id: str) -> None
- send_control · method · L173-L185 — def send_control(self, obj: dict[str, Any]) -> bool
- send_ping · method · L187-L193 — def send_ping(self) -> None
- open_request · method · L195-L200 — def open_request(self) -> tuple[int, _Pending]
- close_request · method · L202-L204 — def close_request(self, req_id: int) -> None
- route_frame · method · L206-L210 — def route_frame(self, req_id: int, event: tuple) -> None
- fail_all · method · L212-L217 — def fail_all(self) -> None
- TunnelRegistry · class · L220-L265 — class TunnelRegistry
- init · method · L221-L223 — def init(self) -> None
- register · method · L225-L241 — def register(self, share_id: str, conn: _TunnelConn) -> str
- unregister · method · L243-L247 — def unregister(self, share_id: str, conn: _TunnelConn) -> None
- drop_conn · method · L249-L254 — def drop_conn(self, conn: _TunnelConn) -> None
- get · method · L256-L258 — def get(self, share_id: str) -> _TunnelConn | None
- disconnect_principals_not_in · method · L260-L265 — def disconnect_principals_not_in(self, allowed: set[str]) -> None
- _RateLimiter · class · L268-L290 — class _RateLimiter
- init · method · L269-L273 — def init(self, rate: float, burst: int) -> None
- allow · method · L275-L283 — def allow(self, key: str, now: float) -> bool
- sweep · method · L285-L290 — def sweep(self, now: float) -> None
- make_relay_handler · function · L293-L657 — def make_relay_handler(config: RelayConfig, registry: TunnelRegistry)
- Handler · class · L296-L655 — class Handler(BaseHTTPRequestHandler)
- log_message · method · L300-L301 — def log_message(self, *a): # quiet
- do_GET · method · L304-L305 — def do_GET(self)
- do_HEAD · method · L307-L308 — def do_HEAD(self)
- do_POST · method · L310-L311 — def do_POST(self)
- _route · method · L315-L335 — def _route(self, method: str) -> None
- _is_upgrade · method · L338-L341 — def _is_upgrade(self) -> bool
- _tunnel · method · L343-L364 — def _tunnel(self) -> None
- _tunnel_loop · method · L366-L402 — def _tunnel_loop(self, conn: _TunnelConn) -> None
- _tunnel_control · method · L404-L459 — def _tunnel_control(self, conn: _TunnelConn, msg: dict[str, Any]) -> None
- _forward · method · L462-L490 — def _forward(self, method: str, share_id: str, client: str) -> None
- _relay_response · method · L492-L530 — def _relay_response( self, method: str, conn: _TunnelConn, req_id: int, pending: _Pending ) -> None
- _stream · method · L532-L577 — def _stream( self, conn: _TunnelConn, req_id: int, pending: _Pending, content_length: str | None, ) -> None
- _drain · method · L579-L586 — def _drain(self, pending: _Pending) -> None
- _sanitize_headers · method · L590-L605 — def _sanitize_headers(raw: Any) -> tuple[dict[str, str], bool]
- _host · method · L607-L609 — def _host(self) -> str
- _share_label · method · L611-L616 — def _share_label(self, host: str) -> str | None
- _bearer · method · L618-L622 — def _bearer(self) -> str | None
- _client_ip · method · L624-L632 — def _client_ip(self) -> str
- _simple · method · L634-L652 — def _simple( self, status: int, body: bytes, *, extra: dict | None = None ) -> None
- _not_found · method · L654-L655 — def _not_found(self) -> None
- RelayServer · class · L660-L681 — class RelayServer(ThreadingHTTPServer)
- init · method · L664-L670 — def init(self, address: tuple[str, int], config: RelayConfig) -> None
- _sweep · method · L672-L677 — def _sweep(self) -> None
- server_close · method · L679-L681 — def server_close(self) -> None
- serve_relay · function · L684-L699 — def serve_relay( *, host: str, port: int, config: RelayConfig, block: bool = True, ) -> RelayServer