feat: add tracker registration routing
This commit is contained in:
@@ -12,11 +12,11 @@ def main() -> None:
|
||||
subparsers = parser.add_subparsers(dest="command")
|
||||
|
||||
start_cmd = subparsers.add_parser("start", help="Start the gateway server")
|
||||
start_cmd.add_argument("--tracker", default="http://localhost:8080", help="Tracker URL")
|
||||
start_cmd.add_argument(
|
||||
route_group = start_cmd.add_mutually_exclusive_group()
|
||||
route_group.add_argument("--tracker", default="http://localhost:8080", help="Tracker URL")
|
||||
route_group.add_argument(
|
||||
"--node-url",
|
||||
default="http://localhost:7000",
|
||||
help="Node URL to route to until tracker routing is implemented",
|
||||
help="Single node URL for local smoke tests instead of tracker routing",
|
||||
)
|
||||
start_cmd.add_argument("--port", type=int, default=8080, help="Port to listen on")
|
||||
|
||||
@@ -25,11 +25,15 @@ def main() -> None:
|
||||
if args.command == "start":
|
||||
from meshnet_gateway.server import GatewayServer
|
||||
|
||||
gateway = GatewayServer(node_url=args.node_url, port=args.port)
|
||||
if args.node_url:
|
||||
gateway = GatewayServer(node_url=args.node_url, port=args.port)
|
||||
routing_label = f"Routing to node URL: {args.node_url}"
|
||||
else:
|
||||
gateway = GatewayServer(tracker_url=args.tracker, port=args.port)
|
||||
routing_label = f"Tracker URL: {args.tracker}"
|
||||
port = gateway.start()
|
||||
print(f"meshnet-gateway listening on port {port}")
|
||||
print(f"Tracker URL: {args.tracker}")
|
||||
print(f"Routing to node URL: {args.node_url}")
|
||||
print(routing_label)
|
||||
try:
|
||||
import time
|
||||
while True:
|
||||
|
||||
Reference in New Issue
Block a user