mirror of
https://github.com/Start9Labs/start-sdk.git
synced 2026-03-31 04:33:40 +00:00
chore: Update types
This commit is contained in:
@@ -75,14 +75,6 @@ type SslProtocols = {
|
|||||||
: never
|
: never
|
||||||
}[keyof KnownProtocols]
|
}[keyof KnownProtocols]
|
||||||
type NotSslProtocols = Exclude<keyof KnownProtocols, SslProtocols>
|
type NotSslProtocols = Exclude<keyof KnownProtocols, SslProtocols>
|
||||||
type OldPortOptionsByKnownProtocol<T extends KnownProtocol> =
|
|
||||||
(typeof knownProtocols)[T] extends { withSsl: KnownProtocol }
|
|
||||||
? BasePortOptions<T> &
|
|
||||||
({ noAddSsl: true } | { addSsl?: Partial<AddSslOptions> })
|
|
||||||
: BasePortOptions<T> & { addSsl?: AddSslOptions | null }
|
|
||||||
type OldPortOptionsByProtocol<T extends string> = T extends KnownProtocol
|
|
||||||
? OldPortOptionsByKnownProtocol<T>
|
|
||||||
: PortOptions
|
|
||||||
|
|
||||||
type PortOptionsByKnownProtocol =
|
type PortOptionsByKnownProtocol =
|
||||||
| ({
|
| ({
|
||||||
@@ -194,40 +186,10 @@ export class Host {
|
|||||||
|
|
||||||
private bindPortForKnownDefaulAddSsl(
|
private bindPortForKnownDefaulAddSsl(
|
||||||
options: PortOptionsByKnownProtocol,
|
options: PortOptionsByKnownProtocol,
|
||||||
protoInfo:
|
protoInfo: KnownProtocols[keyof KnownProtocols],
|
||||||
| {
|
|
||||||
readonly secure: false
|
|
||||||
readonly ssl: false
|
|
||||||
readonly defaultPort: 80
|
|
||||||
readonly withSsl: "https"
|
|
||||||
}
|
|
||||||
| { readonly secure: true; readonly ssl: true; readonly defaultPort: 443 }
|
|
||||||
| {
|
|
||||||
readonly secure: false
|
|
||||||
readonly ssl: false
|
|
||||||
readonly defaultPort: 80
|
|
||||||
readonly withSsl: "wss"
|
|
||||||
}
|
|
||||||
| { readonly secure: true; readonly ssl: true; readonly defaultPort: 443 }
|
|
||||||
| { readonly secure: true; readonly ssl: false; readonly defaultPort: 22 }
|
|
||||||
| {
|
|
||||||
readonly secure: true
|
|
||||||
readonly ssl: false
|
|
||||||
readonly defaultPort: 8333
|
|
||||||
}
|
|
||||||
| {
|
|
||||||
readonly secure: true
|
|
||||||
readonly ssl: true
|
|
||||||
readonly defaultPort: 50051
|
|
||||||
}
|
|
||||||
| {
|
|
||||||
readonly secure: true
|
|
||||||
readonly ssl: false
|
|
||||||
readonly defaultPort: 53
|
|
||||||
},
|
|
||||||
) {
|
) {
|
||||||
if ("noAddSsl" in options && options.noAddSsl) return TRUE_DEFAULT
|
if ("noAddSsl" in options && options.noAddSsl) return TRUE_DEFAULT
|
||||||
if ("withSsl" in protoInfo)
|
if ("withSsl" in protoInfo && protoInfo.withSsl)
|
||||||
return {
|
return {
|
||||||
preferredExternalPort: knownProtocols[protoInfo.withSsl].defaultPort,
|
preferredExternalPort: knownProtocols[protoInfo.withSsl].defaultPort,
|
||||||
scheme: protoInfo.withSsl,
|
scheme: protoInfo.withSsl,
|
||||||
|
|||||||
Reference in New Issue
Block a user