A Python port of the Invisible Internet Project (I2P)
1"""HTTP bidirectional server tunnel — serves and fetches via I2P.
2
3Combines HTTP server functionality with outbound fetch capability,
4allowing a hidden service to both serve requests and make outgoing
5HTTP requests through I2P.
6
7Ported from net.i2p.i2ptunnel.I2PTunnelHTTPBidirServer.
8"""
9
10from __future__ import annotations
11
12import logging
13
14from i2p_apps.i2ptunnel.config import TunnelDefinition, TunnelType
15from i2p_apps.i2ptunnel.http_server import HTTPServerTask
16
17logger = logging.getLogger(__name__)
18
19
20class HTTPBidirServerTask(HTTPServerTask):
21 """HTTP bidirectional server tunnel.
22
23 Extends HTTPServerTask with the ability to make outgoing
24 connections through I2P (for fetching resources, proxying, etc.).
25 The session supports both accept() and connect().
26 """
27
28 def __init__(self, config: TunnelDefinition, session) -> None:
29 super().__init__(config, session)