30 lines
851 B
Python
30 lines
851 B
Python
from libs.fspn.protocol.server import Server
|
|
from libs.fspn.protocol.connection import Connection, EVENTS as CONNECTION_EVENTS
|
|
from libs.api.apiBlueprint import ApiBlueprint
|
|
|
|
from flask import jsonify
|
|
|
|
import logging
|
|
import random
|
|
|
|
class Blueprint(ApiBlueprint):
|
|
def routes(self):
|
|
from .rendezvousClient import RendezvousClient
|
|
self.module:RendezvousClient = self.module
|
|
|
|
@self.blueprint.route('/')
|
|
def show():
|
|
return self.module.name
|
|
|
|
@self.blueprint.route('/connect')
|
|
def connect_server():
|
|
self.module.connect_to_server(('127.0.0.1', 30331))
|
|
return jsonify()
|
|
|
|
@self.blueprint.route('/getRandomPeer')
|
|
def get_random_peer():
|
|
self.module.send_get_random_peer()
|
|
return jsonify({"status":"success"})
|
|
|
|
|