fix transmision in user links

This commit is contained in:
Alireza Ahmadi
2024-05-29 23:29:43 +02:00
parent 9547038164
commit 40fbb22b74
2 changed files with 6 additions and 8 deletions
+5 -7
View File
@@ -140,12 +140,10 @@ export namespace LinkUtil {
host: <string|null>'', host: <string|null>'',
path: <string|null>'', path: <string|null>'',
serviceName: <string|null>'', serviceName: <string|null>'',
type: <string|null>null,
} }
switch (t.type){ switch (t.type){
case TrspTypes.HTTP: case TrspTypes.HTTP:
const th = <HTTP>t const th = <HTTP>t
params.type = 'http'
params.host = th.host?.join(',')?? null params.host = th.host?.join(',')?? null
params.path = th.path?? null params.path = th.path?? null
break break
@@ -224,16 +222,16 @@ export namespace LinkUtil {
v: 2, v: 2,
add: addr, add: addr,
aid: u?.alterId, aid: u?.alterId,
host: tParams.host, host: tParams.host?? undefined,
id: u?.uuid, id: u?.uuid,
net: transport?.type?? 'tcp', net: transport?.type == undefined || transport?.type == 'http' ? 'tcp' : transport.type,
type: transport?.type == 'http' ? 'http' : undefined, type: transport?.type == 'http' ? 'http' : undefined,
path: tParams.path, path: tParams.path?? undefined,
port: inbound.listen_port, port: inbound.listen_port,
ps: inbound.tag, ps: inbound.tag,
sni: inbound.tls.server_name?? '', sni: inbound.tls.server_name?? undefined,
tls: Object.keys(inbound.tls).length>0? 'tls' : 'none' tls: Object.keys(inbound.tls).length>0? 'tls' : 'none'
} }
return 'vmess://' + utf8ToBase64(JSON.stringify(params)) return 'vmess://' + utf8ToBase64(JSON.stringify(params, null, 2))
} }
} }
+1 -1
View File
@@ -203,7 +203,7 @@ const updateLinks = (i: InboundWithUser) => {
i.users.forEach((u:any) => { i.users.forEach((u:any) => {
const client = clients.value.find(c => u.username? c.name == u.username : c.name == u.name) const client = clients.value.find(c => u.username? c.name == u.username : c.name == u.name)
if (client){ if (client){
const clientInbounds = <Inbound[]>inbounds.value.filter(i => client?.inbounds.split(',').includes(i.tag)) const clientInbounds = <Inbound[]>inbounds.value.filter(inb => client?.inbounds.split(',').includes(inb.tag))
const newLinks = <Link[]>[] const newLinks = <Link[]>[]
clientInbounds.forEach(i =>{ clientInbounds.forEach(i =>{
const uri = LinkUtil.linkGenerator(client.name,i) const uri = LinkUtil.linkGenerator(client.name,i)