Freenet Proxy¶
The darc.proxy.freenet module contains the auxiliary functions
around managing and processing the Freenet proxy.
-
darc.proxy.freenet._freenet_bootstrap()¶ Freenet bootstrap.
The bootstrap arguments are defined as
_FREENET_ARGS.- Raises
subprocess.CalledProcessError – If the return code of
_FREENET_PROCis non-zero.
-
darc.proxy.freenet.freenet_bootstrap()¶ Bootstrap wrapper for Freenet.
The function will bootstrap the Freenet proxy. It will retry for
FREENET_RETRYtimes in case of failure.Also, it will NOT re-bootstrap the proxy as is guaranteed by
_FREENET_BS_FLAG.- Warns
FreenetBootstrapFailed – If failed to bootstrap Freenet proxy.
- Raises
UnsupportedPlatform – If the system is not supported, i.e. not macOS or Linux.
-
darc.proxy.freenet.has_freenet(link_pool)¶ Check if contain Freenet links.
- Parameters
link_pool (Iterable[str]) – Link pool to check.
- Returns
If the link pool contains Freenet links.
- Return type
bool
The following constants are configuration through environment variables:
-
darc.proxy.freenet.FREENET_PORT: int¶ Port for Freenet proxy connection.
- Default
8888- Environ
-
darc.proxy.freenet.FREENET_RETRY: int¶ Retry times for Freenet bootstrap when failure.
- Default
3- Environ
-
darc.proxy.freenet.BS_WAIT: float¶ Time after which the attempt to start Freenet is aborted.
- Default
90- Environ
FREENET_WAIT
Note
If not provided, there will be NO timeouts.
-
darc.proxy.freenet.FREENET_PATH: str¶ Path to the Freenet project.
- Default
/usr/local/src/freenet- Environ
-
darc.proxy.freenet.FREENET_ARGS: List[str]¶ Freenet bootstrap arguments for
run.sh start.If provided, it should be parsed as command line arguments (c.f.
shlex.split).- Default
''- Environ
Note
The command will be run as
DARC_USER, if current user (c.f.getpass.getuser()) is root.
The following constants are defined for internal usage:
-
darc.proxy.freenet._FREENET_BS_FLAG: bool¶ If the Freenet proxy is bootstrapped.
-
darc.proxy.freenet._FREENET_PROC: subprocess.Popen¶ Freenet proxy process running in the background.
-
darc.proxy.freenet._FREENET_ARGS: List[str]¶ Freenet proxy bootstrap arguments.