diff --git a/src/Util/Link.ts b/src/Util/Link.ts index 3b4ec8c..328f4af 100644 --- a/src/Util/Link.ts +++ b/src/Util/Link.ts @@ -98,7 +98,7 @@ function parseParams(paramsString?: string): Record | undefined */ function createVlessLink({ uuid, host, port, params, name }: VlessLink): string { // 基本的 VLESS 链接格式 - let link = `vless://${uuid}@${host}:${port}\n`; + let link = `vless://${uuid}@${host}:${port}`; // 如果有查询参数,则拼接它们 if (params && Object.keys(params).length > 0) { @@ -111,7 +111,7 @@ function createVlessLink({ uuid, host, port, params, name }: VlessLink): string link += `#${encodeURIComponent(name)}`; } - return link; + return link + '\n'; } export { CreatVmessDirect, ChangVmessServer, CreateLink, parseVlessLink } diff --git a/src/Util/comm.ts b/src/Util/comm.ts index 9e32f3b..c53635a 100644 --- a/src/Util/comm.ts +++ b/src/Util/comm.ts @@ -67,7 +67,7 @@ const is_ip = (ip: string) => { return reg.test(ip); } function extractIPv4(ip: string): string | null { - const ipv4Regex = /(\b25[0-5]\b|\b2[0-4][0-9]\b|\b[01]?[0-9][0-9]?\b)\.(\b25[0-5]\b|\b2[0-4][0-9]\b|\b[01]?[0-9][0-9]?\b)\.(\b25[0-5]\b|\b2[0-4][0-9]\b|\b[01]?[0-9][0-9]?\b)\.(\b25[0-5]\b|\b2[0-4][0-9]\b|\b[01]?[0-9][0-9]?\b)/g; + const ipv4Regex = /(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)/; const matches = ip.match(ipv4Regex); // 如果没有匹配到任何IPv4地址,返回 null diff --git a/src/components/LinkItem.vue b/src/components/LinkItem.vue index 1e6c828..ace82b2 100644 --- a/src/components/LinkItem.vue +++ b/src/components/LinkItem.vue @@ -58,6 +58,7 @@ export default defineComponent({ vless.port = props.serve.port if (props.serve.istls == 1 && vless.params) { vless.params.security = 'tls' + vless.params.path = `/${ip}` } api.get_server_ms(props.serve.host, props.serve.port, ip, props.serve.istls).then((res) => { console.log(res) diff --git a/src/components/OriginalLinkItem.vue b/src/components/OriginalLinkItem.vue index dcfb065..c6a45de 100644 --- a/src/components/OriginalLinkItem.vue +++ b/src/components/OriginalLinkItem.vue @@ -60,6 +60,9 @@ export default defineComponent({ vless.name = props.names[index] vless.host = ip + vless.port = 9000 + vless.params.path = '/' + vless.params.security = 'none' api.get_server_ms(ip, 9000, ip, 0).then((res) => { console.log(res) time.value = res.time diff --git a/src/pages/CreateLink.vue b/src/pages/CreateLink.vue index 75eb47e..69cb4ca 100644 --- a/src/pages/CreateLink.vue +++ b/src/pages/CreateLink.vue @@ -24,6 +24,7 @@ import { CreateLink, CreatVmessDirect } from 'src/Util/Link'; import { useQuasar } from 'quasar'; import { vlessLink } from 'src/config'; import { getdata } from 'src/api/api'; +import { VLESS } from 'src/Util/node/Vless'; export default defineComponent({ name: 'CreateLink', setup() {