diff --git a/README.md b/README.md index ec60e7f..457a97e 100644 --- a/README.md +++ b/README.md @@ -131,4 +131,14 @@ def is_circuit_built(): if circ.status == 'BUILT': return True return False +``` + +to hot reload the haproxy configuration without having to re-establish tor circuits with a full rebuild or restart, you can run the below (replacing `multisocks-haproxy-1` if appropriate) + +```shell +docker exec \ +multisocks-haproxy-1 haproxy \ +-f /usr/local/etc/haproxy/haproxy.cfg \ +-p /var/run/haproxy.pid \ +-sf $(cat /var/run/haproxy.pid) ``` \ No newline at end of file diff --git a/haconfig/gen_conf.py b/haconfig/gen_conf.py index a0ed30a..4b72265 100644 --- a/haconfig/gen_conf.py +++ b/haconfig/gen_conf.py @@ -11,15 +11,14 @@ def get_dockernet_hostnames(): network = client.networks.get("net_tor") net_tor_id = network.attrs["Id"] containers = client.containers.list() - containers = [ - container for container in containers + container_names = [ + container.attrs['Name'][1:] + for container in containers if ("net_tor" in container.attrs["NetworkSettings"]["Networks"]) and (container.attrs["NetworkSettings"]["Networks"]["net_tor"]["NetworkID"] == net_tor_id) and (container.attrs["Config"]["User"] == "tor") ] - dns = [container.attrs['NetworkSettings']['Networks']["net_tor"]['Aliases'][0] - for container in containers] - return dns + return container_names if __name__ == "__main__": cihosts = get_dockernet_hostnames()