mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-31 04:23:40 +00:00
feat: add bridge filter kind to service interface
Adds 'bridge' as a FilterKind to exclude LXC bridge interface hostnames from non-local service interfaces.
This commit is contained in:
@@ -36,6 +36,7 @@ export const getHostname = (url: string): Hostname | null => {
|
|||||||
* - `'ipv6'` — IPv6 addresses only
|
* - `'ipv6'` — IPv6 addresses only
|
||||||
* - `'localhost'` — loopback addresses (`localhost`, `127.0.0.1`, `::1`)
|
* - `'localhost'` — loopback addresses (`localhost`, `127.0.0.1`, `::1`)
|
||||||
* - `'link-local'` — IPv6 link-local addresses (fe80::/10)
|
* - `'link-local'` — IPv6 link-local addresses (fe80::/10)
|
||||||
|
* - `'bridge'` — The LXC bridge interface
|
||||||
* - `'plugin'` — hostnames provided by a plugin package
|
* - `'plugin'` — hostnames provided by a plugin package
|
||||||
*/
|
*/
|
||||||
type FilterKinds =
|
type FilterKinds =
|
||||||
@@ -46,6 +47,7 @@ type FilterKinds =
|
|||||||
| 'ipv6'
|
| 'ipv6'
|
||||||
| 'localhost'
|
| 'localhost'
|
||||||
| 'link-local'
|
| 'link-local'
|
||||||
|
| 'bridge'
|
||||||
| 'plugin'
|
| 'plugin'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -120,7 +122,11 @@ type FilterReturnTy<F extends Filter> = F extends {
|
|||||||
|
|
||||||
const nonLocalFilter = {
|
const nonLocalFilter = {
|
||||||
exclude: {
|
exclude: {
|
||||||
kind: ['localhost', 'link-local'] as ('localhost' | 'link-local')[],
|
kind: ['localhost', 'link-local', 'bridge'] as (
|
||||||
|
| 'localhost'
|
||||||
|
| 'link-local'
|
||||||
|
| 'bridge'
|
||||||
|
)[],
|
||||||
},
|
},
|
||||||
} as const
|
} as const
|
||||||
const publicFilter = {
|
const publicFilter = {
|
||||||
@@ -284,6 +290,9 @@ function filterRec(
|
|||||||
(kind.has('link-local') &&
|
(kind.has('link-local') &&
|
||||||
h.metadata.kind === 'ipv6' &&
|
h.metadata.kind === 'ipv6' &&
|
||||||
IPV6_LINK_LOCAL.contains(IpAddress.parse(h.hostname))) ||
|
IPV6_LINK_LOCAL.contains(IpAddress.parse(h.hostname))) ||
|
||||||
|
(kind.has('bridge') &&
|
||||||
|
h.metadata.kind === 'ipv4' &&
|
||||||
|
h.metadata.gateway === 'lxcbr0') ||
|
||||||
(kind.has('plugin') && h.metadata.kind === 'plugin')),
|
(kind.has('plugin') && h.metadata.kind === 'plugin')),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user