mirror of
https://github.com/lrnselfreliance/wrolpi.git
synced 2026-12-02 20:59:56 -05:00
Torrents over a fail-closed VPN (#1026)
Torrents reach the Internet only through a fail-closed VPN (WireGuard or OpenVPN, any provider), so peers never see a WROLPi's own address. - A network namespace (Pi/Debian) or the vpn container (Docker) with an nftables kill switch; NAT-PMP or fixed port forwarding. - qBittorrent inside it, sandboxed; torrents kept in config/torrents/. - Torrent download form, Torrents page, Share as torrent, nav warning, and VPN settings in both Controller UIs. - Help docs: Torrents, and The VPN for Torrents. QA'd on a Raspberry Pi with a real provider over WireGuard and OpenVPN. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
633b125dc6
commit
2c3300b8b0
80 changed files with 7516 additions and 45 deletions
|
|
@ -570,3 +570,66 @@ class OnboardingCommitResponse(BaseModel):
|
|||
default=None,
|
||||
description="Populated when needs_force='shadowed'.",
|
||||
)
|
||||
|
||||
|
||||
# ============================================================================
|
||||
# VPN
|
||||
# ============================================================================
|
||||
|
||||
class VpnStatusResponse(BaseModel):
|
||||
"""The tunnel which torrents use."""
|
||||
|
||||
enabled: bool = Field(description="Whether the VPN is turned on in controller.yaml")
|
||||
state: Optional[str] = Field(
|
||||
default=None,
|
||||
description="stopped, disabled, wrol_mode, waiting, connecting, connected, or error. Torrents can only reach the "
|
||||
"Internet while connected.")
|
||||
kind: Optional[str] = Field(default=None, description="wireguard or openvpn")
|
||||
interface: Optional[str] = Field(default=None, description="The tunnel's network interface")
|
||||
addresses: list[str] = Field(default_factory=list, description="The tunnel's addresses")
|
||||
dns: list[str] = Field(default_factory=list, description="The VPN's DNS servers")
|
||||
public_ip: Optional[str] = Field(default=None, description="The address peers see")
|
||||
port_forwarding: str = Field(description="none, fixed, or natpmp")
|
||||
forwarded_port: Optional[int] = Field(default=None, description="The port peers can connect to")
|
||||
warnings: list[str] = Field(default_factory=list, description="Problems which do not stop the tunnel")
|
||||
error: Optional[str] = Field(default=None, description="Why the tunnel is not up")
|
||||
updated_at: Optional[float] = Field(default=None, description="When the tunnel last reported (Unix time)")
|
||||
|
||||
|
||||
class VpnSettingsResponse(BaseModel):
|
||||
"""The VPN settings and a summary of the uploaded config."""
|
||||
|
||||
enabled: bool = Field(description="Whether the VPN is turned on")
|
||||
kind: Optional[str] = Field(default=None, description="wireguard or openvpn; None when no config is uploaded")
|
||||
servers: list[str] = Field(default_factory=list, description="The VPN servers named by the config")
|
||||
needs_auth: bool = Field(description="Whether the OpenVPN config needs a username and password")
|
||||
has_auth: bool = Field(description="Whether an OpenVPN username and password are saved")
|
||||
port_forwarding: str = Field(description="none, fixed, or natpmp")
|
||||
forwarded_port: Optional[int] = Field(default=None, description="The port the provider forwards (fixed)")
|
||||
public_ip_url: Optional[str] = Field(default=None, description="Fetched through the tunnel to show its address")
|
||||
natpmp_gateway: Optional[str] = Field(
|
||||
default=None, description="Where NAT-PMP asks for a port; None: the VPN's gateway or first DNS server")
|
||||
|
||||
|
||||
class VpnSettingsRequest(BaseModel):
|
||||
"""Change VPN settings; omitted fields are unchanged."""
|
||||
|
||||
enabled: Optional[bool] = Field(default=None, description="Turn the VPN on or off")
|
||||
port_forwarding: Optional[str] = Field(default=None, description="none, fixed, or natpmp")
|
||||
forwarded_port: Optional[int] = Field(default=None, description="The port the provider forwards (fixed)")
|
||||
public_ip_url: Optional[str] = Field(default=None, description="Empty to stop checking the public address")
|
||||
natpmp_gateway: Optional[str] = Field(default=None, description="An IPv4 address; empty for the default")
|
||||
|
||||
|
||||
class VpnConfigUploadRequest(BaseModel):
|
||||
"""A VPN config file's name and contents."""
|
||||
|
||||
filename: str = Field(description="Ends in .conf (WireGuard) or .ovpn (OpenVPN)")
|
||||
content: str = Field(description="The file's contents")
|
||||
|
||||
|
||||
class VpnAuthRequest(BaseModel):
|
||||
"""The login an OpenVPN config asks for (auth-user-pass)."""
|
||||
|
||||
username: str = Field(description="VPN username")
|
||||
password: str = Field(description="VPN password")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue