Commit 6754a9e8 authored by nanahira's avatar nanahira

tun proxy

parent 0f404acf
......@@ -51,6 +51,7 @@ interface Gateway {
hidden: boolean;
badUdp: boolean;
redirectAllPorts: boolean;
tunProxy: string;
}
class InventoryBuilder {
......@@ -149,7 +150,7 @@ class InventoryBuilder {
gateway.selectionMark = 0;
gateway.redirectServerPort = 60100;
}
gateway.redirectTargetPorts = gateway.redirectAllPorts ? '1:65535' : this.vars.redirectTargetPorts.replace(/-/g, ':');
gateway.redirectTargetPorts = (gateway.redirectAllPorts || gateway.tunProxy) ? '1:65535' : this.vars.redirectTargetPorts.replace(/-/g, ':');
gateway.pccRules = [];
}
return gateways;
......@@ -314,11 +315,14 @@ class InventoryBuilder {
const gostConfig: GostConfig = {
Routes: availableGateways.map(gateway => {
const useWarp = host.arch !== 'arm' && gateway.warp;
let tunProxy: string = gateway.tunProxy;
if (gateway.tunProxy === 'warp') {
tunProxy = `http://localhost:${gateway.redirectServerPort - 2000}`;
}
return {
ServeNodes: [`red://${host.address}:${gateway.redirectServerPort}`],
Mark: useWarp ? 0 : gateway.selectionMark as number,
ChainNodes: useWarp ? [`http://localhost:${gateway.redirectServerPort - 2000}`] : undefined
Mark: tunProxy?.includes('localhost') ? 0 : gateway.selectionMark as number,
ChainNodes: tunProxy ? tunProxy.split('|') : undefined
}
})
};
......@@ -336,7 +340,7 @@ class InventoryBuilder {
command: '-C /etc/gost/gost.json'
};
if (host.arch !== 'arm') {
for (const gateway of availableGateways.filter(gw => gw.warp)) {
for (const gateway of availableGateways.filter(gw => gw.tunProxy === 'warp')) {
host.dockerServices.services[`warp-${gateway.isp}`] = {
restart: 'always',
image: 'git-registry.mycard.moe/nanahira/warp-proxy',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment