3Kmfi6HP / EDtunnel

Use Cloudflare pages and worker serverless to implement VLESS protocol
MIT License
6.25k stars 6.05k forks source link

大佬你的代码总是不通,这个代码就好用点,不知道哪里不一样 #32

Open xiaoyaoz1 opened 10 months ago

xiaoyaoz1 commented 10 months ago

总觉得有点不对劲,不如另一个代码的好用,这个一直不通

// version base on commit 43fad05dcdae3b723c53c226f8181fc5bd47223e, time is 2023-06-22 15:20:02 UTC. // @ts-ignore import { connect } from 'cloudflare:sockets';

// How to generate your own UUID: // [Windows] Press "Win + R", input cmd and run: Powershell -NoExit -Command "[guid]::NewGuid()" let userID = 'xxxx-xxxx-xxxx-xxxx-xxxxxxxxx';

let proxyIP = 'cdn-all.xn--b6gac.eu.org';

if (!isValidUUID(userID)) { throw new Error('uuid is not valid'); }

export default { /**

/**

/**

/**

}

// https://xtls.github.io/development/protocols/vless.html // https://github.com/zizifn/excalidraw-backup/blob/main/v2ray-protocol.excalidraw

/**

/**

/**

/**

const WS_READY_STATE_OPEN = 1; const WS_READY_STATE_CLOSING = 2; /**

const byteToHex = []; for (let i = 0; i < 256; ++i) { byteToHex.push((i + 256).toString(16).slice(1)); } function unsafeStringify(arr, offset = 0) { return (byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + "-" + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + "-" + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + "-" + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + "-" + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]]).toLowerCase(); } function stringify(arr, offset = 0) { const uuid = unsafeStringify(arr, offset); if (!isValidUUID(uuid)) { throw TypeError("Stringified UUID is invalid"); } return uuid; }

/**

/**

supercyx3 commented 10 months ago

给个地址?

supercyx3 commented 10 months ago

我一直在用作者的,没问题啊

imy7 commented 10 months ago

这个代码我用过,需要指定CDN的IP或域名,仅有一个vless连接和clash连接,如果你没有域名的话,则不能使用tls。