enabling support for wireguard and firewall (#2713)

* wip: enabling support for wireguard and firewall

* wip

* wip

* wip

* wip

* wip

* implement some things

* fix warning

* wip

* alpha.23

* misc fixes

* remove ufw since no longer required

* remove debug info

* add cli bindings

* debugging

* fixes

* individualized acme and privacy settings for domains and bindings

* sdk version bump

* migration

* misc fixes

* refactor Host::update

* debug info

* refactor webserver

* misc fixes

* misc fixes

* refactor port forwarding

* recheck interfaces every 5 min if no dbus event

* misc fixes and cleanup

* misc fixes
This commit is contained in:
Aiden McClelland
2025-01-09 16:34:34 -07:00
committed by GitHub
parent 45ca9405d3
commit 29e8210782
144 changed files with 4878 additions and 2398 deletions

View File

@@ -1,15 +1,6 @@
import { ServiceInterfaceType } from "../types"
import { knownProtocols } from "../interfaces/Host"
import {
AddressInfo,
Host,
HostAddress,
Hostname,
HostnameInfo,
HostnameInfoIp,
HostnameInfoOnion,
IpInfo,
} from "../types"
import { AddressInfo, Host, Hostname, HostnameInfo } from "../types"
import { Effects } from "../Effects"
export type UrlString = string
@@ -48,8 +39,6 @@ export type ServiceInterfaceFilled = {
name: string
/** Human readable description, used as tooltip usually */
description: string
/** Whether or not the interface has a primary URL */
hasPrimary: boolean
/** Whether or not to mask the URIs for this interface. Useful if the URIs contain sensitive information, such as a password, macaroon, or API key */
masked: boolean
/** Information about the host for this binding */
@@ -58,10 +47,6 @@ export type ServiceInterfaceFilled = {
addressInfo: FilledAddressInfo | null
/** Indicates if we are a ui/p2p/api for the kind of interface that this is representing */
type: ServiceInterfaceType
/** The primary hostname for the service, as chosen by the user */
primaryHostname: Hostname | null
/** The primary URL for the service, as chosen by the user */
primaryUrl: UrlString | null
}
const either =
<A>(...args: ((a: A) => boolean)[]) =>
@@ -89,7 +74,9 @@ export const addressHostToUrl = (
if (host.hostname.kind === "domain") {
hostname = `${host.hostname.subdomain ? `${host.hostname.subdomain}.` : ""}${host.hostname.domain}`
} else if (host.hostname.kind === "ipv6") {
hostname = `[${host.hostname.value}]`
hostname = host.hostname.value.startsWith("fe80::")
? `[${host.hostname.value}%${host.hostname.scopeId}]`
: `[${host.hostname.value}]`
} else {
hostname = host.hostname.value
}
@@ -200,23 +187,13 @@ const makeInterfaceFilled = async ({
hostId,
callback,
})
const primaryUrl = await effects.getPrimaryUrl({
hostId,
packageId,
callback,
})
const interfaceFilled: ServiceInterfaceFilled = {
...serviceInterfaceValue,
primaryUrl: primaryUrl,
host,
addressInfo: host
? filledAddress(host, serviceInterfaceValue.addressInfo)
: null,
get primaryHostname() {
if (primaryUrl == null) return null
return getHostname(primaryUrl)
},
}
return interfaceFilled
}

View File

@@ -30,22 +30,10 @@ const makeManyInterfaceFilled = async ({
if (!host) {
throw new Error(`host ${hostId} not found!`)
}
const primaryUrl = await effects
.getPrimaryUrl({
hostId,
packageId,
callback,
})
.catch(() => null)
return {
...serviceInterfaceValue,
primaryUrl: primaryUrl,
host,
addressInfo: filledAddress(host, serviceInterfaceValue.addressInfo),
get primaryHostname() {
if (primaryUrl == null) return null
return getHostname(primaryUrl)
},
}
}),
)

View File

@@ -2,58 +2,58 @@ import { Pattern } from "../actions/input/inputSpecTypes"
import * as regexes from "./regexes"
export const ipv6: Pattern = {
regex: regexes.ipv6.toString(),
regex: regexes.ipv6.source,
description: "Must be a valid IPv6 address",
}
export const ipv4: Pattern = {
regex: regexes.ipv4.toString(),
regex: regexes.ipv4.source,
description: "Must be a valid IPv4 address",
}
export const hostname: Pattern = {
regex: regexes.hostname.toString(),
regex: regexes.hostname.source,
description: "Must be a valid hostname",
}
export const localHostname: Pattern = {
regex: regexes.localHostname.toString(),
regex: regexes.localHostname.source,
description: 'Must be a valid ".local" hostname',
}
export const torHostname: Pattern = {
regex: regexes.torHostname.toString(),
regex: regexes.torHostname.source,
description: 'Must be a valid Tor (".onion") hostname',
}
export const url: Pattern = {
regex: regexes.url.toString(),
regex: regexes.url.source,
description: "Must be a valid URL",
}
export const localUrl: Pattern = {
regex: regexes.localUrl.toString(),
regex: regexes.localUrl.source,
description: 'Must be a valid ".local" URL',
}
export const torUrl: Pattern = {
regex: regexes.torUrl.toString(),
regex: regexes.torUrl.source,
description: 'Must be a valid Tor (".onion") URL',
}
export const ascii: Pattern = {
regex: regexes.ascii.toString(),
regex: regexes.ascii.source,
description:
"May only contain ASCII characters. See https://www.w3schools.com/charsets/ref_html_ascii.asp",
}
export const email: Pattern = {
regex: regexes.email.toString(),
regex: regexes.email.source,
description: "Must be a valid email address",
}
export const base64: Pattern = {
regex: regexes.base64.toString(),
regex: regexes.base64.source,
description:
"May only contain base64 characters. See https://base64.guru/learn/base64-characters",
}