Skip to content

Commit

Permalink
Add endpoint for retrieving best IP configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
3Kmfi6HP committed Mar 23, 2024
1 parent 8ad1b54 commit 344d13a
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion _worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,16 @@ export default {
}
});
};
case `/bestip/${userID_Path}`: {
const bestSubConfig = await fetch(`https://sub.xf.free.hr/auto?host=${request.headers.get('Host')}&uuid=${userID}`);
// Construct and return response object
return new Response(bestSubConfig, {
status: 200,
headers: {
"Content-Type": "text/plain;charset=utf-8",
}
});
};
default:
// return new Response('Not found', { status: 404 });
// For any other path, reverse proxy to 'ramdom website' and return the original response, caching it in the process
Expand Down Expand Up @@ -712,7 +722,7 @@ ${vlessSec}
---------------------------------------------------------------`;
}).join('\n');
const sublink = `https://${hostName}/sub/${userIDArray[0]}?format=clash`
const subbestip = `https://sub.xf.free.hr/auto?host=${hostName}&uuid=${userIDArray[0]}`;
const subbestip = `https://${hostName}/bestip/${userIDArray[0]}`;
const clash_link = `https://api.v1.mk/sub?target=clash&url=${encodeURIComponent(sublink)}&insert=false&emoji=true&list=false&tfo=false&scv=true&fdn=false&sort=false&new_name=true`;
// Prepare header string
const header = `
Expand Down

0 comments on commit 344d13a

Please sign in to comment.