Skip to content

Commit 1412ae5

Browse files
Refactored
1 parent 64dd8a0 commit 1412ae5

File tree

2 files changed

+3
-7
lines changed

2 files changed

+3
-7
lines changed

src/protocols/trojan.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -209,9 +209,7 @@ async function handleTCPOutBound(
209209
const match = proxyIP.match(/^(\[.*?\]):(\d+)$/);
210210
proxyIP = match[1];
211211
proxyIpPort = +match[2];
212-
}
213-
214-
if (proxyIP.split(':').length === 2) {
212+
} else {
215213
proxyIP = proxyIP.split(':')[0];
216214
proxyIpPort = +proxyIP.split(':')[1];
217215
}

src/protocols/vless.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -154,17 +154,15 @@ async function handleTCPOutBound(
154154
// if the cf connect tcp socket have no incoming data, we retry to redirect ip
155155
async function retry() {
156156
let proxyIP, proxyIpPort;
157-
const EncodedPanelProxyIPs = pathName.split('/')[2] || '';
157+
const EncodedPanelProxyIPs = globalThis.pathName.split('/')[2] || '';
158158
const proxyIPs = atob(EncodedPanelProxyIPs) || globalThis.proxyIPs;
159159
const finalProxyIPs = proxyIPs.split(',').map(ip => ip.trim());
160160
proxyIP = finalProxyIPs[Math.floor(Math.random() * finalProxyIPs.length)];
161161
if (proxyIP.includes(']:')) {
162162
const match = proxyIP.match(/^(\[.*?\]):(\d+)$/);
163163
proxyIP = match[1];
164164
proxyIpPort = +match[2];
165-
}
166-
167-
if (proxyIP.split(':').length === 2) {
165+
} else {
168166
proxyIP = proxyIP.split(':')[0];
169167
proxyIpPort = +proxyIP.split(':')[1];
170168
}

0 commit comments

Comments
 (0)