Add Harbor Gateway auto-detection for client routing
This commit is contained in:
@@ -3,7 +3,6 @@ import test from "node:test";
|
||||
|
||||
const {
|
||||
buildSharedProxyInfo,
|
||||
checkSharedProxyGateway,
|
||||
} = await import("../../src/server/sharedProxy.js");
|
||||
|
||||
test("gateway shared proxy info exposes host and socks proxy when running", () => {
|
||||
@@ -23,33 +22,3 @@ test("gateway shared proxy info exposes host and socks proxy when running", () =
|
||||
socksUrl: "socks5://192.168.50.111:8080",
|
||||
});
|
||||
});
|
||||
|
||||
test("client shared proxy check normalizes gateway response into settings patch", async () => {
|
||||
const patch = await checkSharedProxyGateway(
|
||||
"http://192.168.50.111:3456",
|
||||
async (url) => {
|
||||
assert.equal(url, "http://192.168.50.111:3456/api/shared-proxy");
|
||||
return {
|
||||
ok: true,
|
||||
status: 200,
|
||||
json: async () => ({
|
||||
success: true,
|
||||
available: true,
|
||||
proxy: {
|
||||
host: "192.168.50.111",
|
||||
port: 8080,
|
||||
protocol: "socks5",
|
||||
},
|
||||
}),
|
||||
};
|
||||
},
|
||||
);
|
||||
|
||||
assert.equal(patch.sharedProxyEnabled, true);
|
||||
assert.equal(patch.sharedProxyControlUrl, "http://192.168.50.111:3456");
|
||||
assert.deepEqual(patch.sharedProxy, {
|
||||
host: "192.168.50.111",
|
||||
port: 8080,
|
||||
protocol: "socks5",
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user