api: add local processing response type & param

`local-processing` type returns needed info for on-device processing and creates basic proxy tunnels
This commit is contained in:
wukko
2025-01-29 15:00:50 +06:00
parent 75cda47633
commit c7c9cf2f0f
5 changed files with 77 additions and 8 deletions

View File

@@ -70,6 +70,33 @@ export function createStream(obj) {
return streamLink.toString();
}
export function createProxyTunnels(info) {
const proxyTunnels = [];
let urls = info.url;
if (typeof urls === "string") {
urls = [urls];
}
for (const url of urls) {
proxyTunnels.push(
createStream({
url,
type: "proxy",
service: info?.service,
headers: info?.headers,
requestIP: info?.requestIP,
originalRequest: info?.originalRequest
})
);
}
return proxyTunnels;
}
export function getInternalTunnel(id) {
return internalStreamCache.get(id);
}