"""HTTP bidirectional server tunnel — serves and fetches via I2P. Combines HTTP server functionality with outbound fetch capability, allowing a hidden service to both serve requests and make outgoing HTTP requests through I2P. Ported from net.i2p.i2ptunnel.I2PTunnelHTTPBidirServer. """ from __future__ import annotations import logging from i2p_apps.i2ptunnel.config import TunnelDefinition, TunnelType from i2p_apps.i2ptunnel.http_server import HTTPServerTask logger = logging.getLogger(__name__) class HTTPBidirServerTask(HTTPServerTask): """HTTP bidirectional server tunnel. Extends HTTPServerTask with the ability to make outgoing connections through I2P (for fetching resources, proxying, etc.). The session supports both accept() and connect(). """ def __init__(self, config: TunnelDefinition, session) -> None: super().__init__(config, session)