-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmanage_circuits.py
More file actions
40 lines (31 loc) · 1.15 KB
/
Copy pathmanage_circuits.py
File metadata and controls
40 lines (31 loc) · 1.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
from anyone_protocol_sdk import Control, Process, Config
print("Starting Anon...")
# Create a configuration
config = Config(
auto_terms_agreement=True,
display_log=False
)
# Initialize and start the runner
anon = Process.launch_anon(anonrc_path=config.to_file())
client = Control.from_port()
try:
print("Connecting to Control Port...")
client.authenticate()
print("Creating a new circuit through specified relays...")
# relays = [
# "894D4088C63D3FA4446E505E672C47A8247AC891",
# "6DB2B0D574CE216648CA388D309EE7CF5DF0B423",
# "A17C391AAE45689358EC226C43D1290EBED7437A"
# ]# Replace with real relay fingerprints
m_circuit_id = client.new_circuit(await_build=True)
print(f"New circuit created with ID: {m_circuit_id}")
m_circuit = client.get_circuit(m_circuit_id)
print(f"Manual Circuit ID: {m_circuit.id}, Path: {m_circuit.path}")
print("Closing the manual circuit...")
client.close_circuit(m_circuit_id)
print(f"Manual circuit {m_circuit_id} closed successfully.")
finally:
client.close()
print("Controller connection closed.")
print("Stopping Anon...")
anon.stop()