chore: Adds backend ID returning.

This commit is contained in:
Greyson 2024-04-25 13:14:47 +00:00
parent 569016711a
commit 3d5d7d4446
4 changed files with 14 additions and 3 deletions

View file

@ -12,7 +12,7 @@ post {
body:json { body:json {
{ {
"token": "5e2cb92a338a832d385790861312eb85d69f46f82317bfa984ac5e3517368ab5a827897b0f9775a9181b02fa3b9cffed7e59e5b3111d5bdc37f729156caf5f", "token": "535c80825631c04b9add7a8682e06799d62ba57b5089b557f5bab2183fc9926b187b3b8d96da8ef16c67ec80f2917cf81bc21337f47728534f58ac9c4ed5f3fe",
"name": "PortCopier Route", "name": "PortCopier Route",
"description": "This is a test route for portcopier.", "description": "This is a test route for portcopier.",
"backend": "PortCopier", "backend": "PortCopier",

3
routes/NextNet API/runroute.sh Executable file
View file

@ -0,0 +1,3 @@
#!/usr/bin/env bash
npx @usebruno/cli run "$1" --output /tmp/out.json
cat /tmp/out.json | less

View file

@ -3,6 +3,10 @@ export type ParameterReturnedValue = {
message?: string message?: string
} }
export type ConnectedClients = {
};
export interface BackendInterface { export interface BackendInterface {
new(): { new(): {
addConnection(sourceIP: string, sourcePort: number, destPort: number, protocol: "tcp" | "udp"): void; addConnection(sourceIP: string, sourcePort: number, destPort: number, protocol: "tcp" | "udp"): void;
@ -14,6 +18,9 @@ export interface BackendInterface {
destPort: number, destPort: number,
protocol: "tcp" | "udp" protocol: "tcp" | "udp"
}[]; }[];
status: "running" | "stopped" | "starting";
logs: string[],
}, },
checkParametersConnection(sourceIP: string, sourcePort: number, destPort: number, protocol: "tcp" | "udp"): ParameterReturnedValue; checkParametersConnection(sourceIP: string, sourcePort: number, destPort: number, protocol: "tcp" | "udp"): ParameterReturnedValue;

View file

@ -47,7 +47,7 @@ export function route(routeOptions: RouteOptions) {
}); });
}; };
await prisma.desinationProvider.create({ const backend = await prisma.desinationProvider.create({
data: { data: {
name: body.name, name: body.name,
description: body.description, description: body.description,
@ -58,7 +58,8 @@ export function route(routeOptions: RouteOptions) {
}); });
return { return {
success: true success: true,
id: backend.id
}; };
}); });
} }