Feature/network (#2622)

* Feature: Add in the clear bindings

* wip: Working on network

* fix: Make it so the config gives the url

* chore: Remove the repeated types

* chore: Add in the todo's here

* chore: UPdate and remove some poorly name var

* chore: Remove the clear-bindings impl

* chore: Remove the wrapper

* handle HostnameInfo for Host bindings

Co-authored-by: Jade <Blu-J@users.noreply.github.com>

* ??

* chore: Make the install work

* Fix: Url's not being created

* chore: Fix the local onion in url

* include port in hostname

* Chore of adding a comment just to modify.

---------

Co-authored-by: Aiden McClelland <me@drbonez.dev>
Co-authored-by: Jade <Blu-J@users.noreply.github.com>
This commit is contained in:
Jade
2024-06-06 15:39:54 -06:00
committed by GitHub
parent 412c5d68cc
commit 2c12af5af8
67 changed files with 798 additions and 1516 deletions

View File

@@ -6,7 +6,6 @@ import type { Version } from "./Version"
export type AddAssetParams = {
version: Version
platform: string
upload: boolean
url: string
signature: AnySignature
commitment: Blake3Commitment

View File

@@ -0,0 +1,9 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
import type { AnySignature } from "./AnySignature"
import type { MerkleArchiveCommitment } from "./MerkleArchiveCommitment"
export type AddPackageParams = {
url: string
commitment: MerkleArchiveCommitment
signature: AnySignature
}

View File

@@ -2,7 +2,6 @@
import type { AlpnInfo } from "./AlpnInfo"
export type AddSslOptions = {
scheme: string | null
preferredExternalPort: number
alpn: AlpnInfo
alpn: AlpnInfo | null
}

View File

@@ -1,10 +1,11 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
import type { BindOptions } from "./BindOptions"
import type { HostId } from "./HostId"
export type AddressInfo = {
username: string | null
hostId: HostId
bindOptions: BindOptions
internalPort: number
scheme: string | null
sslScheme: string | null
suffix: string
}

View File

@@ -1,4 +1,5 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
import type { BindOptions } from "./BindOptions"
import type { LanInfo } from "./LanInfo"
export type BindInfo = { options: BindOptions; assignedLanPort: number | null }
export type BindInfo = { options: BindOptions; lan: LanInfo }

View File

@@ -3,7 +3,6 @@ import type { AddSslOptions } from "./AddSslOptions"
import type { Security } from "./Security"
export type BindOptions = {
scheme: string | null
preferredExternalPort: number
addSsl: AddSslOptions | null
secure: Security | null

View File

@@ -8,7 +8,6 @@ export type BindParams = {
kind: HostKind
id: HostId
internalPort: number
scheme: string | null
preferredExternalPort: number
addSsl: AddSslOptions | null
secure: Security | null

View File

@@ -1,7 +1,5 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
import type { AddressInfo } from "./AddressInfo"
import type { ExportedHostnameInfo } from "./ExportedHostnameInfo"
import type { HostKind } from "./HostKind"
import type { ServiceInterfaceId } from "./ServiceInterfaceId"
import type { ServiceInterfaceType } from "./ServiceInterfaceType"
@@ -14,6 +12,4 @@ export type ExportServiceInterfaceParams = {
masked: boolean
addressInfo: AddressInfo
type: ServiceInterfaceType
hostKind: HostKind
hostnames: Array<ExportedHostnameInfo>
}

View File

@@ -1,10 +0,0 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
import type { ExportedHostnameInfo } from "./ExportedHostnameInfo"
import type { HostId } from "./HostId"
import type { HostKind } from "./HostKind"
export type ExportedHostInfo = {
id: HostId
kind: HostKind
hostnames: Array<ExportedHostnameInfo>
}

View File

@@ -1,12 +0,0 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
import type { ExportedIpHostname } from "./ExportedIpHostname"
import type { ExportedOnionHostname } from "./ExportedOnionHostname"
export type ExportedHostnameInfo =
| {
kind: "ip"
networkInterfaceId: string
public: boolean
hostname: ExportedIpHostname
}
| { kind: "onion"; hostname: ExportedOnionHostname }

View File

@@ -1,10 +1,9 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
import type { Callback } from "./Callback"
import type { GetHostInfoParamsKind } from "./GetHostInfoParamsKind"
import type { HostId } from "./HostId"
export type GetHostInfoParams = {
kind: GetHostInfoParamsKind | null
serviceInterfaceId: string
hostId: HostId
packageId: string | null
callback: Callback
}

View File

@@ -1,3 +0,0 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
export type GetHostInfoParamsKind = "multi"

View File

@@ -4,6 +4,7 @@ import type { PackageVersionInfo } from "./PackageVersionInfo"
import type { Version } from "./Version"
export type GetPackageResponse = {
categories: string[]
best: { [key: Version]: PackageVersionInfo }
otherVersions?: { [key: Version]: PackageInfoShort }
}

View File

@@ -3,6 +3,7 @@ import type { PackageVersionInfo } from "./PackageVersionInfo"
import type { Version } from "./Version"
export type GetPackageResponseFull = {
categories: string[]
best: { [key: Version]: PackageVersionInfo }
otherVersions: { [key: Version]: PackageVersionInfo }
}

View File

@@ -1,10 +1,9 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
import type { Callback } from "./Callback"
import type { HostId } from "./HostId"
import type { ServiceInterfaceId } from "./ServiceInterfaceId"
export type GetPrimaryUrlParams = {
packageId: string | null
serviceInterfaceId: string
serviceInterfaceId: ServiceInterfaceId
callback: Callback
hostId: HostId
}

View File

@@ -1,8 +1,9 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
import type { Callback } from "./Callback"
import type { ServiceInterfaceId } from "./ServiceInterfaceId"
export type GetServiceInterfaceParams = {
packageId: string | null
serviceInterfaceId: string
serviceInterfaceId: ServiceInterfaceId
callback: Callback
}

View File

@@ -3,5 +3,5 @@
export type HardwareRequirements = {
device: { [key: string]: string }
ram: number | null
arch: Array<string> | null
arch: string[] | null
}

View File

@@ -2,10 +2,14 @@
import type { BindInfo } from "./BindInfo"
import type { HostAddress } from "./HostAddress"
import type { HostKind } from "./HostKind"
import type { HostnameInfo } from "./HostnameInfo"
export type Host = {
kind: HostKind
bindings: { [key: number]: BindInfo }
addresses: Array<HostAddress>
primary: HostAddress | null
/**
* COMPUTED: NetService::update
*/
hostnameInfo: { [key: number]: Array<HostnameInfo> }
}

View File

@@ -0,0 +1,12 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
import type { IpHostname } from "./IpHostname"
import type { OnionHostname } from "./OnionHostname"
export type HostnameInfo =
| {
kind: "ip"
networkInterfaceId: string
public: boolean
hostname: IpHostname
}
| { kind: "onion"; hostname: OnionHostname }

View File

@@ -2,4 +2,4 @@
import type { Host } from "./Host"
import type { HostId } from "./HostId"
export type HostInfo = { [key: HostId]: Host }
export type Hosts = { [key: HostId]: Host }

View File

@@ -1,6 +1,6 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
export type ExportedIpHostname =
export type IpHostname =
| { kind: "ipv4"; value: string; port: number | null; sslPort: number | null }
| { kind: "ipv6"; value: string; port: number | null; sslPort: number | null }
| {

View File

@@ -1,7 +1,6 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
export type ReverseProxyDestination = {
ip: string | null
port: number
ssl: boolean
export type LanInfo = {
assignedPort: number | null
assignedSslPort: number | null
}

View File

@@ -1,6 +1,6 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
export type ExportedOnionHostname = {
export type OnionHostname = {
value: string
port: number | null
sslPort: number | null

View File

@@ -7,7 +7,7 @@ export type OsVersionInfo = {
headline: string
releaseNotes: string
sourceVersion: string
signers: Array<Guid>
authorized: Array<Guid>
iso: { [key: string]: RegistryAsset<Blake3Commitment> }
squashfs: { [key: string]: RegistryAsset<Blake3Commitment> }
img: { [key: string]: RegistryAsset<Blake3Commitment> }

View File

@@ -3,10 +3,10 @@ import type { ActionId } from "./ActionId"
import type { ActionMetadata } from "./ActionMetadata"
import type { CurrentDependencies } from "./CurrentDependencies"
import type { DataUrl } from "./DataUrl"
import type { HostInfo } from "./HostInfo"
import type { Hosts } from "./Hosts"
import type { PackageState } from "./PackageState"
import type { ServiceInterface } from "./ServiceInterface"
import type { ServiceInterfaceId } from "./ServiceInterfaceId"
import type { ServiceInterfaceWithHostInfo } from "./ServiceInterfaceWithHostInfo"
import type { Status } from "./Status"
export type PackageDataEntry = {
@@ -18,7 +18,7 @@ export type PackageDataEntry = {
lastBackup: string | null
currentDependencies: CurrentDependencies
actions: { [key: ActionId]: ActionMetadata }
serviceInterfaces: { [key: ServiceInterfaceId]: ServiceInterfaceWithHostInfo }
hosts: HostInfo
serviceInterfaces: { [key: ServiceInterfaceId]: ServiceInterface }
hosts: Hosts
storeExposedDependents: string[]
}

View File

@@ -4,6 +4,7 @@ import type { PackageVersionInfo } from "./PackageVersionInfo"
import type { Version } from "./Version"
export type PackageInfo = {
signers: Array<Guid>
authorized: Array<Guid>
versions: { [key: Version]: PackageVersionInfo }
categories: string[]
}

View File

@@ -17,7 +17,6 @@ export type PackageVersionInfo = {
upstreamRepo: string
supportSite: string
marketingSite: string
categories: string[]
osVersion: Version
hardwareRequirements: HardwareRequirements
sourceVersion: string | null

View File

@@ -1,3 +0,0 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
export type ReverseProxyBind = { ip: string | null; port: number; ssl: boolean }

View File

@@ -1,3 +0,0 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
export type ReverseProxyHttp = { headers: null | { [key: string]: string } }

View File

@@ -1,10 +0,0 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
import type { ReverseProxyBind } from "./ReverseProxyBind"
import type { ReverseProxyDestination } from "./ReverseProxyDestination"
import type { ReverseProxyHttp } from "./ReverseProxyHttp"
export type ReverseProxyParams = {
bind: ReverseProxyBind
dst: ReverseProxyDestination
http: ReverseProxyHttp
}

View File

@@ -1,17 +0,0 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
import type { AddressInfo } from "./AddressInfo"
import type { ExportedHostInfo } from "./ExportedHostInfo"
import type { ServiceInterfaceId } from "./ServiceInterfaceId"
import type { ServiceInterfaceType } from "./ServiceInterfaceType"
export type ServiceInterfaceWithHostInfo = {
hostInfo: ExportedHostInfo
id: ServiceInterfaceId
name: string
description: string
hasPrimary: boolean
disabled: boolean
masked: boolean
addressInfo: AddressInfo
type: ServiceInterfaceType
}

View File

@@ -3,6 +3,7 @@ export { ActionId } from "./ActionId"
export { ActionMetadata } from "./ActionMetadata"
export { AddAdminParams } from "./AddAdminParams"
export { AddAssetParams } from "./AddAssetParams"
export { AddPackageParams } from "./AddPackageParams"
export { AddressInfo } from "./AddressInfo"
export { AddSslOptions } from "./AddSslOptions"
export { AddVersionParams } from "./AddVersionParams"
@@ -40,15 +41,10 @@ export { Duration } from "./Duration"
export { EncryptedWire } from "./EncryptedWire"
export { ExecuteAction } from "./ExecuteAction"
export { ExportActionParams } from "./ExportActionParams"
export { ExportedHostInfo } from "./ExportedHostInfo"
export { ExportedHostnameInfo } from "./ExportedHostnameInfo"
export { ExportedIpHostname } from "./ExportedIpHostname"
export { ExportedOnionHostname } from "./ExportedOnionHostname"
export { ExportServiceInterfaceParams } from "./ExportServiceInterfaceParams"
export { ExposeForDependentsParams } from "./ExposeForDependentsParams"
export { FullIndex } from "./FullIndex"
export { FullProgress } from "./FullProgress"
export { GetHostInfoParamsKind } from "./GetHostInfoParamsKind"
export { GetHostInfoParams } from "./GetHostInfoParams"
export { GetOsAssetParams } from "./GetOsAssetParams"
export { GetPackageParams } from "./GetPackageParams"
@@ -69,14 +65,17 @@ export { HealthCheckId } from "./HealthCheckId"
export { HealthCheckResult } from "./HealthCheckResult"
export { HostAddress } from "./HostAddress"
export { HostId } from "./HostId"
export { HostInfo } from "./HostInfo"
export { HostKind } from "./HostKind"
export { HostnameInfo } from "./HostnameInfo"
export { Hosts } from "./Hosts"
export { Host } from "./Host"
export { ImageId } from "./ImageId"
export { InstalledState } from "./InstalledState"
export { InstallingInfo } from "./InstallingInfo"
export { InstallingState } from "./InstallingState"
export { IpHostname } from "./IpHostname"
export { IpInfo } from "./IpInfo"
export { LanInfo } from "./LanInfo"
export { ListServiceInterfacesParams } from "./ListServiceInterfacesParams"
export { ListVersionSignersParams } from "./ListVersionSignersParams"
export { MainStatus } from "./MainStatus"
@@ -86,6 +85,7 @@ export { MerkleArchiveCommitment } from "./MerkleArchiveCommitment"
export { MountParams } from "./MountParams"
export { MountTarget } from "./MountTarget"
export { NamedProgress } from "./NamedProgress"
export { OnionHostname } from "./OnionHostname"
export { OsIndex } from "./OsIndex"
export { OsVersionInfo } from "./OsVersionInfo"
export { PackageDataEntry } from "./PackageDataEntry"
@@ -106,10 +106,6 @@ export { RemoveActionParams } from "./RemoveActionParams"
export { RemoveAddressParams } from "./RemoveAddressParams"
export { RemoveVersionParams } from "./RemoveVersionParams"
export { RequestCommitment } from "./RequestCommitment"
export { ReverseProxyBind } from "./ReverseProxyBind"
export { ReverseProxyDestination } from "./ReverseProxyDestination"
export { ReverseProxyHttp } from "./ReverseProxyHttp"
export { ReverseProxyParams } from "./ReverseProxyParams"
export { Security } from "./Security"
export { ServerInfo } from "./ServerInfo"
export { ServerSpecs } from "./ServerSpecs"
@@ -117,7 +113,6 @@ export { ServerStatus } from "./ServerStatus"
export { ServiceInterfaceId } from "./ServiceInterfaceId"
export { ServiceInterface } from "./ServiceInterface"
export { ServiceInterfaceType } from "./ServiceInterfaceType"
export { ServiceInterfaceWithHostInfo } from "./ServiceInterfaceWithHostInfo"
export { SessionList } from "./SessionList"
export { Sessions } from "./Sessions"
export { Session } from "./Session"