feat(ipsec): enhance IPsec management with peer and certificate handling
Docker images / prepare-release (push) Successful in 8s
Docker images / backend-test (push) Successful in 2m39s
Docker images / frontend-image (push) Successful in 2m56s
Docker images / updater-image (push) Successful in 44s
Docker images / backend-image (push) Successful in 2m35s
Docker images / notify-webhook (push) Skipped
Docker images / publish-release (push) Successful in 15s
Docker images / prepare-release (push) Successful in 8s
Docker images / backend-test (push) Successful in 2m39s
Docker images / frontend-image (push) Successful in 2m56s
Docker images / updater-image (push) Successful in 44s
Docker images / backend-image (push) Successful in 2m35s
Docker images / notify-webhook (push) Skipped
Docker images / publish-release (push) Successful in 15s
- Added support for managing IPsec peers, including editing and deleting functionality. - Introduced a new UI component for displaying peers and their details within the IPsec server grid. - Updated the IPsec user creation form to allow binding identities to specific peers. - Enhanced backend routes and services to handle peer patching and deletion requests. - Improved data structures to accommodate multiple peers and certificates for each server. - Added tests to ensure proper functionality of new peer management features.
This commit is contained in:
@@ -3,6 +3,7 @@ import type {
|
||||
IpsecCertBundle,
|
||||
IpsecInitRequest,
|
||||
IpsecListResponse,
|
||||
IpsecPeerPatch,
|
||||
IpsecServerSummaryDto,
|
||||
IpsecUserCreateRequest,
|
||||
IpsecUserCreated,
|
||||
@@ -106,3 +107,48 @@ export async function restoreIpsecRevision(
|
||||
body: JSON.stringify({ serverId }),
|
||||
})
|
||||
}
|
||||
|
||||
export async function patchIpsecPeer(
|
||||
baseUrl: string,
|
||||
serverId: string,
|
||||
peerId: string,
|
||||
patch: IpsecPeerPatch,
|
||||
): Promise<{ ok: boolean }> {
|
||||
return requestJson<{ ok: boolean }>(
|
||||
baseUrl,
|
||||
`/api/ipsec/peers/${encodeURIComponent(serverId)}/${encodeURIComponent(peerId)}`,
|
||||
{ method: "PATCH", body: JSON.stringify(patch) },
|
||||
)
|
||||
}
|
||||
|
||||
export async function deleteIpsecPeer(
|
||||
baseUrl: string,
|
||||
serverId: string,
|
||||
peerId: string,
|
||||
opts?: { force?: boolean },
|
||||
): Promise<{ ok: boolean }> {
|
||||
const q = new URLSearchParams()
|
||||
if (opts?.force) q.set("force", "true")
|
||||
const suffix = q.size > 0 ? `?${q.toString()}` : ""
|
||||
return requestJson<{ ok: boolean }>(
|
||||
baseUrl,
|
||||
`/api/ipsec/peers/${encodeURIComponent(serverId)}/${encodeURIComponent(peerId)}${suffix}`,
|
||||
{ method: "DELETE" },
|
||||
)
|
||||
}
|
||||
|
||||
export async function deleteIpsecCert(
|
||||
baseUrl: string,
|
||||
serverId: string,
|
||||
name: string,
|
||||
opts?: { force?: boolean },
|
||||
): Promise<{ ok: boolean }> {
|
||||
const q = new URLSearchParams()
|
||||
if (opts?.force) q.set("force", "true")
|
||||
const suffix = q.size > 0 ? `?${q.toString()}` : ""
|
||||
return requestJson<{ ok: boolean }>(
|
||||
baseUrl,
|
||||
`/api/ipsec/certs/${encodeURIComponent(serverId)}${suffix}`,
|
||||
{ method: "DELETE", body: JSON.stringify({ name }) },
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user