ZeroNet Proxy¶
The darc.proxy.zeronet module contains the auxiliary functions
around managing and processing the ZeroNet proxy.
-
darc.proxy.zeronet._zeronet_bootstrap()¶ ZeroNet bootstrap.
The bootstrap arguments are defined as
_ZERONET_ARGS.- Raises
subprocess.CalledProcessError – If the return code of
_ZERONET_PROCis non-zero.
-
darc.proxy.zeronet.has_zeronet(link_pool)¶ Check if contain ZeroNet links.
- Parameters
link_pool (Set[str]) – Link pool to check.
- Returns
If the link pool contains ZeroNet links.
- Return type
bool
-
darc.proxy.zeronet.zeronet_bootstrap()¶ Bootstrap wrapper for ZeroNet.
The function will bootstrap the ZeroNet proxy. It will retry for
ZERONET_RETRYtimes in case of failure.Also, it will NOT re-bootstrap the proxy as is guaranteed by
_ZERONET_BS_FLAG.- Warns
ZeroNetBootstrapFailed – If failed to bootstrap ZeroNet proxy.
- Raises
UnsupportedPlatform – If the system is not supported, i.e. not macOS or Linux.
The following constants are configuration through environment variables:
-
darc.proxy.zeronet.ZERONET_PORT: int¶ Port for ZeroNet proxy connection.
- Default
43110- Environ
-
darc.proxy.zeronet.ZERONET_RETRY: int¶ Retry times for ZeroNet bootstrap when failure.
- Default
3- Environ
-
darc.proxy.zeronet.BS_WAIT: float¶ Time after which the attempt to start ZeroNet is aborted.
- Default
90- Environ
ZERONET_WAIT
Note
If not provided, there will be NO timeouts.
-
darc.proxy.zeronet.ZERONET_PATH: str¶ Path to the ZeroNet project.
- Default
/usr/local/src/zeronet- Environ
-
darc.proxy.zeronet.ZERONET_ARGS: List[str]¶ ZeroNet 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.zeronet._ZERONET_BS_FLAG: bool¶ If the ZeroNet proxy is bootstrapped.
-
darc.proxy.zeronet._ZERONET_PROC: subprocess.Popen¶ ZeroNet proxy process running in the background.
-
darc.proxy.zeronet._ZERONET_ARGS: List[str]¶ ZeroNet proxy bootstrap arguments.