This commit is contained in:
lingling 2024-12-01 22:32:34 +08:00
parent 6f551540f0
commit 9c65fb2491
5 changed files with 8 additions and 3 deletions

View File

@ -98,7 +98,7 @@ function parseParams(paramsString?: string): Record<string, string> | undefined
*/ */
function createVlessLink({ uuid, host, port, params, name }: VlessLink): string { function createVlessLink({ uuid, host, port, params, name }: VlessLink): string {
// 基本的 VLESS 链接格式 // 基本的 VLESS 链接格式
let link = `vless://${uuid}@${host}:${port}\n`; let link = `vless://${uuid}@${host}:${port}`;
// 如果有查询参数,则拼接它们 // 如果有查询参数,则拼接它们
if (params && Object.keys(params).length > 0) { if (params && Object.keys(params).length > 0) {
@ -111,7 +111,7 @@ function createVlessLink({ uuid, host, port, params, name }: VlessLink): string
link += `#${encodeURIComponent(name)}`; link += `#${encodeURIComponent(name)}`;
} }
return link; return link + '\n';
} }
export { CreatVmessDirect, ChangVmessServer, CreateLink, parseVlessLink } export { CreatVmessDirect, ChangVmessServer, CreateLink, parseVlessLink }

View File

@ -67,7 +67,7 @@ const is_ip = (ip: string) => {
return reg.test(ip); return reg.test(ip);
} }
function extractIPv4(ip: string): string | null { 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); const matches = ip.match(ipv4Regex);
// 如果没有匹配到任何IPv4地址返回 null // 如果没有匹配到任何IPv4地址返回 null

View File

@ -58,6 +58,7 @@ export default defineComponent({
vless.port = props.serve.port vless.port = props.serve.port
if (props.serve.istls == 1 && vless.params) { if (props.serve.istls == 1 && vless.params) {
vless.params.security = 'tls' vless.params.security = 'tls'
vless.params.path = `/${ip}`
} }
api.get_server_ms(props.serve.host, props.serve.port, ip, props.serve.istls).then((res) => { api.get_server_ms(props.serve.host, props.serve.port, ip, props.serve.istls).then((res) => {
console.log(res) console.log(res)

View File

@ -60,6 +60,9 @@ export default defineComponent({
vless.name = props.names[index] vless.name = props.names[index]
vless.host = ip vless.host = ip
vless.port = 9000
vless.params.path = '/'
vless.params.security = 'none'
api.get_server_ms(ip, 9000, ip, 0).then((res) => { api.get_server_ms(ip, 9000, ip, 0).then((res) => {
console.log(res) console.log(res)
time.value = res.time time.value = res.time

View File

@ -24,6 +24,7 @@ import { CreateLink, CreatVmessDirect } from 'src/Util/Link';
import { useQuasar } from 'quasar'; import { useQuasar } from 'quasar';
import { vlessLink } from 'src/config'; import { vlessLink } from 'src/config';
import { getdata } from 'src/api/api'; import { getdata } from 'src/api/api';
import { VLESS } from 'src/Util/node/Vless';
export default defineComponent({ export default defineComponent({
name: 'CreateLink', name: 'CreateLink',
setup() { setup() {