forked from libp2p/universal-connectivity
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain.py
More file actions
37 lines (27 loc) · 873 Bytes
/
main.py
File metadata and controls
37 lines (27 loc) · 873 Bytes
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
"""
Main entry point for py-peer.
"""
import trio
import logging
from py_peer.config import parse_args, PeerConfig
from py_peer.peer import Peer
from py_peer.utils.logging import configure_logging
def main() -> None:
"""Main entry point for the application."""
# Parse command line arguments
args = parse_args()
# Configure logging
logger = configure_logging(args.verbose)
# Create peer configuration
config = PeerConfig.from_args(args)
logger.info("Running py-peer...")
logger.info(f"Your selected topic is: {config.topic}")
logger.info(f"Your peer ID is: {config.key_pair.public_key}")
# Create and start the peer
peer = Peer(config)
try:
trio.run(peer.start)
except KeyboardInterrupt:
logger.info("Application terminated by user")
if __name__ == "__main__":
main()