Fix I2P web tunnel deployment shape

This commit is contained in:
jwinterm
2026-07-08 09:11:32 -04:00
parent 3cfd69222e
commit c38eab9c28
9 changed files with 24 additions and 16 deletions
+7 -3
View File
@@ -685,14 +685,16 @@ Log notice file {state_dir / "tor.log"}
"""
if protocol.name == "i2p":
port = int(protocol.options.get("local_port", 18081))
inport = int(protocol.options.get("inport", 80))
key_file = protocol.options.get("keys_file", f"{site.id}-web.dat")
tunnel_name = protocol.options.get("tunnel_name", f"{site.id}-web")
return f"""# Generated by AMPG. Review before installing.
[{tunnel_name}]
type = server
type = http
host = 127.0.0.1
port = {port}
keys = {state_dir / str(key_file)}
inport = {inport}
keys = {key_file}
"""
if protocol.name == "gemini":
port = int(protocol.options.get("port", 1965))
@@ -837,10 +839,12 @@ WantedBy=multi-user.target
</plist>
"""
shell = "/data/data/com.termux/files/usr/bin/sh" if provider.name == "android-termux" else "/bin/sh"
state_dir = _state_dir(config, provider, site, protocol)
data_dir_setup = f"\nmkdir -p {state_dir / 'data'}" if protocol.name == "i2p" else ""
return f"""#!{shell}
# Generated by AMPG. Review before installing.
set -eu
mkdir -p {_state_dir(config, provider, site, protocol)}
mkdir -p {state_dir}{data_dir_setup}
{command}
"""
+3 -1
View File
@@ -148,14 +148,16 @@ HiddenServicePort 80 127.0.0.1:{port}
def _i2pd_artifact(site: SiteConfig, protocol: ProtocolConfig) -> PlanArtifact:
port = int(protocol.options.get("local_port", 18081))
inport = int(protocol.options.get("inport", 80))
key_file = protocol.options.get("keys_file", f"{site.id}-web.dat")
tunnel_name = protocol.options.get("tunnel_name", f"{site.id}-web")
path = _protocol_plan_dir(site, protocol) / "i2pd-tunnel.conf"
content = f"""# Generated by AMPG. Review before installing.
[{tunnel_name}]
type = server
type = http
host = 127.0.0.1
port = {port}
inport = {inport}
keys = {key_file}
"""
return PlanArtifact(path=path, content=content)
+1 -1
View File
@@ -210,7 +210,7 @@ def _i2p_contract(
site,
protocol,
role="identity-key",
path=state_dir / key_file,
path=state_dir / "data" / key_file,
owner="daemon",
required=True,
sensitive=True,