MCPcopy
hub / github.com/certbot/certbot / run

Method run

certbot/src/certbot/_internal/plugins/standalone.py:36–69  ·  view source on GitHub ↗

Run ACME server on specified ``port``. This method is idempotent, i.e. all calls with the same pair of ``(port, challenge_type)`` will reuse the same server. :param int port: Port to run the server on. :param challenge_type: Subclass of `acme.challenges.Challenge`,

(self, port: int, challenge_type: type[challenges.Challenge],
            listenaddr: str = "")

Source from the content-addressed store, hash-verified

34 self.http_01_resources = http_01_resources
35
36 def run(self, port: int, challenge_type: type[challenges.Challenge],
37 listenaddr: str = "") -> acme_standalone.HTTP01DualNetworkedServers:
38 """Run ACME server on specified ``port``.
39
40 This method is idempotent, i.e. all calls with the same pair of
41 ``(port, challenge_type)`` will reuse the same server.
42
43 :param int port: Port to run the server on.
44 :param challenge_type: Subclass of `acme.challenges.Challenge`,
45 currently only `acme.challenge.HTTP01`.
46 :param str listenaddr: (optional) The address to listen on. Defaults to all addrs.
47
48 :returns: DualNetworkedServers instance.
49 :rtype: ACMEServerMixin
50
51 """
52 assert challenge_type == challenges.HTTP01
53 if port in self._instances:
54 return self._instances[port]
55
56 address = (listenaddr, port)
57 try:
58 servers = acme_standalone.HTTP01DualNetworkedServers(
59 address, self.http_01_resources)
60 except OSError as error:
61 raise errors.StandaloneBindError(error, port)
62
63 servers.serve_forever()
64
65 # if port == 0, then random free port on OS is taken
66 # both servers, if they exist, have the same port
67 real_port = servers.getsocknames()[0][1]
68 self._instances[real_port] = servers
69 return servers
70
71 def stop(self, port: int) -> None:
72 """Stop ACME server running on the specified ``port``.

Callers 15

get_snap_revisionsFunction · 0.80
promote_snapsFunction · 0.80
_build_snapFunction · 0.80
mainFunction · 0.80
local_repo_to_remoteFunction · 0.80
deploy_scriptFunction · 0.80
certbot_testFunction · 0.80
run_scriptFunction · 0.80
get_python_os_infoFunction · 0.80
execute_command_statusFunction · 0.80

Calls 2

serve_foreverMethod · 0.80
getsocknamesMethod · 0.80

Tested by 7

local_repo_to_remoteFunction · 0.64
deploy_scriptFunction · 0.64
_test_run_stopMethod · 0.64
test_run_idempotentMethod · 0.64
test_run_bind_errorMethod · 0.64