ZeroNet Proxy

The darc.proxy.zeronet module contains the auxiliary functions around managing and processing the ZeroNet proxy.

darc.proxy.zeronet._zeronet_bootstrap()[source]

ZeroNet bootstrap.

The bootstrap arguments are defined as _ZERONET_ARGS.

Raises:

subprocess.CalledProcessError – If the return code of _ZERONET_PROC is non-zero.

Return type:

None

darc.proxy.zeronet.launch_zeronet()[source]

Launch ZeroNet process. :rtype: Popen[bytes]

See also

This function mocks the behaviour of stem.process.launch_tor().

Return type:

Popen[bytes]

darc.proxy.zeronet.zeronet_bootstrap()[source]

Bootstrap wrapper for ZeroNet.

The function will bootstrap the ZeroNet proxy. It will retry for ZERONET_RETRY times 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.

Return type:

None

The following constants are configuration through environment variables:

darc.proxy.zeronet.ZERONET_PORT: int

Port for ZeroNet proxy connection.

Default:

43110

Environ:

ZERONET_PORT

darc.proxy.zeronet.ZERONET_RETRY: int

Retry times for ZeroNet bootstrap when failure.

Default:

3

Environ:

ZERONET_RETRY

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:

ZERONET_PATH

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:

ZERONET_ARGS

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._MNG_ZERONET: bool

If manage ZeroNet proxy through darc.

Default:

True

Environ:

DARC_ZERONET

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.