chore: Move API source code to API folder.
This commit is contained in:
parent
8015b0af74
commit
d3a664fea4
59 changed files with 43 additions and 38 deletions
|
@ -1,59 +0,0 @@
|
|||
export type ParameterReturnedValue = {
|
||||
success: boolean,
|
||||
message?: string
|
||||
}
|
||||
|
||||
export type ForwardRule = {
|
||||
sourceIP: string,
|
||||
sourcePort: number,
|
||||
destPort: number
|
||||
};
|
||||
|
||||
export type ConnectedClient = {
|
||||
ip: string,
|
||||
port: number,
|
||||
|
||||
connectionDetails: ForwardRule
|
||||
};
|
||||
|
||||
export class BackendBaseClass {
|
||||
state: "stopped" | "stopping" | "started" | "starting";
|
||||
|
||||
clients?: ConnectedClient[]; // Not required to be implemented, but more consistency
|
||||
logs: string[];
|
||||
|
||||
constructor(parameters: string) {
|
||||
this.logs = [];
|
||||
this.clients = [];
|
||||
|
||||
this.state = "stopped";
|
||||
}
|
||||
|
||||
addConnection(sourceIP: string, sourcePort: number, destPort: number, protocol: "tcp" | "udp"): void {};
|
||||
removeConnection(sourceIP: string, sourcePort: number, destPort: number, protocol: "tcp" | "udp"): void {};
|
||||
|
||||
async start(): Promise<boolean> {
|
||||
return true;
|
||||
}
|
||||
|
||||
async stop(): Promise<boolean> {
|
||||
return true;
|
||||
};
|
||||
|
||||
getAllConnections(): ConnectedClient[] {
|
||||
if (this.clients == null) return [];
|
||||
return this.clients;
|
||||
};
|
||||
|
||||
static checkParametersConnection(sourceIP: string, sourcePort: number, destPort: number, protocol: "tcp" | "udp"): ParameterReturnedValue {
|
||||
return {
|
||||
success: true
|
||||
}
|
||||
};
|
||||
|
||||
static checkParametersBackendInstance(data: string): ParameterReturnedValue {
|
||||
return {
|
||||
success: true
|
||||
}
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue