mirror of
https://github.com/clash-verge-rev/clash-verge-rev.git
synced 2026-11-20 10:52:08 +08:00
fix: support VLESS xhttp and normalize IPv6 addresses
This commit is contained in:
@@ -193,6 +193,10 @@ export type UrlLikeParts = {
|
||||
fragment?: string
|
||||
}
|
||||
|
||||
export function normalizeHost(host: string): string {
|
||||
return host.startsWith('[') && host.endsWith(']') ? host.slice(1, -1) : host
|
||||
}
|
||||
|
||||
const URLLIKE_RE =
|
||||
/^(?:(?<auth>.*?)@)?(?<host>.*?)(?::(?<port>\d+))?\/?(?:\?(?<query>.*?))?(?:#(?<fragment>.*?))?$/
|
||||
|
||||
@@ -227,7 +231,7 @@ export function parseUrlLike(
|
||||
|
||||
const result: UrlLikeParts = {
|
||||
auth,
|
||||
host: groups.host,
|
||||
host: normalizeHost(groups.host),
|
||||
port: groups.port,
|
||||
query: groups.query,
|
||||
fragment: groups.fragment,
|
||||
|
||||
Reference in New Issue
Block a user