搜索
 找回密码
 立即注册

CF反代U2B还能实现吗

phil 2023-07-12 17:17 391
CF反代U2B还能实现吗
随机推荐

6 回复

应该不行了,之前的好像老是弹验证码
魔法巴拉
2023-7-12 18:39:02
这个代码年久失修了,你试试看,可能要改一些地方

  1. // List of domains bind to your WorkersProxy.
  2. const domain_list = ['https://cdn.reverse-proxy.live/', 'https://ytb.yanyu.workers.dev/']

  3. // Website you intended to retrieve for users.
  4. const upstream = 'https://www.youtube.com/'

  5. // Website you intended to retrieve for users using mobile devices.
  6. const upstream_mobile = 'https://www.youtube.com/'

  7. // Countries and regions where you wish to suspend your service.
  8. const blocked_region = []

  9. // IP addresses which you wish to block from using your service.
  10. const blocked_ip_address = []

  11. addEventListener('fetch', event => {
  12.     event.respondWith(fetchAndApply(event.request));
  13. })

  14. async function fetchAndApply(request) {

  15.     const region = request.headers.get('cf-ipcountry').toUpperCase();
  16.     const ip_address = request.headers.get('cf-connecting-ip');
  17.     const user_agent = request.headers.get('user-agent');
  18.     let response = null;
  19.     let url = request.url;

  20.     if (await device_status(user_agent)){
  21.         upstream_domain = upstream
  22.     } else {
  23.         upstream_domain = upstream_mobile
  24.     }

  25.     for(let domain of domain_list) {
  26.         url = url.replace(domain, upstream_domain)
  27.     };

  28.     if (blocked_region.includes(region)) {
  29.         response = new Response('Access denied: WorkersProxy is not available in your region yet.', {
  30.             status: 403
  31.         });
  32.     } else if(blocked_ip_address.includes(ip_address)){
  33.         response = new Response('Access denied: Your IP address is blocked by WorkersProxy.', {
  34.             status: 403
  35.         });
  36.     } else{
  37.         let method = request.method;
  38.         let headers = request.headers;
  39.         response = fetch(url, {
  40.             method: method,
  41.             headers: headers
  42.         })
  43.     }
  44.     return response;
  45. }

  46. async function device_status (userAgentInfo) {
  47.     var Agents = ["Android", "iPhone", "SymbianOS", "Windows Phone", "iPad", "iPod"];
  48.     var flag = true;
  49.     for (var v = 0; v < Agents.length; v++) {
  50.         if (userAgentInfo.indexOf(Agents[v]) > 0) {
  51.             flag = false;
  52.             break;
  53.         }
  54.     }
  55.     return flag;
  56. }
复制代码


欢迎大家加入西柚论坛!
dave
2023-7-14 15:04:30
魔法巴拉 发表于 2023-7-12 18:39
这个代码年久失修了,你试试看,可能要改一些地方

CF WORKER还有什么玩法????
贴几期教学贴吧
魔法巴拉
2023-7-14 15:25:06
dave 发表于 2023-7-14 15:04
CF WORKER还有什么玩法????
贴几期教学贴吧

基本上反代的都可以做,人有多大胆,cf有多大产,我接了单子,最近没时间搞了
欢迎大家加入西柚论坛!
zip
2023-7-15 00:31:18
什么单?又是论坛?
lewiet
2023-7-15 00:42:19
魔法巴拉 发表于 2023-7-14 15:25
基本上反代的都可以做,人有多大胆,cf有多大产,我接了单子,最近没时间搞了 ...

不经常制造热点论坛很快会荒废的
游客
高级模式
返回顶部