async def CreateUser(self, stream): request = await stream.recv_message() data = { "user_id": request.user_id, "port": request.port, "method": request.method, "password": request.password, "enable": request.enable, } user = m.User.create_or_update_user_from_data(data) await stream.send_message(aioshadowsocks_pb2.User(**user.to_dict()))
async def GetUser(self, stream): request = await stream.recv_message() user = m.User.get_by_id(request.user_id) await stream.send_message(aioshadowsocks_pb2.User(**user.to_dict()))