mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-30 20:14:49 +00:00
best address logic
This commit is contained in:
@@ -3,6 +3,7 @@ import { knownProtocols } from "../interfaces/Host"
|
||||
import { AddressInfo, Host, Hostname, HostnameInfo } from "../types"
|
||||
import { Effects } from "../Effects"
|
||||
import { DropGenerator, DropPromise } from "./Drop"
|
||||
import { IPV6_LINK_LOCAL } from "./ip"
|
||||
|
||||
export type UrlString = string
|
||||
export type HostId = string
|
||||
@@ -95,9 +96,9 @@ export const addressHostToUrl = (
|
||||
hostname = host.hostname.value
|
||||
} else if (host.kind === "ip") {
|
||||
if (host.hostname.kind === "domain") {
|
||||
hostname = `${host.hostname.subdomain ? `${host.hostname.subdomain}.` : ""}${host.hostname.domain}`
|
||||
hostname = host.hostname.value
|
||||
} else if (host.hostname.kind === "ipv6") {
|
||||
hostname = host.hostname.value.startsWith("fe80::")
|
||||
hostname = IPV6_LINK_LOCAL.contains(host.hostname.value)
|
||||
? `[${host.hostname.value}%${host.hostname.scopeId}]`
|
||||
: `[${host.hostname.value}]`
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user