Compare commits
10
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8ed92d917e | ||
|
|
a83e3e5da3 | ||
|
|
3f8a111972 | ||
|
|
c30cd447c5 | ||
|
|
42345fbcc0 | ||
|
|
00b655d315 | ||
|
|
8e259ae996 | ||
|
|
441749afe5 | ||
|
|
2518e345fc | ||
|
|
e925ade94a |
No files matched your search
@@ -0,0 +1,17 @@
|
|||||||
|
root = true
|
||||||
|
|
||||||
|
[*]
|
||||||
|
charset = utf-8
|
||||||
|
end_of_line = lf
|
||||||
|
insert_final_newline = true
|
||||||
|
trim_trailing_whitespace = true
|
||||||
|
|
||||||
|
[*.go]
|
||||||
|
indent_style = tab
|
||||||
|
|
||||||
|
[*.{md,yml,yaml,json}]
|
||||||
|
indent_style = space
|
||||||
|
indent_size = 2
|
||||||
|
|
||||||
|
[Makefile]
|
||||||
|
indent_style = tab
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
* text=auto eol=lf
|
||||||
|
|
||||||
|
*.go text diff=golang
|
||||||
|
*.md text diff=markdown
|
||||||
|
*.png binary
|
||||||
|
*.jpg binary
|
||||||
|
*.jpeg binary
|
||||||
|
*.gif binary
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
* @MeghdadFadaee
|
||||||
@@ -0,0 +1,50 @@
|
|||||||
|
name: Bug report
|
||||||
|
description: Report a reproducible DomainOps defect without including secrets.
|
||||||
|
title: "[Bug]: "
|
||||||
|
labels:
|
||||||
|
- bug
|
||||||
|
body:
|
||||||
|
- type: markdown
|
||||||
|
attributes:
|
||||||
|
value: |
|
||||||
|
Never include API tokens, vault files, vault passwords, private keys, certificates, database files, or sensitive production-domain data. Use the private security advisory link for vulnerabilities.
|
||||||
|
- type: input
|
||||||
|
id: version
|
||||||
|
attributes:
|
||||||
|
label: DomainOps version
|
||||||
|
description: Run `domainops version` and paste only the version, commit, and build date.
|
||||||
|
placeholder: "DomainOps 0.1.0 (commit, date)"
|
||||||
|
validations:
|
||||||
|
required: true
|
||||||
|
- type: dropdown
|
||||||
|
id: os
|
||||||
|
attributes:
|
||||||
|
label: Operating system
|
||||||
|
options:
|
||||||
|
- Linux amd64
|
||||||
|
- Linux arm64
|
||||||
|
- macOS amd64
|
||||||
|
- macOS arm64
|
||||||
|
- Other unsupported platform
|
||||||
|
validations:
|
||||||
|
required: true
|
||||||
|
- type: textarea
|
||||||
|
id: behavior
|
||||||
|
attributes:
|
||||||
|
label: What happened?
|
||||||
|
description: Include the expected result, actual result, and minimal reproduction with domains anonymized.
|
||||||
|
validations:
|
||||||
|
required: true
|
||||||
|
- type: textarea
|
||||||
|
id: logs
|
||||||
|
attributes:
|
||||||
|
label: Sanitized output
|
||||||
|
description: Remove tokens, account IDs, credential IDs, domains, IPs, certificate material, filesystem usernames, and vault/database contents.
|
||||||
|
render: shell
|
||||||
|
- type: checkboxes
|
||||||
|
id: safety
|
||||||
|
attributes:
|
||||||
|
label: Sensitive-data confirmation
|
||||||
|
options:
|
||||||
|
- label: I removed all credentials, private material, and sensitive infrastructure identifiers.
|
||||||
|
required: true
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
blank_issues_enabled: false
|
||||||
|
contact_links:
|
||||||
|
- name: Security vulnerability
|
||||||
|
url: https://github.com/MeghdadFadaee/domainops/security/advisories/new
|
||||||
|
about: Report vulnerabilities privately. Do not disclose tokens, private keys, or exploit details in a public issue.
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
name: Feature request
|
||||||
|
description: Propose an operator workflow or provider capability.
|
||||||
|
title: "[Feature]: "
|
||||||
|
labels:
|
||||||
|
- enhancement
|
||||||
|
body:
|
||||||
|
- type: textarea
|
||||||
|
id: problem
|
||||||
|
attributes:
|
||||||
|
label: Operator problem
|
||||||
|
description: Describe the workflow or risk this feature should address.
|
||||||
|
validations:
|
||||||
|
required: true
|
||||||
|
- type: textarea
|
||||||
|
id: proposal
|
||||||
|
attributes:
|
||||||
|
label: Proposed behavior
|
||||||
|
description: Explain the desired TUI/CLI behavior, provider scope, and safety expectations.
|
||||||
|
validations:
|
||||||
|
required: true
|
||||||
|
- type: textarea
|
||||||
|
id: alternatives
|
||||||
|
attributes:
|
||||||
|
label: Alternatives considered
|
||||||
|
- type: checkboxes
|
||||||
|
id: safety
|
||||||
|
attributes:
|
||||||
|
label: Sensitive-data confirmation
|
||||||
|
options:
|
||||||
|
- label: This request contains no credentials, private keys, or sensitive production-domain data.
|
||||||
|
required: true
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
## Summary
|
||||||
|
|
||||||
|
Describe the operator-visible behavior and why the change is needed.
|
||||||
|
|
||||||
|
## Safety checklist
|
||||||
|
|
||||||
|
- [ ] I did not include API tokens, vault files, private keys, certificates, databases, or production-domain data.
|
||||||
|
- [ ] Provider mutations retain conflict checks, explicit credential routing, and fail-closed behavior.
|
||||||
|
- [ ] Certificate changes preserve staging/production isolation and exact DNS-01 cleanup ownership.
|
||||||
|
- [ ] I added or updated tests for the changed behavior.
|
||||||
|
- [ ] `make verify` passes locally.
|
||||||
|
- [ ] I updated documentation and the changelog when behavior changed.
|
||||||
|
|
||||||
|
## Testing
|
||||||
|
|
||||||
|
List the commands and environments used to validate this change.
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
version: 2
|
||||||
|
updates:
|
||||||
|
- package-ecosystem: gomod
|
||||||
|
directory: /
|
||||||
|
schedule:
|
||||||
|
interval: weekly
|
||||||
|
day: monday
|
||||||
|
open-pull-requests-limit: 5
|
||||||
|
groups:
|
||||||
|
go-dependencies:
|
||||||
|
patterns:
|
||||||
|
- '*'
|
||||||
|
|
||||||
|
- package-ecosystem: github-actions
|
||||||
|
directory: /
|
||||||
|
schedule:
|
||||||
|
interval: weekly
|
||||||
|
day: monday
|
||||||
|
open-pull-requests-limit: 5
|
||||||
|
groups:
|
||||||
|
github-actions:
|
||||||
|
patterns:
|
||||||
|
- '*'
|
||||||
+66
-14
@@ -4,51 +4,103 @@ on:
|
|||||||
push:
|
push:
|
||||||
branches: [main]
|
branches: [main]
|
||||||
pull_request:
|
pull_request:
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
contents: read
|
contents: read
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
group: ci-${{ github.workflow }}-${{ github.ref }}
|
||||||
|
cancel-in-progress: true
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
test:
|
test:
|
||||||
|
name: Test (${{ matrix.os }})
|
||||||
|
timeout-minutes: 30
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
os: [ubuntu-latest, macos-latest]
|
os: [ubuntu-latest, macos-latest]
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- name: Check out source
|
||||||
- uses: actions/setup-go@v5
|
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||||
with:
|
with:
|
||||||
go-version: '1.26.x'
|
persist-credentials: false
|
||||||
|
- name: Set up Go
|
||||||
|
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
|
||||||
|
with:
|
||||||
|
go-version-file: go.mod
|
||||||
cache: true
|
cache: true
|
||||||
- run: go test ./...
|
cache-dependency-path: go.sum
|
||||||
- run: go test -race ./...
|
- name: Verify dependency checksums
|
||||||
- run: go vet ./...
|
run: go mod verify
|
||||||
- run: go build -trimpath ./cmd/domainops
|
- name: Verify formatting
|
||||||
|
if: runner.os == 'Linux'
|
||||||
|
run: test -z "$(gofmt -l cmd internal)"
|
||||||
|
- name: Test
|
||||||
|
run: go test -shuffle=on ./...
|
||||||
|
- name: Test with race detector
|
||||||
|
run: go test -race ./...
|
||||||
|
- name: Vet
|
||||||
|
run: go vet ./...
|
||||||
|
- name: Build
|
||||||
|
run: go build -trimpath ./cmd/domainops
|
||||||
|
|
||||||
release-config:
|
vulnerability-scan:
|
||||||
|
name: Go vulnerability scan
|
||||||
|
timeout-minutes: 15
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- name: Check out source
|
||||||
|
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||||
|
with:
|
||||||
|
persist-credentials: false
|
||||||
|
- name: Set up Go
|
||||||
|
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
|
||||||
|
with:
|
||||||
|
go-version-file: go.mod
|
||||||
|
cache: true
|
||||||
|
cache-dependency-path: go.sum
|
||||||
|
- name: Scan reachable code
|
||||||
|
run: go run golang.org/x/vuln/cmd/govulncheck@v1.6.0 ./...
|
||||||
|
|
||||||
|
release-config:
|
||||||
|
name: Validate release configuration
|
||||||
|
timeout-minutes: 10
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Check out full history
|
||||||
|
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
- uses: goreleaser/goreleaser-action@v6
|
persist-credentials: false
|
||||||
|
- name: Check GoReleaser configuration
|
||||||
|
uses: goreleaser/goreleaser-action@a4f02ab5355a589de60d917a659ce617ed19b3de # v7.3.0
|
||||||
with:
|
with:
|
||||||
distribution: goreleaser
|
distribution: goreleaser
|
||||||
version: '~> v2'
|
version: v2.17.0
|
||||||
args: check
|
args: check
|
||||||
|
|
||||||
cross-build:
|
cross-build:
|
||||||
|
name: Cross-build supported targets
|
||||||
|
timeout-minutes: 20
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- name: Check out source
|
||||||
- uses: actions/setup-go@v5
|
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||||
with:
|
with:
|
||||||
go-version: '1.26.x'
|
persist-credentials: false
|
||||||
|
- name: Set up Go
|
||||||
|
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
|
||||||
|
with:
|
||||||
|
go-version-file: go.mod
|
||||||
cache: true
|
cache: true
|
||||||
|
cache-dependency-path: go.sum
|
||||||
- name: Build supported targets
|
- name: Build supported targets
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
|
set -euo pipefail
|
||||||
for os in linux darwin; do
|
for os in linux darwin; do
|
||||||
for arch in amd64 arm64; do
|
for arch in amd64 arm64; do
|
||||||
CGO_ENABLED=0 GOOS="$os" GOARCH="$arch" go build -trimpath -o "build/domainops-$os-$arch" ./cmd/domainops
|
CGO_ENABLED=0 GOOS="$os" GOARCH="$arch" go build -trimpath -o "build/domainops-$os-$arch" ./cmd/domainops
|
||||||
|
|||||||
@@ -4,40 +4,63 @@ on:
|
|||||||
push:
|
push:
|
||||||
tags:
|
tags:
|
||||||
- 'v*'
|
- 'v*'
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
contents: read
|
contents: read
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
group: release-${{ github.ref }}
|
||||||
|
cancel-in-progress: false
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
verify:
|
verify:
|
||||||
|
timeout-minutes: 30
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- name: Check out source
|
||||||
- uses: actions/setup-go@v5
|
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||||
with:
|
with:
|
||||||
go-version: '1.26.x'
|
persist-credentials: false
|
||||||
|
- name: Set up Go
|
||||||
|
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
|
||||||
|
with:
|
||||||
|
go-version-file: go.mod
|
||||||
cache: true
|
cache: true
|
||||||
- run: go test ./...
|
cache-dependency-path: go.sum
|
||||||
- run: go vet ./...
|
- name: Verify dependency checksums
|
||||||
- run: go build -trimpath ./cmd/domainops
|
run: go mod verify
|
||||||
|
- name: Test
|
||||||
|
run: go test ./...
|
||||||
|
- name: Vet
|
||||||
|
run: go vet ./...
|
||||||
|
- name: Build
|
||||||
|
run: go build -trimpath ./cmd/domainops
|
||||||
|
|
||||||
release:
|
release:
|
||||||
needs: verify
|
needs: verify
|
||||||
|
if: startsWith(github.ref, 'refs/tags/v')
|
||||||
|
timeout-minutes: 20
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
permissions:
|
permissions:
|
||||||
contents: write
|
contents: write
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- name: Check out full history
|
||||||
|
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
- uses: actions/setup-go@v5
|
persist-credentials: false
|
||||||
|
- name: Set up Go
|
||||||
|
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
|
||||||
with:
|
with:
|
||||||
go-version: '1.26.x'
|
go-version-file: go.mod
|
||||||
cache: true
|
cache: true
|
||||||
- uses: goreleaser/goreleaser-action@v6
|
cache-dependency-path: go.sum
|
||||||
|
- name: Build and publish release
|
||||||
|
uses: goreleaser/goreleaser-action@a4f02ab5355a589de60d917a659ce617ed19b3de # v7.3.0
|
||||||
with:
|
with:
|
||||||
distribution: goreleaser
|
distribution: goreleaser
|
||||||
version: '~> v2'
|
version: v2.17.0
|
||||||
args: release --clean
|
args: release --clean
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
+10
@@ -7,6 +7,16 @@
|
|||||||
*.out
|
*.out
|
||||||
.DS_Store
|
.DS_Store
|
||||||
.idea/
|
.idea/
|
||||||
|
.vscode/
|
||||||
.env
|
.env
|
||||||
.env.*
|
.env.*
|
||||||
!.env.example
|
!.env.example
|
||||||
|
*.pem
|
||||||
|
*.key
|
||||||
|
*.p12
|
||||||
|
*.pfx
|
||||||
|
*.sqlite
|
||||||
|
*.sqlite3
|
||||||
|
*.db
|
||||||
|
vault-password
|
||||||
|
vault-password.txt
|
||||||
@@ -6,6 +6,8 @@ builds:
|
|||||||
- id: domainops
|
- id: domainops
|
||||||
main: ./cmd/domainops
|
main: ./cmd/domainops
|
||||||
binary: domainops
|
binary: domainops
|
||||||
|
flags:
|
||||||
|
- -trimpath
|
||||||
env:
|
env:
|
||||||
- CGO_ENABLED=0
|
- CGO_ENABLED=0
|
||||||
goos:
|
goos:
|
||||||
@@ -19,13 +21,28 @@ builds:
|
|||||||
- -X github.com/MeghdadFadaee/domainops/internal/buildinfo.Version={{.Version}}
|
- -X github.com/MeghdadFadaee/domainops/internal/buildinfo.Version={{.Version}}
|
||||||
- -X github.com/MeghdadFadaee/domainops/internal/buildinfo.Commit={{.Commit}}
|
- -X github.com/MeghdadFadaee/domainops/internal/buildinfo.Commit={{.Commit}}
|
||||||
- -X github.com/MeghdadFadaee/domainops/internal/buildinfo.Date={{.Date}}
|
- -X github.com/MeghdadFadaee/domainops/internal/buildinfo.Date={{.Date}}
|
||||||
|
mod_timestamp: "{{ .CommitTimestamp }}"
|
||||||
|
|
||||||
archives:
|
archives:
|
||||||
- formats: [tar.gz]
|
- formats: [tar.gz]
|
||||||
name_template: "{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}"
|
name_template: "{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}"
|
||||||
|
files:
|
||||||
|
- LICENSE*
|
||||||
|
- README.md
|
||||||
|
- CHANGELOG.md
|
||||||
|
- THIRD_PARTY_LICENSES/**/*
|
||||||
|
|
||||||
checksum:
|
checksum:
|
||||||
name_template: checksums.txt
|
name_template: checksums.txt
|
||||||
|
|
||||||
changelog:
|
changelog:
|
||||||
sort: asc
|
sort: asc
|
||||||
|
use: github
|
||||||
|
filters:
|
||||||
|
exclude:
|
||||||
|
- '^docs:'
|
||||||
|
- '^test:'
|
||||||
|
- '^chore:'
|
||||||
|
|
||||||
|
release:
|
||||||
|
prerelease: auto
|
||||||
@@ -2,6 +2,8 @@
|
|||||||
|
|
||||||
## Unreleased
|
## Unreleased
|
||||||
|
|
||||||
|
## 0.1.0 - 2026-07-13
|
||||||
|
|
||||||
- Initial DomainOps implementation.
|
- Initial DomainOps implementation.
|
||||||
- Multi-account Cloudflare inventory and DNS management.
|
- Multi-account Cloudflare inventory and DNS management.
|
||||||
- Cloudflare core TLS controls and edge certificate inventory.
|
- Cloudflare core TLS controls and edge certificate inventory.
|
||||||
@@ -19,3 +21,7 @@
|
|||||||
- Crash-durable ACME account-key commits, idempotent explicit exports, and stricter private-path validation.
|
- Crash-durable ACME account-key commits, idempotent explicit exports, and stricter private-path validation.
|
||||||
- Per-zone DNS authority invalidation, nested endpoint ownership, and a forward migration for legacy endpoint duplicates.
|
- Per-zone DNS authority invalidation, nested endpoint ownership, and a forward migration for legacy endpoint duplicates.
|
||||||
- Zone-bound TLS drafts, blocked-recovery retry, undersized-terminal input safety, and ambiguity-safe certificate forms.
|
- Zone-bound TLS drafts, blocked-recovery retry, undersized-terminal input safety, and ambiguity-safe certificate forms.
|
||||||
|
- Safe TUI connection removal and explicit zone routing with immutable-ID confirmations, affected-route disclosure, and write-unproven warnings.
|
||||||
|
- Provider-neutral DNS-01 dispatch plus optional batch/TLS capabilities, preserving Cloudflare behavior while preparing additional adapters.
|
||||||
|
- Public-repository hardening with pinned least-privilege CI/release workflows, vulnerability scanning, Dependabot, contribution guidance, private security reporting, and release documentation.
|
||||||
|
- In-TUI certificate progress with scrollable bounded activity, safe cancellation, per-order deadlines, authoritative DNS propagation checks, and isolation of lego logs from terminal/JSON output.
|
||||||
@@ -0,0 +1,48 @@
|
|||||||
|
# Contributing to DomainOps
|
||||||
|
|
||||||
|
DomainOps manages live DNS and private certificate material. Contributions are welcome, but changes to mutation, credential, vault, ACME, and recovery paths require conservative review.
|
||||||
|
|
||||||
|
## Development setup
|
||||||
|
|
||||||
|
Use Go 1.26 or newer.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
git clone https://github.com/MeghdadFadaee/domainops.git
|
||||||
|
cd domainops
|
||||||
|
make verify
|
||||||
|
make build
|
||||||
|
```
|
||||||
|
|
||||||
|
Run the race detector before submitting changes to worker, event, synchronization, or TUI state code:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
make race
|
||||||
|
```
|
||||||
|
|
||||||
|
Run the vulnerability scan when dependencies change:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
make vuln
|
||||||
|
make licenses
|
||||||
|
```
|
||||||
|
|
||||||
|
Review the regenerated third-party license directory before committing it; generation is an aid, not a substitute for license review.
|
||||||
|
|
||||||
|
## Safety rules
|
||||||
|
|
||||||
|
- Never commit Cloudflare tokens, vault files or passwords, private keys, certificates, SQLite databases, or real infrastructure inventories.
|
||||||
|
- Use `example.com`, RFC 5737 IP addresses, fake provider IDs, and local HTTP test servers in tests and examples.
|
||||||
|
- Never add a test that contacts Cloudflare or a production ACME directory.
|
||||||
|
- Preserve explicit per-zone credential routing. A mutation must not silently fall back to another credential.
|
||||||
|
- Re-fetch provider state before destructive writes and treat ambiguous provider outcomes as unknown until reconciled.
|
||||||
|
- DNS-01 cleanup must delete only the record created or durably adopted by the exact challenge job.
|
||||||
|
- Keep staging and production ACME accounts, lineages, and filesystem activation paths isolated.
|
||||||
|
- Keep terminal mutations disabled while crash recovery is blocked.
|
||||||
|
|
||||||
|
## Pull requests
|
||||||
|
|
||||||
|
Keep changes focused and explain operator-visible behavior. Add tests for success, cancellation, stale state, provider denial, and ambiguous outcomes as applicable. Update `README.md`, `docs/`, and `CHANGELOG.md` when workflows or guarantees change.
|
||||||
|
|
||||||
|
Maintainers may ask for a design issue before accepting a new provider adapter or a change to the storage, vault, or release formats.
|
||||||
|
|
||||||
|
By submitting a contribution, you agree that it may be distributed under the project’s [MIT License](LICENSE), and you certify that you have the right to submit it.
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2026 Meghdad Fadaee
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
.PHONY: build test race lint fmt check snapshot clean
|
.PHONY: build test race lint fmt fmt-check vuln licenses verify check snapshot clean
|
||||||
|
|
||||||
APP := domainops
|
APP := domainops
|
||||||
VERSION ?= dev
|
VERSION ?= dev
|
||||||
@@ -21,12 +21,28 @@ race:
|
|||||||
fmt:
|
fmt:
|
||||||
gofmt -w $$(find cmd internal -name '*.go' -type f)
|
gofmt -w $$(find cmd internal -name '*.go' -type f)
|
||||||
|
|
||||||
|
fmt-check:
|
||||||
|
test -z "$$(gofmt -l cmd internal)"
|
||||||
|
|
||||||
lint:
|
lint:
|
||||||
go vet ./...
|
go vet ./...
|
||||||
|
|
||||||
check:
|
vuln:
|
||||||
$(MAKE) lint
|
go run golang.org/x/vuln/cmd/govulncheck@v1.6.0 ./...
|
||||||
|
|
||||||
|
licenses:
|
||||||
|
go run github.com/google/go-licenses@v1.6.0 save ./cmd/domainops \
|
||||||
|
--ignore github.com/MeghdadFadaee/domainops \
|
||||||
|
--confidence_threshold 0.7 \
|
||||||
|
--save_path THIRD_PARTY_LICENSES \
|
||||||
|
--force
|
||||||
|
|
||||||
|
verify: fmt-check
|
||||||
|
go mod verify
|
||||||
go test ./...
|
go test ./...
|
||||||
|
go vet ./...
|
||||||
|
|
||||||
|
check: verify
|
||||||
|
|
||||||
snapshot:
|
snapshot:
|
||||||
goreleaser release --snapshot --clean
|
goreleaser release --snapshot --clean
|
||||||
|
|||||||
@@ -1,9 +1,15 @@
|
|||||||
# DomainOps
|
# DomainOps
|
||||||
|
|
||||||
|
[](https://github.com/MeghdadFadaee/domainops/actions/workflows/ci.yml)
|
||||||
|
[](https://go.dev/)
|
||||||
|
|
||||||
DomainOps is a local-first terminal console for managing domains, DNS, Cloudflare TLS, and locally owned ACME certificates. It is designed for operators with many zones across multiple accounts and remains usable over SSH on a minimal Linux server.
|
DomainOps is a local-first terminal console for managing domains, DNS, Cloudflare TLS, and locally owned ACME certificates. It is designed for operators with many zones across multiple accounts and remains usable over SSH on a minimal Linux server.
|
||||||
|
|
||||||
The default command opens a full-screen Bubble Tea v2 interface. The same engine also exposes stable JSON commands for scripts.
|
The default command opens a full-screen Bubble Tea v2 interface. The same engine also exposes stable JSON commands for scripts.
|
||||||
|
|
||||||
|
> [!IMPORTANT]
|
||||||
|
> DomainOps is prerelease software that can modify authoritative DNS and handle deployable private keys. Start with a dedicated test zone and Let’s Encrypt staging, review every mutation, and maintain protected backups of the data directory.
|
||||||
|
|
||||||
## Current capabilities
|
## Current capabilities
|
||||||
|
|
||||||
- Multiple Cloudflare user-owned or account-owned API tokens.
|
- Multiple Cloudflare user-owned or account-owned API tokens.
|
||||||
@@ -27,7 +33,7 @@ The default command opens a full-screen Bubble Tea v2 interface. The same engine
|
|||||||
|
|
||||||
## Build and start
|
## Build and start
|
||||||
|
|
||||||
Go 1.26 or newer is required when building from source.
|
Go 1.26.5 or newer is required when building from source.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
make build
|
make build
|
||||||
@@ -42,6 +48,8 @@ The first run creates a local vault. On macOS or a desktop Linux session, Domain
|
|||||||
|
|
||||||
No root privileges are required.
|
No root privileges are required.
|
||||||
|
|
||||||
|
Tagged releases provide checksum-protected archives for macOS and Linux on amd64 and arm64. Download the archive and `checksums.txt` from the [GitHub Releases page](https://github.com/MeghdadFadaee/domainops/releases), verify its SHA-256 digest, extract it, and move `domainops` to a directory on your `PATH`.
|
||||||
|
|
||||||
## Cloudflare token setup
|
## Cloudflare token setup
|
||||||
|
|
||||||
Use a scoped API token, never a Global API Key. Recommended permissions are:
|
Use a scoped API token, never a Global API Key. Recommended permissions are:
|
||||||
@@ -56,6 +64,8 @@ Restrict the token to only the accounts and zones DomainOps should manage. For a
|
|||||||
|
|
||||||
Press `a` on the Dashboard or Accounts screen to add a token. DomainOps masks it immediately and stores it only in the encrypted vault.
|
Press `a` on the Dashboard or Accounts screen to add a token. DomainOps masks it immediately and stores it only in the encrypted vault.
|
||||||
|
|
||||||
|
The Accounts view shows each local credential ID. Press `d` to remove the selected local connection—not the remote Cloudflare account. If that connection owns preferred zone routes, DomainOps live-verifies eligible replacements and fails closed unless every route can be reassigned safely. In Zones, press `p` to assign a connection explicitly; duplicate labels require the credential ID, and DNS read access is verified before the route changes. Cloudflare does not expose effective write permission, so the routing dialog marks write access as unproven until a real mutation succeeds.
|
||||||
|
|
||||||
Cloudflare’s token-verification response does not disclose effective write scopes. DomainOps therefore labels reads from live probes and records `dns:write`/`tls:write` only after a real mutation succeeds, scoped to that credential and zone. An authoritative later DNS-access denial removes only that zone’s read evidence and detaches the denied route; network failures, rate limits, and Cloudflare 5xx responses preserve the last known-good route. Before removing a preferred connection, perform a successful DNS operation through its replacement on every affected zone within 15 minutes; DomainOps then re-probes exact-zone DNS read access, and removal otherwise fails closed.
|
Cloudflare’s token-verification response does not disclose effective write scopes. DomainOps therefore labels reads from live probes and records `dns:write`/`tls:write` only after a real mutation succeeds, scoped to that credential and zone. An authoritative later DNS-access denial removes only that zone’s read evidence and detaches the denied route; network failures, rate limits, and Cloudflare 5xx responses preserve the last known-good route. Before removing a preferred connection, perform a successful DNS operation through its replacement on every affected zone within 15 minutes; DomainOps then re-probes exact-zone DNS read access, and removal otherwise fails closed.
|
||||||
|
|
||||||
## TUI workflow
|
## TUI workflow
|
||||||
@@ -69,8 +79,13 @@ Cloudflare’s token-verification response does not disclose effective write sco
|
|||||||
| `r` | Synchronize Cloudflare and run public health checks |
|
| `r` | Synchronize Cloudflare and run public health checks |
|
||||||
| `R` | Retry blocked crash recovery after correcting the underlying problem |
|
| `R` | Retry blocked crash recovery after correcting the underlying problem |
|
||||||
| `a` | Add a Cloudflare connection |
|
| `a` | Add a Cloudflare connection |
|
||||||
|
| `d` | Safely remove the selected connection/token in Accounts |
|
||||||
|
| `p` | Live-verify and set the selected zone’s preferred connection |
|
||||||
| `n`, `e`, `d` | Create, edit, or delete a DNS record |
|
| `n`, `e`, `d` | Create, edit, or delete a DNS record |
|
||||||
| `n`, `u`, `i`, `x`, `d` | Issue, renew due, import, export, or revoke a certificate in the Certificates view |
|
| `n`, `u`, `i`, `x`, `d` | Issue, renew due, import, export, or revoke a certificate in the Certificates view |
|
||||||
|
| `↑` / `↓`, `PgUp` / `PgDn`, `Home` / `End` | Inspect the bounded activity history during certificate issuance or renewal |
|
||||||
|
| `b` / `o` | Background the certificate progress console or reopen it while navigating |
|
||||||
|
| `c` or `Esc` | Cancel an active certificate batch and wait for exact DNS challenge cleanup |
|
||||||
| `m`, `h`, `t`, `v` | Adjust the TLS mode, HTTPS, TLS 1.3, or minimum TLS version |
|
| `m`, `h`, `t`, `v` | Adjust the TLS mode, HTTPS, TLS 1.3, or minimum TLS version |
|
||||||
| `s` | Review and apply the Cloudflare TLS diff |
|
| `s` | Review and apply the Cloudflare TLS diff |
|
||||||
| `?` | Contextual help |
|
| `?` | Contextual help |
|
||||||
@@ -78,6 +93,8 @@ Cloudflare’s token-verification response does not disclose effective write sco
|
|||||||
|
|
||||||
Long-running synchronization, certificate, and public endpoint jobs run outside the render loop. The TUI remains navigable while they work.
|
Long-running synchronization, certificate, and public endpoint jobs run outside the render loop. The TUI remains navigable while they work.
|
||||||
|
|
||||||
|
Certificate issuance and renewal use a dedicated progress console rather than writing ACME library logs to the terminal. It shows per-zone stages, DNS propagation waits, elapsed/deadline timing, completed and failed counts, and a scrollable 500-event activity history. Every individual ACME order has a ten-minute safety deadline; cancellation gives exact-record DNS cleanup a separate bounded window before the operation finishes.
|
||||||
|
|
||||||
## Certificate issuance
|
## Certificate issuance
|
||||||
|
|
||||||
Wildcard certificates use DNS-01. A default plan for `example.com` contains both:
|
Wildcard certificates use DNS-01. A default plan for `example.com` contains both:
|
||||||
@@ -117,6 +134,8 @@ Production issuance always requires explicit confirmation. A large selection cre
|
|||||||
|
|
||||||
Each order first verifies the active zone, exact preferred DNS credential, and nested challenge routing, then checks read-probed DNS-access and cached CAA signals. Cloudflare enforces write permission when the challenge is created, and Let’s Encrypt performs the authoritative live DNS and CAA checks.
|
Each order first verifies the active zone, exact preferred DNS credential, and nested challenge routing, then checks read-probed DNS-access and cached CAA signals. Cloudflare enforces write permission when the challenge is created, and Let’s Encrypt performs the authoritative live DNS and CAA checks.
|
||||||
|
|
||||||
|
DomainOps waits for the challenge value on Cloudflare’s authoritative nameservers. It intentionally does not require the machine’s recursive resolver to refresh first: recursive resolvers can retain an earlier NXDOMAIN for the SOA negative-cache period even after the authoritative TXT record exists. The CA still performs its own independent DNS validation.
|
||||||
|
|
||||||
Renew only certificates inside their stored renewal window:
|
Renew only certificates inside their stored renewal window:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
@@ -212,10 +231,15 @@ Apply revalidates the complete plan, submits one Cloudflare zone batch, reloads
|
|||||||
make test
|
make test
|
||||||
make race
|
make race
|
||||||
make check
|
make check
|
||||||
|
make vuln
|
||||||
```
|
```
|
||||||
|
|
||||||
The test suite covers Cloudflare request mapping and rate-limit errors, legacy SQLite upgrades and recovery state, encrypted-vault tampering, DNS-01 exact-record cleanup, 60-order bounded ACME batches, staging/production isolation, durable account/certificate commits and revocation retry, ARI renewal replacement, PEM validation/export, public TLS findings, non-blocking worker limits, CLI JSON envelopes, and responsive TUI rendering.
|
The test suite covers Cloudflare request mapping and rate-limit errors, legacy SQLite upgrades and recovery state, encrypted-vault tampering, DNS-01 exact-record cleanup, 60-order bounded ACME batches, staging/production isolation, durable account/certificate commits and revocation retry, ARI renewal replacement, PEM validation/export, public TLS findings, non-blocking worker limits, CLI JSON envelopes, and responsive TUI rendering.
|
||||||
|
|
||||||
Live Cloudflare and Let’s Encrypt production operations should first be exercised with a dedicated test zone and the staging CA. The automated suite never issues a real production certificate.
|
Live Cloudflare and Let’s Encrypt production operations should first be exercised with a dedicated test zone and the staging CA. The automated suite never issues a real production certificate.
|
||||||
|
|
||||||
See [architecture](docs/architecture.md) and [security](docs/security.md) for implementation boundaries and threat-model details.
|
See [architecture](docs/architecture.md) and [security design](docs/security.md) for implementation boundaries and threat-model details. Contributions should follow [CONTRIBUTING.md](CONTRIBUTING.md). Report vulnerabilities privately according to [SECURITY.md](SECURITY.md), never through a public issue. Maintainers should follow the [release process](docs/releasing.md).
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
|
DomainOps is available under the [MIT License](LICENSE). Release archives also include the notices for bundled dependencies under `THIRD_PARTY_LICENSES`.
|
||||||
+36
@@ -0,0 +1,36 @@
|
|||||||
|
# Security Policy
|
||||||
|
|
||||||
|
DomainOps handles DNS authority, API credentials, ACME account keys, and deployable private keys. Please report suspected vulnerabilities privately and avoid testing against infrastructure you do not own.
|
||||||
|
|
||||||
|
## Supported versions
|
||||||
|
|
||||||
|
Before the first tagged release, security fixes are applied to the `main` branch. After releases begin, the latest published minor release and `main` are supported. Older prereleases and development snapshots are not supported.
|
||||||
|
|
||||||
|
## Reporting a vulnerability
|
||||||
|
|
||||||
|
Use [GitHub private vulnerability reporting](https://github.com/MeghdadFadaee/domainops/security/advisories/new). Do not open a public issue for a suspected vulnerability.
|
||||||
|
|
||||||
|
Include:
|
||||||
|
|
||||||
|
- the affected version or commit;
|
||||||
|
- the operating system and architecture;
|
||||||
|
- a minimal reproduction using fake tokens, example domains, and non-production data;
|
||||||
|
- the security impact and any known mitigations.
|
||||||
|
|
||||||
|
Never send live Cloudflare tokens, vault passwords, vault/database files, ACME account keys, certificate private keys, or an unredacted production inventory. If sensitive material was exposed while reproducing an issue, revoke or rotate it immediately.
|
||||||
|
|
||||||
|
You should receive an acknowledgement within seven days. Validation and remediation timing depend on severity and complexity. Please allow time for a fix and coordinated disclosure before publishing details.
|
||||||
|
|
||||||
|
## Scope
|
||||||
|
|
||||||
|
Security reports are especially useful for:
|
||||||
|
|
||||||
|
- credential or private-key disclosure;
|
||||||
|
- vault, filesystem-permission, or path-traversal weaknesses;
|
||||||
|
- cross-account or cross-provider routing errors;
|
||||||
|
- DNS mutation conflict bypasses;
|
||||||
|
- DNS-01 cleanup deleting records it does not own;
|
||||||
|
- staging/production certificate isolation failures;
|
||||||
|
- crash-recovery bypasses or unsafe retry behavior.
|
||||||
|
|
||||||
|
Operational questions, provider outages, and feature requests belong in the public issue tracker after removing sensitive data.
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2020-2026 Charmbracelet, Inc.
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2020-2026 Charmbracelet, Inc.
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2021-2026 Charmbracelet, Inc.
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
Copyright (c) 2013 Ato Araki. All rights reserved.
|
||||||
|
|
||||||
|
Redistribution and use in source and binary forms, with or without
|
||||||
|
modification, are permitted provided that the following conditions are
|
||||||
|
met:
|
||||||
|
|
||||||
|
* Redistributions of source code must retain the above copyright
|
||||||
|
notice, this list of conditions and the following disclaimer.
|
||||||
|
* Redistributions in binary form must reproduce the above
|
||||||
|
copyright notice, this list of conditions and the following disclaimer
|
||||||
|
in the documentation and/or other materials provided with the
|
||||||
|
distribution.
|
||||||
|
* Neither the name of @atotto. nor the names of its
|
||||||
|
contributors may be used to endorse or promote products derived from
|
||||||
|
this software without specific prior written permission.
|
||||||
|
|
||||||
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
|
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
|
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||||
|
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||||
|
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||||
|
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
|
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||||
|
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
|
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
The MIT License (MIT)
|
||||||
|
|
||||||
|
Copyright (c) 2014 Cenk Altı
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||||
|
this software and associated documentation files (the "Software"), to deal in
|
||||||
|
the Software without restriction, including without limitation the rights to
|
||||||
|
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||||
|
the Software, and to permit persons to whom the Software is furnished to do so,
|
||||||
|
subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||||
|
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||||
|
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||||
|
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||||
|
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2020-2024 Charmbracelet, Inc
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2025 Charmbracelet, Inc
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2023 Charmbracelet, Inc.
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2023 Charmbracelet, Inc.
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2023 Charmbracelet, Inc.
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2023 Charmbracelet, Inc.
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2025 Matt Sherman
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2020 Matt Sherman
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
Copyright (c) 2005-2008 Dustin Sallings <dustin@spy.net>
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in
|
||||||
|
all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
||||||
|
|
||||||
|
<http://www.opensource.org/licenses/mit-license.php>
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
The MIT License (MIT)
|
||||||
|
|
||||||
|
Copyright (c) 2017-2024 Ludovic Fernandez
|
||||||
|
Copyright (c) 2015-2017 Sebastian Erhart
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
||||||
@@ -0,0 +1,202 @@
|
|||||||
|
|
||||||
|
Apache License
|
||||||
|
Version 2.0, January 2004
|
||||||
|
http://www.apache.org/licenses/
|
||||||
|
|
||||||
|
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||||
|
|
||||||
|
1. Definitions.
|
||||||
|
|
||||||
|
"License" shall mean the terms and conditions for use, reproduction,
|
||||||
|
and distribution as defined by Sections 1 through 9 of this document.
|
||||||
|
|
||||||
|
"Licensor" shall mean the copyright owner or entity authorized by
|
||||||
|
the copyright owner that is granting the License.
|
||||||
|
|
||||||
|
"Legal Entity" shall mean the union of the acting entity and all
|
||||||
|
other entities that control, are controlled by, or are under common
|
||||||
|
control with that entity. For the purposes of this definition,
|
||||||
|
"control" means (i) the power, direct or indirect, to cause the
|
||||||
|
direction or management of such entity, whether by contract or
|
||||||
|
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||||
|
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||||
|
|
||||||
|
"You" (or "Your") shall mean an individual or Legal Entity
|
||||||
|
exercising permissions granted by this License.
|
||||||
|
|
||||||
|
"Source" form shall mean the preferred form for making modifications,
|
||||||
|
including but not limited to software source code, documentation
|
||||||
|
source, and configuration files.
|
||||||
|
|
||||||
|
"Object" form shall mean any form resulting from mechanical
|
||||||
|
transformation or translation of a Source form, including but
|
||||||
|
not limited to compiled object code, generated documentation,
|
||||||
|
and conversions to other media types.
|
||||||
|
|
||||||
|
"Work" shall mean the work of authorship, whether in Source or
|
||||||
|
Object form, made available under the License, as indicated by a
|
||||||
|
copyright notice that is included in or attached to the work
|
||||||
|
(an example is provided in the Appendix below).
|
||||||
|
|
||||||
|
"Derivative Works" shall mean any work, whether in Source or Object
|
||||||
|
form, that is based on (or derived from) the Work and for which the
|
||||||
|
editorial revisions, annotations, elaborations, or other modifications
|
||||||
|
represent, as a whole, an original work of authorship. For the purposes
|
||||||
|
of this License, Derivative Works shall not include works that remain
|
||||||
|
separable from, or merely link (or bind by name) to the interfaces of,
|
||||||
|
the Work and Derivative Works thereof.
|
||||||
|
|
||||||
|
"Contribution" shall mean any work of authorship, including
|
||||||
|
the original version of the Work and any modifications or additions
|
||||||
|
to that Work or Derivative Works thereof, that is intentionally
|
||||||
|
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||||
|
or by an individual or Legal Entity authorized to submit on behalf of
|
||||||
|
the copyright owner. For the purposes of this definition, "submitted"
|
||||||
|
means any form of electronic, verbal, or written communication sent
|
||||||
|
to the Licensor or its representatives, including but not limited to
|
||||||
|
communication on electronic mailing lists, source code control systems,
|
||||||
|
and issue tracking systems that are managed by, or on behalf of, the
|
||||||
|
Licensor for the purpose of discussing and improving the Work, but
|
||||||
|
excluding communication that is conspicuously marked or otherwise
|
||||||
|
designated in writing by the copyright owner as "Not a Contribution."
|
||||||
|
|
||||||
|
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||||
|
on behalf of whom a Contribution has been received by Licensor and
|
||||||
|
subsequently incorporated within the Work.
|
||||||
|
|
||||||
|
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||||
|
this License, each Contributor hereby grants to You a perpetual,
|
||||||
|
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||||
|
copyright license to reproduce, prepare Derivative Works of,
|
||||||
|
publicly display, publicly perform, sublicense, and distribute the
|
||||||
|
Work and such Derivative Works in Source or Object form.
|
||||||
|
|
||||||
|
3. Grant of Patent License. Subject to the terms and conditions of
|
||||||
|
this License, each Contributor hereby grants to You a perpetual,
|
||||||
|
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||||
|
(except as stated in this section) patent license to make, have made,
|
||||||
|
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||||
|
where such license applies only to those patent claims licensable
|
||||||
|
by such Contributor that are necessarily infringed by their
|
||||||
|
Contribution(s) alone or by combination of their Contribution(s)
|
||||||
|
with the Work to which such Contribution(s) was submitted. If You
|
||||||
|
institute patent litigation against any entity (including a
|
||||||
|
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||||
|
or a Contribution incorporated within the Work constitutes direct
|
||||||
|
or contributory patent infringement, then any patent licenses
|
||||||
|
granted to You under this License for that Work shall terminate
|
||||||
|
as of the date such litigation is filed.
|
||||||
|
|
||||||
|
4. Redistribution. You may reproduce and distribute copies of the
|
||||||
|
Work or Derivative Works thereof in any medium, with or without
|
||||||
|
modifications, and in Source or Object form, provided that You
|
||||||
|
meet the following conditions:
|
||||||
|
|
||||||
|
(a) You must give any other recipients of the Work or
|
||||||
|
Derivative Works a copy of this License; and
|
||||||
|
|
||||||
|
(b) You must cause any modified files to carry prominent notices
|
||||||
|
stating that You changed the files; and
|
||||||
|
|
||||||
|
(c) You must retain, in the Source form of any Derivative Works
|
||||||
|
that You distribute, all copyright, patent, trademark, and
|
||||||
|
attribution notices from the Source form of the Work,
|
||||||
|
excluding those notices that do not pertain to any part of
|
||||||
|
the Derivative Works; and
|
||||||
|
|
||||||
|
(d) If the Work includes a "NOTICE" text file as part of its
|
||||||
|
distribution, then any Derivative Works that You distribute must
|
||||||
|
include a readable copy of the attribution notices contained
|
||||||
|
within such NOTICE file, excluding those notices that do not
|
||||||
|
pertain to any part of the Derivative Works, in at least one
|
||||||
|
of the following places: within a NOTICE text file distributed
|
||||||
|
as part of the Derivative Works; within the Source form or
|
||||||
|
documentation, if provided along with the Derivative Works; or,
|
||||||
|
within a display generated by the Derivative Works, if and
|
||||||
|
wherever such third-party notices normally appear. The contents
|
||||||
|
of the NOTICE file are for informational purposes only and
|
||||||
|
do not modify the License. You may add Your own attribution
|
||||||
|
notices within Derivative Works that You distribute, alongside
|
||||||
|
or as an addendum to the NOTICE text from the Work, provided
|
||||||
|
that such additional attribution notices cannot be construed
|
||||||
|
as modifying the License.
|
||||||
|
|
||||||
|
You may add Your own copyright statement to Your modifications and
|
||||||
|
may provide additional or different license terms and conditions
|
||||||
|
for use, reproduction, or distribution of Your modifications, or
|
||||||
|
for any such Derivative Works as a whole, provided Your use,
|
||||||
|
reproduction, and distribution of the Work otherwise complies with
|
||||||
|
the conditions stated in this License.
|
||||||
|
|
||||||
|
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||||
|
any Contribution intentionally submitted for inclusion in the Work
|
||||||
|
by You to the Licensor shall be under the terms and conditions of
|
||||||
|
this License, without any additional terms or conditions.
|
||||||
|
Notwithstanding the above, nothing herein shall supersede or modify
|
||||||
|
the terms of any separate license agreement you may have executed
|
||||||
|
with Licensor regarding such Contributions.
|
||||||
|
|
||||||
|
6. Trademarks. This License does not grant permission to use the trade
|
||||||
|
names, trademarks, service marks, or product names of the Licensor,
|
||||||
|
except as required for reasonable and customary use in describing the
|
||||||
|
origin of the Work and reproducing the content of the NOTICE file.
|
||||||
|
|
||||||
|
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||||
|
agreed to in writing, Licensor provides the Work (and each
|
||||||
|
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||||
|
implied, including, without limitation, any warranties or conditions
|
||||||
|
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||||
|
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||||
|
appropriateness of using or redistributing the Work and assume any
|
||||||
|
risks associated with Your exercise of permissions under this License.
|
||||||
|
|
||||||
|
8. Limitation of Liability. In no event and under no legal theory,
|
||||||
|
whether in tort (including negligence), contract, or otherwise,
|
||||||
|
unless required by applicable law (such as deliberate and grossly
|
||||||
|
negligent acts) or agreed to in writing, shall any Contributor be
|
||||||
|
liable to You for damages, including any direct, indirect, special,
|
||||||
|
incidental, or consequential damages of any character arising as a
|
||||||
|
result of this License or out of the use or inability to use the
|
||||||
|
Work (including but not limited to damages for loss of goodwill,
|
||||||
|
work stoppage, computer failure or malfunction, or any and all
|
||||||
|
other commercial damages or losses), even if such Contributor
|
||||||
|
has been advised of the possibility of such damages.
|
||||||
|
|
||||||
|
9. Accepting Warranty or Additional Liability. While redistributing
|
||||||
|
the Work or Derivative Works thereof, You may choose to offer,
|
||||||
|
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||||
|
or other liability obligations and/or rights consistent with this
|
||||||
|
License. However, in accepting such obligations, You may act only
|
||||||
|
on Your own behalf and on Your sole responsibility, not on behalf
|
||||||
|
of any other Contributor, and only if You agree to indemnify,
|
||||||
|
defend, and hold each Contributor harmless for any liability
|
||||||
|
incurred by, or claims asserted against, such Contributor by reason
|
||||||
|
of your accepting any such warranty or additional liability.
|
||||||
|
|
||||||
|
END OF TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
APPENDIX: How to apply the Apache License to your work.
|
||||||
|
|
||||||
|
To apply the Apache License to your work, attach the following
|
||||||
|
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||||
|
replaced with your own identifying information. (Don't include
|
||||||
|
the brackets!) The text should be enclosed in the appropriate
|
||||||
|
comment syntax for the file format. We also recommend that a
|
||||||
|
file or class name and description of purpose be included on the
|
||||||
|
same "printed page" as the copyright notice for easier
|
||||||
|
identification within third-party archives.
|
||||||
|
|
||||||
|
Copyright [yyyy] [name of copyright owner]
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
Copyright (c) 2012 The Go Authors. All rights reserved.
|
||||||
|
|
||||||
|
Redistribution and use in source and binary forms, with or without
|
||||||
|
modification, are permitted provided that the following conditions are
|
||||||
|
met:
|
||||||
|
|
||||||
|
* Redistributions of source code must retain the above copyright
|
||||||
|
notice, this list of conditions and the following disclaimer.
|
||||||
|
* Redistributions in binary form must reproduce the above
|
||||||
|
copyright notice, this list of conditions and the following disclaimer
|
||||||
|
in the documentation and/or other materials provided with the
|
||||||
|
distribution.
|
||||||
|
* Neither the name of Google Inc. nor the names of its
|
||||||
|
contributors may be used to endorse or promote products derived from
|
||||||
|
this software without specific prior written permission.
|
||||||
|
|
||||||
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
|
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
|
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||||
|
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||||
|
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||||
|
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
|
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||||
|
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
|
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
Copyright (c) 2009,2014 Google Inc. All rights reserved.
|
||||||
|
|
||||||
|
Redistribution and use in source and binary forms, with or without
|
||||||
|
modification, are permitted provided that the following conditions are
|
||||||
|
met:
|
||||||
|
|
||||||
|
* Redistributions of source code must retain the above copyright
|
||||||
|
notice, this list of conditions and the following disclaimer.
|
||||||
|
* Redistributions in binary form must reproduce the above
|
||||||
|
copyright notice, this list of conditions and the following disclaimer
|
||||||
|
in the documentation and/or other materials provided with the
|
||||||
|
distribution.
|
||||||
|
* Neither the name of Google Inc. nor the names of its
|
||||||
|
contributors may be used to endorse or promote products derived from
|
||||||
|
this software without specific prior written permission.
|
||||||
|
|
||||||
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
|
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
|
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||||
|
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||||
|
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||||
|
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
|
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||||
|
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
|
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
Copyright (c) 2013 Lucas Beyer
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
Copyright (c) Yasuhiro MATSUMOTO <mattn.jp@gmail.com>
|
||||||
|
|
||||||
|
MIT License (Expat)
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
The MIT License (MIT)
|
||||||
|
|
||||||
|
Copyright (c) 2016 Yasuhiro Matsumoto
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
BSD 3-Clause License
|
||||||
|
|
||||||
|
Copyright (c) 2009, The Go Authors. Extensions copyright (c) 2011, Miek Gieben.
|
||||||
|
All rights reserved.
|
||||||
|
|
||||||
|
Redistribution and use in source and binary forms, with or without
|
||||||
|
modification, are permitted provided that the following conditions are met:
|
||||||
|
|
||||||
|
1. Redistributions of source code must retain the above copyright notice, this
|
||||||
|
list of conditions and the following disclaimer.
|
||||||
|
|
||||||
|
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
this list of conditions and the following disclaimer in the documentation
|
||||||
|
and/or other materials provided with the distribution.
|
||||||
|
|
||||||
|
3. Neither the name of the copyright holder nor the names of its
|
||||||
|
contributors may be used to endorse or promote products derived from
|
||||||
|
this software without specific prior written permission.
|
||||||
|
|
||||||
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||||
|
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||||
|
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||||
|
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||||
|
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||||
|
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
|
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2022 Erik Geiser and Christian Muehlhaeuser
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2022 Nuno Cruces
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
Copyright (c) 2012 The Go Authors. All rights reserved.
|
||||||
|
|
||||||
|
Redistribution and use in source and binary forms, with or without
|
||||||
|
modification, are permitted provided that the following conditions are
|
||||||
|
met:
|
||||||
|
|
||||||
|
* Redistributions of source code must retain the above copyright
|
||||||
|
notice, this list of conditions and the following disclaimer.
|
||||||
|
* Redistributions in binary form must reproduce the above
|
||||||
|
copyright notice, this list of conditions and the following disclaimer
|
||||||
|
in the documentation and/or other materials provided with the
|
||||||
|
distribution.
|
||||||
|
* Neither the name of Google Inc. nor the names of its
|
||||||
|
contributors may be used to endorse or promote products derived from
|
||||||
|
this software without specific prior written permission.
|
||||||
|
|
||||||
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
|
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
|
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||||
|
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||||
|
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||||
|
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
|
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||||
|
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
|
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2019 Oliver Kuederle
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
||||||
@@ -0,0 +1,174 @@
|
|||||||
|
Apache License
|
||||||
|
Version 2.0, January 2004
|
||||||
|
http://www.apache.org/licenses/
|
||||||
|
|
||||||
|
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||||
|
|
||||||
|
1. Definitions.
|
||||||
|
|
||||||
|
"License" shall mean the terms and conditions for use, reproduction,
|
||||||
|
and distribution as defined by Sections 1 through 9 of this document.
|
||||||
|
|
||||||
|
"Licensor" shall mean the copyright owner or entity authorized by
|
||||||
|
the copyright owner that is granting the License.
|
||||||
|
|
||||||
|
"Legal Entity" shall mean the union of the acting entity and all
|
||||||
|
other entities that control, are controlled by, or are under common
|
||||||
|
control with that entity. For the purposes of this definition,
|
||||||
|
"control" means (i) the power, direct or indirect, to cause the
|
||||||
|
direction or management of such entity, whether by contract or
|
||||||
|
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||||
|
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||||
|
|
||||||
|
"You" (or "Your") shall mean an individual or Legal Entity
|
||||||
|
exercising permissions granted by this License.
|
||||||
|
|
||||||
|
"Source" form shall mean the preferred form for making modifications,
|
||||||
|
including but not limited to software source code, documentation
|
||||||
|
source, and configuration files.
|
||||||
|
|
||||||
|
"Object" form shall mean any form resulting from mechanical
|
||||||
|
transformation or translation of a Source form, including but
|
||||||
|
not limited to compiled object code, generated documentation,
|
||||||
|
and conversions to other media types.
|
||||||
|
|
||||||
|
"Work" shall mean the work of authorship, whether in Source or
|
||||||
|
Object form, made available under the License, as indicated by a
|
||||||
|
copyright notice that is included in or attached to the work
|
||||||
|
(an example is provided in the Appendix below).
|
||||||
|
|
||||||
|
"Derivative Works" shall mean any work, whether in Source or Object
|
||||||
|
form, that is based on (or derived from) the Work and for which the
|
||||||
|
editorial revisions, annotations, elaborations, or other modifications
|
||||||
|
represent, as a whole, an original work of authorship. For the purposes
|
||||||
|
of this License, Derivative Works shall not include works that remain
|
||||||
|
separable from, or merely link (or bind by name) to the interfaces of,
|
||||||
|
the Work and Derivative Works thereof.
|
||||||
|
|
||||||
|
"Contribution" shall mean any work of authorship, including
|
||||||
|
the original version of the Work and any modifications or additions
|
||||||
|
to that Work or Derivative Works thereof, that is intentionally
|
||||||
|
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||||
|
or by an individual or Legal Entity authorized to submit on behalf of
|
||||||
|
the copyright owner. For the purposes of this definition, "submitted"
|
||||||
|
means any form of electronic, verbal, or written communication sent
|
||||||
|
to the Licensor or its representatives, including but not limited to
|
||||||
|
communication on electronic mailing lists, source code control systems,
|
||||||
|
and issue tracking systems that are managed by, or on behalf of, the
|
||||||
|
Licensor for the purpose of discussing and improving the Work, but
|
||||||
|
excluding communication that is conspicuously marked or otherwise
|
||||||
|
designated in writing by the copyright owner as "Not a Contribution."
|
||||||
|
|
||||||
|
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||||
|
on behalf of whom a Contribution has been received by Licensor and
|
||||||
|
subsequently incorporated within the Work.
|
||||||
|
|
||||||
|
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||||
|
this License, each Contributor hereby grants to You a perpetual,
|
||||||
|
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||||
|
copyright license to reproduce, prepare Derivative Works of,
|
||||||
|
publicly display, publicly perform, sublicense, and distribute the
|
||||||
|
Work and such Derivative Works in Source or Object form.
|
||||||
|
|
||||||
|
3. Grant of Patent License. Subject to the terms and conditions of
|
||||||
|
this License, each Contributor hereby grants to You a perpetual,
|
||||||
|
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||||
|
(except as stated in this section) patent license to make, have made,
|
||||||
|
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||||
|
where such license applies only to those patent claims licensable
|
||||||
|
by such Contributor that are necessarily infringed by their
|
||||||
|
Contribution(s) alone or by combination of their Contribution(s)
|
||||||
|
with the Work to which such Contribution(s) was submitted. If You
|
||||||
|
institute patent litigation against any entity (including a
|
||||||
|
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||||
|
or a Contribution incorporated within the Work constitutes direct
|
||||||
|
or contributory patent infringement, then any patent licenses
|
||||||
|
granted to You under this License for that Work shall terminate
|
||||||
|
as of the date such litigation is filed.
|
||||||
|
|
||||||
|
4. Redistribution. You may reproduce and distribute copies of the
|
||||||
|
Work or Derivative Works thereof in any medium, with or without
|
||||||
|
modifications, and in Source or Object form, provided that You
|
||||||
|
meet the following conditions:
|
||||||
|
|
||||||
|
(a) You must give any other recipients of the Work or
|
||||||
|
Derivative Works a copy of this License; and
|
||||||
|
|
||||||
|
(b) You must cause any modified files to carry prominent notices
|
||||||
|
stating that You changed the files; and
|
||||||
|
|
||||||
|
(c) You must retain, in the Source form of any Derivative Works
|
||||||
|
that You distribute, all copyright, patent, trademark, and
|
||||||
|
attribution notices from the Source form of the Work,
|
||||||
|
excluding those notices that do not pertain to any part of
|
||||||
|
the Derivative Works; and
|
||||||
|
|
||||||
|
(d) If the Work includes a "NOTICE" text file as part of its
|
||||||
|
distribution, then any Derivative Works that You distribute must
|
||||||
|
include a readable copy of the attribution notices contained
|
||||||
|
within such NOTICE file, excluding those notices that do not
|
||||||
|
pertain to any part of the Derivative Works, in at least one
|
||||||
|
of the following places: within a NOTICE text file distributed
|
||||||
|
as part of the Derivative Works; within the Source form or
|
||||||
|
documentation, if provided along with the Derivative Works; or,
|
||||||
|
within a display generated by the Derivative Works, if and
|
||||||
|
wherever such third-party notices normally appear. The contents
|
||||||
|
of the NOTICE file are for informational purposes only and
|
||||||
|
do not modify the License. You may add Your own attribution
|
||||||
|
notices within Derivative Works that You distribute, alongside
|
||||||
|
or as an addendum to the NOTICE text from the Work, provided
|
||||||
|
that such additional attribution notices cannot be construed
|
||||||
|
as modifying the License.
|
||||||
|
|
||||||
|
You may add Your own copyright statement to Your modifications and
|
||||||
|
may provide additional or different license terms and conditions
|
||||||
|
for use, reproduction, or distribution of Your modifications, or
|
||||||
|
for any such Derivative Works as a whole, provided Your use,
|
||||||
|
reproduction, and distribution of the Work otherwise complies with
|
||||||
|
the conditions stated in this License.
|
||||||
|
|
||||||
|
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||||
|
any Contribution intentionally submitted for inclusion in the Work
|
||||||
|
by You to the Licensor shall be under the terms and conditions of
|
||||||
|
this License, without any additional terms or conditions.
|
||||||
|
Notwithstanding the above, nothing herein shall supersede or modify
|
||||||
|
the terms of any separate license agreement you may have executed
|
||||||
|
with Licensor regarding such Contributions.
|
||||||
|
|
||||||
|
6. Trademarks. This License does not grant permission to use the trade
|
||||||
|
names, trademarks, service marks, or product names of the Licensor,
|
||||||
|
except as required for reasonable and customary use in describing the
|
||||||
|
origin of the Work and reproducing the content of the NOTICE file.
|
||||||
|
|
||||||
|
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||||
|
agreed to in writing, Licensor provides the Work (and each
|
||||||
|
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||||
|
implied, including, without limitation, any warranties or conditions
|
||||||
|
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||||
|
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||||
|
appropriateness of using or redistributing the Work and assume any
|
||||||
|
risks associated with Your exercise of permissions under this License.
|
||||||
|
|
||||||
|
8. Limitation of Liability. In no event and under no legal theory,
|
||||||
|
whether in tort (including negligence), contract, or otherwise,
|
||||||
|
unless required by applicable law (such as deliberate and grossly
|
||||||
|
negligent acts) or agreed to in writing, shall any Contributor be
|
||||||
|
liable to You for damages, including any direct, indirect, special,
|
||||||
|
incidental, or consequential damages of any character arising as a
|
||||||
|
result of this License or out of the use or inability to use the
|
||||||
|
Work (including but not limited to damages for loss of goodwill,
|
||||||
|
work stoppage, computer failure or malfunction, or any and all
|
||||||
|
other commercial damages or losses), even if such Contributor
|
||||||
|
has been advised of the possibility of such damages.
|
||||||
|
|
||||||
|
9. Accepting Warranty or Additional Liability. While redistributing
|
||||||
|
the Work or Derivative Works thereof, You may choose to offer,
|
||||||
|
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||||
|
or other liability obligations and/or rights consistent with this
|
||||||
|
License. However, in accepting such obligations, You may act only
|
||||||
|
on Your own behalf and on Your sole responsibility, not on behalf
|
||||||
|
of any other Contributor, and only if You agree to indemnify,
|
||||||
|
defend, and hold each Contributor harmless for any liability
|
||||||
|
incurred by, or claims asserted against, such Contributor by reason
|
||||||
|
of your accepting any such warranty or additional liability.
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
Copyright (c) 2012 Alex Ogier. All rights reserved.
|
||||||
|
Copyright (c) 2012 The Go Authors. All rights reserved.
|
||||||
|
|
||||||
|
Redistribution and use in source and binary forms, with or without
|
||||||
|
modification, are permitted provided that the following conditions are
|
||||||
|
met:
|
||||||
|
|
||||||
|
* Redistributions of source code must retain the above copyright
|
||||||
|
notice, this list of conditions and the following disclaimer.
|
||||||
|
* Redistributions in binary form must reproduce the above
|
||||||
|
copyright notice, this list of conditions and the following disclaimer
|
||||||
|
in the documentation and/or other materials provided with the
|
||||||
|
distribution.
|
||||||
|
* Neither the name of Google Inc. nor the names of its
|
||||||
|
contributors may be used to endorse or promote products derived from
|
||||||
|
this software without specific prior written permission.
|
||||||
|
|
||||||
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
|
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
|
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||||
|
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||||
|
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||||
|
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
|
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||||
|
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
|
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
The MIT License (MIT)
|
||||||
|
|
||||||
|
Copyright (c) 2016 Anmol Sethi
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
The MIT License (MIT)
|
||||||
|
|
||||||
|
Copyright (c) 2016 Zalando SE
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
The MIT License (MIT)
|
||||||
|
|
||||||
|
Copyright (c) 2016 Alessio Treglia
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
Copyright 2009 The Go Authors.
|
||||||
|
|
||||||
|
Redistribution and use in source and binary forms, with or without
|
||||||
|
modification, are permitted provided that the following conditions are
|
||||||
|
met:
|
||||||
|
|
||||||
|
* Redistributions of source code must retain the above copyright
|
||||||
|
notice, this list of conditions and the following disclaimer.
|
||||||
|
* Redistributions in binary form must reproduce the above
|
||||||
|
copyright notice, this list of conditions and the following disclaimer
|
||||||
|
in the documentation and/or other materials provided with the
|
||||||
|
distribution.
|
||||||
|
* Neither the name of Google LLC nor the names of its
|
||||||
|
contributors may be used to endorse or promote products derived from
|
||||||
|
this software without specific prior written permission.
|
||||||
|
|
||||||
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
|
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
|
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||||
|
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||||
|
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||||
|
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
|
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||||
|
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
|
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
Copyright 2009 The Go Authors.
|
||||||
|
|
||||||
|
Redistribution and use in source and binary forms, with or without
|
||||||
|
modification, are permitted provided that the following conditions are
|
||||||
|
met:
|
||||||
|
|
||||||
|
* Redistributions of source code must retain the above copyright
|
||||||
|
notice, this list of conditions and the following disclaimer.
|
||||||
|
* Redistributions in binary form must reproduce the above
|
||||||
|
copyright notice, this list of conditions and the following disclaimer
|
||||||
|
in the documentation and/or other materials provided with the
|
||||||
|
distribution.
|
||||||
|
* Neither the name of Google LLC nor the names of its
|
||||||
|
contributors may be used to endorse or promote products derived from
|
||||||
|
this software without specific prior written permission.
|
||||||
|
|
||||||
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
|
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
|
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||||
|
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||||
|
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||||
|
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
|
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||||
|
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
|
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
Copyright 2009 The Go Authors.
|
||||||
|
|
||||||
|
Redistribution and use in source and binary forms, with or without
|
||||||
|
modification, are permitted provided that the following conditions are
|
||||||
|
met:
|
||||||
|
|
||||||
|
* Redistributions of source code must retain the above copyright
|
||||||
|
notice, this list of conditions and the following disclaimer.
|
||||||
|
* Redistributions in binary form must reproduce the above
|
||||||
|
copyright notice, this list of conditions and the following disclaimer
|
||||||
|
in the documentation and/or other materials provided with the
|
||||||
|
distribution.
|
||||||
|
* Neither the name of Google LLC nor the names of its
|
||||||
|
contributors may be used to endorse or promote products derived from
|
||||||
|
this software without specific prior written permission.
|
||||||
|
|
||||||
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
|
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
|
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||||
|
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||||
|
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||||
|
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
|
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||||
|
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
|
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
Copyright 2009 The Go Authors.
|
||||||
|
|
||||||
|
Redistribution and use in source and binary forms, with or without
|
||||||
|
modification, are permitted provided that the following conditions are
|
||||||
|
met:
|
||||||
|
|
||||||
|
* Redistributions of source code must retain the above copyright
|
||||||
|
notice, this list of conditions and the following disclaimer.
|
||||||
|
* Redistributions in binary form must reproduce the above
|
||||||
|
copyright notice, this list of conditions and the following disclaimer
|
||||||
|
in the documentation and/or other materials provided with the
|
||||||
|
distribution.
|
||||||
|
* Neither the name of Google LLC nor the names of its
|
||||||
|
contributors may be used to endorse or promote products derived from
|
||||||
|
this software without specific prior written permission.
|
||||||
|
|
||||||
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
|
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
|
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||||
|
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||||
|
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||||
|
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
|
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||||
|
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
|
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
Copyright 2009 The Go Authors.
|
||||||
|
|
||||||
|
Redistribution and use in source and binary forms, with or without
|
||||||
|
modification, are permitted provided that the following conditions are
|
||||||
|
met:
|
||||||
|
|
||||||
|
* Redistributions of source code must retain the above copyright
|
||||||
|
notice, this list of conditions and the following disclaimer.
|
||||||
|
* Redistributions in binary form must reproduce the above
|
||||||
|
copyright notice, this list of conditions and the following disclaimer
|
||||||
|
in the documentation and/or other materials provided with the
|
||||||
|
distribution.
|
||||||
|
* Neither the name of Google LLC nor the names of its
|
||||||
|
contributors may be used to endorse or promote products derived from
|
||||||
|
this software without specific prior written permission.
|
||||||
|
|
||||||
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
|
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
|
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||||
|
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||||
|
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||||
|
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
|
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||||
|
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
|
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
Copyright (c) 2017 The Libc Authors. All rights reserved.
|
||||||
|
|
||||||
|
Redistribution and use in source and binary forms, with or without
|
||||||
|
modification, are permitted provided that the following conditions are
|
||||||
|
met:
|
||||||
|
|
||||||
|
* Redistributions of source code must retain the above copyright
|
||||||
|
notice, this list of conditions and the following disclaimer.
|
||||||
|
* Redistributions in binary form must reproduce the above
|
||||||
|
copyright notice, this list of conditions and the following disclaimer
|
||||||
|
in the documentation and/or other materials provided with the
|
||||||
|
distribution.
|
||||||
|
* Neither the names of the authors nor the names of the
|
||||||
|
contributors may be used to endorse or promote products derived from
|
||||||
|
this software without specific prior written permission.
|
||||||
|
|
||||||
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
|
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
|
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||||
|
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||||
|
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||||
|
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
|
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||||
|
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
|
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
Copyright (c) 2014 The mathutil Authors. All rights reserved.
|
||||||
|
|
||||||
|
Redistribution and use in source and binary forms, with or without
|
||||||
|
modification, are permitted provided that the following conditions are
|
||||||
|
met:
|
||||||
|
|
||||||
|
* Redistributions of source code must retain the above copyright
|
||||||
|
notice, this list of conditions and the following disclaimer.
|
||||||
|
* Redistributions in binary form must reproduce the above
|
||||||
|
copyright notice, this list of conditions and the following disclaimer
|
||||||
|
in the documentation and/or other materials provided with the
|
||||||
|
distribution.
|
||||||
|
* Neither the names of the authors nor the names of the
|
||||||
|
contributors may be used to endorse or promote products derived from
|
||||||
|
this software without specific prior written permission.
|
||||||
|
|
||||||
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
|
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
|
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||||
|
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||||
|
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||||
|
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
|
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||||
|
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
|
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
Copyright (c) 2017 The Memory Authors. All rights reserved.
|
||||||
|
|
||||||
|
Redistribution and use in source and binary forms, with or without
|
||||||
|
modification, are permitted provided that the following conditions are
|
||||||
|
met:
|
||||||
|
|
||||||
|
* Redistributions of source code must retain the above copyright
|
||||||
|
notice, this list of conditions and the following disclaimer.
|
||||||
|
* Redistributions in binary form must reproduce the above
|
||||||
|
copyright notice, this list of conditions and the following disclaimer
|
||||||
|
in the documentation and/or other materials provided with the
|
||||||
|
distribution.
|
||||||
|
* Neither the names of the authors nor the names of the
|
||||||
|
contributors may be used to endorse or promote products derived from
|
||||||
|
this software without specific prior written permission.
|
||||||
|
|
||||||
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
|
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
|
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||||
|
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||||
|
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||||
|
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
|
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||||
|
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
|
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
Copyright (c) 2017 The Sqlite Authors. All rights reserved.
|
||||||
|
|
||||||
|
Redistribution and use in source and binary forms, with or without
|
||||||
|
modification, are permitted provided that the following conditions are met:
|
||||||
|
|
||||||
|
1. Redistributions of source code must retain the above copyright notice, this
|
||||||
|
list of conditions and the following disclaimer.
|
||||||
|
|
||||||
|
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
this list of conditions and the following disclaimer in the documentation
|
||||||
|
and/or other materials provided with the distribution.
|
||||||
|
|
||||||
|
3. Neither the name of the copyright holder nor the names of its contributors
|
||||||
|
may be used to endorse or promote products derived from this software without
|
||||||
|
specific prior written permission.
|
||||||
|
|
||||||
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||||
|
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||||
|
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||||
|
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||||
|
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||||
|
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||||
|
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
|
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
Copyright (c) 2015, 2018, 2019 Opsmate, Inc. All rights reserved.
|
||||||
|
Copyright (c) 2009 The Go Authors. All rights reserved.
|
||||||
|
|
||||||
|
Redistribution and use in source and binary forms, with or without
|
||||||
|
modification, are permitted provided that the following conditions are
|
||||||
|
met:
|
||||||
|
|
||||||
|
* Redistributions of source code must retain the above copyright
|
||||||
|
notice, this list of conditions and the following disclaimer.
|
||||||
|
* Redistributions in binary form must reproduce the above
|
||||||
|
copyright notice, this list of conditions and the following disclaimer
|
||||||
|
in the documentation and/or other materials provided with the
|
||||||
|
distribution.
|
||||||
|
* Neither the name of Google Inc. nor the names of its
|
||||||
|
contributors may be used to endorse or promote products derived from
|
||||||
|
this software without specific prior written permission.
|
||||||
|
|
||||||
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
|
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
|
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||||
|
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||||
|
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||||
|
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
|
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||||
|
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
|
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
@@ -32,10 +32,16 @@ The provider package defines focused capabilities:
|
|||||||
- `DNS01Solver`
|
- `DNS01Solver`
|
||||||
- `EdgeTLSService`
|
- `EdgeTLSService`
|
||||||
|
|
||||||
Cloudflare is the first adapter. Its wire types do not escape the adapter. Unknown DNS record JSON is retained so new provider fields remain visible even before DomainOps adds an editor for them.
|
Credential verification, zone inventory, single-record DNS CRUD, and DNS-01 form the mandatory provider contract. DNS batching, ambiguous DNS-01 reconciliation, and edge TLS are optional capabilities discovered at runtime; unsupported operations return typed capability errors instead of forcing every future adapter to imitate Cloudflare.
|
||||||
|
|
||||||
|
Cloudflare is the first adapter. Its wire types do not escape the adapter. Unknown DNS record JSON is retained so new provider fields remain visible even before DomainOps adds an editor for them. ACME presentation, cleanup, and crash reconciliation route through the provider identity bound to the exact credential, so remote zone-ID collisions cannot redirect a delayed challenge operation to another adapter.
|
||||||
|
|
||||||
Credential identities and remote accounts are separate. One user token may expose several Cloudflare accounts, while an account token belongs to one account. A zone stores an explicit preferred credential; ACME and DNS writes never silently switch credentials.
|
Credential identities and remote accounts are separate. One user token may expose several Cloudflare accounts, while an account token belongs to one account. A zone stores an explicit preferred credential; ACME and DNS writes never silently switch credentials.
|
||||||
|
|
||||||
|
Operator-facing removal and routing retain immutable local credential/zone IDs across confirmation and reload. Removing a local connection can reassign preferred routes only after recent per-zone write evidence plus a fresh DNS read through the replacement. Explicit routing verifies DNS read immediately; write authority remains visibly unproven until Cloudflare accepts a real mutation.
|
||||||
|
|
||||||
|
ACME library output never owns stdout. Certificate stages are converted into persisted jobs and non-blocking application events; the TUI consumes those events in a bounded, scrollable progress console. Each order has an independent safety deadline, while cleanup detaches from an expired issuance context for one bounded attempt to remove the exact journaled TXT record.
|
||||||
|
|
||||||
After a successful full sync, a zone no longer visible to its preferred credential is retained as cached history but marked unknown and detached from that stale preference. DNS-read authority is also stored per credential and zone. An authoritative 401/403 on a later zone read atomically removes that evidence and detaches only the denied route, while transient transport, rate-limit, and server failures preserve the last successful observation. A later credential that rediscovers the zone can restore routing without trapping credential removal behind an unreachable zone.
|
After a successful full sync, a zone no longer visible to its preferred credential is retained as cached history but marked unknown and detached from that stale preference. DNS-read authority is also stored per credential and zone. An authoritative 401/403 on a later zone read atomically removes that evidence and detaches only the denied route, while transient transport, rate-limit, and server failures preserve the last successful observation. A later credential that rediscovers the zone can restore routing without trapping credential removal behind an unreachable zone.
|
||||||
|
|
||||||
Future providers should implement only their supported capabilities and register statically. A future third-party plugin system should be an out-of-process, versioned protocol rather than Go’s in-process plugin mechanism.
|
Future providers should implement only their supported capabilities and register statically. A future third-party plugin system should be an out-of-process, versioned protocol rather than Go’s in-process plugin mechanism.
|
||||||
|
|||||||
@@ -0,0 +1,38 @@
|
|||||||
|
# Release process
|
||||||
|
|
||||||
|
Releases are built by GitHub Actions and GoReleaser for macOS and Linux on amd64 and arm64. Release archives contain the binary, README, changelog, project license, and third-party dependency notices, with a SHA-256 checksum manifest.
|
||||||
|
|
||||||
|
## Before tagging
|
||||||
|
|
||||||
|
1. Confirm the working tree contains no credentials, vaults, private keys, certificates, databases, or production inventory.
|
||||||
|
2. Regenerate `THIRD_PARTY_LICENSES` when dependencies change and review every detected license.
|
||||||
|
3. Move relevant entries from `Unreleased` in `CHANGELOG.md` into a versioned section.
|
||||||
|
4. Run:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
make verify
|
||||||
|
make race
|
||||||
|
make vuln
|
||||||
|
goreleaser release --snapshot --clean
|
||||||
|
```
|
||||||
|
|
||||||
|
5. Inspect every snapshot archive and verify `domainops version` on a supported host.
|
||||||
|
6. Commit the release notes and create an annotated, signed semantic-version tag such as `v0.1.0`.
|
||||||
|
|
||||||
|
## Publishing
|
||||||
|
|
||||||
|
Push the commit first and wait for CI to pass. Then push the signed tag. The release workflow re-runs verification and publishes archives plus `checksums.txt`.
|
||||||
|
|
||||||
|
Never rebuild or replace an existing release tag. If a release is faulty, document it, publish a corrected version, and leave the original artifacts available for auditability.
|
||||||
|
|
||||||
|
## GitHub repository settings
|
||||||
|
|
||||||
|
For a public repository, enable:
|
||||||
|
|
||||||
|
- private vulnerability reporting;
|
||||||
|
- secret scanning and push protection;
|
||||||
|
- Dependabot alerts and security updates;
|
||||||
|
- branch protection or a ruleset requiring the CI checks and pull-request review;
|
||||||
|
- read-only default `GITHUB_TOKEN` permissions.
|
||||||
|
|
||||||
|
Protect tags matching `v*` from deletion or force updates.
|
||||||
@@ -22,6 +22,10 @@ Global API Keys are rejected. Use least-privilege API tokens scoped to the neces
|
|||||||
|
|
||||||
Tokens are masked during entry. Headless use accepts a token file or vault-password file only when it is a regular file with no group/other permission bits. Literal secret flags are intentionally unavailable.
|
Tokens are masked during entry. Headless use accepts a token file or vault-password file only when it is a regular file with no group/other permission bits. Literal secret flags are intentionally unavailable.
|
||||||
|
|
||||||
|
TUI connection removal and zone routing bind confirmation to immutable local IDs rather than filtered row positions or non-unique labels. Removal shows affected routes, uses a bounded long-running verification window, and refuses to remove a credential when any preferred zone lacks a live-readable replacement with recent observed write success. Explicit preference changes live-probe DNS read access and label write authority as unproven until an actual provider mutation succeeds.
|
||||||
|
|
||||||
|
Certificate progress is structured and bounded; third-party ACME logs are discarded rather than allowed to corrupt the TUI or JSON output. DNS readiness is verified against all authoritative nameservers, avoiding stale recursive negative caches. ACME orders terminate at an explicit per-order deadline, and operator cancellation retains a separate bounded cleanup context so an already-created TXT record is not abandoned merely because the issuance context ended.
|
||||||
|
|
||||||
## ACME safety
|
## ACME safety
|
||||||
|
|
||||||
- Staging is the default issuance environment.
|
- Staging is the default issuance environment.
|
||||||
|
|||||||
@@ -1,28 +1,28 @@
|
|||||||
module github.com/MeghdadFadaee/domainops
|
module github.com/MeghdadFadaee/domainops
|
||||||
|
|
||||||
go 1.26.0
|
go 1.26.5
|
||||||
|
|
||||||
require (
|
require (
|
||||||
charm.land/bubbles/v2 v2.1.1
|
charm.land/bubbles/v2 v2.2.1
|
||||||
charm.land/bubbletea/v2 v2.0.8
|
charm.land/bubbletea/v2 v2.0.9
|
||||||
charm.land/lipgloss/v2 v2.0.5
|
charm.land/lipgloss/v2 v2.0.6
|
||||||
github.com/charmbracelet/x/term v0.2.2
|
github.com/charmbracelet/x/term v0.2.2
|
||||||
github.com/go-acme/lego/v5 v5.2.2
|
github.com/go-acme/lego/v5 v5.4.1
|
||||||
github.com/spf13/cobra v1.10.2
|
github.com/spf13/cobra v1.10.2
|
||||||
github.com/zalando/go-keyring v0.2.8
|
github.com/zalando/go-keyring v0.2.8
|
||||||
golang.org/x/crypto v0.54.0
|
golang.org/x/crypto v0.55.0
|
||||||
golang.org/x/net v0.57.0
|
golang.org/x/net v0.58.0
|
||||||
golang.org/x/sync v0.22.0
|
golang.org/x/sync v0.23.0
|
||||||
golang.org/x/sys v0.47.0
|
golang.org/x/sys v0.48.0
|
||||||
modernc.org/sqlite v1.53.0
|
modernc.org/sqlite v1.58.0
|
||||||
)
|
)
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/atotto/clipboard v0.1.4 // indirect
|
github.com/atotto/clipboard v0.1.4 // indirect
|
||||||
github.com/cenkalti/backoff/v5 v5.0.3 // indirect
|
github.com/cenkalti/backoff/v5 v5.0.3 // indirect
|
||||||
github.com/charmbracelet/colorprofile v0.4.3 // indirect
|
github.com/charmbracelet/colorprofile v0.4.3 // indirect
|
||||||
github.com/charmbracelet/ultraviolet v0.0.0-20260703014108-f5a850f9c2b7 // indirect
|
github.com/charmbracelet/ultraviolet v0.0.0-20260811164956-006e29f97886 // indirect
|
||||||
github.com/charmbracelet/x/ansi v0.11.7 // indirect
|
github.com/charmbracelet/x/ansi v0.11.8 // indirect
|
||||||
github.com/charmbracelet/x/termios v0.1.1 // indirect
|
github.com/charmbracelet/x/termios v0.1.1 // indirect
|
||||||
github.com/charmbracelet/x/windows v0.2.2 // indirect
|
github.com/charmbracelet/x/windows v0.2.2 // indirect
|
||||||
github.com/clipperhouse/displaywidth v0.11.0 // indirect
|
github.com/clipperhouse/displaywidth v0.11.0 // indirect
|
||||||
@@ -33,21 +33,19 @@ require (
|
|||||||
github.com/godbus/dbus/v5 v5.2.2 // indirect
|
github.com/godbus/dbus/v5 v5.2.2 // indirect
|
||||||
github.com/google/uuid v1.6.0 // indirect
|
github.com/google/uuid v1.6.0 // indirect
|
||||||
github.com/inconshreveable/mousetrap v1.1.0 // indirect
|
github.com/inconshreveable/mousetrap v1.1.0 // indirect
|
||||||
github.com/lucasb-eyer/go-colorful v1.4.0 // indirect
|
github.com/lucasb-eyer/go-colorful v1.4.1 // indirect
|
||||||
github.com/mattn/go-isatty v0.0.22 // indirect
|
github.com/mattn/go-isatty v0.0.24 // indirect
|
||||||
github.com/mattn/go-runewidth v0.0.24 // indirect
|
github.com/mattn/go-runewidth v0.0.27 // indirect
|
||||||
github.com/miekg/dns v1.1.72 // indirect
|
github.com/miekg/dns v1.1.73 // indirect
|
||||||
github.com/muesli/cancelreader v0.2.2 // indirect
|
github.com/muesli/cancelreader v0.2.2 // indirect
|
||||||
github.com/ncruces/go-strftime v1.0.0 // indirect
|
github.com/ncruces/go-strftime v1.0.0 // indirect
|
||||||
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec // indirect
|
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec // indirect
|
||||||
github.com/rivo/uniseg v0.4.7 // indirect
|
github.com/rivo/uniseg v0.4.7 // indirect
|
||||||
github.com/spf13/pflag v1.0.9 // indirect
|
github.com/spf13/pflag v1.0.10 // indirect
|
||||||
github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e // indirect
|
github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e // indirect
|
||||||
golang.org/x/mod v0.37.0 // indirect
|
golang.org/x/text v0.41.0 // indirect
|
||||||
golang.org/x/text v0.40.0 // indirect
|
modernc.org/libc v1.75.6 // indirect
|
||||||
golang.org/x/tools v0.47.0 // indirect
|
|
||||||
modernc.org/libc v1.73.4 // indirect
|
|
||||||
modernc.org/mathutil v1.7.1 // indirect
|
modernc.org/mathutil v1.7.1 // indirect
|
||||||
modernc.org/memory v1.11.0 // indirect
|
modernc.org/memory v1.12.1 // indirect
|
||||||
software.sslmate.com/src/go-pkcs12 v0.7.2 // indirect
|
software.sslmate.com/src/go-pkcs12 v0.7.3 // indirect
|
||||||
)
|
)
|
||||||
@@ -1,9 +1,9 @@
|
|||||||
charm.land/bubbles/v2 v2.1.1 h1:7r55WzBxpo/R3z98hGmY7KKPd3ET6vsf0Fb9sDHOV60=
|
charm.land/bubbles/v2 v2.2.1 h1:Fq1+qm5hV6GkvzLQDhCBpXXE5tLgvh1PRriCLwSvIQU=
|
||||||
charm.land/bubbles/v2 v2.1.1/go.mod h1:GE6M31gaWZVXzGw73OeuTTgy4lX+OtkH0E5ymnNsHxo=
|
charm.land/bubbles/v2 v2.2.1/go.mod h1:wdMgn+sje1KNXdwFizIWjbf328fIUBxqEmJ/vYPo8yc=
|
||||||
charm.land/bubbletea/v2 v2.0.8 h1:SxTJMhCAI3lbPmy4SgX5LWZ24AdINr4I6UEqzZvYJuY=
|
charm.land/bubbletea/v2 v2.0.9 h1:DpJCMWKgzQK8SJv4zbKKFHAI10ymWy/evClPFk0k0f8=
|
||||||
charm.land/bubbletea/v2 v2.0.8/go.mod h1:2SkdgoTXluXJHOUwAoRlRXF/28vklb1rFl6GcgV1/ss=
|
charm.land/bubbletea/v2 v2.0.9/go.mod h1:2SkdgoTXluXJHOUwAoRlRXF/28vklb1rFl6GcgV1/ss=
|
||||||
charm.land/lipgloss/v2 v2.0.5 h1:kbNxgeeUOYv5J0YdpxFjfvf3dFvqH8Aci4zB6xqFtrY=
|
charm.land/lipgloss/v2 v2.0.6 h1:EaGKeuA8FvF+v2BT5VmZd2LoYLaMZJXA5n34th8nCIQ=
|
||||||
charm.land/lipgloss/v2 v2.0.5/go.mod h1:9oqhxt4yxIMe6q5A4kHr44DremZk7J9UNh74GlWa5nc=
|
charm.land/lipgloss/v2 v2.0.6/go.mod h1:ipDDJNSGa1hlwDtSfW1s2/xR8Vdhbut4PXh2zEKZd0Q=
|
||||||
github.com/atotto/clipboard v0.1.4 h1:EH0zSVneZPSuFR11BlR9YppQTVDbh5+16AmcJi4g1z4=
|
github.com/atotto/clipboard v0.1.4 h1:EH0zSVneZPSuFR11BlR9YppQTVDbh5+16AmcJi4g1z4=
|
||||||
github.com/atotto/clipboard v0.1.4/go.mod h1:ZY9tmq7sm5xIbd9bOK4onWV4S6X0u6GY7Vn0Yu86PYI=
|
github.com/atotto/clipboard v0.1.4/go.mod h1:ZY9tmq7sm5xIbd9bOK4onWV4S6X0u6GY7Vn0Yu86PYI=
|
||||||
github.com/aymanbagabas/go-udiff v0.4.1 h1:OEIrQ8maEeDBXQDoGCbbTTXYJMYRCRO1fnodZ12Gv5o=
|
github.com/aymanbagabas/go-udiff v0.4.1 h1:OEIrQ8maEeDBXQDoGCbbTTXYJMYRCRO1fnodZ12Gv5o=
|
||||||
@@ -12,10 +12,10 @@ github.com/cenkalti/backoff/v5 v5.0.3 h1:ZN+IMa753KfX5hd8vVaMixjnqRZ3y8CuJKRKj1x
|
|||||||
github.com/cenkalti/backoff/v5 v5.0.3/go.mod h1:rkhZdG3JZukswDf7f0cwqPNk4K0sa+F97BxZthm/crw=
|
github.com/cenkalti/backoff/v5 v5.0.3/go.mod h1:rkhZdG3JZukswDf7f0cwqPNk4K0sa+F97BxZthm/crw=
|
||||||
github.com/charmbracelet/colorprofile v0.4.3 h1:QPa1IWkYI+AOB+fE+mg/5/4HRMZcaXex9t5KX76i20Q=
|
github.com/charmbracelet/colorprofile v0.4.3 h1:QPa1IWkYI+AOB+fE+mg/5/4HRMZcaXex9t5KX76i20Q=
|
||||||
github.com/charmbracelet/colorprofile v0.4.3/go.mod h1:/zT4BhpD5aGFpqQQqw7a+VtHCzu+zrQtt1zhMt9mR4Q=
|
github.com/charmbracelet/colorprofile v0.4.3/go.mod h1:/zT4BhpD5aGFpqQQqw7a+VtHCzu+zrQtt1zhMt9mR4Q=
|
||||||
github.com/charmbracelet/ultraviolet v0.0.0-20260703014108-f5a850f9c2b7 h1:3FmWoGNWK4STvqg0O0Aeav2T7rodWJAPeF0QpH+8gFw=
|
github.com/charmbracelet/ultraviolet v0.0.0-20260811164956-006e29f97886 h1:rdnVWKgJpTVXKuKuJyxDJ+NFJdUaUqGvyGy61OcvlbA=
|
||||||
github.com/charmbracelet/ultraviolet v0.0.0-20260703014108-f5a850f9c2b7/go.mod h1:f/jRa757WUmaOZrbPspXymbg/GnbF+rwe4OLsG7aXYo=
|
github.com/charmbracelet/ultraviolet v0.0.0-20260811164956-006e29f97886/go.mod h1:nAw0d9PhFp1qdzi2xhQU5YOu5sVpDIHWlaW2Uz/bCro=
|
||||||
github.com/charmbracelet/x/ansi v0.11.7 h1:kzv1kJvjg2S3r9KHo8hDdHFQLEqn4RBCb39dAYC84jI=
|
github.com/charmbracelet/x/ansi v0.11.8 h1:JMFwp0CgDC2+jcOB162HH5k7I3FVbgFSMMYg7dSPBQQ=
|
||||||
github.com/charmbracelet/x/ansi v0.11.7/go.mod h1:9qGpnAVYz+8ACONkZBUWPtL7lulP9No6p1epAihUZwQ=
|
github.com/charmbracelet/x/ansi v0.11.8/go.mod h1:ZNN+3mXny/516oTQPLMPIBeSINvNJJQ8uQXDgbeJxY0=
|
||||||
github.com/charmbracelet/x/exp/golden v0.0.0-20250806222409-83e3a29d542f h1:pk6gmGpCE7F3FcjaOEKYriCvpmIN4+6OS/RD0vm4uIA=
|
github.com/charmbracelet/x/exp/golden v0.0.0-20250806222409-83e3a29d542f h1:pk6gmGpCE7F3FcjaOEKYriCvpmIN4+6OS/RD0vm4uIA=
|
||||||
github.com/charmbracelet/x/exp/golden v0.0.0-20250806222409-83e3a29d542f/go.mod h1:IfZAMTHB6XkZSeXUqriemErjAWCCzT0LwjKFYCZyw0I=
|
github.com/charmbracelet/x/exp/golden v0.0.0-20250806222409-83e3a29d542f/go.mod h1:IfZAMTHB6XkZSeXUqriemErjAWCCzT0LwjKFYCZyw0I=
|
||||||
github.com/charmbracelet/x/term v0.2.2 h1:xVRT/S2ZcKdhhOuSP4t5cLi5o+JxklsoEObBSgfgZRk=
|
github.com/charmbracelet/x/term v0.2.2 h1:xVRT/S2ZcKdhhOuSP4t5cLi5o+JxklsoEObBSgfgZRk=
|
||||||
@@ -31,40 +31,36 @@ github.com/clipperhouse/uax29/v2 v2.7.0/go.mod h1:EFJ2TJMRUaplDxHKj1qAEhCtQPW2tJ
|
|||||||
github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g=
|
github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g=
|
||||||
github.com/danieljoos/wincred v1.2.3 h1:v7dZC2x32Ut3nEfRH+vhoZGvN72+dQ/snVXo/vMFLdQ=
|
github.com/danieljoos/wincred v1.2.3 h1:v7dZC2x32Ut3nEfRH+vhoZGvN72+dQ/snVXo/vMFLdQ=
|
||||||
github.com/danieljoos/wincred v1.2.3/go.mod h1:6qqX0WNrS4RzPZ1tnroDzq9kY3fu1KwE7MRLQK4X0bs=
|
github.com/danieljoos/wincred v1.2.3/go.mod h1:6qqX0WNrS4RzPZ1tnroDzq9kY3fu1KwE7MRLQK4X0bs=
|
||||||
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM=
|
|
||||||
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
|
||||||
github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY=
|
github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY=
|
||||||
github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto=
|
github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto=
|
||||||
github.com/go-acme/lego/v5 v5.2.2 h1:KqFas/Ak2QDdU+Qm7MO9OEnS35zC000kPmM+5tLdZKk=
|
github.com/go-acme/lego/v5 v5.4.1 h1:Jt6xAP9xQrJ3SLLGgxejfDDd3pzdrmuLCWe4oTqHHQc=
|
||||||
github.com/go-acme/lego/v5 v5.2.2/go.mod h1:H/hb7OJKmpVGa8zypgZh0ys5P4VUu++ZNgAEcOwq+OI=
|
github.com/go-acme/lego/v5 v5.4.1/go.mod h1:OvMMHc6DVeqycOGhNRuMlNa1V304qEFRljWDHMpEcLc=
|
||||||
github.com/go-jose/go-jose/v4 v4.1.4 h1:moDMcTHmvE6Groj34emNPLs/qtYXRVcd6S7NHbHz3kA=
|
github.com/go-jose/go-jose/v4 v4.1.4 h1:moDMcTHmvE6Groj34emNPLs/qtYXRVcd6S7NHbHz3kA=
|
||||||
github.com/go-jose/go-jose/v4 v4.1.4/go.mod h1:x4oUasVrzR7071A4TnHLGSPpNOm2a21K9Kf04k1rs08=
|
github.com/go-jose/go-jose/v4 v4.1.4/go.mod h1:x4oUasVrzR7071A4TnHLGSPpNOm2a21K9Kf04k1rs08=
|
||||||
github.com/godbus/dbus/v5 v5.2.2 h1:TUR3TgtSVDmjiXOgAAyaZbYmIeP3DPkld3jgKGV8mXQ=
|
github.com/godbus/dbus/v5 v5.2.2 h1:TUR3TgtSVDmjiXOgAAyaZbYmIeP3DPkld3jgKGV8mXQ=
|
||||||
github.com/godbus/dbus/v5 v5.2.2/go.mod h1:3AAv2+hPq5rdnr5txxxRwiGjPXamgoIHgz9FPBfOp3c=
|
github.com/godbus/dbus/v5 v5.2.2/go.mod h1:3AAv2+hPq5rdnr5txxxRwiGjPXamgoIHgz9FPBfOp3c=
|
||||||
github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8=
|
github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8=
|
||||||
github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU=
|
github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU=
|
||||||
github.com/google/pprof v0.0.0-20250317173921-a4b03ec1a45e h1:ijClszYn+mADRFY17kjQEVQ1XRhq2/JR1M3sGqeJoxs=
|
github.com/google/pprof v0.0.0-20260802141513-ef3492d7dac3 h1:LMLX+LgTNWpfvCBdFebv6EsYotImrt/Ppc5cXIriCSo=
|
||||||
github.com/google/pprof v0.0.0-20250317173921-a4b03ec1a45e/go.mod h1:boTsfXsheKC2y+lKOCMpSfarhxDeIzfZG1jqGcPl3cA=
|
github.com/google/pprof v0.0.0-20260802141513-ef3492d7dac3/go.mod h1:jl5iWTm0/hd5PjEYEOuwAJ57L/CibdZfrqZ5XA5GrCk=
|
||||||
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
|
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
|
||||||
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||||
github.com/hashicorp/golang-lru/v2 v2.0.7 h1:a+bsQ5rvGLjzHuww6tVxozPZFVghXaHOwFs4luLUK2k=
|
github.com/hashicorp/golang-lru/v2 v2.0.7 h1:a+bsQ5rvGLjzHuww6tVxozPZFVghXaHOwFs4luLUK2k=
|
||||||
github.com/hashicorp/golang-lru/v2 v2.0.7/go.mod h1:QeFd9opnmA6QUJc5vARoKUSoFhyfM2/ZepoAG6RGpeM=
|
github.com/hashicorp/golang-lru/v2 v2.0.7/go.mod h1:QeFd9opnmA6QUJc5vARoKUSoFhyfM2/ZepoAG6RGpeM=
|
||||||
github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8=
|
github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8=
|
||||||
github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
|
github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
|
||||||
github.com/lucasb-eyer/go-colorful v1.4.0 h1:UtrWVfLdarDgc44HcS7pYloGHJUjHV/4FwW4TvVgFr4=
|
github.com/lucasb-eyer/go-colorful v1.4.1 h1:1EO+WB73+EH8EVbzlrG3KLAfEypQWVHIBqlTf+2hNss=
|
||||||
github.com/lucasb-eyer/go-colorful v1.4.0/go.mod h1:R4dSotOR9KMtayYi1e77YzuveK+i7ruzyGqttikkLy0=
|
github.com/lucasb-eyer/go-colorful v1.4.1/go.mod h1:R4dSotOR9KMtayYi1e77YzuveK+i7ruzyGqttikkLy0=
|
||||||
github.com/mattn/go-isatty v0.0.22 h1:j8l17JJ9i6VGPUFUYoTUKPSgKe/83EYU2zBC7YNKMw4=
|
github.com/mattn/go-isatty v0.0.24 h1:tGZZoVgT/KiqK1c8ocVLeDS8BSWMRd47J3Lbz7vsReI=
|
||||||
github.com/mattn/go-isatty v0.0.22/go.mod h1:ZXfXG4SQHsB/w3ZeOYbR0PrPwLy+n6xiMrJlRFqopa4=
|
github.com/mattn/go-isatty v0.0.24/go.mod h1:nMCL3Zebbrt45jsMDgnfIwz6ydEQApk5oEI3HqDio6A=
|
||||||
github.com/mattn/go-runewidth v0.0.24 h1:cpokDiIn0MGnhdHwuWnJBITySJ20QyNGnY2kR/ay2DU=
|
github.com/mattn/go-runewidth v0.0.27 h1:Feg/Oou5zI/wnpgDF6omIU0OokC9GxLC/WRknhVlIR0=
|
||||||
github.com/mattn/go-runewidth v0.0.24/go.mod h1:XBkDxAl56ILZc9knddidhrOlY5R/pDhgLpndooCuJAs=
|
github.com/mattn/go-runewidth v0.0.27/go.mod h1:3qAiGCV4Koz/yuveO58qUefmUTRm8r0IGEXZ9jeHp/8=
|
||||||
github.com/miekg/dns v1.1.72 h1:vhmr+TF2A3tuoGNkLDFK9zi36F2LS+hKTRW0Uf8kbzI=
|
github.com/miekg/dns v1.1.73 h1:uhT8nJxmTrPJYClxVxTCX+CVn6qnzSiybRk72Z6DgrE=
|
||||||
github.com/miekg/dns v1.1.72/go.mod h1:+EuEPhdHOsfk6Wk5TT2CzssZdqkmFhf8r+aVyDEToIs=
|
github.com/miekg/dns v1.1.73/go.mod h1:RW2Obtfd5NZHvOFe3zYG0W8koWOQtAzyHaLo8vASBuQ=
|
||||||
github.com/muesli/cancelreader v0.2.2 h1:3I4Kt4BQjOR54NavqnDogx/MIoWBFa0StPA8ELUXHmA=
|
github.com/muesli/cancelreader v0.2.2 h1:3I4Kt4BQjOR54NavqnDogx/MIoWBFa0StPA8ELUXHmA=
|
||||||
github.com/muesli/cancelreader v0.2.2/go.mod h1:3XuTXfFS2VjM+HTLZY9Ak0l6eUKfijIfMUZ4EgX0QYo=
|
github.com/muesli/cancelreader v0.2.2/go.mod h1:3XuTXfFS2VjM+HTLZY9Ak0l6eUKfijIfMUZ4EgX0QYo=
|
||||||
github.com/ncruces/go-strftime v1.0.0 h1:HMFp8mLCTPp341M/ZnA4qaf7ZlsbTc+miZjCLOFAw7w=
|
github.com/ncruces/go-strftime v1.0.0 h1:HMFp8mLCTPp341M/ZnA4qaf7ZlsbTc+miZjCLOFAw7w=
|
||||||
github.com/ncruces/go-strftime v1.0.0/go.mod h1:Fwc5htZGVVkseilnfgOVb9mKy6w1naJmn9CehxcKcls=
|
github.com/ncruces/go-strftime v1.0.0/go.mod h1:Fwc5htZGVVkseilnfgOVb9mKy6w1naJmn9CehxcKcls=
|
||||||
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U=
|
|
||||||
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
|
||||||
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec h1:W09IVJc94icq4NjY3clb7Lk8O1qJ8BdBEF8z0ibU0rE=
|
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec h1:W09IVJc94icq4NjY3clb7Lk8O1qJ8BdBEF8z0ibU0rE=
|
||||||
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo=
|
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo=
|
||||||
github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ=
|
github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ=
|
||||||
@@ -72,63 +68,64 @@ github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUc
|
|||||||
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
|
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
|
||||||
github.com/spf13/cobra v1.10.2 h1:DMTTonx5m65Ic0GOoRY2c16WCbHxOOw6xxezuLaBpcU=
|
github.com/spf13/cobra v1.10.2 h1:DMTTonx5m65Ic0GOoRY2c16WCbHxOOw6xxezuLaBpcU=
|
||||||
github.com/spf13/cobra v1.10.2/go.mod h1:7C1pvHqHw5A4vrJfjNwvOdzYu0Gml16OCs2GRiTUUS4=
|
github.com/spf13/cobra v1.10.2/go.mod h1:7C1pvHqHw5A4vrJfjNwvOdzYu0Gml16OCs2GRiTUUS4=
|
||||||
github.com/spf13/pflag v1.0.9 h1:9exaQaMOCwffKiiiYk6/BndUBv+iRViNW+4lEMi0PvY=
|
|
||||||
github.com/spf13/pflag v1.0.9/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
|
github.com/spf13/pflag v1.0.9/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
|
||||||
|
github.com/spf13/pflag v1.0.10 h1:4EBh2KAYBwaONj6b2Ye1GiHfwjqyROoF4RwYO+vPwFk=
|
||||||
|
github.com/spf13/pflag v1.0.10/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
|
||||||
github.com/stretchr/objx v0.5.3 h1:jmXUvGomnU1o3W/V5h2VEradbpJDwGrzugQQvL0POH4=
|
github.com/stretchr/objx v0.5.3 h1:jmXUvGomnU1o3W/V5h2VEradbpJDwGrzugQQvL0POH4=
|
||||||
github.com/stretchr/objx v0.5.3/go.mod h1:rDQraq+vQZU7Fde9LOZLr8Tax6zZvy4kuNKF+QYS+U0=
|
github.com/stretchr/objx v0.5.3/go.mod h1:rDQraq+vQZU7Fde9LOZLr8Tax6zZvy4kuNKF+QYS+U0=
|
||||||
github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U=
|
github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE=
|
||||||
github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U=
|
github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg=
|
||||||
github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e h1:JVG44RsyaB9T2KIHavMF/ppJZNG9ZpyihvCd0w101no=
|
github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e h1:JVG44RsyaB9T2KIHavMF/ppJZNG9ZpyihvCd0w101no=
|
||||||
github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e/go.mod h1:RbqR21r5mrJuqunuUZ/Dhy/avygyECGrLceyNeo4LiM=
|
github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e/go.mod h1:RbqR21r5mrJuqunuUZ/Dhy/avygyECGrLceyNeo4LiM=
|
||||||
github.com/zalando/go-keyring v0.2.8 h1:6sD/Ucpl7jNq10rM2pgqTs0sZ9V3qMrqfIIy5YPccHs=
|
github.com/zalando/go-keyring v0.2.8 h1:6sD/Ucpl7jNq10rM2pgqTs0sZ9V3qMrqfIIy5YPccHs=
|
||||||
github.com/zalando/go-keyring v0.2.8/go.mod h1:tsMo+VpRq5NGyKfxoBVjCuMrG47yj8cmakZDO5QGii0=
|
github.com/zalando/go-keyring v0.2.8/go.mod h1:tsMo+VpRq5NGyKfxoBVjCuMrG47yj8cmakZDO5QGii0=
|
||||||
go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg=
|
go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg=
|
||||||
golang.org/x/crypto v0.54.0 h1:YLIA59K4fiNzHzjnZt2tUJQjQtUWfWbeHBqKtk3eScw=
|
go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw=
|
||||||
golang.org/x/crypto v0.54.0/go.mod h1:KWL8ny2AZdGR2cWmzeHrp2azQPGogOv+HeQaVEXC2dk=
|
go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg=
|
||||||
|
golang.org/x/crypto v0.55.0 h1:+KWHjbgOaAQ66dh/YlkZKHlz9ZUlq61AFirAR9ntP8M=
|
||||||
|
golang.org/x/crypto v0.55.0/go.mod h1:uq0V9dE/fzQuJtbnL+2EhWOE63vo164FY8xqEnV9xis=
|
||||||
golang.org/x/exp v0.0.0-20260410095643-746e56fc9e2f h1:W3F4c+6OLc6H2lb//N1q4WpJkhzJCK5J6kUi1NTVXfM=
|
golang.org/x/exp v0.0.0-20260410095643-746e56fc9e2f h1:W3F4c+6OLc6H2lb//N1q4WpJkhzJCK5J6kUi1NTVXfM=
|
||||||
golang.org/x/exp v0.0.0-20260410095643-746e56fc9e2f/go.mod h1:J1xhfL/vlindoeF/aINzNzt2Bket5bjo9sdOYzOsU80=
|
golang.org/x/exp v0.0.0-20260410095643-746e56fc9e2f/go.mod h1:J1xhfL/vlindoeF/aINzNzt2Bket5bjo9sdOYzOsU80=
|
||||||
golang.org/x/mod v0.37.0 h1:vF1DjpVEshcIqoEaauuHebaLk1O1forxjxBaVn884JQ=
|
golang.org/x/mod v0.38.0 h1:MECBjubtXD7yj4HrhIUcywNaGeNVUdfVnxmPajOk4yk=
|
||||||
golang.org/x/mod v0.37.0/go.mod h1:m8S8VeM9r4dzDwjrKO0a1sZP3YjeMamRRlD+fmR2Q/0=
|
golang.org/x/mod v0.38.0/go.mod h1:V6Xz0pq8TQ3dGqVQ1FVHuelZpAL0uNhSkk9ogYP3c40=
|
||||||
golang.org/x/net v0.57.0 h1:K5+3DljvIuDG9/Jv9rvyMywYNFCQ9RSUY6OOTTkT+tE=
|
golang.org/x/net v0.58.0 h1:ynWG7rqYi4ccpTEuPZ2QGWHktVEM9DMCj9yzDE0Q7To=
|
||||||
golang.org/x/net v0.57.0/go.mod h1:KpXc8iv+r3XplLAG/f7Jsf9RPszJzdR0f58q9vGOuEU=
|
golang.org/x/net v0.58.0/go.mod h1:YwCddHnFlT7eLQqVprV19OnhLGtc5xOKgE0RyqgfWAU=
|
||||||
golang.org/x/sync v0.22.0 h1:SZjpbeLmrCk4xhRSZFNZW5gFUeCeFgjekvI/+gfScek=
|
golang.org/x/sync v0.23.0 h1:KameEIfc1IkluZyXWLn39Wd4tURc6GbCiISGiZm2bQk=
|
||||||
golang.org/x/sync v0.22.0/go.mod h1:9xrNwdLfx4jkKbNva9FpL6vEN7evnE43NNNJQ2LF3+0=
|
golang.org/x/sync v0.23.0/go.mod h1:sUUOizhqBxiL6pEWpqNLUiaJn1ShEbZ6BBqskPbjZm0=
|
||||||
golang.org/x/sys v0.47.0 h1:o7XGOvZQCADBQQ4Y7VNq2dRWQR7JmOUW8Kxx4ZsNgWs=
|
golang.org/x/sys v0.48.0 h1:bbX/i/6MgT9BVLM9RT1thmxL04yeTAhbEz4SyadbXoo=
|
||||||
golang.org/x/sys v0.47.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw=
|
golang.org/x/sys v0.48.0/go.mod h1:hNLxWAXmnKAxqDtdwIYC4bM9oQPEecfsnNMuSxOs3og=
|
||||||
golang.org/x/text v0.40.0 h1:Ub2Z6/xjgF1WrYQz2nuITOEegKFtiIy+rieRJ5lHZKs=
|
golang.org/x/text v0.41.0 h1:vz/seA0lnX87Othu2f/0L24RcgrXD9/YFTSuGjj3rH8=
|
||||||
golang.org/x/text v0.40.0/go.mod h1:hpnzDAfGV753zIKo+wk3u1bVKCGPbrnF7+7LBF/UHVY=
|
golang.org/x/text v0.41.0/go.mod h1:jvf1O8ajNzZqhSrQBPbutR/EB83Cc0CFrezNQIwbb5M=
|
||||||
golang.org/x/tools v0.47.0 h1:7Kn5x/d1svx/PzryTsqeoZN4TZwqeH5pGWjefhLi/1Q=
|
golang.org/x/tools v0.48.0 h1:3+hClM1aLL5mjMKm5ovokw9epgRXPuu2tILgismM6RE=
|
||||||
golang.org/x/tools v0.47.0/go.mod h1:dFHnyTvFWY212G+h7ZY4Vsp/K3U4/7W9TyVaAul8uCA=
|
golang.org/x/tools v0.48.0/go.mod h1:08xX0orndb/F7jJxGDicx061tyd5pcMto75YMAXr6lk=
|
||||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||||
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
modernc.org/cc/v4 v4.29.2 h1:h6+9ciCnPKutf4I03CvheAvDLX7+IHlqR6Iy6J+cgd8=
|
||||||
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
modernc.org/cc/v4 v4.29.2/go.mod h1:OnovgIhbbMXMu1aISnJ0wvVD1KnW+cAUJkIrAWh+kVI=
|
||||||
modernc.org/cc/v4 v4.28.4 h1:Hd/4Es+MBj+/7hSdZaisNyu6bv3V0Dp2MdllyfqaH+c=
|
modernc.org/ccgo/v4 v4.35.0 h1:F+TUsmw09QxLzmi3aeYYGxjAXarmZaKgj3mKQHNaA8w=
|
||||||
modernc.org/cc/v4 v4.28.4/go.mod h1:OnovgIhbbMXMu1aISnJ0wvVD1KnW+cAUJkIrAWh+kVI=
|
modernc.org/ccgo/v4 v4.35.0/go.mod h1:qrVGs9S3Sr2Ztcg9ve+kTAYMp5a3YvWjo+SoN06kJ5I=
|
||||||
modernc.org/ccgo/v4 v4.34.4 h1:OVnSOWQjVKOYkFxoHYB+qQmSHK5gqMqARM+K9DpR/Ws=
|
|
||||||
modernc.org/ccgo/v4 v4.34.4/go.mod h1:qdKqE8FNIYyysougB1RX9MxCzp5oJOcQXSobANJ4TuE=
|
|
||||||
modernc.org/fileutil v1.4.0 h1:j6ZzNTftVS054gi281TyLjHPp6CPHr2KCxEXjEbD6SM=
|
modernc.org/fileutil v1.4.0 h1:j6ZzNTftVS054gi281TyLjHPp6CPHr2KCxEXjEbD6SM=
|
||||||
modernc.org/fileutil v1.4.0/go.mod h1:EqdKFDxiByqxLk8ozOxObDSfcVOv/54xDs/DUHdvCUU=
|
modernc.org/fileutil v1.4.0/go.mod h1:EqdKFDxiByqxLk8ozOxObDSfcVOv/54xDs/DUHdvCUU=
|
||||||
modernc.org/gc/v2 v2.6.5 h1:nyqdV8q46KvTpZlsw66kWqwXRHdjIlJOhG6kxiV/9xI=
|
modernc.org/gc/v2 v2.6.5 h1:nyqdV8q46KvTpZlsw66kWqwXRHdjIlJOhG6kxiV/9xI=
|
||||||
modernc.org/gc/v2 v2.6.5/go.mod h1:YgIahr1ypgfe7chRuJi2gD7DBQiKSLMPgBQe9oIiito=
|
modernc.org/gc/v2 v2.6.5/go.mod h1:YgIahr1ypgfe7chRuJi2gD7DBQiKSLMPgBQe9oIiito=
|
||||||
modernc.org/gc/v3 v3.1.3 h1:6QAplYyVO+KdPW3pGnqmJDUxtkec8ooEWvks/hhU3lc=
|
modernc.org/gc/v3 v3.1.5 h1:21ldfPfRYE31Tb7B3mwAK8gy1AxP4+dKjrOQPfqakoc=
|
||||||
modernc.org/gc/v3 v3.1.3/go.mod h1:HFK/6AGESC7Ex+EZJhJ2Gni6cTaYpSMmU/cT9RmlfYY=
|
modernc.org/gc/v3 v3.1.5/go.mod h1:HFK/6AGESC7Ex+EZJhJ2Gni6cTaYpSMmU/cT9RmlfYY=
|
||||||
modernc.org/goabi0 v0.2.0 h1:HvEowk7LxcPd0eq6mVOAEMai46V+i7Jrj13t4AzuNks=
|
modernc.org/goabi0 v0.2.0 h1:HvEowk7LxcPd0eq6mVOAEMai46V+i7Jrj13t4AzuNks=
|
||||||
modernc.org/goabi0 v0.2.0/go.mod h1:CEFRnnJhKvWT1c1JTI3Avm+tgOWbkOu5oPA8eH8LnMI=
|
modernc.org/goabi0 v0.2.0/go.mod h1:CEFRnnJhKvWT1c1JTI3Avm+tgOWbkOu5oPA8eH8LnMI=
|
||||||
modernc.org/libc v1.73.4 h1:+ra4Ui8ngyt8HDcO1FTDPWlkAh6yOdaO2yAoh8MddQA=
|
modernc.org/libc v1.75.6 h1:yKk8qo+Di4gkmvRboK8ocCqH22FiUCR6jRy2OwtCRus=
|
||||||
modernc.org/libc v1.73.4/go.mod h1:DXZ3eO8qMCNn2SnmTNCiC71nJ9Rcq3PsnpU6Vc4rWK8=
|
modernc.org/libc v1.75.6/go.mod h1:bO5o2ztHxBb2rjz0PgdHN0sSMw57CgxGFLZ3Qd/QpVQ=
|
||||||
modernc.org/mathutil v1.7.1 h1:GCZVGXdaN8gTqB1Mf/usp1Y/hSqgI2vAGGP4jZMCxOU=
|
modernc.org/mathutil v1.7.1 h1:GCZVGXdaN8gTqB1Mf/usp1Y/hSqgI2vAGGP4jZMCxOU=
|
||||||
modernc.org/mathutil v1.7.1/go.mod h1:4p5IwJITfppl0G4sUEDtCr4DthTaT47/N3aT6MhfgJg=
|
modernc.org/mathutil v1.7.1/go.mod h1:4p5IwJITfppl0G4sUEDtCr4DthTaT47/N3aT6MhfgJg=
|
||||||
modernc.org/memory v1.11.0 h1:o4QC8aMQzmcwCK3t3Ux/ZHmwFPzE6hf2Y5LbkRs+hbI=
|
modernc.org/memory v1.12.1 h1:nFMiWrpStgZczNl6XI9GnIk/rWhYIyHGUaR04pGbp9g=
|
||||||
modernc.org/memory v1.11.0/go.mod h1:/JP4VbVC+K5sU2wZi9bHoq2MAkCnrt2r98UGeSK7Mjw=
|
modernc.org/memory v1.12.1/go.mod h1:/JP4VbVC+K5sU2wZi9bHoq2MAkCnrt2r98UGeSK7Mjw=
|
||||||
modernc.org/opt v0.2.0 h1:tGyef5ApycA7FSEOMraay9SaTk5zmbx7Tu+cJs4QKZg=
|
modernc.org/opt v0.2.0 h1:tGyef5ApycA7FSEOMraay9SaTk5zmbx7Tu+cJs4QKZg=
|
||||||
modernc.org/opt v0.2.0/go.mod h1:03fq9lsNfvkYSfxrfUhZCWPk1lm4cq4N+Bh//bEtgns=
|
modernc.org/opt v0.2.0/go.mod h1:03fq9lsNfvkYSfxrfUhZCWPk1lm4cq4N+Bh//bEtgns=
|
||||||
modernc.org/sortutil v1.2.1 h1:+xyoGf15mM3NMlPDnFqrteY07klSFxLElE2PVuWIJ7w=
|
modernc.org/sortutil v1.2.1 h1:+xyoGf15mM3NMlPDnFqrteY07klSFxLElE2PVuWIJ7w=
|
||||||
modernc.org/sortutil v1.2.1/go.mod h1:7ZI3a3REbai7gzCLcotuw9AC4VZVpYMjDzETGsSMqJE=
|
modernc.org/sortutil v1.2.1/go.mod h1:7ZI3a3REbai7gzCLcotuw9AC4VZVpYMjDzETGsSMqJE=
|
||||||
modernc.org/sqlite v1.53.0 h1:20WG8N9q4ji/dEqGk4uiI0c6OPjSeLTNYGFCc3+7c1M=
|
modernc.org/sqlite v1.58.0 h1:38u40/bwkfM7f0Myhosl+SEMltSDxnGdQf8o6Kjmys0=
|
||||||
modernc.org/sqlite v1.53.0/go.mod h1:xoEpOIpGrgT48H5iiyt/YXPCZPEzlfmfFwtk8Lklw8s=
|
modernc.org/sqlite v1.58.0/go.mod h1:rsD2CckafgObKC4DhBlGBf+RiHxkc3hINGt1Xw32tVY=
|
||||||
modernc.org/strutil v1.2.1 h1:UneZBkQA+DX2Rp35KcM69cSsNES9ly8mQWD71HKlOA0=
|
modernc.org/strutil v1.2.1 h1:UneZBkQA+DX2Rp35KcM69cSsNES9ly8mQWD71HKlOA0=
|
||||||
modernc.org/strutil v1.2.1/go.mod h1:EHkiggD70koQxjVdSBM3JKM7k6L0FbGE5eymy9i3B9A=
|
modernc.org/strutil v1.2.1/go.mod h1:EHkiggD70koQxjVdSBM3JKM7k6L0FbGE5eymy9i3B9A=
|
||||||
modernc.org/token v1.1.0 h1:Xl7Ap9dKaEs5kLoOQeQmPWevfnk/DM5qcLcYlA8ys6Y=
|
modernc.org/token v1.1.0 h1:Xl7Ap9dKaEs5kLoOQeQmPWevfnk/DM5qcLcYlA8ys6Y=
|
||||||
modernc.org/token v1.1.0/go.mod h1:UGzOrNV1mAFSEB63lOFHIpNRUVMvYTc6yu1SMY/XTDM=
|
modernc.org/token v1.1.0/go.mod h1:UGzOrNV1mAFSEB63lOFHIpNRUVMvYTc6yu1SMY/XTDM=
|
||||||
software.sslmate.com/src/go-pkcs12 v0.7.2 h1:Rh9FoMaI5k7Oo6EOS+2/BnoZ+JFIS+XHjM0VGkSPXLM=
|
software.sslmate.com/src/go-pkcs12 v0.7.3 h1:JBQD3FDqYjTeyDAeZQklj2ar88ykBLtALloPJHyAauU=
|
||||||
software.sslmate.com/src/go-pkcs12 v0.7.2/go.mod h1:Qiz0EyvDRJjjxGyUQa2cCNZn/wMyzrRJ/qcDXOQazLI=
|
software.sslmate.com/src/go-pkcs12 v0.7.3/go.mod h1:Qiz0EyvDRJjjxGyUQa2cCNZn/wMyzrRJ/qcDXOQazLI=
|
||||||
@@ -22,12 +22,13 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type CertificateService struct {
|
type CertificateService struct {
|
||||||
Repository store.Repository
|
Repository store.Repository
|
||||||
Secrets store.SecretStore
|
Secrets store.SecretStore
|
||||||
Engine *certificates.Engine
|
Engine *certificates.Engine
|
||||||
Lifecycle *certificates.Lifecycle
|
Lifecycle *certificates.Lifecycle
|
||||||
ExportRoot string
|
ExportRoot string
|
||||||
Now func() time.Time
|
Now func() time.Time
|
||||||
|
JobObserver func(domain.Job)
|
||||||
}
|
}
|
||||||
|
|
||||||
type IssueZonesRequest struct {
|
type IssueZonesRequest struct {
|
||||||
@@ -143,7 +144,7 @@ func (s *CertificateService) IssueZones(ctx context.Context, request IssueZonesR
|
|||||||
now := s.now().UTC()
|
now := s.now().UTC()
|
||||||
payload, _ := json.Marshal(map[string]any{"environment": request.Environment, "plan": plan})
|
payload, _ := json.Marshal(map[string]any{"environment": request.Environment, "plan": plan})
|
||||||
job := domain.Job{ID: identifier.New("job"), Kind: "certificate.issue", State: domain.JobRunning, ResourceID: zone.ID, Progress: 5, Message: "Preparing ACME order for " + zone.Name, Payload: payload, CreatedAt: now, StartedAt: &now, UpdatedAt: now}
|
job := domain.Job{ID: identifier.New("job"), Kind: "certificate.issue", State: domain.JobRunning, ResourceID: zone.ID, Progress: 5, Message: "Preparing ACME order for " + zone.Name, Payload: payload, CreatedAt: now, StartedAt: &now, UpdatedAt: now}
|
||||||
if err := s.Repository.SaveJob(ctx, job); err != nil {
|
if err := s.saveJob(ctx, job); err != nil {
|
||||||
return IssueZonesResult{}, err
|
return IssueZonesResult{}, err
|
||||||
}
|
}
|
||||||
items = append(items, workItem{zone: zone, plan: plan, job: job})
|
items = append(items, workItem{zone: zone, plan: plan, job: job})
|
||||||
@@ -165,13 +166,27 @@ func (s *CertificateService) IssueZones(ctx context.Context, request IssueZonesR
|
|||||||
issued, issueErr := s.Engine.Issue(groupCtx, certificates.IssueRequest{
|
issued, issueErr := s.Engine.Issue(groupCtx, certificates.IssueRequest{
|
||||||
JobID: item.job.ID, Environment: request.Environment, Plan: item.plan,
|
JobID: item.job.ID, Environment: request.Environment, Plan: item.plan,
|
||||||
ConfirmProduction: request.ConfirmProduction,
|
ConfirmProduction: request.ConfirmProduction,
|
||||||
|
Progress: func(progress certificates.IssueProgress) {
|
||||||
|
job.Progress = progress.Percent
|
||||||
|
job.Message = item.zone.Name + " · " + progress.Message
|
||||||
|
job.UpdatedAt = s.now().UTC()
|
||||||
|
if progress.WaitingDNS {
|
||||||
|
job.State = domain.JobWaitingForDNS
|
||||||
|
} else {
|
||||||
|
job.State = domain.JobRunning
|
||||||
|
}
|
||||||
|
_ = s.saveJob(groupCtx, job)
|
||||||
|
},
|
||||||
})
|
})
|
||||||
finished := s.now().UTC()
|
finished := s.now().UTC()
|
||||||
if issueErr != nil {
|
if issueErr != nil {
|
||||||
job.State, job.Progress = domain.JobFailed, 100
|
job.State, job.Progress = domain.JobFailed, 100
|
||||||
job.Message, job.Error = "Certificate issuance failed", issueErr.Error()
|
job.Message, job.Error = "Certificate issuance failed", issueErr.Error()
|
||||||
|
if errors.Is(issueErr, context.Canceled) {
|
||||||
|
job.State, job.Message = domain.JobCancelled, "Certificate issuance cancelled after DNS cleanup"
|
||||||
|
}
|
||||||
job.FinishedAt, job.UpdatedAt = &finished, finished
|
job.FinishedAt, job.UpdatedAt = &finished, finished
|
||||||
_ = s.Repository.SaveJob(context.WithoutCancel(groupCtx), job)
|
_ = s.saveJob(context.WithoutCancel(groupCtx), job)
|
||||||
failure := IssueFailure{ZoneID: item.zone.ID, Name: item.zone.Name, Error: issueErr.Error()}
|
failure := IssueFailure{ZoneID: item.zone.ID, Name: item.zone.Name, Error: issueErr.Error()}
|
||||||
outcomes[index] = zoneOutcome{failure: &failure, err: fmt.Errorf("%s: %w", item.zone.Name, issueErr)}
|
outcomes[index] = zoneOutcome{failure: &failure, err: fmt.Errorf("%s: %w", item.zone.Name, issueErr)}
|
||||||
return nil
|
return nil
|
||||||
@@ -179,6 +194,9 @@ func (s *CertificateService) IssueZones(ctx context.Context, request IssueZonesR
|
|||||||
|
|
||||||
// Once the CA has issued material, finalization must get a brief chance
|
// Once the CA has issued material, finalization must get a brief chance
|
||||||
// to persist it even if the caller cancels the remaining bulk job.
|
// to persist it even if the caller cancels the remaining bulk job.
|
||||||
|
job.State, job.Progress = domain.JobRunning, 90
|
||||||
|
job.Message, job.UpdatedAt = "Storing and activating issued certificate", s.now().UTC()
|
||||||
|
_ = s.saveJob(context.WithoutCancel(groupCtx), job)
|
||||||
finalizeCtx, cancel := context.WithTimeout(context.WithoutCancel(groupCtx), 2*time.Minute)
|
finalizeCtx, cancel := context.WithTimeout(context.WithoutCancel(groupCtx), 2*time.Minute)
|
||||||
defer cancel()
|
defer cancel()
|
||||||
var previous *domain.CertificateLineage
|
var previous *domain.CertificateLineage
|
||||||
@@ -209,7 +227,7 @@ func (s *CertificateService) IssueZones(ctx context.Context, request IssueZonesR
|
|||||||
}
|
}
|
||||||
job.Progress = 100
|
job.Progress = 100
|
||||||
job.FinishedAt, job.UpdatedAt = &finished, finished
|
job.FinishedAt, job.UpdatedAt = &finished, finished
|
||||||
_ = s.Repository.SaveJob(finalizeCtx, job)
|
_ = s.saveJob(finalizeCtx, job)
|
||||||
return nil
|
return nil
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -233,6 +251,14 @@ func (s *CertificateService) IssueZones(ctx context.Context, request IssueZonesR
|
|||||||
return result, errors.Join(failures...)
|
return result, errors.Join(failures...)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (s *CertificateService) saveJob(ctx context.Context, job domain.Job) error {
|
||||||
|
err := s.Repository.SaveJob(ctx, job)
|
||||||
|
if s.JobObserver != nil {
|
||||||
|
s.JobObserver(job)
|
||||||
|
}
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
func (s *CertificateService) RenewDue(ctx context.Context, environment string, confirmProduction bool) (IssueZonesResult, error) {
|
func (s *CertificateService) RenewDue(ctx context.Context, environment string, confirmProduction bool) (IssueZonesResult, error) {
|
||||||
if environment == "" {
|
if environment == "" {
|
||||||
environment = certificates.EnvironmentProduction
|
environment = certificates.EnvironmentProduction
|
||||||
@@ -299,22 +325,39 @@ func (s *CertificateService) RenewDue(ctx context.Context, environment string, c
|
|||||||
group.Go(func() error {
|
group.Go(func() error {
|
||||||
started := s.now()
|
started := s.now()
|
||||||
job := domain.Job{ID: identifier.New("job"), Kind: "certificate.renew", State: domain.JobRunning, ResourceID: item.zone.ID, Progress: 5, Message: "Renewing " + item.lineage.Name, CreatedAt: started, StartedAt: &started, UpdatedAt: started}
|
job := domain.Job{ID: identifier.New("job"), Kind: "certificate.renew", State: domain.JobRunning, ResourceID: item.zone.ID, Progress: 5, Message: "Renewing " + item.lineage.Name, CreatedAt: started, StartedAt: &started, UpdatedAt: started}
|
||||||
if saveErr := s.Repository.SaveJob(groupCtx, job); saveErr != nil {
|
if saveErr := s.saveJob(groupCtx, job); saveErr != nil {
|
||||||
return saveErr
|
return saveErr
|
||||||
}
|
}
|
||||||
plan := certificates.Plan{Name: item.lineage.Name, ZoneID: item.zone.ID, ZoneName: item.zone.Name, Identifiers: slices.Clone(item.lineage.Identifiers), KeyAlgorithm: item.lineage.KeyAlgorithm, Profile: item.lineage.Profile}
|
plan := certificates.Plan{Name: item.lineage.Name, ZoneID: item.zone.ID, ZoneName: item.zone.Name, Identifiers: slices.Clone(item.lineage.Identifiers), KeyAlgorithm: item.lineage.KeyAlgorithm, Profile: item.lineage.Profile}
|
||||||
issued, renewErr := s.Engine.Renew(groupCtx, certificates.RenewRequest{IssueRequest: certificates.IssueRequest{JobID: job.ID, Environment: environment, Plan: plan, ConfirmProduction: confirmProduction}, PreviousCertificatePEM: item.certificatePEM})
|
issued, renewErr := s.Engine.Renew(groupCtx, certificates.RenewRequest{IssueRequest: certificates.IssueRequest{
|
||||||
|
JobID: job.ID, Environment: environment, Plan: plan, ConfirmProduction: confirmProduction,
|
||||||
|
Progress: func(progress certificates.IssueProgress) {
|
||||||
|
job.Progress, job.Message, job.UpdatedAt = progress.Percent, item.lineage.Name+" · "+progress.Message, s.now().UTC()
|
||||||
|
if progress.WaitingDNS {
|
||||||
|
job.State = domain.JobWaitingForDNS
|
||||||
|
} else {
|
||||||
|
job.State = domain.JobRunning
|
||||||
|
}
|
||||||
|
_ = s.saveJob(groupCtx, job)
|
||||||
|
},
|
||||||
|
}, PreviousCertificatePEM: item.certificatePEM})
|
||||||
finished := s.now()
|
finished := s.now()
|
||||||
if renewErr != nil {
|
if renewErr != nil {
|
||||||
job.State, job.Progress, job.Message, job.Error = domain.JobFailed, 100, "Certificate renewal failed", renewErr.Error()
|
job.State, job.Progress, job.Message, job.Error = domain.JobFailed, 100, "Certificate renewal failed", renewErr.Error()
|
||||||
|
if errors.Is(renewErr, context.Canceled) {
|
||||||
|
job.State, job.Message = domain.JobCancelled, "Certificate renewal cancelled after DNS cleanup"
|
||||||
|
}
|
||||||
job.FinishedAt, job.UpdatedAt = &finished, finished
|
job.FinishedAt, job.UpdatedAt = &finished, finished
|
||||||
_ = s.Repository.SaveJob(context.Background(), job)
|
_ = s.saveJob(context.Background(), job)
|
||||||
resultMu.Lock()
|
resultMu.Lock()
|
||||||
result.Failed = append(result.Failed, IssueFailure{ZoneID: item.zone.ID, Name: item.lineage.Name, Error: renewErr.Error()})
|
result.Failed = append(result.Failed, IssueFailure{ZoneID: item.zone.ID, Name: item.lineage.Name, Error: renewErr.Error()})
|
||||||
failures = append(failures, fmt.Errorf("%s: %w", item.lineage.Name, renewErr))
|
failures = append(failures, fmt.Errorf("%s: %w", item.lineage.Name, renewErr))
|
||||||
resultMu.Unlock()
|
resultMu.Unlock()
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
job.State, job.Progress = domain.JobRunning, 90
|
||||||
|
job.Message, job.UpdatedAt = "Storing and activating renewed certificate", s.now().UTC()
|
||||||
|
_ = s.saveJob(context.WithoutCancel(groupCtx), job)
|
||||||
finalizeCtx, cancel := context.WithTimeout(context.WithoutCancel(groupCtx), 2*time.Minute)
|
finalizeCtx, cancel := context.WithTimeout(context.WithoutCancel(groupCtx), 2*time.Minute)
|
||||||
defer cancel()
|
defer cancel()
|
||||||
exportRoot := s.managedExportRoot(environment, item.zone.Name)
|
exportRoot := s.managedExportRoot(environment, item.zone.Name)
|
||||||
@@ -339,7 +382,7 @@ func (s *CertificateService) RenewDue(ctx context.Context, environment string, c
|
|||||||
resultMu.Unlock()
|
resultMu.Unlock()
|
||||||
}
|
}
|
||||||
job.Progress, job.FinishedAt, job.UpdatedAt = 100, &finished, finished
|
job.Progress, job.FinishedAt, job.UpdatedAt = 100, &finished, finished
|
||||||
_ = s.Repository.SaveJob(finalizeCtx, job)
|
_ = s.saveJob(finalizeCtx, job)
|
||||||
return nil
|
return nil
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
+162
-55
@@ -91,14 +91,15 @@ type DNSBatchResult struct {
|
|||||||
type plannedDNSBatch struct {
|
type plannedDNSBatch struct {
|
||||||
plan DNSBatchPlan
|
plan DNSBatchPlan
|
||||||
zone domain.Zone
|
zone domain.Zone
|
||||||
cloud provider.CloudProvider
|
cloud provider.Provider
|
||||||
|
batch provider.DNSBatchService
|
||||||
auth provider.Auth
|
auth provider.Auth
|
||||||
}
|
}
|
||||||
|
|
||||||
type Service struct {
|
type Service struct {
|
||||||
repo store.Repository
|
repo store.Repository
|
||||||
secrets store.SecretStore
|
secrets store.SecretStore
|
||||||
providers map[string]provider.CloudProvider
|
providers map[string]provider.Provider
|
||||||
now func() time.Time
|
now func() time.Time
|
||||||
events chan Event
|
events chan Event
|
||||||
healthCheck func(context.Context) error
|
healthCheck func(context.Context) error
|
||||||
@@ -107,17 +108,22 @@ type Service struct {
|
|||||||
recoveryBlocked atomic.Bool
|
recoveryBlocked atomic.Bool
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var (
|
||||||
|
_ provider.DNS01Solver = (*Service)(nil)
|
||||||
|
_ provider.DNS01Reconciler = (*Service)(nil)
|
||||||
|
)
|
||||||
|
|
||||||
func New(repo store.Repository, secrets store.SecretStore) *Service {
|
func New(repo store.Repository, secrets store.SecretStore) *Service {
|
||||||
return &Service{
|
return &Service{
|
||||||
repo: repo,
|
repo: repo,
|
||||||
secrets: secrets,
|
secrets: secrets,
|
||||||
providers: make(map[string]provider.CloudProvider),
|
providers: make(map[string]provider.Provider),
|
||||||
now: time.Now,
|
now: time.Now,
|
||||||
events: make(chan Event, 128),
|
events: make(chan Event, 128),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Service) RegisterProvider(name string, value provider.CloudProvider) {
|
func (s *Service) RegisterProvider(name string, value provider.Provider) {
|
||||||
s.providers[name] = value
|
s.providers[name] = value
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -167,6 +173,11 @@ func (s *Service) SetHealthCheck(check func(context.Context) error) { s.healthCh
|
|||||||
func (s *Service) SetUnlockHook(hook func(context.Context) error) { s.unlockHook = hook }
|
func (s *Service) SetUnlockHook(hook func(context.Context) error) { s.unlockHook = hook }
|
||||||
func (s *Service) SetCertificateService(service *CertificateService) {
|
func (s *Service) SetCertificateService(service *CertificateService) {
|
||||||
s.certificateService = service
|
s.certificateService = service
|
||||||
|
if service != nil {
|
||||||
|
service.JobObserver = func(job domain.Job) {
|
||||||
|
s.publish(Event{Kind: "certificate.progress", Message: job.Message, Value: job})
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Service) ResolveCredential(ctx context.Context, credentialID string) (provider.Auth, error) {
|
func (s *Service) ResolveCredential(ctx context.Context, credentialID string) (provider.Auth, error) {
|
||||||
@@ -177,6 +188,50 @@ func (s *Service) ResolveCredential(ctx context.Context, credentialID string) (p
|
|||||||
return s.auth(ctx, credential)
|
return s.auth(ctx, credential)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// PresentDNS01, CleanupDNS01, and ReconcileDNS01 make Service the provider
|
||||||
|
// router used by the ACME engine and crash recovery. Routing is based only on
|
||||||
|
// the provider identity bound into Auth; remote zone IDs are not globally
|
||||||
|
// unique and must never select a provider implicitly.
|
||||||
|
func (s *Service) PresentDNS01(ctx context.Context, auth provider.Auth, zoneID, fqdn, value, jobID string) (string, error) {
|
||||||
|
p, err := s.dns01Provider(auth)
|
||||||
|
if err != nil {
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
|
return p.PresentDNS01(ctx, auth, zoneID, fqdn, value, jobID)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *Service) CleanupDNS01(ctx context.Context, auth provider.Auth, zoneID, recordID string) error {
|
||||||
|
p, err := s.dns01Provider(auth)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return p.CleanupDNS01(ctx, auth, zoneID, recordID)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *Service) ReconcileDNS01(ctx context.Context, auth provider.Auth, zoneID, fqdn, valueHash, jobID string) (string, bool, error) {
|
||||||
|
p, err := s.dns01Provider(auth)
|
||||||
|
if err != nil {
|
||||||
|
return "", false, err
|
||||||
|
}
|
||||||
|
reconciler, ok := p.(provider.DNS01Reconciler)
|
||||||
|
if !ok {
|
||||||
|
return "", false, provider.Unsupported(auth.Provider, "DNS-01 reconciliation")
|
||||||
|
}
|
||||||
|
return reconciler.ReconcileDNS01(ctx, auth, zoneID, fqdn, valueHash, jobID)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *Service) dns01Provider(auth provider.Auth) (provider.Provider, error) {
|
||||||
|
providerName := strings.TrimSpace(auth.Provider)
|
||||||
|
if providerName == "" {
|
||||||
|
return nil, errors.New("DNS-01 credential has no provider identity")
|
||||||
|
}
|
||||||
|
p, ok := s.providers[providerName]
|
||||||
|
if !ok {
|
||||||
|
return nil, fmt.Errorf("DNS-01 provider %q is not registered", providerName)
|
||||||
|
}
|
||||||
|
return p, nil
|
||||||
|
}
|
||||||
|
|
||||||
func (s *Service) IssueCertificates(ctx context.Context, request IssueZonesRequest) (IssueZonesResult, error) {
|
func (s *Service) IssueCertificates(ctx context.Context, request IssueZonesRequest) (IssueZonesResult, error) {
|
||||||
if err := s.ensureRecoveryReady(ctx); err != nil {
|
if err := s.ensureRecoveryReady(ctx); err != nil {
|
||||||
return IssueZonesResult{}, err
|
return IssueZonesResult{}, err
|
||||||
@@ -341,7 +396,7 @@ func (s *Service) AddCloudflareCredential(ctx context.Context, input AddCredenti
|
|||||||
}
|
}
|
||||||
|
|
||||||
id := identifier.New("cred")
|
id := identifier.New("cred")
|
||||||
auth := provider.Auth{CredentialID: id, Token: strings.TrimSpace(input.Token), Kind: input.Kind, AccountID: strings.TrimSpace(input.AccountID)}
|
auth := provider.Auth{Provider: domain.ProviderCloudflare, CredentialID: id, Token: strings.TrimSpace(input.Token), Kind: input.Kind, AccountID: strings.TrimSpace(input.AccountID)}
|
||||||
verification, err := p.VerifyCredential(ctx, auth)
|
verification, err := p.VerifyCredential(ctx, auth)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return domain.Credential{}, fmt.Errorf("verify Cloudflare credential: %w", err)
|
return domain.Credential{}, fmt.Errorf("verify Cloudflare credential: %w", err)
|
||||||
@@ -393,7 +448,7 @@ func (s *Service) AddCloudflareCredential(ctx context.Context, input AddCredenti
|
|||||||
if len(verification.Accounts) > 0 {
|
if len(verification.Accounts) > 0 {
|
||||||
links := make([]domain.AccountCredential, 0, len(verification.Accounts))
|
links := make([]domain.AccountCredential, 0, len(verification.Accounts))
|
||||||
for i := range verification.Accounts {
|
for i := range verification.Accounts {
|
||||||
normalizeAccount(&verification.Accounts[i])
|
normalizeAccount(&verification.Accounts[i], domain.ProviderCloudflare)
|
||||||
_, known := knownAccounts[verification.Accounts[i].ID]
|
_, known := knownAccounts[verification.Accounts[i].ID]
|
||||||
links = append(links, domain.AccountCredential{AccountID: verification.Accounts[i].ID, CredentialID: id, Preferred: !known})
|
links = append(links, domain.AccountCredential{AccountID: verification.Accounts[i].ID, CredentialID: id, Preferred: !known})
|
||||||
}
|
}
|
||||||
@@ -567,7 +622,7 @@ func compensateSecretDelete(ctx context.Context, secrets store.SecretStore, refe
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *Service) SyncCredential(ctx context.Context, credentialID string) (domain.Job, error) {
|
func (s *Service) SyncCredential(ctx context.Context, credentialID string) (domain.Job, error) {
|
||||||
job := s.startJob(ctx, "cloudflare.sync", credentialID, "Connecting to Cloudflare")
|
job := s.startJob(ctx, "provider.sync", credentialID, "Connecting to provider")
|
||||||
fail := func(err error) (domain.Job, error) {
|
fail := func(err error) (domain.Job, error) {
|
||||||
job.State = domain.JobFailed
|
job.State = domain.JobFailed
|
||||||
job.Error = err.Error()
|
job.Error = err.Error()
|
||||||
@@ -586,6 +641,10 @@ func (s *Service) SyncCredential(ctx context.Context, credentialID string) (doma
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return fail(err)
|
return fail(err)
|
||||||
}
|
}
|
||||||
|
job.Kind = credential.Provider + ".sync"
|
||||||
|
job.Message = "Connecting to " + credential.Provider
|
||||||
|
job.UpdatedAt = s.now().UTC()
|
||||||
|
_ = s.repo.SaveJob(ctx, job)
|
||||||
p, ok := s.providers[credential.Provider]
|
p, ok := s.providers[credential.Provider]
|
||||||
if !ok {
|
if !ok {
|
||||||
return fail(fmt.Errorf("provider %q is not registered", credential.Provider))
|
return fail(fmt.Errorf("provider %q is not registered", credential.Provider))
|
||||||
@@ -653,13 +712,14 @@ func (s *Service) SyncCredential(ctx context.Context, credentialID string) (doma
|
|||||||
|
|
||||||
accountByID := make(map[string]domain.RemoteAccount)
|
accountByID := make(map[string]domain.RemoteAccount)
|
||||||
for _, account := range verification.Accounts {
|
for _, account := range verification.Accounts {
|
||||||
normalizeAccount(&account)
|
normalizeAccount(&account, credential.Provider)
|
||||||
accountByID[account.ID] = account
|
accountByID[account.ID] = account
|
||||||
}
|
}
|
||||||
returnedZoneIDs := make(map[string]struct{}, len(zones))
|
returnedZoneIDs := make(map[string]struct{}, len(zones))
|
||||||
newZoneIDs := make(map[string]struct{}, len(zones))
|
newZoneIDs := make(map[string]struct{}, len(zones))
|
||||||
for i := range zones {
|
for i := range zones {
|
||||||
normalizeZone(&zones[i], "")
|
accountProviderID := zones[i].AccountID
|
||||||
|
normalizeZone(&zones[i], credential.Provider, "")
|
||||||
key := zones[i].Provider + "\x00" + zones[i].ProviderID
|
key := zones[i].Provider + "\x00" + zones[i].ProviderID
|
||||||
returnedZoneIDs[key] = struct{}{}
|
returnedZoneIDs[key] = struct{}{}
|
||||||
if existing, known := existingZoneByProviderID[key]; known {
|
if existing, known := existingZoneByProviderID[key]; known {
|
||||||
@@ -676,10 +736,13 @@ func (s *Service) SyncCredential(ctx context.Context, credentialID string) (doma
|
|||||||
newZoneIDs[zones[i].ID] = struct{}{}
|
newZoneIDs[zones[i].ID] = struct{}{}
|
||||||
}
|
}
|
||||||
if _, exists := accountByID[zones[i].AccountID]; !exists {
|
if _, exists := accountByID[zones[i].AccountID]; !exists {
|
||||||
providerID := strings.TrimPrefix(zones[i].AccountID, "cfacct_")
|
providerID := accountProviderID
|
||||||
|
if credential.Provider == domain.ProviderCloudflare {
|
||||||
|
providerID = strings.TrimPrefix(zones[i].AccountID, "cfacct_")
|
||||||
|
}
|
||||||
accountByID[zones[i].AccountID] = domain.RemoteAccount{
|
accountByID[zones[i].AccountID] = domain.RemoteAccount{
|
||||||
ID: zones[i].AccountID, Provider: domain.ProviderCloudflare,
|
ID: zones[i].AccountID, Provider: credential.Provider,
|
||||||
ProviderID: providerID, Name: "Cloudflare account " + shortID(providerID), CreatedAt: s.now().UTC(),
|
ProviderID: providerID, Name: credential.Provider + " account " + shortID(providerID), CreatedAt: s.now().UTC(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -714,7 +777,7 @@ func (s *Service) SyncCredential(ctx context.Context, credentialID string) (doma
|
|||||||
if visibilityErr != nil || !visible {
|
if visibilityErr != nil || !visible {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
normalizeZone(&visibleZone, "")
|
normalizeZone(&visibleZone, candidate.Provider, "")
|
||||||
visibleZone.PreferredCredentialID = ""
|
visibleZone.PreferredCredentialID = ""
|
||||||
visibleZone.LastSyncedAt = &staleAt
|
visibleZone.LastSyncedAt = &staleAt
|
||||||
existing = visibleZone
|
existing = visibleZone
|
||||||
@@ -774,7 +837,7 @@ func (s *Service) SyncCredential(ctx context.Context, credentialID string) (doma
|
|||||||
if listErr == nil {
|
if listErr == nil {
|
||||||
now := s.now().UTC()
|
now := s.now().UTC()
|
||||||
for i := range records {
|
for i := range records {
|
||||||
normalizeRecord(&records[i], zone.ID)
|
normalizeRecord(&records[i], zone.Provider, zone.ID)
|
||||||
records[i].LastSyncedAt = &now
|
records[i].LastSyncedAt = &now
|
||||||
}
|
}
|
||||||
listErr = s.repo.ReplaceDNSRecords(groupCtx, zone.ID, records, now)
|
listErr = s.repo.ReplaceDNSRecords(groupCtx, zone.ID, records, now)
|
||||||
@@ -842,7 +905,7 @@ func (s *Service) CreateDNSRecord(ctx context.Context, zoneID string, record dom
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
s.observeZoneCapability(context.WithoutCancel(ctx), auth.CredentialID, zone.ID, "dns:write")
|
s.observeZoneCapability(context.WithoutCancel(ctx), auth.CredentialID, zone.ID, "dns:write")
|
||||||
normalizeRecord(&created, zone.ID)
|
normalizeRecord(&created, zone.Provider, zone.ID)
|
||||||
s.audit(context.WithoutCancel(ctx), "dns.create", created.ID, nil, created)
|
s.audit(context.WithoutCancel(ctx), "dns.create", created.ID, nil, created)
|
||||||
if _, reconcileErr := s.reconcileDNSZone(ctx, zone, p, auth); reconcileErr != nil {
|
if _, reconcileErr := s.reconcileDNSZone(ctx, zone, p, auth); reconcileErr != nil {
|
||||||
return created, dnsMutationAppliedButUnreconciledError("create", reconcileErr)
|
return created, dnsMutationAppliedButUnreconciledError("create", reconcileErr)
|
||||||
@@ -898,7 +961,7 @@ func (s *Service) PatchDNSRecord(ctx context.Context, zoneID, recordID string, d
|
|||||||
reconcileStructuredRecordData(&desired, remote)
|
reconcileStructuredRecordData(&desired, remote)
|
||||||
desired.Raw = append(json.RawMessage(nil), remote.Raw...)
|
desired.Raw = append(json.RawMessage(nil), remote.Raw...)
|
||||||
desired.Proxiable = remote.Proxiable
|
desired.Proxiable = remote.Proxiable
|
||||||
normalizeRecord(&remote, zone.ID)
|
normalizeRecord(&remote, zone.Provider, zone.ID)
|
||||||
updated, mutationErr := p.PatchDNSRecord(ctx, auth, zone.ProviderID, cached.ProviderID, desired)
|
updated, mutationErr := p.PatchDNSRecord(ctx, auth, zone.ProviderID, cached.ProviderID, desired)
|
||||||
if mutationErr != nil {
|
if mutationErr != nil {
|
||||||
if mutationFailureIsDefinitive(mutationErr) {
|
if mutationFailureIsDefinitive(mutationErr) {
|
||||||
@@ -909,7 +972,7 @@ func (s *Service) PatchDNSRecord(ctx context.Context, zoneID, recordID string, d
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
s.observeZoneCapability(context.WithoutCancel(ctx), auth.CredentialID, zone.ID, "dns:write")
|
s.observeZoneCapability(context.WithoutCancel(ctx), auth.CredentialID, zone.ID, "dns:write")
|
||||||
normalizeRecord(&updated, zone.ID)
|
normalizeRecord(&updated, zone.Provider, zone.ID)
|
||||||
s.audit(context.WithoutCancel(ctx), "dns.patch", updated.ID, remote, updated)
|
s.audit(context.WithoutCancel(ctx), "dns.patch", updated.ID, remote, updated)
|
||||||
if _, reconcileErr := s.reconcileDNSZone(ctx, zone, p, auth); reconcileErr != nil {
|
if _, reconcileErr := s.reconcileDNSZone(ctx, zone, p, auth); reconcileErr != nil {
|
||||||
return updated, dnsMutationAppliedButUnreconciledError("patch", reconcileErr)
|
return updated, dnsMutationAppliedButUnreconciledError("patch", reconcileErr)
|
||||||
@@ -952,7 +1015,7 @@ func (s *Service) DeleteDNSRecord(ctx context.Context, zoneID, recordID string)
|
|||||||
if !sameDNSRecordVersion(cached, remote) {
|
if !sameDNSRecordVersion(cached, remote) {
|
||||||
return fmt.Errorf("%w: %s", ErrDNSConflict, cached.Name)
|
return fmt.Errorf("%w: %s", ErrDNSConflict, cached.Name)
|
||||||
}
|
}
|
||||||
normalizeRecord(&remote, zone.ID)
|
normalizeRecord(&remote, zone.Provider, zone.ID)
|
||||||
if mutationErr := p.DeleteDNSRecord(ctx, auth, zone.ProviderID, cached.ProviderID); mutationErr != nil {
|
if mutationErr := p.DeleteDNSRecord(ctx, auth, zone.ProviderID, cached.ProviderID); mutationErr != nil {
|
||||||
if mutationFailureIsDefinitive(mutationErr) {
|
if mutationFailureIsDefinitive(mutationErr) {
|
||||||
return mutationErr
|
return mutationErr
|
||||||
@@ -991,7 +1054,7 @@ func (s *Service) ApplyDNSBatch(ctx context.Context, zoneID string, mutations []
|
|||||||
return DNSBatchResult{}, err
|
return DNSBatchResult{}, err
|
||||||
}
|
}
|
||||||
result := DNSBatchResult{Plan: planned.plan}
|
result := DNSBatchResult{Plan: planned.plan}
|
||||||
if _, applyErr := planned.cloud.ApplyDNSBatch(ctx, planned.auth, planned.zone.ProviderID, planned.plan.Mutations); applyErr != nil {
|
if _, applyErr := planned.batch.ApplyDNSBatch(ctx, planned.auth, planned.zone.ProviderID, planned.plan.Mutations); applyErr != nil {
|
||||||
if mutationFailureIsDefinitive(applyErr) {
|
if mutationFailureIsDefinitive(applyErr) {
|
||||||
return result, applyErr
|
return result, applyErr
|
||||||
}
|
}
|
||||||
@@ -1004,7 +1067,7 @@ func (s *Service) ApplyDNSBatch(ctx context.Context, zoneID string, mutations []
|
|||||||
if refreshErr == nil {
|
if refreshErr == nil {
|
||||||
now := s.now().UTC()
|
now := s.now().UTC()
|
||||||
for index := range records {
|
for index := range records {
|
||||||
normalizeRecord(&records[index], planned.zone.ID)
|
normalizeRecord(&records[index], planned.zone.Provider, planned.zone.ID)
|
||||||
records[index].LastSyncedAt = &now
|
records[index].LastSyncedAt = &now
|
||||||
}
|
}
|
||||||
result.Records = records
|
result.Records = records
|
||||||
@@ -1015,7 +1078,7 @@ func (s *Service) ApplyDNSBatch(ctx context.Context, zoneID string, mutations []
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
return result, errors.Join(
|
return result, errors.Join(
|
||||||
fmt.Errorf("Cloudflare batch outcome is unknown; synchronize and review before retrying: %w", applyErr),
|
fmt.Errorf("%s DNS batch outcome is unknown; synchronize and review before retrying: %w", planned.zone.Provider, applyErr),
|
||||||
refreshErr,
|
refreshErr,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -1030,7 +1093,7 @@ func (s *Service) ApplyDNSBatch(ctx context.Context, zoneID string, mutations []
|
|||||||
}
|
}
|
||||||
now := s.now().UTC()
|
now := s.now().UTC()
|
||||||
for index := range records {
|
for index := range records {
|
||||||
normalizeRecord(&records[index], planned.zone.ID)
|
normalizeRecord(&records[index], planned.zone.Provider, planned.zone.ID)
|
||||||
records[index].LastSyncedAt = &now
|
records[index].LastSyncedAt = &now
|
||||||
}
|
}
|
||||||
result.Records = records
|
result.Records = records
|
||||||
@@ -1056,7 +1119,7 @@ func mutationFailureIsDefinitive(err error) bool {
|
|||||||
// snapshot. It deliberately outlives cancellation of the mutation request, but
|
// snapshot. It deliberately outlives cancellation of the mutation request, but
|
||||||
// remains bounded so an interrupted client cannot leave reconciliation running
|
// remains bounded so an interrupted client cannot leave reconciliation running
|
||||||
// indefinitely.
|
// indefinitely.
|
||||||
func (s *Service) reconcileDNSZone(ctx context.Context, zone domain.Zone, cloud provider.CloudProvider, auth provider.Auth) ([]domain.DNSRecord, error) {
|
func (s *Service) reconcileDNSZone(ctx context.Context, zone domain.Zone, cloud provider.Provider, auth provider.Auth) ([]domain.DNSRecord, error) {
|
||||||
reconcileCtx, cancel := context.WithTimeout(context.WithoutCancel(ctx), dnsMutationReconcileTimeout)
|
reconcileCtx, cancel := context.WithTimeout(context.WithoutCancel(ctx), dnsMutationReconcileTimeout)
|
||||||
defer cancel()
|
defer cancel()
|
||||||
records, err := listAllRecords(reconcileCtx, cloud, auth, zone.ProviderID)
|
records, err := listAllRecords(reconcileCtx, cloud, auth, zone.ProviderID)
|
||||||
@@ -1065,7 +1128,7 @@ func (s *Service) reconcileDNSZone(ctx context.Context, zone domain.Zone, cloud
|
|||||||
}
|
}
|
||||||
now := s.now().UTC()
|
now := s.now().UTC()
|
||||||
for index := range records {
|
for index := range records {
|
||||||
normalizeRecord(&records[index], zone.ID)
|
normalizeRecord(&records[index], zone.Provider, zone.ID)
|
||||||
records[index].LastSyncedAt = &now
|
records[index].LastSyncedAt = &now
|
||||||
}
|
}
|
||||||
cacheErr := s.repo.ReplaceDNSRecords(reconcileCtx, zone.ID, records, now)
|
cacheErr := s.repo.ReplaceDNSRecords(reconcileCtx, zone.ID, records, now)
|
||||||
@@ -1089,7 +1152,7 @@ func (s *Service) dnsMutationOutcomeUnknownError(
|
|||||||
before, after interface{},
|
before, after interface{},
|
||||||
mutationErr error,
|
mutationErr error,
|
||||||
zone domain.Zone,
|
zone domain.Zone,
|
||||||
cloud provider.CloudProvider,
|
cloud provider.Provider,
|
||||||
auth provider.Auth,
|
auth provider.Auth,
|
||||||
) error {
|
) error {
|
||||||
s.audit(context.WithoutCancel(ctx), "dns."+action+".outcome_unknown", resourceID, before, after)
|
s.audit(context.WithoutCancel(ctx), "dns."+action+".outcome_unknown", resourceID, before, after)
|
||||||
@@ -1119,6 +1182,10 @@ func (s *Service) planDNSBatch(ctx context.Context, zoneID string, mutations []d
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return plannedDNSBatch{}, err
|
return plannedDNSBatch{}, err
|
||||||
}
|
}
|
||||||
|
batch, ok := cloud.(provider.DNSBatchService)
|
||||||
|
if !ok {
|
||||||
|
return plannedDNSBatch{}, provider.Unsupported(zone.Provider, "DNS batch")
|
||||||
|
}
|
||||||
cachedRecords, err := s.repo.ListDNSRecords(ctx, zone.ID)
|
cachedRecords, err := s.repo.ListDNSRecords(ctx, zone.ID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return plannedDNSBatch{}, err
|
return plannedDNSBatch{}, err
|
||||||
@@ -1175,7 +1242,7 @@ func (s *Service) planDNSBatch(ctx context.Context, zoneID string, mutations []d
|
|||||||
return plannedDNSBatch{}, fmt.Errorf("DNS batch mutation %d: %w: %s", index, ErrDNSConflict, cached.Name)
|
return plannedDNSBatch{}, fmt.Errorf("DNS batch mutation %d: %w: %s", index, ErrDNSConflict, cached.Name)
|
||||||
}
|
}
|
||||||
remoteForPlan := cloneDNSRecord(remote)
|
remoteForPlan := cloneDNSRecord(remote)
|
||||||
normalizeRecord(&remoteForPlan, zone.ID)
|
normalizeRecord(&remoteForPlan, zone.Provider, zone.ID)
|
||||||
plannedMutation.RecordID = cached.ProviderID
|
plannedMutation.RecordID = cached.ProviderID
|
||||||
plannedMutation.Before = &remoteForPlan
|
plannedMutation.Before = &remoteForPlan
|
||||||
if mutation.Kind == domain.MutationDelete {
|
if mutation.Kind == domain.MutationDelete {
|
||||||
@@ -1212,7 +1279,7 @@ func (s *Service) planDNSBatch(ctx context.Context, zoneID string, mutations []d
|
|||||||
}
|
}
|
||||||
plan.Mutations = append(plan.Mutations, plannedMutation)
|
plan.Mutations = append(plan.Mutations, plannedMutation)
|
||||||
}
|
}
|
||||||
return plannedDNSBatch{plan: plan, zone: zone, cloud: cloud, auth: auth}, nil
|
return plannedDNSBatch{plan: plan, zone: zone, cloud: cloud, batch: batch, auth: auth}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func dnsMutationRecordID(mutation domain.DNSMutation) string {
|
func dnsMutationRecordID(mutation domain.DNSMutation) string {
|
||||||
@@ -1293,7 +1360,11 @@ func (s *Service) TLSSettings(ctx context.Context, zoneID string, refresh bool)
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return domain.EdgeTLSSettings{}, err
|
return domain.EdgeTLSSettings{}, err
|
||||||
}
|
}
|
||||||
settings, err := p.GetEdgeTLSSettings(ctx, auth, zone.ProviderID)
|
tlsProvider, ok := p.(provider.EdgeTLSService)
|
||||||
|
if !ok {
|
||||||
|
return domain.EdgeTLSSettings{}, provider.Unsupported(zone.Provider, "edge TLS")
|
||||||
|
}
|
||||||
|
settings, err := tlsProvider.GetEdgeTLSSettings(ctx, auth, zone.ProviderID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return domain.EdgeTLSSettings{}, err
|
return domain.EdgeTLSSettings{}, err
|
||||||
}
|
}
|
||||||
@@ -1313,10 +1384,14 @@ func (s *Service) EdgeCertificates(ctx context.Context, zoneID string) ([]domain
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
tlsProvider, ok := p.(provider.EdgeTLSService)
|
||||||
|
if !ok {
|
||||||
|
return nil, provider.Unsupported(zone.Provider, "edge TLS")
|
||||||
|
}
|
||||||
const pageSize = 50
|
const pageSize = 50
|
||||||
values := make([]domain.EdgeCertificate, 0, pageSize)
|
values := make([]domain.EdgeCertificate, 0, pageSize)
|
||||||
for page := 1; page <= 200; page++ {
|
for page := 1; page <= 200; page++ {
|
||||||
batch, listErr := p.ListEdgeCertificates(ctx, auth, zone.ProviderID, provider.PageRequest{Page: page, PerPage: pageSize})
|
batch, listErr := tlsProvider.ListEdgeCertificates(ctx, auth, zone.ProviderID, provider.PageRequest{Page: page, PerPage: pageSize})
|
||||||
if listErr != nil {
|
if listErr != nil {
|
||||||
return nil, listErr
|
return nil, listErr
|
||||||
}
|
}
|
||||||
@@ -1342,6 +1417,10 @@ func (s *Service) UpdateTLSSettings(ctx context.Context, zoneID string, desired
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return domain.EdgeTLSSettings{}, err
|
return domain.EdgeTLSSettings{}, err
|
||||||
}
|
}
|
||||||
|
tlsProvider, ok := p.(provider.EdgeTLSService)
|
||||||
|
if !ok {
|
||||||
|
return domain.EdgeTLSSettings{}, provider.Unsupported(zone.Provider, "edge TLS")
|
||||||
|
}
|
||||||
baseline, err := s.repo.GetTLSSettings(ctx, zone.ID)
|
baseline, err := s.repo.GetTLSSettings(ctx, zone.ID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return domain.EdgeTLSSettings{}, fmt.Errorf("load displayed TLS baseline: %w", err)
|
return domain.EdgeTLSSettings{}, fmt.Errorf("load displayed TLS baseline: %w", err)
|
||||||
@@ -1349,7 +1428,7 @@ func (s *Service) UpdateTLSSettings(ctx context.Context, zoneID string, desired
|
|||||||
if desired.LastSyncedAt != nil && baseline.LastSyncedAt != nil && !desired.LastSyncedAt.Equal(*baseline.LastSyncedAt) {
|
if desired.LastSyncedAt != nil && baseline.LastSyncedAt != nil && !desired.LastSyncedAt.Equal(*baseline.LastSyncedAt) {
|
||||||
return domain.EdgeTLSSettings{}, ErrTLSConflict
|
return domain.EdgeTLSSettings{}, ErrTLSConflict
|
||||||
}
|
}
|
||||||
before, err := p.GetEdgeTLSSettings(ctx, auth, zone.ProviderID)
|
before, err := tlsProvider.GetEdgeTLSSettings(ctx, auth, zone.ProviderID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return domain.EdgeTLSSettings{}, fmt.Errorf("re-fetch Cloudflare TLS settings: %w", err)
|
return domain.EdgeTLSSettings{}, fmt.Errorf("re-fetch Cloudflare TLS settings: %w", err)
|
||||||
}
|
}
|
||||||
@@ -1369,7 +1448,7 @@ func (s *Service) UpdateTLSSettings(ctx context.Context, zoneID string, desired
|
|||||||
return before, nil
|
return before, nil
|
||||||
}
|
}
|
||||||
desired.ZoneID = zone.ProviderID
|
desired.ZoneID = zone.ProviderID
|
||||||
updated, updateErr := p.UpdateEdgeTLSSettings(ctx, auth, zone.ProviderID, baseline, desired)
|
updated, updateErr := tlsProvider.UpdateEdgeTLSSettings(ctx, auth, zone.ProviderID, baseline, desired)
|
||||||
if updateErr != nil {
|
if updateErr != nil {
|
||||||
reconcileCtx, cancel := context.WithTimeout(context.WithoutCancel(ctx), 30*time.Second)
|
reconcileCtx, cancel := context.WithTimeout(context.WithoutCancel(ctx), 30*time.Second)
|
||||||
defer cancel()
|
defer cancel()
|
||||||
@@ -1380,7 +1459,7 @@ func (s *Service) UpdateTLSSettings(ctx context.Context, zoneID string, desired
|
|||||||
saveErr := s.repo.SaveTLSSettings(reconcileCtx, before)
|
saveErr := s.repo.SaveTLSSettings(reconcileCtx, before)
|
||||||
return before, errors.Join(updateErr, wrapError("save unchanged TLS settings", saveErr))
|
return before, errors.Join(updateErr, wrapError("save unchanged TLS settings", saveErr))
|
||||||
}
|
}
|
||||||
effective, refreshErr := p.GetEdgeTLSSettings(reconcileCtx, auth, zone.ProviderID)
|
effective, refreshErr := tlsProvider.GetEdgeTLSSettings(reconcileCtx, auth, zone.ProviderID)
|
||||||
if refreshErr != nil {
|
if refreshErr != nil {
|
||||||
return domain.EdgeTLSSettings{}, errors.Join(
|
return domain.EdgeTLSSettings{}, errors.Join(
|
||||||
ErrTLSMutationOutcomeUnknown,
|
ErrTLSMutationOutcomeUnknown,
|
||||||
@@ -1490,6 +1569,10 @@ func (s *Service) ObserveCredentialZoneCapability(ctx context.Context, credentia
|
|||||||
(capability != "dns:read" && capability != "dns:write" && capability != "tls:read" && capability != "tls:write") {
|
(capability != "dns:read" && capability != "dns:write" && capability != "tls:read" && capability != "tls:write") {
|
||||||
return errors.New("unsupported observed credential capability")
|
return errors.New("unsupported observed credential capability")
|
||||||
}
|
}
|
||||||
|
credential, err := s.repo.GetCredential(ctx, credentialID)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
zone, err := s.repo.GetZone(ctx, zoneReference)
|
zone, err := s.repo.GetZone(ctx, zoneReference)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
zones, listErr := s.repo.ListZones(ctx)
|
zones, listErr := s.repo.ListZones(ctx)
|
||||||
@@ -1498,7 +1581,7 @@ func (s *Service) ObserveCredentialZoneCapability(ctx context.Context, credentia
|
|||||||
}
|
}
|
||||||
zone = domain.Zone{}
|
zone = domain.Zone{}
|
||||||
for _, candidate := range zones {
|
for _, candidate := range zones {
|
||||||
if candidate.ProviderID == zoneReference {
|
if candidate.Provider == credential.Provider && candidate.ProviderID == zoneReference {
|
||||||
zone = candidate
|
zone = candidate
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
@@ -1507,10 +1590,6 @@ func (s *Service) ObserveCredentialZoneCapability(ctx context.Context, credentia
|
|||||||
return fmt.Errorf("zone %q for observed capability was not found", zoneReference)
|
return fmt.Errorf("zone %q for observed capability was not found", zoneReference)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
credential, err := s.repo.GetCredential(ctx, credentialID)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
if credential.Provider != zone.Provider {
|
if credential.Provider != zone.Provider {
|
||||||
return errors.New("observed capability credential and zone providers differ")
|
return errors.New("observed capability credential and zone providers differ")
|
||||||
}
|
}
|
||||||
@@ -1537,10 +1616,10 @@ func (s *Service) auth(ctx context.Context, credential domain.Credential) (provi
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return provider.Auth{}, fmt.Errorf("unlock credential %q: %w", credential.Label, err)
|
return provider.Auth{}, fmt.Errorf("unlock credential %q: %w", credential.Label, err)
|
||||||
}
|
}
|
||||||
return provider.Auth{CredentialID: credential.ID, Token: string(secret), Kind: credential.Kind, AccountID: credential.AccountHint}, nil
|
return provider.Auth{Provider: credential.Provider, CredentialID: credential.ID, Token: string(secret), Kind: credential.Kind, AccountID: credential.AccountHint}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Service) zoneProvider(ctx context.Context, zoneID string) (domain.Zone, provider.CloudProvider, provider.Auth, error) {
|
func (s *Service) zoneProvider(ctx context.Context, zoneID string) (domain.Zone, provider.Provider, provider.Auth, error) {
|
||||||
zone, err := s.repo.GetZone(ctx, zoneID)
|
zone, err := s.repo.GetZone(ctx, zoneID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return domain.Zone{}, nil, provider.Auth{}, err
|
return domain.Zone{}, nil, provider.Auth{}, err
|
||||||
@@ -1563,7 +1642,7 @@ func (s *Service) zoneProvider(ctx context.Context, zoneID string) (domain.Zone,
|
|||||||
return zone, p, auth, err
|
return zone, p, auth, err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Service) dnsZoneProvider(ctx context.Context, zoneID string) (domain.Zone, provider.CloudProvider, provider.Auth, error) {
|
func (s *Service) dnsZoneProvider(ctx context.Context, zoneID string) (domain.Zone, provider.Provider, provider.Auth, error) {
|
||||||
zone, cloud, auth, err := s.zoneProvider(ctx, zoneID)
|
zone, cloud, auth, err := s.zoneProvider(ctx, zoneID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return domain.Zone{}, nil, provider.Auth{}, err
|
return domain.Zone{}, nil, provider.Auth{}, err
|
||||||
@@ -1695,25 +1774,46 @@ func advancePage(request *provider.PageRequest, nextCursor string, responsePage,
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
func normalizeAccount(account *domain.RemoteAccount) {
|
func normalizeAccount(account *domain.RemoteAccount, providerName string) {
|
||||||
|
if providerName == "" {
|
||||||
|
providerName = account.Provider
|
||||||
|
}
|
||||||
if account.ProviderID == "" {
|
if account.ProviderID == "" {
|
||||||
account.ProviderID = strings.TrimPrefix(account.ID, "cfacct_")
|
account.ProviderID = account.ID
|
||||||
|
if providerName == domain.ProviderCloudflare {
|
||||||
|
account.ProviderID = strings.TrimPrefix(account.ProviderID, "cfacct_")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
account.Provider = providerName
|
||||||
|
if providerName == domain.ProviderCloudflare {
|
||||||
|
account.ID = "cfacct_" + account.ProviderID
|
||||||
|
} else {
|
||||||
|
account.ID = stableID("account", providerName, account.ProviderID)
|
||||||
}
|
}
|
||||||
account.Provider = domain.ProviderCloudflare
|
|
||||||
account.ID = "cfacct_" + account.ProviderID
|
|
||||||
if account.CreatedAt.IsZero() {
|
if account.CreatedAt.IsZero() {
|
||||||
account.CreatedAt = time.Now().UTC()
|
account.CreatedAt = time.Now().UTC()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func normalizeZone(zone *domain.Zone, credentialID string) {
|
func normalizeZone(zone *domain.Zone, providerName, credentialID string) {
|
||||||
if zone.ProviderID == "" {
|
if providerName == "" {
|
||||||
zone.ProviderID = strings.TrimPrefix(zone.ID, "cfzone_")
|
providerName = zone.Provider
|
||||||
}
|
}
|
||||||
zone.Provider = domain.ProviderCloudflare
|
if zone.ProviderID == "" {
|
||||||
zone.ID = "cfzone_" + zone.ProviderID
|
zone.ProviderID = zone.ID
|
||||||
if !strings.HasPrefix(zone.AccountID, "cfacct_") {
|
if providerName == domain.ProviderCloudflare {
|
||||||
zone.AccountID = "cfacct_" + zone.AccountID
|
zone.ProviderID = strings.TrimPrefix(zone.ProviderID, "cfzone_")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
zone.Provider = providerName
|
||||||
|
if providerName == domain.ProviderCloudflare {
|
||||||
|
zone.ID = "cfzone_" + zone.ProviderID
|
||||||
|
if !strings.HasPrefix(zone.AccountID, "cfacct_") {
|
||||||
|
zone.AccountID = "cfacct_" + zone.AccountID
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
zone.ID = stableID("zone", providerName, zone.ProviderID)
|
||||||
|
zone.AccountID = stableID("account", providerName, zone.AccountID)
|
||||||
}
|
}
|
||||||
zone.PreferredCredentialID = credentialID
|
zone.PreferredCredentialID = credentialID
|
||||||
if zone.Status == "" {
|
if zone.Status == "" {
|
||||||
@@ -1721,11 +1821,18 @@ func normalizeZone(zone *domain.Zone, credentialID string) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func normalizeRecord(record *domain.DNSRecord, zoneID string) {
|
func normalizeRecord(record *domain.DNSRecord, providerName, zoneID string) {
|
||||||
if record.ProviderID == "" {
|
if record.ProviderID == "" {
|
||||||
record.ProviderID = strings.TrimPrefix(record.ID, "cfrecord_")
|
record.ProviderID = record.ID
|
||||||
|
if providerName == domain.ProviderCloudflare {
|
||||||
|
record.ProviderID = strings.TrimPrefix(record.ProviderID, "cfrecord_")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if providerName == domain.ProviderCloudflare {
|
||||||
|
record.ID = "cfrecord_" + record.ProviderID
|
||||||
|
} else {
|
||||||
|
record.ID = stableID("record", providerName, zoneID, record.ProviderID)
|
||||||
}
|
}
|
||||||
record.ID = "cfrecord_" + record.ProviderID
|
|
||||||
record.ZoneID = zoneID
|
record.ZoneID = zoneID
|
||||||
if unicodeName, err := idna.Lookup.ToUnicode(record.Name); err == nil {
|
if unicodeName, err := idna.Lookup.ToUnicode(record.Name); err == nil {
|
||||||
record.UnicodeName = unicodeName
|
record.UnicodeName = unicodeName
|
||||||
@@ -1797,7 +1904,7 @@ func validateRecordValue(record *domain.DNSRecord) error {
|
|||||||
// Empty TXT values are valid and intentionally preserved.
|
// Empty TXT values are valid and intentionally preserved.
|
||||||
}
|
}
|
||||||
if record.Proxied && record.Type != domain.RecordA && record.Type != domain.RecordAAAA && record.Type != domain.RecordCNAME {
|
if record.Proxied && record.Type != domain.RecordA && record.Type != domain.RecordAAAA && record.Type != domain.RecordCNAME {
|
||||||
return fmt.Errorf("record type %s cannot be Cloudflare proxied", record.Type)
|
return fmt.Errorf("record type %s cannot be proxied by this provider", record.Type)
|
||||||
}
|
}
|
||||||
if record.Priority != nil && record.Type != domain.RecordMX && record.Type != domain.RecordSRV {
|
if record.Priority != nil && record.Type != domain.RecordMX && record.Type != domain.RecordSRV {
|
||||||
return fmt.Errorf("record type %s does not use priority", record.Type)
|
return fmt.Errorf("record type %s does not use priority", record.Type)
|
||||||
|
|||||||
@@ -132,7 +132,7 @@ func TestServiceMultiCredentialSyncAndDNSLifecycle(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
auth, providerZoneID, err := service.ResolveDNS01(ctx, "_acme-challenge.api.example.com.")
|
auth, providerZoneID, err := service.ResolveDNS01(ctx, "_acme-challenge.api.example.com.")
|
||||||
if err != nil || auth.Token != "token-one" || providerZoneID != "zone-provider" {
|
if err != nil || auth.Provider != domain.ProviderCloudflare || auth.CredentialID != first.ID || auth.Token != "token-one" || providerZoneID != "zone-provider" {
|
||||||
t.Fatalf("DNS-01 resolution = %#v, %q, %v", auth, providerZoneID, err)
|
t.Fatalf("DNS-01 resolution = %#v, %q, %v", auth, providerZoneID, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1123,6 +1123,147 @@ func TestSetPreferredCredentialLiveProbePersistsZoneReadEvidence(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestDNS01RouterDispatchesExactProviderAndCredential(t *testing.T) {
|
||||||
|
service := New(nil, nil)
|
||||||
|
alpha := &routingProvider{name: "alpha"}
|
||||||
|
beta := &routingProvider{name: "beta"}
|
||||||
|
service.RegisterProvider("alpha", alpha)
|
||||||
|
service.RegisterProvider("beta", beta)
|
||||||
|
auth := provider.Auth{Provider: "beta", CredentialID: "credential-beta", Token: "beta-secret", Kind: domain.CredentialUserToken}
|
||||||
|
|
||||||
|
recordID, err := service.PresentDNS01(context.Background(), auth, "shared-zone-id", "_acme.example.", "value", "job-1")
|
||||||
|
if err != nil || recordID != "beta-record" {
|
||||||
|
t.Fatalf("PresentDNS01 = %q, %v", recordID, err)
|
||||||
|
}
|
||||||
|
if err := service.CleanupDNS01(context.Background(), auth, "shared-zone-id", recordID); err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
reconciledID, found, err := service.ReconcileDNS01(context.Background(), auth, "shared-zone-id", "_acme.example.", "hash", "job-1")
|
||||||
|
if err != nil || !found || reconciledID != "beta-reconciled" {
|
||||||
|
t.Fatalf("ReconcileDNS01 = %q, %v, %v", reconciledID, found, err)
|
||||||
|
}
|
||||||
|
if len(alpha.calls) != 0 {
|
||||||
|
t.Fatalf("unselected provider received calls: %#v", alpha.calls)
|
||||||
|
}
|
||||||
|
if len(beta.calls) != 3 {
|
||||||
|
t.Fatalf("selected provider calls = %#v", beta.calls)
|
||||||
|
}
|
||||||
|
for _, call := range beta.calls {
|
||||||
|
if call.auth != auth || call.zoneID != "shared-zone-id" {
|
||||||
|
t.Fatalf("routed call changed auth/zone: %#v", call)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if _, err := service.PresentDNS01(context.Background(), provider.Auth{CredentialID: "credential-beta"}, "shared-zone-id", "fqdn", "value", "job"); err == nil || !strings.Contains(err.Error(), "no provider identity") {
|
||||||
|
t.Fatalf("provider-less auth was routed: %v", err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestCertificateServicePublishesStructuredJobProgress(t *testing.T) {
|
||||||
|
service := New(nil, nil)
|
||||||
|
certificates := &CertificateService{}
|
||||||
|
service.SetCertificateService(certificates)
|
||||||
|
job := domain.Job{ID: "job-1", Kind: "certificate.issue", State: domain.JobWaitingForDNS, Progress: 45, Message: "Waiting for authoritative DNS propagation"}
|
||||||
|
certificates.JobObserver(job)
|
||||||
|
select {
|
||||||
|
case event := <-service.Events():
|
||||||
|
observed, ok := event.Value.(domain.Job)
|
||||||
|
if event.Kind != "certificate.progress" || event.Message != job.Message || !ok || observed.ID != job.ID || observed.State != job.State || observed.Progress != job.Progress {
|
||||||
|
t.Fatalf("certificate event = %#v", event)
|
||||||
|
}
|
||||||
|
case <-time.After(time.Second):
|
||||||
|
t.Fatal("certificate progress event was not published")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestOptionalProviderCapabilitiesFailClearly(t *testing.T) {
|
||||||
|
fake := newFakeCloudProvider()
|
||||||
|
service, _, zone := newBatchTestService(t, fake)
|
||||||
|
service.RegisterProvider(domain.ProviderCloudflare, coreOnlyProvider{Provider: fake})
|
||||||
|
|
||||||
|
mutation := domain.DNSMutation{Kind: domain.MutationCreate, After: &domain.DNSRecord{Type: domain.RecordA, Name: "new", Content: "192.0.2.20", TTL: 300}}
|
||||||
|
if _, err := service.PlanDNSBatch(context.Background(), zone.ID, []domain.DNSMutation{mutation}); !errors.Is(err, provider.ErrCapabilityUnsupported) || !strings.Contains(err.Error(), "DNS batch") {
|
||||||
|
t.Fatalf("unsupported batch error = %v", err)
|
||||||
|
}
|
||||||
|
if _, err := service.TLSSettings(context.Background(), zone.ID, true); !errors.Is(err, provider.ErrCapabilityUnsupported) || !strings.Contains(err.Error(), "edge TLS") {
|
||||||
|
t.Fatalf("unsupported TLS read error = %v", err)
|
||||||
|
}
|
||||||
|
if _, err := service.EdgeCertificates(context.Background(), zone.ID); !errors.Is(err, provider.ErrCapabilityUnsupported) {
|
||||||
|
t.Fatalf("unsupported TLS inventory error = %v", err)
|
||||||
|
}
|
||||||
|
if _, err := service.UpdateTLSSettings(context.Background(), zone.ID, domain.EdgeTLSSettings{}); !errors.Is(err, provider.ErrCapabilityUnsupported) {
|
||||||
|
t.Fatalf("unsupported TLS update error = %v", err)
|
||||||
|
}
|
||||||
|
auth, err := service.ResolveCredential(context.Background(), zone.PreferredCredentialID)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
if _, _, err := service.ReconcileDNS01(context.Background(), auth, zone.ProviderID, "_acme.example.", "hash", "job"); !errors.Is(err, provider.ErrCapabilityUnsupported) || !strings.Contains(err.Error(), "DNS-01 reconciliation") {
|
||||||
|
t.Fatalf("unsupported DNS-01 reconciliation error = %v", err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestProviderNeutralNormalizationPreservesCloudflareAndIsolatesRemoteIDs(t *testing.T) {
|
||||||
|
cloudflareAccount := domain.RemoteAccount{ID: "remote-account"}
|
||||||
|
normalizeAccount(&cloudflareAccount, domain.ProviderCloudflare)
|
||||||
|
if cloudflareAccount.ID != "cfacct_remote-account" || cloudflareAccount.Provider != domain.ProviderCloudflare {
|
||||||
|
t.Fatalf("Cloudflare account normalization changed: %#v", cloudflareAccount)
|
||||||
|
}
|
||||||
|
cloudflareZone := domain.Zone{ID: "remote-zone", AccountID: "remote-account"}
|
||||||
|
normalizeZone(&cloudflareZone, domain.ProviderCloudflare, "credential")
|
||||||
|
if cloudflareZone.ID != "cfzone_remote-zone" || cloudflareZone.AccountID != "cfacct_remote-account" {
|
||||||
|
t.Fatalf("Cloudflare zone normalization changed: %#v", cloudflareZone)
|
||||||
|
}
|
||||||
|
cloudflareRecord := domain.DNSRecord{ID: "remote-record"}
|
||||||
|
normalizeRecord(&cloudflareRecord, domain.ProviderCloudflare, cloudflareZone.ID)
|
||||||
|
if cloudflareRecord.ID != "cfrecord_remote-record" {
|
||||||
|
t.Fatalf("Cloudflare record normalization changed: %#v", cloudflareRecord)
|
||||||
|
}
|
||||||
|
|
||||||
|
firstZone := domain.Zone{ID: "shared-zone", AccountID: "shared-account"}
|
||||||
|
secondZone := firstZone
|
||||||
|
normalizeZone(&firstZone, "provider-a", "credential-a")
|
||||||
|
normalizeZone(&secondZone, "provider-b", "credential-b")
|
||||||
|
if firstZone.ID == secondZone.ID || firstZone.AccountID == secondZone.AccountID {
|
||||||
|
t.Fatalf("provider-local zone/account IDs collided: %#v / %#v", firstZone, secondZone)
|
||||||
|
}
|
||||||
|
firstRecord := domain.DNSRecord{ID: "shared-record"}
|
||||||
|
secondRecord := firstRecord
|
||||||
|
normalizeRecord(&firstRecord, "provider-a", firstZone.ID)
|
||||||
|
normalizeRecord(&secondRecord, "provider-b", secondZone.ID)
|
||||||
|
if firstRecord.ID == secondRecord.ID || firstRecord.ProviderID != "shared-record" || secondRecord.ProviderID != "shared-record" {
|
||||||
|
t.Fatalf("provider-local record IDs were not isolated: %#v / %#v", firstRecord, secondRecord)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestObservedCapabilityProviderIDFallbackCannotCrossProviders(t *testing.T) {
|
||||||
|
ctx := context.Background()
|
||||||
|
service, repository, cloudflareZone := newBatchTestService(t, newFakeCloudProvider())
|
||||||
|
credential, err := repository.GetCredential(ctx, cloudflareZone.PreferredCredentialID)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
foreignAccount := domain.RemoteAccount{ID: stableID("account", "other", "account"), Provider: "other", ProviderID: "account", Name: "Other", CreatedAt: time.Now().UTC()}
|
||||||
|
if err := repository.SaveAccounts(ctx, []domain.RemoteAccount{foreignAccount}, nil); err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
foreignZone := domain.Zone{ID: stableID("zone", "other", cloudflareZone.ProviderID), Provider: "other", ProviderID: cloudflareZone.ProviderID, AccountID: foreignAccount.ID, Name: "aaa-other.example", Status: domain.ZoneActive}
|
||||||
|
if err := repository.SaveZones(ctx, []domain.Zone{foreignZone}); err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := service.ObserveCredentialZoneCapability(ctx, credential.ID, cloudflareZone.ProviderID, "tls:write"); err != nil {
|
||||||
|
t.Fatalf("provider-scoped fallback: %v", err)
|
||||||
|
}
|
||||||
|
cloudflareObserved, err := repository.HasCredentialZoneCapability(ctx, credential.ID, cloudflareZone.ID, "tls:write")
|
||||||
|
if err != nil || !cloudflareObserved {
|
||||||
|
t.Fatalf("Cloudflare observation = %v, %v", cloudflareObserved, err)
|
||||||
|
}
|
||||||
|
foreignObserved, err := repository.HasCredentialZoneCapability(ctx, credential.ID, foreignZone.ID, "tls:write")
|
||||||
|
if err != nil || foreignObserved {
|
||||||
|
t.Fatalf("foreign observation = %v, %v", foreignObserved, err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func TestCredentialDeleteKeepsMetadataWhenVaultDeleteFails(t *testing.T) {
|
func TestCredentialDeleteKeepsMetadataWhenVaultDeleteFails(t *testing.T) {
|
||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
fake := newFakeCloudProvider()
|
fake := newFakeCloudProvider()
|
||||||
@@ -1323,6 +1464,53 @@ type providerRequest struct {
|
|||||||
Cursor string
|
Cursor string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type coreOnlyProvider struct{ provider.Provider }
|
||||||
|
|
||||||
|
type routingCall struct {
|
||||||
|
action string
|
||||||
|
auth provider.Auth
|
||||||
|
zoneID string
|
||||||
|
}
|
||||||
|
|
||||||
|
type routingProvider struct {
|
||||||
|
name string
|
||||||
|
calls []routingCall
|
||||||
|
}
|
||||||
|
|
||||||
|
func (p *routingProvider) VerifyCredential(context.Context, provider.Auth) (provider.Verification, error) {
|
||||||
|
return provider.Verification{Status: domain.CredentialValid}, nil
|
||||||
|
}
|
||||||
|
func (p *routingProvider) ListZones(context.Context, provider.Auth, provider.PageRequest) (provider.ZonePage, error) {
|
||||||
|
return provider.ZonePage{}, nil
|
||||||
|
}
|
||||||
|
func (p *routingProvider) ListDNSRecords(context.Context, provider.Auth, string, provider.PageRequest) (provider.RecordPage, error) {
|
||||||
|
return provider.RecordPage{}, nil
|
||||||
|
}
|
||||||
|
func (p *routingProvider) GetDNSRecord(context.Context, provider.Auth, string, string) (domain.DNSRecord, error) {
|
||||||
|
return domain.DNSRecord{}, nil
|
||||||
|
}
|
||||||
|
func (p *routingProvider) CreateDNSRecord(context.Context, provider.Auth, string, domain.DNSRecord) (domain.DNSRecord, error) {
|
||||||
|
return domain.DNSRecord{}, nil
|
||||||
|
}
|
||||||
|
func (p *routingProvider) PatchDNSRecord(context.Context, provider.Auth, string, string, domain.DNSRecord) (domain.DNSRecord, error) {
|
||||||
|
return domain.DNSRecord{}, nil
|
||||||
|
}
|
||||||
|
func (p *routingProvider) DeleteDNSRecord(context.Context, provider.Auth, string, string) error {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
func (p *routingProvider) PresentDNS01(_ context.Context, auth provider.Auth, zoneID, _, _, _ string) (string, error) {
|
||||||
|
p.calls = append(p.calls, routingCall{action: "present", auth: auth, zoneID: zoneID})
|
||||||
|
return p.name + "-record", nil
|
||||||
|
}
|
||||||
|
func (p *routingProvider) CleanupDNS01(_ context.Context, auth provider.Auth, zoneID, _ string) error {
|
||||||
|
p.calls = append(p.calls, routingCall{action: "cleanup", auth: auth, zoneID: zoneID})
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
func (p *routingProvider) ReconcileDNS01(_ context.Context, auth provider.Auth, zoneID, _, _, _ string) (string, bool, error) {
|
||||||
|
p.calls = append(p.calls, routingCall{action: "reconcile", auth: auth, zoneID: zoneID})
|
||||||
|
return p.name + "-reconciled", true, nil
|
||||||
|
}
|
||||||
|
|
||||||
type paginatedZoneProvider struct{ requests []providerRequest }
|
type paginatedZoneProvider struct{ requests []providerRequest }
|
||||||
|
|
||||||
func (p *paginatedZoneProvider) ListZones(_ context.Context, _ provider.Auth, request provider.PageRequest) (provider.ZonePage, error) {
|
func (p *paginatedZoneProvider) ListZones(_ context.Context, _ provider.Auth, request provider.PageRequest) (provider.ZonePage, error) {
|
||||||
|
|||||||
@@ -4,6 +4,8 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"io"
|
||||||
|
"log/slog"
|
||||||
"net/http"
|
"net/http"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"time"
|
"time"
|
||||||
@@ -16,6 +18,7 @@ import (
|
|||||||
cloudflareprovider "github.com/MeghdadFadaee/domainops/internal/providers/cloudflare"
|
cloudflareprovider "github.com/MeghdadFadaee/domainops/internal/providers/cloudflare"
|
||||||
"github.com/MeghdadFadaee/domainops/internal/secrets"
|
"github.com/MeghdadFadaee/domainops/internal/secrets"
|
||||||
sqlitestore "github.com/MeghdadFadaee/domainops/internal/store/sqlite"
|
sqlitestore "github.com/MeghdadFadaee/domainops/internal/store/sqlite"
|
||||||
|
legolog "github.com/go-acme/lego/v5/log"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Options struct {
|
type Options struct {
|
||||||
@@ -35,10 +38,25 @@ type Runtime struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func Open(ctx context.Context, options Options) (*Runtime, error) {
|
func Open(ctx context.Context, options Options) (*Runtime, error) {
|
||||||
|
configureACMELogger()
|
||||||
paths, err := config.Resolve(options.DataDir)
|
paths, err := config.Resolve(options.DataDir)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Continue with all local resource initialization only after logging is
|
||||||
|
// isolated from stdout; JSON and alternate-screen output must stay clean.
|
||||||
|
return openRuntime(ctx, options, paths)
|
||||||
|
}
|
||||||
|
|
||||||
|
func configureACMELogger() {
|
||||||
|
// lego's default logger writes directly to stdout, which corrupts both the
|
||||||
|
// Bubble Tea alternate screen and JSON CLI envelopes. DomainOps exposes
|
||||||
|
// bounded, structured certificate progress through its own job/event model.
|
||||||
|
legolog.SetDefault(slog.New(slog.NewTextHandler(io.Discard, nil)))
|
||||||
|
}
|
||||||
|
|
||||||
|
func openRuntime(ctx context.Context, options Options, paths config.Paths) (*Runtime, error) {
|
||||||
if err := paths.Ensure(); err != nil {
|
if err := paths.Ensure(); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@@ -76,7 +94,7 @@ func Open(ctx context.Context, options Options) (*Runtime, error) {
|
|||||||
application.RegisterProvider("cloudflare", cloudflareClient)
|
application.RegisterProvider("cloudflare", cloudflareClient)
|
||||||
|
|
||||||
httpClient := &http.Client{Timeout: 45 * time.Second}
|
httpClient := &http.Client{Timeout: 45 * time.Second}
|
||||||
engine := certificates.NewEngine(repository, vault, cloudflareClient, application.ResolveDNS01,
|
engine := certificates.NewEngine(repository, vault, application, application.ResolveDNS01,
|
||||||
certificates.WithACMEHTTPClient(httpClient, "DomainOps/1"),
|
certificates.WithACMEHTTPClient(httpClient, "DomainOps/1"),
|
||||||
certificates.WithPreflight(application.CertificatePreflight),
|
certificates.WithPreflight(application.CertificatePreflight),
|
||||||
certificates.WithDNSWriteObserver(func(observeCtx context.Context, credentialID, providerZoneID string) error {
|
certificates.WithDNSWriteObserver(func(observeCtx context.Context, credentialID, providerZoneID string) error {
|
||||||
@@ -97,7 +115,7 @@ func Open(ctx context.Context, options Options) (*Runtime, error) {
|
|||||||
recoveryErr := errors.Join(
|
recoveryErr := errors.Join(
|
||||||
certificates.RecoverACMEAccountCommitIntents(cleanupCtx, repository, vault),
|
certificates.RecoverACMEAccountCommitIntents(cleanupCtx, repository, vault),
|
||||||
certificates.RecoverCertificateCommitIntents(cleanupCtx, repository, vault, paths.Certificates),
|
certificates.RecoverCertificateCommitIntents(cleanupCtx, repository, vault, paths.Certificates),
|
||||||
certificates.CleanupOpenChallenges(cleanupCtx, repository, cloudflareClient, application.ResolveDNS01, application.ResolveCredential),
|
certificates.CleanupOpenChallenges(cleanupCtx, repository, application, application.ResolveDNS01, application.ResolveCredential),
|
||||||
certificateService.RepairManagedCurrentLinks(cleanupCtx),
|
certificateService.RepairManagedCurrentLinks(cleanupCtx),
|
||||||
)
|
)
|
||||||
return reconcileJobsAfterRecovery(recoveryErr, func() error {
|
return reconcileJobsAfterRecovery(recoveryErr, func() error {
|
||||||
@@ -148,7 +166,7 @@ func (r *Runtime) Recover(ctx context.Context) error {
|
|||||||
recoveryErr := errors.Join(
|
recoveryErr := errors.Join(
|
||||||
certificates.RecoverACMEAccountCommitIntents(ctx, r.Repository, r.Vault),
|
certificates.RecoverACMEAccountCommitIntents(ctx, r.Repository, r.Vault),
|
||||||
certificates.RecoverCertificateCommitIntents(ctx, r.Repository, r.Vault, r.Paths.Certificates),
|
certificates.RecoverCertificateCommitIntents(ctx, r.Repository, r.Vault, r.Paths.Certificates),
|
||||||
certificates.CleanupOpenChallenges(ctx, r.Repository, r.Cloudflare, r.Application.ResolveDNS01, r.Application.ResolveCredential),
|
certificates.CleanupOpenChallenges(ctx, r.Repository, r.Application, r.Application.ResolveDNS01, r.Application.ResolveCredential),
|
||||||
r.Certificates.RepairManagedCurrentLinks(ctx),
|
r.Certificates.RepairManagedCurrentLinks(ctx),
|
||||||
)
|
)
|
||||||
return reconcileJobsAfterRecovery(recoveryErr, func() error {
|
return reconcileJobsAfterRecovery(recoveryErr, func() error {
|
||||||
|
|||||||
@@ -1,8 +1,12 @@
|
|||||||
package bootstrap
|
package bootstrap
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"bytes"
|
||||||
"errors"
|
"errors"
|
||||||
|
"log/slog"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
|
legolog "github.com/go-acme/lego/v5/log"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestReconcileJobsAfterRecoveryRunsOnlyAfterSuccessfulRecovery(t *testing.T) {
|
func TestReconcileJobsAfterRecoveryRunsOnlyAfterSuccessfulRecovery(t *testing.T) {
|
||||||
@@ -26,3 +30,15 @@ func TestReconcileJobsAfterRecoveryRunsOnlyAfterSuccessfulRecovery(t *testing.T)
|
|||||||
t.Fatalf("successful recovery result = %v, reconcile called=%v", err, called)
|
t.Fatalf("successful recovery result = %v, reconcile called=%v", err, called)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestConfigureACMELoggerDoesNotWriteToTerminal(t *testing.T) {
|
||||||
|
original := legolog.Default()
|
||||||
|
defer legolog.SetDefault(original)
|
||||||
|
var output bytes.Buffer
|
||||||
|
legolog.SetDefault(slog.New(slog.NewTextHandler(&output, nil)))
|
||||||
|
configureACMELogger()
|
||||||
|
legolog.Info("dns01: waiting for record propagation.", slog.String("domain", "*.example.com"))
|
||||||
|
if output.Len() != 0 {
|
||||||
|
t.Fatalf("ACME logger escaped to terminal: %q", output.String())
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -404,6 +404,10 @@ func TestJournaledDNSProviderExactRecordLifecycle(t *testing.T) {
|
|||||||
return provider.Auth{CredentialID: "credential-1", Token: "secret"}, "zone-1", nil
|
return provider.Auth{CredentialID: "credential-1", Token: "secret"}, "zone-1", nil
|
||||||
}
|
}
|
||||||
dnsProvider := NewJournaledDNSProvider(solver, repository, resolver, "job-1")
|
dnsProvider := NewJournaledDNSProvider(solver, repository, resolver, "job-1")
|
||||||
|
var presentedDomain, presentedFQDN string
|
||||||
|
dnsProvider.OnPresented = func(domainName, fqdn string) {
|
||||||
|
presentedDomain, presentedFQDN = domainName, fqdn
|
||||||
|
}
|
||||||
if err := dnsProvider.Present(context.Background(), "example.com", "token-1", "key-auth"); err != nil {
|
if err := dnsProvider.Present(context.Background(), "example.com", "token-1", "key-auth"); err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
@@ -413,9 +417,17 @@ func TestJournaledDNSProviderExactRecordLifecycle(t *testing.T) {
|
|||||||
if repository.challenges[0].ValueHash == "" || solver.presentedJob != "job-1" {
|
if repository.challenges[0].ValueHash == "" || solver.presentedJob != "job-1" {
|
||||||
t.Fatalf("challenge was not hashed/tagged: %#v", repository.challenges[0])
|
t.Fatalf("challenge was not hashed/tagged: %#v", repository.challenges[0])
|
||||||
}
|
}
|
||||||
if err := dnsProvider.CleanUp(context.Background(), "example.com", "token-1", "key-auth"); err != nil {
|
if presentedDomain != "example.com" || presentedFQDN != "_acme-challenge.example.com." {
|
||||||
|
t.Fatalf("presented callback = %q, %q", presentedDomain, presentedFQDN)
|
||||||
|
}
|
||||||
|
cancelled, cancel := context.WithCancel(context.Background())
|
||||||
|
cancel()
|
||||||
|
if err := dnsProvider.CleanUp(cancelled, "example.com", "token-1", "key-auth"); err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
if solver.cleanupContextErr != nil {
|
||||||
|
t.Fatalf("cleanup inherited cancelled issuance context: %v", solver.cleanupContextErr)
|
||||||
|
}
|
||||||
if !slices.Equal(solver.cleaned, []string{"record-1"}) {
|
if !slices.Equal(solver.cleaned, []string{"record-1"}) {
|
||||||
t.Fatalf("cleaned = %#v", solver.cleaned)
|
t.Fatalf("cleaned = %#v", solver.cleaned)
|
||||||
}
|
}
|
||||||
@@ -518,6 +530,46 @@ func TestIssueBatchCapsConcurrencyAndUsesFreshKeys(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestIssueDeadlineStopsAStalledBackendAndReportsStage(t *testing.T) {
|
||||||
|
accountKey, err := GeneratePrivateKey(domain.KeyECDSAP256)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
accountKeyPEM, err := MarshalPrivateKeyPKCS8(accountKey)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
registrationJSON, _ := json.Marshal(&acme.ExtendedAccount{Location: "https://acme.test/acct/1"})
|
||||||
|
repository := &memoryRepository{account: domain.ACMEAccount{
|
||||||
|
ID: "account-1", Environment: EnvironmentStaging, DirectoryURL: "https://acme.test/directory",
|
||||||
|
Email: "ops@example.com", Registration: string(registrationJSON), SecretRef: "secret-1",
|
||||||
|
}}
|
||||||
|
secrets := &memorySecrets{values: map[string][]byte{"secret-1": accountKeyPEM}}
|
||||||
|
backend := &fakeBackend{obtainDelay: time.Hour}
|
||||||
|
engine := NewEngine(repository, secrets, &fakeSolver{}, func(context.Context, string) (provider.Auth, string, error) {
|
||||||
|
return provider.Auth{}, "zone-1", nil
|
||||||
|
}, WithBackendFactory(fakeBackendFactory{backend: backend}), WithIssuanceTimeout(40*time.Millisecond))
|
||||||
|
plan, err := NewWildcardPlan("zone-1", "example.com")
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
var progress []IssueProgress
|
||||||
|
started := time.Now()
|
||||||
|
_, err = engine.Issue(context.Background(), IssueRequest{
|
||||||
|
JobID: "job", Environment: EnvironmentStaging, Plan: plan,
|
||||||
|
Progress: func(value IssueProgress) { progress = append(progress, value) },
|
||||||
|
})
|
||||||
|
if err == nil || !strings.Contains(err.Error(), "safety deadline") || !strings.Contains(err.Error(), "acme-validation") {
|
||||||
|
t.Fatalf("deadline error = %v", err)
|
||||||
|
}
|
||||||
|
if elapsed := time.Since(started); elapsed > time.Second {
|
||||||
|
t.Fatalf("stalled issue returned after %s", elapsed)
|
||||||
|
}
|
||||||
|
if len(progress) < 2 || progress[0].Stage != "preflight" || progress[1].Stage != "acme-order" {
|
||||||
|
t.Fatalf("progress = %#v", progress)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func TestRenewSetsARIReplacementAndKeepsIdentifiers(t *testing.T) {
|
func TestRenewSetsARIReplacementAndKeepsIdentifiers(t *testing.T) {
|
||||||
accountKey, err := GeneratePrivateKey(domain.KeyECDSAP256)
|
accountKey, err := GeneratePrivateKey(domain.KeyECDSAP256)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -1093,8 +1145,9 @@ func testVersion(id, lineageID string, artifact Artifact) domain.CertificateVers
|
|||||||
}
|
}
|
||||||
|
|
||||||
type fakeSolver struct {
|
type fakeSolver struct {
|
||||||
presentedJob string
|
presentedJob string
|
||||||
cleaned []string
|
cleaned []string
|
||||||
|
cleanupContextErr error
|
||||||
}
|
}
|
||||||
|
|
||||||
type recoverySolver struct {
|
type recoverySolver struct {
|
||||||
@@ -1120,7 +1173,8 @@ func (s *fakeSolver) PresentDNS01(_ context.Context, _ provider.Auth, _, _, _, j
|
|||||||
s.presentedJob = jobID
|
s.presentedJob = jobID
|
||||||
return "record-1", nil
|
return "record-1", nil
|
||||||
}
|
}
|
||||||
func (s *fakeSolver) CleanupDNS01(_ context.Context, _ provider.Auth, _ string, recordID string) error {
|
func (s *fakeSolver) CleanupDNS01(ctx context.Context, _ provider.Auth, _ string, recordID string) error {
|
||||||
|
s.cleanupContextErr = ctx.Err()
|
||||||
s.cleaned = append(s.cleaned, recordID)
|
s.cleaned = append(s.cleaned, recordID)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@@ -1291,6 +1345,7 @@ type fakeBackend struct {
|
|||||||
replaces []string
|
replaces []string
|
||||||
renewalInfo *certificate.RenewalInfo
|
renewalInfo *certificate.RenewalInfo
|
||||||
renewalErr error
|
renewalErr error
|
||||||
|
obtainDelay time.Duration
|
||||||
}
|
}
|
||||||
|
|
||||||
func (b *fakeBackend) Obtain(ctx context.Context, request certificate.ObtainRequest) (*certificate.Resource, error) {
|
func (b *fakeBackend) Obtain(ctx context.Context, request certificate.ObtainRequest) (*certificate.Resource, error) {
|
||||||
@@ -1302,8 +1357,12 @@ func (b *fakeBackend) Obtain(ctx context.Context, request certificate.ObtainRequ
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
defer b.active.Add(-1)
|
defer b.active.Add(-1)
|
||||||
|
delay := b.obtainDelay
|
||||||
|
if delay <= 0 {
|
||||||
|
delay = 15 * time.Millisecond
|
||||||
|
}
|
||||||
select {
|
select {
|
||||||
case <-time.After(15 * time.Millisecond):
|
case <-time.After(delay):
|
||||||
case <-ctx.Done():
|
case <-ctx.Done():
|
||||||
return nil, ctx.Err()
|
return nil, ctx.Err()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -47,6 +47,7 @@ type JournaledDNSProvider struct {
|
|||||||
PropagationTimeout time.Duration
|
PropagationTimeout time.Duration
|
||||||
PollingInterval time.Duration
|
PollingInterval time.Duration
|
||||||
OnWriteObserved func(context.Context, string, string) error
|
OnWriteObserved func(context.Context, string, string) error
|
||||||
|
OnPresented func(domainName, fqdn string)
|
||||||
|
|
||||||
mu sync.Mutex
|
mu sync.Mutex
|
||||||
presented map[string]presentedChallenge
|
presented map[string]presentedChallenge
|
||||||
@@ -108,6 +109,9 @@ func (p *JournaledDNSProvider) Present(ctx context.Context, domainName, token, k
|
|||||||
recordID: recordID,
|
recordID: recordID,
|
||||||
}
|
}
|
||||||
p.mu.Unlock()
|
p.mu.Unlock()
|
||||||
|
if p.OnPresented != nil {
|
||||||
|
p.OnPresented(domainName, info.EffectiveFQDN)
|
||||||
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -122,11 +126,16 @@ func (p *JournaledDNSProvider) CleanUp(ctx context.Context, domainName, token, _
|
|||||||
if !ok {
|
if !ok {
|
||||||
return fmt.Errorf("DNS-01 record for %s is not present in this process", domainName)
|
return fmt.Errorf("DNS-01 record for %s is not present in this process", domainName)
|
||||||
}
|
}
|
||||||
if err := p.Solver.CleanupDNS01(ctx, presented.auth, presented.zoneID, presented.recordID); err != nil {
|
// lego calls cleanup with the issuance context, which may already be
|
||||||
|
// cancelled or expired. Give exact-record cleanup its own bounded window so
|
||||||
|
// operator cancellation does not strand a live ACME TXT record.
|
||||||
|
cleanupCtx, cancel := context.WithTimeout(context.WithoutCancel(ctx), 45*time.Second)
|
||||||
|
defer cancel()
|
||||||
|
if err := p.Solver.CleanupDNS01(cleanupCtx, presented.auth, presented.zoneID, presented.recordID); err != nil {
|
||||||
return fmt.Errorf("delete DNS-01 record %s: %w", presented.recordID, err)
|
return fmt.Errorf("delete DNS-01 record %s: %w", presented.recordID, err)
|
||||||
}
|
}
|
||||||
cleanedAt := time.Now().UTC()
|
cleanedAt := time.Now().UTC()
|
||||||
if err := p.Repository.MarkChallengeCleaned(ctx, presented.journalID, cleanedAt); err != nil {
|
if err := p.Repository.MarkChallengeCleaned(cleanupCtx, presented.journalID, cleanedAt); err != nil {
|
||||||
return fmt.Errorf("mark DNS-01 challenge %s cleaned: %w", presented.journalID, err)
|
return fmt.Errorf("mark DNS-01 challenge %s cleaned: %w", presented.journalID, err)
|
||||||
}
|
}
|
||||||
p.mu.Lock()
|
p.mu.Lock()
|
||||||
|
|||||||
@@ -18,10 +18,14 @@ import (
|
|||||||
"github.com/go-acme/lego/v5/certcrypto"
|
"github.com/go-acme/lego/v5/certcrypto"
|
||||||
"github.com/go-acme/lego/v5/certificate"
|
"github.com/go-acme/lego/v5/certificate"
|
||||||
"github.com/go-acme/lego/v5/challenge"
|
"github.com/go-acme/lego/v5/challenge"
|
||||||
|
"github.com/go-acme/lego/v5/challenge/dns01"
|
||||||
"github.com/go-acme/lego/v5/lego"
|
"github.com/go-acme/lego/v5/lego"
|
||||||
)
|
)
|
||||||
|
|
||||||
const maxIssuanceConcurrency = 3
|
const (
|
||||||
|
maxIssuanceConcurrency = 3
|
||||||
|
defaultIssuanceTimeout = 10 * time.Minute
|
||||||
|
)
|
||||||
|
|
||||||
type EngineRepository interface {
|
type EngineRepository interface {
|
||||||
AccountRepository
|
AccountRepository
|
||||||
@@ -49,6 +53,7 @@ type Engine struct {
|
|||||||
preflights []PreflightHook
|
preflights []PreflightHook
|
||||||
writeObserver func(context.Context, string, string) error
|
writeObserver func(context.Context, string, string) error
|
||||||
concurrency int
|
concurrency int
|
||||||
|
issueTimeout time.Duration
|
||||||
}
|
}
|
||||||
|
|
||||||
type EngineOption func(*Engine)
|
type EngineOption func(*Engine)
|
||||||
@@ -83,6 +88,14 @@ func WithIssuanceConcurrency(concurrency int) EngineOption {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func WithIssuanceTimeout(timeout time.Duration) EngineOption {
|
||||||
|
return func(engine *Engine) {
|
||||||
|
if timeout > 0 {
|
||||||
|
engine.issueTimeout = timeout
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func WithACMEHTTPClient(client *http.Client, userAgent string) EngineOption {
|
func WithACMEHTTPClient(client *http.Client, userAgent string) EngineOption {
|
||||||
return func(engine *Engine) {
|
return func(engine *Engine) {
|
||||||
engine.accounts.HTTPClient = client
|
engine.accounts.HTTPClient = client
|
||||||
@@ -93,12 +106,13 @@ func WithACMEHTTPClient(client *http.Client, userAgent string) EngineOption {
|
|||||||
|
|
||||||
func NewEngine(repository EngineRepository, secrets SecretStore, solver provider.DNS01Solver, resolve ZoneResolver, options ...EngineOption) *Engine {
|
func NewEngine(repository EngineRepository, secrets SecretStore, solver provider.DNS01Solver, resolve ZoneResolver, options ...EngineOption) *Engine {
|
||||||
engine := &Engine{
|
engine := &Engine{
|
||||||
accounts: &AccountService{Repository: repository, Secrets: secrets},
|
accounts: &AccountService{Repository: repository, Secrets: secrets},
|
||||||
repository: repository,
|
repository: repository,
|
||||||
solver: solver,
|
solver: solver,
|
||||||
resolve: resolve,
|
resolve: resolve,
|
||||||
factory: &legoBackendFactory{},
|
factory: &legoBackendFactory{},
|
||||||
concurrency: maxIssuanceConcurrency,
|
concurrency: maxIssuanceConcurrency,
|
||||||
|
issueTimeout: defaultIssuanceTimeout,
|
||||||
}
|
}
|
||||||
for _, option := range options {
|
for _, option := range options {
|
||||||
option(engine)
|
option(engine)
|
||||||
@@ -109,11 +123,20 @@ func NewEngine(repository EngineRepository, secrets SecretStore, solver provider
|
|||||||
func (e *Engine) Accounts() *AccountService { return e.accounts }
|
func (e *Engine) Accounts() *AccountService { return e.accounts }
|
||||||
|
|
||||||
type IssueRequest struct {
|
type IssueRequest struct {
|
||||||
JobID string `json:"job_id"`
|
JobID string `json:"job_id"`
|
||||||
Environment string `json:"environment"`
|
Environment string `json:"environment"`
|
||||||
Plan Plan `json:"plan"`
|
Plan Plan `json:"plan"`
|
||||||
ConfirmProduction bool `json:"confirm_production"`
|
ConfirmProduction bool `json:"confirm_production"`
|
||||||
ReplacesCertID string `json:"-"`
|
ReplacesCertID string `json:"-"`
|
||||||
|
Progress func(IssueProgress) `json:"-"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type IssueProgress struct {
|
||||||
|
Stage string
|
||||||
|
Message string
|
||||||
|
Domain string
|
||||||
|
Percent int
|
||||||
|
WaitingDNS bool
|
||||||
}
|
}
|
||||||
|
|
||||||
type IssueResult struct {
|
type IssueResult struct {
|
||||||
@@ -136,6 +159,14 @@ func (e *Engine) Issue(ctx context.Context, request IssueRequest) (IssueResult,
|
|||||||
if request.Environment == EnvironmentProduction && !request.ConfirmProduction {
|
if request.Environment == EnvironmentProduction && !request.ConfirmProduction {
|
||||||
return IssueResult{}, errors.New("production issuance requires explicit confirmation")
|
return IssueResult{}, errors.New("production issuance requires explicit confirmation")
|
||||||
}
|
}
|
||||||
|
timeout := e.issueTimeout
|
||||||
|
if timeout <= 0 {
|
||||||
|
timeout = defaultIssuanceTimeout
|
||||||
|
}
|
||||||
|
ctx, cancel := context.WithTimeout(ctx, timeout)
|
||||||
|
defer cancel()
|
||||||
|
stage := "preflight"
|
||||||
|
reportIssueProgress(request, IssueProgress{Stage: stage, Message: "Checking zone, credential, DNS, and CAA prerequisites", Percent: 10})
|
||||||
for _, preflight := range e.preflights {
|
for _, preflight := range e.preflights {
|
||||||
if err := preflight(ctx, request.Plan); err != nil {
|
if err := preflight(ctx, request.Plan); err != nil {
|
||||||
return IssueResult{}, fmt.Errorf("certificate preflight: %w", err)
|
return IssueResult{}, fmt.Errorf("certificate preflight: %w", err)
|
||||||
@@ -151,6 +182,15 @@ func (e *Engine) Issue(ctx context.Context, request IssueRequest) (IssueResult,
|
|||||||
}
|
}
|
||||||
dnsProvider := NewJournaledDNSProvider(e.solver, e.repository, e.resolve, request.JobID)
|
dnsProvider := NewJournaledDNSProvider(e.solver, e.repository, e.resolve, request.JobID)
|
||||||
dnsProvider.OnWriteObserved = e.writeObserver
|
dnsProvider.OnWriteObserved = e.writeObserver
|
||||||
|
dnsProvider.OnPresented = func(domainName, fqdn string) {
|
||||||
|
stage = "dns-propagation"
|
||||||
|
reportIssueProgress(request, IssueProgress{
|
||||||
|
Stage: stage, Domain: domainName, Percent: 45, WaitingDNS: true,
|
||||||
|
Message: fmt.Sprintf("DNS challenge published for %s; waiting for authoritative propagation", fqdn),
|
||||||
|
})
|
||||||
|
}
|
||||||
|
stage = "acme-order"
|
||||||
|
reportIssueProgress(request, IssueProgress{Stage: stage, Message: "Creating ACME order", Percent: 20})
|
||||||
backend, err := e.factory.New(ctx, account, dnsProvider)
|
backend, err := e.factory.New(ctx, account, dnsProvider)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return IssueResult{}, fmt.Errorf("create ACME backend: %w", err)
|
return IssueResult{}, fmt.Errorf("create ACME backend: %w", err)
|
||||||
@@ -159,6 +199,7 @@ func (e *Engine) Issue(ctx context.Context, request IssueRequest) (IssueResult,
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return IssueResult{}, err
|
return IssueResult{}, err
|
||||||
}
|
}
|
||||||
|
stage = "acme-validation"
|
||||||
resource, err := backend.Obtain(ctx, certificate.ObtainRequest{
|
resource, err := backend.Obtain(ctx, certificate.ObtainRequest{
|
||||||
Domains: slices.Clone(request.Plan.Identifiers),
|
Domains: slices.Clone(request.Plan.Identifiers),
|
||||||
PrivateKey: privateKey,
|
PrivateKey: privateKey,
|
||||||
@@ -170,8 +211,16 @@ func (e *Engine) Issue(ctx context.Context, request IssueRequest) (IssueResult,
|
|||||||
AlwaysDeactivateAuthorizations: true,
|
AlwaysDeactivateAuthorizations: true,
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
if errors.Is(ctx.Err(), context.DeadlineExceeded) {
|
||||||
|
return IssueResult{}, fmt.Errorf("ACME order for %s exceeded the %s safety deadline during %s: %w", request.Plan.Name, timeout, stage, ctx.Err())
|
||||||
|
}
|
||||||
|
if errors.Is(ctx.Err(), context.Canceled) {
|
||||||
|
return IssueResult{}, fmt.Errorf("ACME order for %s cancelled during %s: %w", request.Plan.Name, stage, ctx.Err())
|
||||||
|
}
|
||||||
return IssueResult{}, fmt.Errorf("obtain certificate for %s: %w", request.Plan.Name, err)
|
return IssueResult{}, fmt.Errorf("obtain certificate for %s: %w", request.Plan.Name, err)
|
||||||
}
|
}
|
||||||
|
stage = "certificate-validation"
|
||||||
|
reportIssueProgress(request, IssueProgress{Stage: stage, Message: "Certificate issued; validating returned key and chain", Percent: 82})
|
||||||
artifact, err := artifactFromResource(resource, privateKey, request.Plan.Identifiers)
|
artifact, err := artifactFromResource(resource, privateKey, request.Plan.Identifiers)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return IssueResult{}, fmt.Errorf("validate ACME result: %w", err)
|
return IssueResult{}, fmt.Errorf("validate ACME result: %w", err)
|
||||||
@@ -192,6 +241,12 @@ func (e *Engine) Issue(ctx context.Context, request IssueRequest) (IssueResult,
|
|||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func reportIssueProgress(request IssueRequest, progress IssueProgress) {
|
||||||
|
if request.Progress != nil {
|
||||||
|
request.Progress(progress)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
type BatchResult struct {
|
type BatchResult struct {
|
||||||
Request IssueRequest `json:"request"`
|
Request IssueRequest `json:"request"`
|
||||||
Result IssueResult `json:"-"`
|
Result IssueResult `json:"-"`
|
||||||
@@ -450,7 +505,27 @@ func (f *legoBackendFactory) New(_ context.Context, material AccountMaterial, dn
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
if dnsProvider != nil {
|
if dnsProvider != nil {
|
||||||
if err := client.Challenge.SetDNS01Provider(dnsProvider); err != nil {
|
contextAwarePrecheck := dns01.WrapPreCheck(func(ctx context.Context, _ string, fqdn, value string, check dns01.PreCheckFunc) (bool, error) {
|
||||||
|
if err := ctx.Err(); err != nil {
|
||||||
|
return true, err
|
||||||
|
}
|
||||||
|
checkCtx, cancel := context.WithTimeout(ctx, 30*time.Second)
|
||||||
|
defer cancel()
|
||||||
|
ready, err := check(checkCtx, fqdn, value)
|
||||||
|
if ctxErr := ctx.Err(); ctxErr != nil {
|
||||||
|
return true, ctxErr
|
||||||
|
}
|
||||||
|
return ready, err
|
||||||
|
})
|
||||||
|
// Recursive resolvers can retain a negative _acme-challenge response for
|
||||||
|
// the zone's SOA negative TTL long after Cloudflare is authoritative for
|
||||||
|
// the new TXT value. Gate on every authoritative nameserver instead; the
|
||||||
|
// ACME server still performs its own independent validation afterward.
|
||||||
|
if err := client.Challenge.SetDNS01Provider(
|
||||||
|
dnsProvider,
|
||||||
|
dns01.DisableRecursiveNSsPropagationRequirement(),
|
||||||
|
contextAwarePrecheck,
|
||||||
|
); err != nil {
|
||||||
return nil, fmt.Errorf("configure DNS-01 provider: %w", err)
|
return nil, fmt.Errorf("configure DNS-01 provider: %w", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package provider
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"errors"
|
"errors"
|
||||||
|
"fmt"
|
||||||
|
|
||||||
"github.com/MeghdadFadaee/domainops/internal/domain"
|
"github.com/MeghdadFadaee/domainops/internal/domain"
|
||||||
)
|
)
|
||||||
@@ -38,6 +39,10 @@ func AccessFailureIsAuthoritative(err error) bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type Auth struct {
|
type Auth struct {
|
||||||
|
// Provider is the stable registry identity used to route this credential.
|
||||||
|
// It travels with the secret so delayed DNS-01 cleanup cannot be redirected
|
||||||
|
// to a different provider that happens to use the same remote zone ID.
|
||||||
|
Provider string
|
||||||
CredentialID string
|
CredentialID string
|
||||||
Token string
|
Token string
|
||||||
Kind domain.CredentialKind
|
Kind domain.CredentialKind
|
||||||
@@ -118,11 +123,40 @@ type EdgeTLSService interface {
|
|||||||
ListEdgeCertificates(context.Context, Auth, string, PageRequest) ([]domain.EdgeCertificate, error)
|
ListEdgeCertificates(context.Context, Auth, string, PageRequest) ([]domain.EdgeCertificate, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
type CloudProvider interface {
|
// Provider is the mandatory provider contract. DNS batching and edge TLS are
|
||||||
|
// deliberately optional: a provider with safe single-record DNS operations
|
||||||
|
// and DNS-01 support can be registered without pretending to implement them.
|
||||||
|
type Provider interface {
|
||||||
CredentialVerifier
|
CredentialVerifier
|
||||||
ZoneInventory
|
ZoneInventory
|
||||||
DNSRecordService
|
DNSRecordService
|
||||||
DNSBatchService
|
|
||||||
DNS01Solver
|
DNS01Solver
|
||||||
|
}
|
||||||
|
|
||||||
|
// CloudProvider retains the original all-capabilities contract for source
|
||||||
|
// compatibility. New registrations should depend on Provider and discover
|
||||||
|
// these optional capabilities with interface assertions.
|
||||||
|
type CloudProvider interface {
|
||||||
|
Provider
|
||||||
|
DNSBatchService
|
||||||
EdgeTLSService
|
EdgeTLSService
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var ErrCapabilityUnsupported = errors.New("provider capability is not supported")
|
||||||
|
|
||||||
|
// UnsupportedCapabilityError identifies the exact optional feature and
|
||||||
|
// provider which cannot satisfy an operation.
|
||||||
|
type UnsupportedCapabilityError struct {
|
||||||
|
Provider string
|
||||||
|
Capability string
|
||||||
|
}
|
||||||
|
|
||||||
|
func (e *UnsupportedCapabilityError) Error() string {
|
||||||
|
return fmt.Sprintf("provider %q does not support %s", e.Provider, e.Capability)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (e *UnsupportedCapabilityError) Unwrap() error { return ErrCapabilityUnsupported }
|
||||||
|
|
||||||
|
func Unsupported(providerName, capability string) error {
|
||||||
|
return &UnsupportedCapabilityError{Provider: providerName, Capability: capability}
|
||||||
|
}
|
||||||
@@ -40,7 +40,8 @@ type Options struct {
|
|||||||
Now func() time.Time
|
Now func() time.Time
|
||||||
}
|
}
|
||||||
|
|
||||||
// Client implements provider.CloudProvider.
|
// Client implements the mandatory provider contract and Cloudflare's optional
|
||||||
|
// batch, DNS-01 recovery, and edge-TLS capabilities.
|
||||||
type Client struct {
|
type Client struct {
|
||||||
baseURL string
|
baseURL string
|
||||||
httpClient HTTPDoer
|
httpClient HTTPDoer
|
||||||
@@ -48,7 +49,12 @@ type Client struct {
|
|||||||
now func() time.Time
|
now func() time.Time
|
||||||
}
|
}
|
||||||
|
|
||||||
var _ provider.CloudProvider = (*Client)(nil)
|
var (
|
||||||
|
_ provider.Provider = (*Client)(nil)
|
||||||
|
_ provider.DNSBatchService = (*Client)(nil)
|
||||||
|
_ provider.DNS01Reconciler = (*Client)(nil)
|
||||||
|
_ provider.EdgeTLSService = (*Client)(nil)
|
||||||
|
)
|
||||||
|
|
||||||
// New returns a production Cloudflare client.
|
// New returns a production Cloudflare client.
|
||||||
func New() *Client {
|
func New() *Client {
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ var fixedNow = time.Date(2026, time.July, 11, 9, 30, 0, 0, time.UTC)
|
|||||||
|
|
||||||
func testAuth() provider.Auth {
|
func testAuth() provider.Auth {
|
||||||
return provider.Auth{
|
return provider.Auth{
|
||||||
|
Provider: domain.ProviderCloudflare,
|
||||||
CredentialID: "cred-1",
|
CredentialID: "cred-1",
|
||||||
Token: "test-secret-token",
|
Token: "test-secret-token",
|
||||||
Kind: domain.CredentialUserToken,
|
Kind: domain.CredentialUserToken,
|
||||||
|
|||||||
+609
-19
@@ -29,6 +29,8 @@ type Backend interface {
|
|||||||
Jobs(context.Context, int) ([]domain.Job, error)
|
Jobs(context.Context, int) ([]domain.Job, error)
|
||||||
Audit(context.Context, int) ([]domain.AuditEvent, error)
|
Audit(context.Context, int) ([]domain.AuditEvent, error)
|
||||||
AddCloudflareCredential(context.Context, app.AddCredentialInput) (domain.Credential, error)
|
AddCloudflareCredential(context.Context, app.AddCredentialInput) (domain.Credential, error)
|
||||||
|
DeleteCredential(context.Context, string) error
|
||||||
|
SetZonePreferredCredential(context.Context, string, string) (domain.Zone, error)
|
||||||
SyncAll(context.Context) ([]domain.Job, error)
|
SyncAll(context.Context) ([]domain.Job, error)
|
||||||
CreateDNSRecord(context.Context, string, domain.DNSRecord) (domain.DNSRecord, error)
|
CreateDNSRecord(context.Context, string, domain.DNSRecord) (domain.DNSRecord, error)
|
||||||
PatchDNSRecord(context.Context, string, string, domain.DNSRecord) (domain.DNSRecord, error)
|
PatchDNSRecord(context.Context, string, string, domain.DNSRecord) (domain.DNSRecord, error)
|
||||||
@@ -123,9 +125,29 @@ type Model struct {
|
|||||||
unlockFocus int
|
unlockFocus int
|
||||||
unlockInputs []textinput.Model
|
unlockInputs []textinput.Model
|
||||||
|
|
||||||
addCredential bool
|
addCredential bool
|
||||||
credentialFocus int
|
credentialFocus int
|
||||||
credentialInputs []textinput.Model
|
credentialInputs []textinput.Model
|
||||||
|
removeCredential bool
|
||||||
|
removeCredentialInput textinput.Model
|
||||||
|
removeCredentialID string
|
||||||
|
removeCredentialExpected string
|
||||||
|
removeCredentialKind domain.CredentialKind
|
||||||
|
removeCredentialAccountHint string
|
||||||
|
removeCredentialZoneIDs []string
|
||||||
|
removeCredentialZoneNames []string
|
||||||
|
|
||||||
|
preferCredential bool
|
||||||
|
preferCredentialFocus int
|
||||||
|
preferCredentialInputs []textinput.Model
|
||||||
|
preferZoneID string
|
||||||
|
preferZoneExpectedName string
|
||||||
|
preferZoneProvider string
|
||||||
|
preferZoneAccountID string
|
||||||
|
preferOriginalCredentialID string
|
||||||
|
preferResolvedCredentialID string
|
||||||
|
preferResolvedCredentialLabel string
|
||||||
|
preferCredentialSelection string
|
||||||
|
|
||||||
editRecord bool
|
editRecord bool
|
||||||
recordEditing bool
|
recordEditing bool
|
||||||
@@ -152,6 +174,7 @@ type Model struct {
|
|||||||
certificateIssueZoneValue string
|
certificateIssueZoneValue string
|
||||||
certificateLineageID string
|
certificateLineageID string
|
||||||
certificateExpectedName string
|
certificateExpectedName string
|
||||||
|
certificateRun *certificateRunState
|
||||||
}
|
}
|
||||||
|
|
||||||
type loadMsg struct {
|
type loadMsg struct {
|
||||||
@@ -176,9 +199,44 @@ type loadMsg struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type operationMsg struct {
|
type operationMsg struct {
|
||||||
message string
|
message string
|
||||||
err error
|
err error
|
||||||
reload bool
|
reload bool
|
||||||
|
certificate bool
|
||||||
|
}
|
||||||
|
|
||||||
|
type backendEventMsg struct {
|
||||||
|
event app.Event
|
||||||
|
ok bool
|
||||||
|
}
|
||||||
|
|
||||||
|
type certificateTickMsg time.Time
|
||||||
|
|
||||||
|
type certificateActivity struct {
|
||||||
|
At time.Time
|
||||||
|
JobID string
|
||||||
|
State domain.JobState
|
||||||
|
Progress int
|
||||||
|
Message string
|
||||||
|
Error string
|
||||||
|
}
|
||||||
|
|
||||||
|
type certificateRunState struct {
|
||||||
|
Title string
|
||||||
|
StartedAt time.Time
|
||||||
|
Deadline time.Time
|
||||||
|
TargetCount int
|
||||||
|
Jobs map[string]domain.Job
|
||||||
|
Order []string
|
||||||
|
Activity []certificateActivity
|
||||||
|
ActivityScroll int
|
||||||
|
Cancel context.CancelFunc
|
||||||
|
CancelRequested bool
|
||||||
|
Ticking bool
|
||||||
|
Visible bool
|
||||||
|
Done bool
|
||||||
|
Summary string
|
||||||
|
Err error
|
||||||
}
|
}
|
||||||
|
|
||||||
type unlockMsg struct{ err error }
|
type unlockMsg struct{ err error }
|
||||||
@@ -218,14 +276,35 @@ func makePasswordInputs(first bool) []textinput.Model {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (m *Model) Init() tea.Cmd {
|
func (m *Model) Init() tea.Cmd {
|
||||||
|
commands := make([]tea.Cmd, 0, 2)
|
||||||
if m.unlock {
|
if m.unlock {
|
||||||
return textinput.Blink
|
commands = append(commands, textinput.Blink)
|
||||||
|
} else {
|
||||||
|
commands = append(commands, m.startLoad("", false, false))
|
||||||
}
|
}
|
||||||
return m.startLoad("", false, false)
|
if command := waitForBackendEvent(m.backend); command != nil {
|
||||||
|
commands = append(commands, command)
|
||||||
|
}
|
||||||
|
return tea.Batch(commands...)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *Model) Update(message tea.Msg) (tea.Model, tea.Cmd) {
|
func (m *Model) Update(message tea.Msg) (tea.Model, tea.Cmd) {
|
||||||
switch msg := message.(type) {
|
switch msg := message.(type) {
|
||||||
|
case backendEventMsg:
|
||||||
|
if msg.ok {
|
||||||
|
m.applyBackendEvent(msg.event)
|
||||||
|
if m.certificateRun != nil && !m.certificateRun.Done && !m.certificateRun.Ticking {
|
||||||
|
m.certificateRun.Ticking = true
|
||||||
|
return m, tea.Batch(waitForBackendEvent(m.backend), certificateTickCmd())
|
||||||
|
}
|
||||||
|
return m, waitForBackendEvent(m.backend)
|
||||||
|
}
|
||||||
|
return m, nil
|
||||||
|
case certificateTickMsg:
|
||||||
|
if m.certificateRun != nil && !m.certificateRun.Done {
|
||||||
|
return m, certificateTickCmd()
|
||||||
|
}
|
||||||
|
return m, nil
|
||||||
case tea.WindowSizeMsg:
|
case tea.WindowSizeMsg:
|
||||||
m.width, m.height = msg.Width, msg.Height
|
m.width, m.height = msg.Width, msg.Height
|
||||||
m.resizeInputs()
|
m.resizeInputs()
|
||||||
@@ -275,6 +354,13 @@ func (m *Model) Update(message tea.Msg) (tea.Model, tea.Cmd) {
|
|||||||
case operationMsg:
|
case operationMsg:
|
||||||
m.err = msg.err
|
m.err = msg.err
|
||||||
m.operationErr = msg.err
|
m.operationErr = msg.err
|
||||||
|
if msg.certificate && m.certificateRun != nil {
|
||||||
|
m.certificateRun.Done = true
|
||||||
|
m.certificateRun.Visible = true
|
||||||
|
m.certificateRun.Summary = msg.message
|
||||||
|
m.certificateRun.Err = msg.err
|
||||||
|
m.certificateRun.Cancel = nil
|
||||||
|
}
|
||||||
if msg.err == nil {
|
if msg.err == nil {
|
||||||
m.toast, m.toastAt = msg.message, time.Now()
|
m.toast, m.toastAt = msg.message, time.Now()
|
||||||
}
|
}
|
||||||
@@ -322,6 +408,9 @@ func (m *Model) Update(message tea.Msg) (tea.Model, tea.Cmd) {
|
|||||||
}
|
}
|
||||||
return m, nil
|
return m, nil
|
||||||
}
|
}
|
||||||
|
if m.certificateRun != nil && m.certificateRun.Visible {
|
||||||
|
return m.updateCertificateRun(message)
|
||||||
|
}
|
||||||
if key, ok := message.(tea.KeyPressMsg); ok && m.recoveryBlocked && key.String() == "R" {
|
if key, ok := message.(tea.KeyPressMsg); ok && m.recoveryBlocked && key.String() == "R" {
|
||||||
if m.busy || m.loading {
|
if m.busy || m.loading {
|
||||||
message := "An operation is already running"
|
message := "An operation is already running"
|
||||||
@@ -342,6 +431,12 @@ func (m *Model) Update(message tea.Msg) (tea.Model, tea.Cmd) {
|
|||||||
if m.addCredential {
|
if m.addCredential {
|
||||||
return m.updateCredentialForm(message)
|
return m.updateCredentialForm(message)
|
||||||
}
|
}
|
||||||
|
if m.removeCredential {
|
||||||
|
return m.updateRemoveCredentialForm(message)
|
||||||
|
}
|
||||||
|
if m.preferCredential {
|
||||||
|
return m.updatePreferredCredentialForm(message)
|
||||||
|
}
|
||||||
if m.editRecord {
|
if m.editRecord {
|
||||||
return m.updateRecordForm(message)
|
return m.updateRecordForm(message)
|
||||||
}
|
}
|
||||||
@@ -384,6 +479,15 @@ func (m *Model) Update(message tea.Msg) (tea.Model, tea.Cmd) {
|
|||||||
m.toast, m.toastAt = "Load this zone’s TLS snapshot before editing", time.Now()
|
m.toast, m.toastAt = "Load this zone’s TLS snapshot before editing", time.Now()
|
||||||
return m, nil
|
return m, nil
|
||||||
}
|
}
|
||||||
|
if m.certificateRun != nil && key.String() == "o" {
|
||||||
|
m.certificateRun.Visible = true
|
||||||
|
return m, nil
|
||||||
|
}
|
||||||
|
if m.certificateRun != nil && !m.certificateRun.Done && (key.String() == "q" || key.String() == "ctrl+c") {
|
||||||
|
m.certificateRun.Visible = true
|
||||||
|
m.toast, m.toastAt = "Cancel the certificate operation and wait for DNS cleanup before quitting", time.Now()
|
||||||
|
return m, nil
|
||||||
|
}
|
||||||
switch key.String() {
|
switch key.String() {
|
||||||
case "q", "ctrl+c":
|
case "q", "ctrl+c":
|
||||||
return m, tea.Quit
|
return m, tea.Quit
|
||||||
@@ -406,6 +510,11 @@ func (m *Model) Update(message tea.Msg) (tea.Model, tea.Cmd) {
|
|||||||
m.openCredentialForm()
|
m.openCredentialForm()
|
||||||
return m, textinput.Blink
|
return m, textinput.Blink
|
||||||
}
|
}
|
||||||
|
case "p":
|
||||||
|
if m.screen == screenZones && len(m.filteredZones()) > 0 {
|
||||||
|
m.openPreferredCredentialForm()
|
||||||
|
return m, textinput.Blink
|
||||||
|
}
|
||||||
case "n":
|
case "n":
|
||||||
if m.screen == screenDNS && len(m.zones) > 0 {
|
if m.screen == screenDNS && len(m.zones) > 0 {
|
||||||
m.openRecordForm(false)
|
m.openRecordForm(false)
|
||||||
@@ -436,6 +545,10 @@ func (m *Model) Update(message tea.Msg) (tea.Model, tea.Cmd) {
|
|||||||
return m, textinput.Blink
|
return m, textinput.Blink
|
||||||
}
|
}
|
||||||
case "d":
|
case "d":
|
||||||
|
if m.screen == screenAccounts && len(m.filteredCredentials()) > 0 {
|
||||||
|
m.openRemoveCredentialForm()
|
||||||
|
return m, textinput.Blink
|
||||||
|
}
|
||||||
if m.screen == screenDNS && len(m.filteredRecords()) > 0 {
|
if m.screen == screenDNS && len(m.filteredRecords()) > 0 {
|
||||||
m.confirmDelete = true
|
m.confirmDelete = true
|
||||||
}
|
}
|
||||||
@@ -792,6 +905,313 @@ func (m *Model) clearCredentialForm() {
|
|||||||
m.addCredential = false
|
m.addCredential = false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (m *Model) openRemoveCredentialForm() {
|
||||||
|
credentials := m.filteredCredentials()
|
||||||
|
if len(credentials) == 0 {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
credential := credentials[min(m.rowOffset, len(credentials)-1)]
|
||||||
|
m.removeCredentialZoneIDs = nil
|
||||||
|
m.removeCredentialZoneNames = nil
|
||||||
|
input := textinput.New()
|
||||||
|
input.Prompt = ""
|
||||||
|
input.Placeholder = "Type the exact connection label"
|
||||||
|
input.SetWidth(52)
|
||||||
|
input.Focus()
|
||||||
|
m.removeCredentialInput = input
|
||||||
|
m.removeCredentialID = credential.ID
|
||||||
|
m.removeCredentialExpected = credential.Label
|
||||||
|
m.removeCredentialKind = credential.Kind
|
||||||
|
m.removeCredentialAccountHint = credential.AccountHint
|
||||||
|
for _, zone := range m.zones {
|
||||||
|
if zone.PreferredCredentialID == credential.ID {
|
||||||
|
m.removeCredentialZoneIDs = append(m.removeCredentialZoneIDs, zone.ID)
|
||||||
|
m.removeCredentialZoneNames = append(m.removeCredentialZoneNames, zone.Name)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
m.removeCredential = true
|
||||||
|
m.err = nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *Model) updateRemoveCredentialForm(message tea.Msg) (tea.Model, tea.Cmd) {
|
||||||
|
if key, ok := message.(tea.KeyPressMsg); ok {
|
||||||
|
switch key.String() {
|
||||||
|
case "esc":
|
||||||
|
m.clearRemoveCredentialForm()
|
||||||
|
return m, nil
|
||||||
|
case "enter":
|
||||||
|
if m.mutationFormBlocked() {
|
||||||
|
return m, nil
|
||||||
|
}
|
||||||
|
credential, ok := m.credentialByID(m.removeCredentialID)
|
||||||
|
if !ok || credential.Label != m.removeCredentialExpected {
|
||||||
|
m.err = errors.New("the selected connection changed; cancel and select it again")
|
||||||
|
return m, nil
|
||||||
|
}
|
||||||
|
if !m.removeCredentialRoutesUnchanged() {
|
||||||
|
m.err = errors.New("the affected zone routes changed; cancel and review the removal again")
|
||||||
|
return m, nil
|
||||||
|
}
|
||||||
|
if m.removeCredentialInput.Value() != m.removeCredentialExpected {
|
||||||
|
m.err = fmt.Errorf("type %q exactly to confirm removal", m.removeCredentialExpected)
|
||||||
|
return m, nil
|
||||||
|
}
|
||||||
|
credentialID := m.removeCredentialID
|
||||||
|
label := m.removeCredentialExpected
|
||||||
|
m.clearRemoveCredentialForm()
|
||||||
|
m.busy = true
|
||||||
|
return m, func() tea.Msg {
|
||||||
|
ctx, cancel := context.WithTimeout(context.Background(), 15*time.Minute)
|
||||||
|
defer cancel()
|
||||||
|
err := m.backend.DeleteCredential(ctx, credentialID)
|
||||||
|
return operationMsg{message: "Removed Cloudflare connection " + label, err: err, reload: true}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
var cmd tea.Cmd
|
||||||
|
m.removeCredentialInput, cmd = m.removeCredentialInput.Update(message)
|
||||||
|
return m, cmd
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *Model) clearRemoveCredentialForm() {
|
||||||
|
m.removeCredentialInput.SetValue("")
|
||||||
|
m.removeCredentialInput.Blur()
|
||||||
|
m.removeCredential = false
|
||||||
|
m.removeCredentialID = ""
|
||||||
|
m.removeCredentialExpected = ""
|
||||||
|
m.removeCredentialKind = ""
|
||||||
|
m.removeCredentialAccountHint = ""
|
||||||
|
m.removeCredentialZoneIDs = nil
|
||||||
|
m.removeCredentialZoneNames = nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *Model) removeCredentialRoutesUnchanged() bool {
|
||||||
|
if len(m.removeCredentialZoneIDs) != len(m.removeCredentialZoneNames) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
expected := make(map[string]string, len(m.removeCredentialZoneIDs))
|
||||||
|
for index, zoneID := range m.removeCredentialZoneIDs {
|
||||||
|
expected[zoneID] = m.removeCredentialZoneNames[index]
|
||||||
|
}
|
||||||
|
seen := 0
|
||||||
|
for _, zone := range m.zones {
|
||||||
|
if zone.PreferredCredentialID != m.removeCredentialID {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
name, ok := expected[zone.ID]
|
||||||
|
if !ok || name != zone.Name {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
seen++
|
||||||
|
}
|
||||||
|
return seen == len(expected)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *Model) openPreferredCredentialForm() {
|
||||||
|
zone, ok := m.selectedZone()
|
||||||
|
if !ok {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
newInput := func(placeholder string) textinput.Model {
|
||||||
|
input := textinput.New()
|
||||||
|
input.Prompt = ""
|
||||||
|
input.Placeholder = placeholder
|
||||||
|
input.SetWidth(54)
|
||||||
|
return input
|
||||||
|
}
|
||||||
|
m.preferCredentialInputs = []textinput.Model{
|
||||||
|
newInput("Credential ID or unique connection label"),
|
||||||
|
newInput("Type the exact zone name"),
|
||||||
|
}
|
||||||
|
m.preferCredentialInputs[0].Focus()
|
||||||
|
m.preferCredentialFocus = 0
|
||||||
|
m.preferZoneID = zone.ID
|
||||||
|
m.preferZoneExpectedName = zone.Name
|
||||||
|
m.preferZoneProvider = zone.Provider
|
||||||
|
m.preferZoneAccountID = zone.AccountID
|
||||||
|
m.preferOriginalCredentialID = zone.PreferredCredentialID
|
||||||
|
m.preferResolvedCredentialID = ""
|
||||||
|
m.preferResolvedCredentialLabel = ""
|
||||||
|
m.preferCredentialSelection = ""
|
||||||
|
m.preferCredential = true
|
||||||
|
m.err = nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *Model) updatePreferredCredentialForm(message tea.Msg) (tea.Model, tea.Cmd) {
|
||||||
|
if key, ok := message.(tea.KeyPressMsg); ok {
|
||||||
|
switch key.String() {
|
||||||
|
case "esc":
|
||||||
|
m.clearPreferredCredentialForm()
|
||||||
|
return m, nil
|
||||||
|
case "tab", "down":
|
||||||
|
if m.preferCredentialFocus == 0 && !m.capturePreferredCredential() {
|
||||||
|
return m, nil
|
||||||
|
}
|
||||||
|
m.focusPreferredCredential(1)
|
||||||
|
return m, nil
|
||||||
|
case "shift+tab", "up":
|
||||||
|
if m.preferCredentialFocus == 0 && !m.capturePreferredCredential() {
|
||||||
|
return m, nil
|
||||||
|
}
|
||||||
|
m.focusPreferredCredential(-1)
|
||||||
|
return m, nil
|
||||||
|
case "enter":
|
||||||
|
if m.preferCredentialFocus < len(m.preferCredentialInputs)-1 {
|
||||||
|
if !m.capturePreferredCredential() {
|
||||||
|
return m, nil
|
||||||
|
}
|
||||||
|
m.focusPreferredCredential(1)
|
||||||
|
return m, nil
|
||||||
|
}
|
||||||
|
if m.mutationFormBlocked() {
|
||||||
|
return m, nil
|
||||||
|
}
|
||||||
|
zone, ok := m.zoneByID(m.preferZoneID)
|
||||||
|
if !ok || zone.Name != m.preferZoneExpectedName || zone.Provider != m.preferZoneProvider || zone.AccountID != m.preferZoneAccountID || zone.PreferredCredentialID != m.preferOriginalCredentialID {
|
||||||
|
m.err = errors.New("the selected zone or its route changed; cancel and select it again")
|
||||||
|
return m, nil
|
||||||
|
}
|
||||||
|
if m.preferCredentialInputs[1].Value() != m.preferZoneExpectedName {
|
||||||
|
m.err = fmt.Errorf("type %q exactly to confirm the routing change", m.preferZoneExpectedName)
|
||||||
|
return m, nil
|
||||||
|
}
|
||||||
|
if m.preferResolvedCredentialID == "" || strings.TrimSpace(m.preferCredentialInputs[0].Value()) != m.preferCredentialSelection {
|
||||||
|
m.err = errors.New("select the connection again before confirming")
|
||||||
|
return m, nil
|
||||||
|
}
|
||||||
|
credential, ok := m.credentialByID(m.preferResolvedCredentialID)
|
||||||
|
if !ok || credential.Label != m.preferResolvedCredentialLabel {
|
||||||
|
m.err = errors.New("the selected connection changed; select it again")
|
||||||
|
return m, nil
|
||||||
|
}
|
||||||
|
if _, err := validatePreferredCredential(credential, zone); err != nil {
|
||||||
|
m.err = err
|
||||||
|
return m, nil
|
||||||
|
}
|
||||||
|
zoneID := m.preferZoneID
|
||||||
|
credentialID := credential.ID
|
||||||
|
zoneName := m.preferZoneExpectedName
|
||||||
|
m.clearPreferredCredentialForm()
|
||||||
|
m.busy = true
|
||||||
|
return m, func() tea.Msg {
|
||||||
|
ctx, cancel := context.WithTimeout(context.Background(), 90*time.Second)
|
||||||
|
defer cancel()
|
||||||
|
_, err := m.backend.SetZonePreferredCredential(ctx, zoneID, credentialID)
|
||||||
|
return operationMsg{message: "Preferred connection updated for " + zoneName, err: err, reload: true}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
var cmd tea.Cmd
|
||||||
|
m.preferCredentialInputs[m.preferCredentialFocus], cmd = m.preferCredentialInputs[m.preferCredentialFocus].Update(message)
|
||||||
|
if m.preferCredentialFocus == 0 {
|
||||||
|
m.preferResolvedCredentialID = ""
|
||||||
|
m.preferResolvedCredentialLabel = ""
|
||||||
|
m.preferCredentialSelection = ""
|
||||||
|
}
|
||||||
|
return m, cmd
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *Model) capturePreferredCredential() bool {
|
||||||
|
zone, ok := m.zoneByID(m.preferZoneID)
|
||||||
|
if !ok || zone.Name != m.preferZoneExpectedName || zone.Provider != m.preferZoneProvider || zone.AccountID != m.preferZoneAccountID || zone.PreferredCredentialID != m.preferOriginalCredentialID {
|
||||||
|
m.err = errors.New("the selected zone or its route changed; cancel and select it again")
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
selection := strings.TrimSpace(m.preferCredentialInputs[0].Value())
|
||||||
|
credential, err := m.resolvePreferredCredential(selection, zone)
|
||||||
|
if err != nil {
|
||||||
|
m.err = err
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
m.preferResolvedCredentialID = credential.ID
|
||||||
|
m.preferResolvedCredentialLabel = credential.Label
|
||||||
|
m.preferCredentialSelection = selection
|
||||||
|
m.err = nil
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *Model) focusPreferredCredential(delta int) {
|
||||||
|
m.preferCredentialInputs[m.preferCredentialFocus].Blur()
|
||||||
|
m.preferCredentialFocus = (m.preferCredentialFocus + delta + len(m.preferCredentialInputs)) % len(m.preferCredentialInputs)
|
||||||
|
m.preferCredentialInputs[m.preferCredentialFocus].Focus()
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *Model) clearPreferredCredentialForm() {
|
||||||
|
for i := range m.preferCredentialInputs {
|
||||||
|
m.preferCredentialInputs[i].SetValue("")
|
||||||
|
m.preferCredentialInputs[i].Blur()
|
||||||
|
}
|
||||||
|
m.preferCredential = false
|
||||||
|
m.preferCredentialFocus = 0
|
||||||
|
m.preferZoneID = ""
|
||||||
|
m.preferZoneExpectedName = ""
|
||||||
|
m.preferZoneProvider = ""
|
||||||
|
m.preferZoneAccountID = ""
|
||||||
|
m.preferOriginalCredentialID = ""
|
||||||
|
m.preferResolvedCredentialID = ""
|
||||||
|
m.preferResolvedCredentialLabel = ""
|
||||||
|
m.preferCredentialSelection = ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *Model) resolvePreferredCredential(value string, zone domain.Zone) (domain.Credential, error) {
|
||||||
|
value = strings.TrimSpace(value)
|
||||||
|
if value == "" {
|
||||||
|
return domain.Credential{}, errors.New("a credential ID or connection label is required")
|
||||||
|
}
|
||||||
|
for _, credential := range m.credentials {
|
||||||
|
if credential.ID == value {
|
||||||
|
return validatePreferredCredential(credential, zone)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
matches := make([]domain.Credential, 0, 1)
|
||||||
|
for _, credential := range m.credentials {
|
||||||
|
if strings.EqualFold(strings.TrimSpace(credential.Label), value) {
|
||||||
|
matches = append(matches, credential)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
switch len(matches) {
|
||||||
|
case 0:
|
||||||
|
return domain.Credential{}, fmt.Errorf("connection %q is not synchronized; use an ID shown in Accounts", value)
|
||||||
|
case 1:
|
||||||
|
return validatePreferredCredential(matches[0], zone)
|
||||||
|
default:
|
||||||
|
return domain.Credential{}, fmt.Errorf("connection label %q is ambiguous across %d credentials; use the credential ID", value, len(matches))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func validatePreferredCredential(credential domain.Credential, zone domain.Zone) (domain.Credential, error) {
|
||||||
|
if credential.Provider != zone.Provider {
|
||||||
|
return domain.Credential{}, fmt.Errorf("connection %q uses provider %q, not %q", credential.Label, credential.Provider, zone.Provider)
|
||||||
|
}
|
||||||
|
if credential.Status != domain.CredentialValid {
|
||||||
|
return domain.Credential{}, fmt.Errorf("connection %q is %s; synchronize or replace it before routing", credential.Label, credential.Status)
|
||||||
|
}
|
||||||
|
return credential, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *Model) credentialByID(id string) (domain.Credential, bool) {
|
||||||
|
for _, credential := range m.credentials {
|
||||||
|
if credential.ID == id {
|
||||||
|
return credential, true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return domain.Credential{}, false
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *Model) mutationFormBlocked() bool {
|
||||||
|
switch {
|
||||||
|
case m.recoveryBlocked:
|
||||||
|
m.toast, m.toastAt = "Crash recovery must succeed before mutations are enabled", time.Now()
|
||||||
|
case m.busy:
|
||||||
|
m.toast, m.toastAt = "An operation is already running", time.Now()
|
||||||
|
case m.loading:
|
||||||
|
m.toast, m.toastAt = "Loading the latest zone state", time.Now()
|
||||||
|
default:
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
func (m *Model) openRecordForm(editing bool) {
|
func (m *Model) openRecordForm(editing bool) {
|
||||||
newInput := func(placeholder string) textinput.Model {
|
newInput := func(placeholder string) textinput.Model {
|
||||||
input := textinput.New()
|
input := textinput.New()
|
||||||
@@ -1213,16 +1633,18 @@ func (m *Model) submitCertificateForm() tea.Cmd {
|
|||||||
ConfirmProduction: m.certificateConfirmProduction,
|
ConfirmProduction: m.certificateConfirmProduction,
|
||||||
KeyAlgorithm: domain.KeyAlgorithm(strings.ToUpper(inputs[4])),
|
KeyAlgorithm: domain.KeyAlgorithm(strings.ToUpper(inputs[4])),
|
||||||
}
|
}
|
||||||
return func() tea.Msg {
|
ctx, cancel := context.WithTimeout(context.Background(), certificateBatchTimeout(len(zoneIDs)))
|
||||||
ctx, cancel := context.WithTimeout(context.Background(), 6*time.Hour)
|
m.beginCertificateRun("ISSUING WILDCARD CERTIFICATES", len(zoneIDs), ctx, cancel)
|
||||||
|
command := func() tea.Msg {
|
||||||
defer cancel()
|
defer cancel()
|
||||||
result, issueErr := m.backend.IssueCertificates(ctx, request)
|
result, issueErr := m.backend.IssueCertificates(ctx, request)
|
||||||
message := fmt.Sprintf("Issued %d certificate(s)", len(result.Completed))
|
message := fmt.Sprintf("Issued %d certificate(s)", len(result.Completed))
|
||||||
if warnings := result.WarningCount(); warnings > 0 {
|
if warnings := result.WarningCount(); warnings > 0 {
|
||||||
message += fmt.Sprintf(" with %d activation warning(s)", warnings)
|
message += fmt.Sprintf(" with %d activation warning(s)", warnings)
|
||||||
}
|
}
|
||||||
return operationMsg{message: message, err: issueErr, reload: true}
|
return operationMsg{message: message, err: issueErr, reload: true, certificate: true}
|
||||||
}
|
}
|
||||||
|
return command
|
||||||
case "import":
|
case "import":
|
||||||
zoneID := ""
|
zoneID := ""
|
||||||
if inputs[2] != "" {
|
if inputs[2] != "" {
|
||||||
@@ -1274,21 +1696,159 @@ func (m *Model) submitCertificateForm() tea.Cmd {
|
|||||||
return operationMsg{message: "Certificate revoked", err: revokeErr, reload: true}
|
return operationMsg{message: "Certificate revoked", err: revokeErr, reload: true}
|
||||||
}
|
}
|
||||||
case "renew":
|
case "renew":
|
||||||
return func() tea.Msg {
|
targets := max(1, len(m.filteredLineages()))
|
||||||
ctx, cancel := context.WithTimeout(context.Background(), 6*time.Hour)
|
ctx, cancel := context.WithTimeout(context.Background(), certificateBatchTimeout(targets))
|
||||||
|
m.beginCertificateRun("RENEWING DUE CERTIFICATES", targets, ctx, cancel)
|
||||||
|
command := func() tea.Msg {
|
||||||
defer cancel()
|
defer cancel()
|
||||||
result, renewErr := m.backend.RenewCertificates(ctx, strings.ToLower(inputs[0]), m.certificateConfirmProduction)
|
result, renewErr := m.backend.RenewCertificates(ctx, strings.ToLower(inputs[0]), m.certificateConfirmProduction)
|
||||||
message := fmt.Sprintf("Renewed %d certificate(s)", len(result.Completed))
|
message := fmt.Sprintf("Renewed %d certificate(s)", len(result.Completed))
|
||||||
if warnings := result.WarningCount(); warnings > 0 {
|
if warnings := result.WarningCount(); warnings > 0 {
|
||||||
message += fmt.Sprintf(" with %d activation warning(s)", warnings)
|
message += fmt.Sprintf(" with %d activation warning(s)", warnings)
|
||||||
}
|
}
|
||||||
return operationMsg{message: message, err: renewErr, reload: true}
|
return operationMsg{message: message, err: renewErr, reload: true, certificate: true}
|
||||||
}
|
}
|
||||||
|
return command
|
||||||
}
|
}
|
||||||
m.busy = false
|
m.busy = false
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func waitForBackendEvent(backend Backend) tea.Cmd {
|
||||||
|
source, ok := backend.(interface{ Events() <-chan app.Event })
|
||||||
|
if !ok {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
events := source.Events()
|
||||||
|
if events == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
return func() tea.Msg {
|
||||||
|
event, open := <-events
|
||||||
|
return backendEventMsg{event: event, ok: open}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func certificateTickCmd() tea.Cmd {
|
||||||
|
return tea.Tick(time.Second, func(at time.Time) tea.Msg { return certificateTickMsg(at) })
|
||||||
|
}
|
||||||
|
|
||||||
|
func certificateBatchTimeout(targets int) time.Duration {
|
||||||
|
if targets < 1 {
|
||||||
|
targets = 1
|
||||||
|
}
|
||||||
|
waves := (targets + 2) / 3
|
||||||
|
timeout := time.Duration(waves)*11*time.Minute + 2*time.Minute
|
||||||
|
if timeout > 4*time.Hour {
|
||||||
|
return 4 * time.Hour
|
||||||
|
}
|
||||||
|
return timeout
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *Model) beginCertificateRun(title string, targets int, ctx context.Context, cancel context.CancelFunc) {
|
||||||
|
deadline, _ := ctx.Deadline()
|
||||||
|
m.certificateRun = &certificateRunState{
|
||||||
|
Title: title, StartedAt: time.Now(), Deadline: deadline, TargetCount: max(1, targets),
|
||||||
|
Jobs: make(map[string]domain.Job), Cancel: cancel, Visible: true,
|
||||||
|
}
|
||||||
|
m.certificateRun.Activity = append(m.certificateRun.Activity, certificateActivity{
|
||||||
|
At: time.Now(), State: domain.JobQueued,
|
||||||
|
Message: fmt.Sprintf("Queued %d certificate order(s); up to 3 run concurrently", m.certificateRun.TargetCount),
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *Model) applyBackendEvent(event app.Event) {
|
||||||
|
if event.Kind != "certificate.progress" || m.certificateRun == nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
job, ok := event.Value.(domain.Job)
|
||||||
|
if !ok {
|
||||||
|
if pointer, pointerOK := event.Value.(*domain.Job); pointerOK && pointer != nil {
|
||||||
|
job, ok = *pointer, true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if !ok || job.ID == "" {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
previous, existed := m.certificateRun.Jobs[job.ID]
|
||||||
|
m.certificateRun.Jobs[job.ID] = job
|
||||||
|
if !existed {
|
||||||
|
m.certificateRun.Order = append(m.certificateRun.Order, job.ID)
|
||||||
|
}
|
||||||
|
if existed && previous.State == job.State && previous.Progress == job.Progress && previous.Message == job.Message && previous.Error == job.Error {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
at := job.UpdatedAt
|
||||||
|
if at.IsZero() {
|
||||||
|
at = time.Now()
|
||||||
|
}
|
||||||
|
m.certificateRun.Activity = append(m.certificateRun.Activity, certificateActivity{
|
||||||
|
At: at, JobID: job.ID, State: job.State, Progress: job.Progress, Message: job.Message, Error: job.Error,
|
||||||
|
})
|
||||||
|
if m.certificateRun.ActivityScroll > 0 {
|
||||||
|
m.certificateRun.ActivityScroll++
|
||||||
|
}
|
||||||
|
if len(m.certificateRun.Activity) > 500 {
|
||||||
|
dropped := len(m.certificateRun.Activity) - 500
|
||||||
|
m.certificateRun.Activity = append([]certificateActivity(nil), m.certificateRun.Activity[dropped:]...)
|
||||||
|
m.certificateRun.ActivityScroll = max(0, m.certificateRun.ActivityScroll-dropped)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *Model) updateCertificateRun(message tea.Msg) (tea.Model, tea.Cmd) {
|
||||||
|
key, ok := message.(tea.KeyPressMsg)
|
||||||
|
if !ok {
|
||||||
|
return m, nil
|
||||||
|
}
|
||||||
|
window := certificateActivityWindow(m.height)
|
||||||
|
maxScroll := max(0, len(m.certificateRun.Activity)-window)
|
||||||
|
switch key.String() {
|
||||||
|
case "up", "k":
|
||||||
|
m.certificateRun.ActivityScroll = min(maxScroll, m.certificateRun.ActivityScroll+1)
|
||||||
|
return m, nil
|
||||||
|
case "down", "j":
|
||||||
|
m.certificateRun.ActivityScroll = max(0, m.certificateRun.ActivityScroll-1)
|
||||||
|
return m, nil
|
||||||
|
case "pgup":
|
||||||
|
m.certificateRun.ActivityScroll = min(maxScroll, m.certificateRun.ActivityScroll+window)
|
||||||
|
return m, nil
|
||||||
|
case "pgdown":
|
||||||
|
m.certificateRun.ActivityScroll = max(0, m.certificateRun.ActivityScroll-window)
|
||||||
|
return m, nil
|
||||||
|
case "home":
|
||||||
|
m.certificateRun.ActivityScroll = maxScroll
|
||||||
|
return m, nil
|
||||||
|
case "end":
|
||||||
|
m.certificateRun.ActivityScroll = 0
|
||||||
|
return m, nil
|
||||||
|
case "b":
|
||||||
|
m.certificateRun.Visible = false
|
||||||
|
return m, nil
|
||||||
|
}
|
||||||
|
if m.certificateRun.Done {
|
||||||
|
if key.String() == "enter" || key.String() == "esc" {
|
||||||
|
m.certificateRun = nil
|
||||||
|
}
|
||||||
|
return m, nil
|
||||||
|
}
|
||||||
|
if key.String() == "c" || key.String() == "esc" || key.String() == "ctrl+c" {
|
||||||
|
if !m.certificateRun.CancelRequested {
|
||||||
|
m.certificateRun.CancelRequested = true
|
||||||
|
m.certificateRun.Activity = append(m.certificateRun.Activity, certificateActivity{
|
||||||
|
At: time.Now(), State: domain.JobCancelled, Message: "Cancellation requested; safely cleaning DNS challenges",
|
||||||
|
})
|
||||||
|
if m.certificateRun.Cancel != nil {
|
||||||
|
m.certificateRun.Cancel()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return m, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func certificateActivityWindow(height int) int {
|
||||||
|
return max(2, min(7, height-14))
|
||||||
|
}
|
||||||
|
|
||||||
func (m *Model) resolveZoneValues(values []string) ([]string, error) {
|
func (m *Model) resolveZoneValues(values []string) ([]string, error) {
|
||||||
byID := make(map[string]string, len(m.zones))
|
byID := make(map[string]string, len(m.zones))
|
||||||
byName := make(map[string][]string, len(m.zones))
|
byName := make(map[string][]string, len(m.zones))
|
||||||
@@ -1383,12 +1943,14 @@ func (m *Model) isMutationKey(key string) bool {
|
|||||||
return true
|
return true
|
||||||
case "a":
|
case "a":
|
||||||
return m.screen == screenDashboard || m.screen == screenAccounts
|
return m.screen == screenDashboard || m.screen == screenAccounts
|
||||||
|
case "p":
|
||||||
|
return m.screen == screenZones
|
||||||
case "n":
|
case "n":
|
||||||
return m.screen == screenDNS || m.screen == screenCertificates
|
return m.screen == screenDNS || m.screen == screenCertificates
|
||||||
case "i", "x", "u":
|
case "i", "x", "u":
|
||||||
return m.screen == screenCertificates
|
return m.screen == screenCertificates
|
||||||
case "d":
|
case "d":
|
||||||
return m.screen == screenDNS || m.screen == screenCertificates
|
return m.screen == screenAccounts || m.screen == screenDNS || m.screen == screenCertificates
|
||||||
case "e":
|
case "e":
|
||||||
return m.screen == screenDNS
|
return m.screen == screenDNS
|
||||||
case "s", "m", "t", "v", "h":
|
case "s", "m", "t", "v", "h":
|
||||||
@@ -1493,8 +2055,25 @@ func (m *Model) updateOverlay(message tea.Msg) (tea.Model, tea.Cmd) {
|
|||||||
m.openCredentialForm()
|
m.openCredentialForm()
|
||||||
return m, textinput.Blink
|
return m, textinput.Blink
|
||||||
}
|
}
|
||||||
m.busy = true
|
switch selected - len(screens) {
|
||||||
return m, syncCmd(m.backend)
|
case 1:
|
||||||
|
m.busy = true
|
||||||
|
return m, syncCmd(m.backend)
|
||||||
|
case 2:
|
||||||
|
if m.screen != screenAccounts || len(m.filteredCredentials()) == 0 {
|
||||||
|
m.toast, m.toastAt = "Select a connection in Accounts first", time.Now()
|
||||||
|
return m, nil
|
||||||
|
}
|
||||||
|
m.openRemoveCredentialForm()
|
||||||
|
return m, textinput.Blink
|
||||||
|
case 3:
|
||||||
|
if m.screen != screenZones || len(m.filteredZones()) == 0 {
|
||||||
|
m.toast, m.toastAt = "Select a zone in Zones first", time.Now()
|
||||||
|
return m, nil
|
||||||
|
}
|
||||||
|
m.openPreferredCredentialForm()
|
||||||
|
return m, textinput.Blink
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return m, nil
|
return m, nil
|
||||||
}
|
}
|
||||||
@@ -1737,6 +2316,12 @@ func (m *Model) resizeInputs() {
|
|||||||
for i := range m.credentialInputs {
|
for i := range m.credentialInputs {
|
||||||
m.credentialInputs[i].SetWidth(width)
|
m.credentialInputs[i].SetWidth(width)
|
||||||
}
|
}
|
||||||
|
if m.removeCredential {
|
||||||
|
m.removeCredentialInput.SetWidth(width)
|
||||||
|
}
|
||||||
|
for i := range m.preferCredentialInputs {
|
||||||
|
m.preferCredentialInputs[i].SetWidth(width)
|
||||||
|
}
|
||||||
for i := range m.recordInputs {
|
for i := range m.recordInputs {
|
||||||
m.recordInputs[i].SetWidth(width)
|
m.recordInputs[i].SetWidth(width)
|
||||||
}
|
}
|
||||||
@@ -1778,9 +2363,14 @@ func max(a, b int) int {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func paletteCommands() []string {
|
func paletteCommands() []string {
|
||||||
result := make([]string, 0, len(screens)+2)
|
result := make([]string, 0, len(screens)+4)
|
||||||
for _, item := range screens {
|
for _, item := range screens {
|
||||||
result = append(result, "Go to "+item.name)
|
result = append(result, "Go to "+item.name)
|
||||||
}
|
}
|
||||||
return append(result, "Add Cloudflare account", "Synchronize everything")
|
return append(result,
|
||||||
|
"Add Cloudflare account",
|
||||||
|
"Synchronize everything",
|
||||||
|
"Remove selected Cloudflare connection/token",
|
||||||
|
"Set selected zone preferred connection",
|
||||||
|
)
|
||||||
}
|
}
|
||||||
+364
-15
@@ -9,6 +9,7 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
|
|
||||||
tea "charm.land/bubbletea/v2"
|
tea "charm.land/bubbletea/v2"
|
||||||
|
"charm.land/lipgloss/v2"
|
||||||
|
|
||||||
"github.com/MeghdadFadaee/domainops/internal/app"
|
"github.com/MeghdadFadaee/domainops/internal/app"
|
||||||
"github.com/MeghdadFadaee/domainops/internal/domain"
|
"github.com/MeghdadFadaee/domainops/internal/domain"
|
||||||
@@ -713,6 +714,340 @@ func TestLoadingCommandPaletteRejectsMutationEntries(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestRemoveCredentialCapturesExactIDAndDisclosesAffectedRoutes(t *testing.T) {
|
||||||
|
backend := &fakeBackend{}
|
||||||
|
model := New(backend, Options{})
|
||||||
|
model.screen = screenAccounts
|
||||||
|
model.credentials = []domain.Credential{
|
||||||
|
{ID: "credential-a", Label: "Primary", Provider: domain.ProviderCloudflare, Status: domain.CredentialValid},
|
||||||
|
{ID: "credential-b", Label: "Retiring", Provider: domain.ProviderCloudflare, Kind: domain.CredentialAccountToken, AccountHint: "account-main", Status: domain.CredentialValid},
|
||||||
|
}
|
||||||
|
model.zones = []domain.Zone{
|
||||||
|
{ID: "zone-a", Name: "example.com", PreferredCredentialID: "credential-b"},
|
||||||
|
{ID: "zone-b", Name: "example.net", PreferredCredentialID: "credential-b"},
|
||||||
|
}
|
||||||
|
model.rowOffset = 1
|
||||||
|
|
||||||
|
_, blink := model.Update(tea.KeyPressMsg{Code: 'd', Text: "d"})
|
||||||
|
if blink == nil || !model.removeCredential || model.removeCredentialID != "credential-b" || model.removeCredentialInput.Value() != "" {
|
||||||
|
t.Fatalf("remove form = open:%v id:%q input:%q cmd:%v", model.removeCredential, model.removeCredentialID, model.removeCredentialInput.Value(), blink != nil)
|
||||||
|
}
|
||||||
|
view := model.View().Content
|
||||||
|
for _, expected := range []string{"Retiring", "credential-b", "account_token", "account-main", "2 preferred zone route", "example.com", "example.net", "reassigned"} {
|
||||||
|
if !strings.Contains(view, expected) {
|
||||||
|
t.Fatalf("remove form does not disclose %q: %q", expected, view)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// A refresh/reorder after opening must not redirect removal to the new row.
|
||||||
|
_, _ = model.Update(loadMsg{credentials: []domain.Credential{
|
||||||
|
{ID: "credential-b", Label: "Retiring", Provider: domain.ProviderCloudflare, Kind: domain.CredentialAccountToken, AccountHint: "account-main", Status: domain.CredentialValid},
|
||||||
|
{ID: "credential-a", Label: "Primary", Provider: domain.ProviderCloudflare, Status: domain.CredentialValid},
|
||||||
|
}, zones: model.zones})
|
||||||
|
model.removeCredentialInput.SetValue("Retiring")
|
||||||
|
_, cmd := model.Update(tea.KeyPressMsg{Code: tea.KeyEnter})
|
||||||
|
if cmd == nil || model.removeCredential || !model.busy {
|
||||||
|
t.Fatalf("confirmed removal = cmd:%v open:%v busy:%v", cmd != nil, model.removeCredential, model.busy)
|
||||||
|
}
|
||||||
|
message, ok := cmd().(operationMsg)
|
||||||
|
if !ok || !message.reload || message.err != nil {
|
||||||
|
t.Fatalf("remove result = %#v", message)
|
||||||
|
}
|
||||||
|
if len(backend.deletedCredentials) != 1 || backend.deletedCredentials[0] != "credential-b" {
|
||||||
|
t.Fatalf("deleted credential IDs = %v", backend.deletedCredentials)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestRemoveCredentialCancellationAndStaleConnectionAreSafe(t *testing.T) {
|
||||||
|
backend := &fakeBackend{}
|
||||||
|
model := New(backend, Options{})
|
||||||
|
model.screen = screenAccounts
|
||||||
|
model.credentials = []domain.Credential{{ID: "credential", Label: "Production", Provider: domain.ProviderCloudflare, Status: domain.CredentialValid}}
|
||||||
|
|
||||||
|
_, _ = model.Update(tea.KeyPressMsg{Code: 'd', Text: "d"})
|
||||||
|
model.removeCredentialInput.SetValue("Production")
|
||||||
|
_, _ = model.Update(tea.KeyPressMsg{Code: tea.KeyEscape})
|
||||||
|
if model.removeCredential || model.removeCredentialID != "" || model.removeCredentialExpected != "" || model.removeCredentialInput.Value() != "" {
|
||||||
|
t.Fatalf("cancel retained remove state: open=%v id=%q label=%q input=%q", model.removeCredential, model.removeCredentialID, model.removeCredentialExpected, model.removeCredentialInput.Value())
|
||||||
|
}
|
||||||
|
|
||||||
|
_, _ = model.Update(tea.KeyPressMsg{Code: 'd', Text: "d"})
|
||||||
|
model.removeCredentialInput.SetValue("Production")
|
||||||
|
model.credentials = nil
|
||||||
|
_, cmd := model.Update(tea.KeyPressMsg{Code: tea.KeyEnter})
|
||||||
|
if cmd != nil || model.err == nil || len(backend.deletedCredentials) != 0 {
|
||||||
|
t.Fatalf("stale remove mutated: cmd=%v err=%v calls=%v", cmd != nil, model.err, backend.deletedCredentials)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestRemoveCredentialRejectsChangedAffectedRoutes(t *testing.T) {
|
||||||
|
backend := &fakeBackend{}
|
||||||
|
model := New(backend, Options{})
|
||||||
|
model.screen = screenAccounts
|
||||||
|
model.credentials = []domain.Credential{{ID: "credential", Label: "Production", Provider: domain.ProviderCloudflare, Status: domain.CredentialValid}}
|
||||||
|
model.zones = []domain.Zone{{ID: "zone-a", Name: "example.com", PreferredCredentialID: "credential"}}
|
||||||
|
|
||||||
|
_, _ = model.Update(tea.KeyPressMsg{Code: 'd', Text: "d"})
|
||||||
|
model.removeCredentialInput.SetValue("Production")
|
||||||
|
model.zones = append(model.zones, domain.Zone{ID: "zone-b", Name: "example.net", PreferredCredentialID: "credential"})
|
||||||
|
_, cmd := model.Update(tea.KeyPressMsg{Code: tea.KeyEnter})
|
||||||
|
if cmd != nil || model.err == nil || !strings.Contains(model.err.Error(), "affected zone routes changed") || len(backend.deletedCredentials) != 0 {
|
||||||
|
t.Fatalf("changed route disclosure mutated: cmd=%v err=%v calls=%v", cmd != nil, model.err, backend.deletedCredentials)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestRemoveCredentialSurfacesFailClosedReplacementError(t *testing.T) {
|
||||||
|
backend := &fakeBackend{deleteCredentialErr: errors.New("zone example.com has no proven replacement")}
|
||||||
|
model := New(backend, Options{})
|
||||||
|
model.screen = screenAccounts
|
||||||
|
model.credentials = []domain.Credential{{ID: "credential", Label: "Production", Provider: domain.ProviderCloudflare, Status: domain.CredentialValid}}
|
||||||
|
|
||||||
|
_, _ = model.Update(tea.KeyPressMsg{Code: 'd', Text: "d"})
|
||||||
|
model.removeCredentialInput.SetValue("Production")
|
||||||
|
_, cmd := model.Update(tea.KeyPressMsg{Code: tea.KeyEnter})
|
||||||
|
if cmd == nil {
|
||||||
|
t.Fatal("confirmed removal did not call backend")
|
||||||
|
}
|
||||||
|
_, reload := model.Update(cmd())
|
||||||
|
if reload == nil || model.err == nil || !strings.Contains(model.err.Error(), "no proven replacement") {
|
||||||
|
t.Fatalf("replacement failure = reload:%v err:%v", reload != nil, model.err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestPreferredCredentialRejectsAmbiguousLabelAndInvalidCandidates(t *testing.T) {
|
||||||
|
model := New(&fakeBackend{}, Options{})
|
||||||
|
zone := domain.Zone{ID: "zone", Name: "example.com", Provider: domain.ProviderCloudflare}
|
||||||
|
model.screen = screenZones
|
||||||
|
model.zones = []domain.Zone{zone}
|
||||||
|
model.credentials = []domain.Credential{
|
||||||
|
{ID: "credential-a", Label: "Production", Provider: domain.ProviderCloudflare, Status: domain.CredentialValid},
|
||||||
|
{ID: "credential-b", Label: "production", Provider: domain.ProviderCloudflare, Status: domain.CredentialValid},
|
||||||
|
{ID: "credential-invalid", Label: "Invalid", Provider: domain.ProviderCloudflare, Status: domain.CredentialInvalid},
|
||||||
|
{ID: "credential-other", Label: "Other", Provider: "other", Status: domain.CredentialValid},
|
||||||
|
}
|
||||||
|
|
||||||
|
_, _ = model.Update(tea.KeyPressMsg{Code: 'p', Text: "p"})
|
||||||
|
if model.preferCredentialInputs[0].Value() != "" || model.preferCredentialInputs[1].Value() != "" {
|
||||||
|
t.Fatalf("preference confirmation was prefilled: %#v", model.preferCredentialInputs)
|
||||||
|
}
|
||||||
|
model.preferCredentialInputs[0].SetValue("Production")
|
||||||
|
_, cmd := model.Update(tea.KeyPressMsg{Code: tea.KeyEnter})
|
||||||
|
if cmd != nil || model.preferCredentialFocus != 0 || model.err == nil || !strings.Contains(model.err.Error(), "ambiguous") {
|
||||||
|
t.Fatalf("ambiguous label = cmd:%v focus:%d err:%v", cmd != nil, model.preferCredentialFocus, model.err)
|
||||||
|
}
|
||||||
|
for _, test := range []struct {
|
||||||
|
value string
|
||||||
|
want string
|
||||||
|
}{{"credential-invalid", "invalid"}, {"credential-other", "provider"}} {
|
||||||
|
model.preferCredentialInputs[0].SetValue(test.value)
|
||||||
|
_, _ = model.Update(tea.KeyPressMsg{Code: tea.KeyEnter})
|
||||||
|
if model.err == nil || !strings.Contains(model.err.Error(), test.want) {
|
||||||
|
t.Fatalf("selector %q error = %v, want %q", test.value, model.err, test.want)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestPreferredCredentialCapturesIDAcrossRefreshAndCallsExactZone(t *testing.T) {
|
||||||
|
backend := &fakeBackend{}
|
||||||
|
model := New(backend, Options{})
|
||||||
|
model.screen = screenZones
|
||||||
|
model.zones = []domain.Zone{{ID: "zone-id", Name: "example.com", Provider: domain.ProviderCloudflare, PreferredCredentialID: "credential-old"}}
|
||||||
|
model.credentials = []domain.Credential{
|
||||||
|
{ID: "credential-old", Label: "Old", Provider: domain.ProviderCloudflare, Status: domain.CredentialValid},
|
||||||
|
{ID: "credential-selected", Label: "Replacement", Provider: domain.ProviderCloudflare, Status: domain.CredentialValid},
|
||||||
|
}
|
||||||
|
|
||||||
|
_, _ = model.Update(tea.KeyPressMsg{Code: 'p', Text: "p"})
|
||||||
|
model.preferCredentialInputs[0].SetValue("Replacement")
|
||||||
|
_, _ = model.Update(tea.KeyPressMsg{Code: tea.KeyEnter})
|
||||||
|
if model.preferCredentialFocus != 1 || model.preferResolvedCredentialID != "credential-selected" {
|
||||||
|
t.Fatalf("captured credential = focus:%d id:%q err:%v", model.preferCredentialFocus, model.preferResolvedCredentialID, model.err)
|
||||||
|
}
|
||||||
|
|
||||||
|
// The label becomes ambiguous after capture. Final confirmation must retain
|
||||||
|
// the immutable ID instead of resolving the label to a different row.
|
||||||
|
_, _ = model.Update(loadMsg{zones: model.zones, credentials: []domain.Credential{
|
||||||
|
{ID: "credential-new", Label: "Replacement", Provider: domain.ProviderCloudflare, Status: domain.CredentialValid},
|
||||||
|
{ID: "credential-selected", Label: "Replacement", Provider: domain.ProviderCloudflare, Status: domain.CredentialValid},
|
||||||
|
{ID: "credential-old", Label: "Old", Provider: domain.ProviderCloudflare, Status: domain.CredentialValid},
|
||||||
|
}})
|
||||||
|
model.preferCredentialInputs[1].SetValue("example.com")
|
||||||
|
_, cmd := model.Update(tea.KeyPressMsg{Code: tea.KeyEnter})
|
||||||
|
if cmd == nil || model.preferCredential || !model.busy {
|
||||||
|
t.Fatalf("preference submit = cmd:%v open:%v busy:%v err:%v", cmd != nil, model.preferCredential, model.busy, model.err)
|
||||||
|
}
|
||||||
|
message, ok := cmd().(operationMsg)
|
||||||
|
if !ok || !message.reload || message.err != nil {
|
||||||
|
t.Fatalf("preference result = %#v", message)
|
||||||
|
}
|
||||||
|
if fmt.Sprint(backend.preferredZones) != "[zone-id]" || fmt.Sprint(backend.preferredCredentials) != "[credential-selected]" {
|
||||||
|
t.Fatalf("preferred calls = zones:%v credentials:%v", backend.preferredZones, backend.preferredCredentials)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestPreferredCredentialFormFitsMinimumTerminalAndShowsRoutingIdentity(t *testing.T) {
|
||||||
|
model := New(&fakeBackend{}, Options{})
|
||||||
|
_, _ = model.Update(tea.WindowSizeMsg{Width: 64, Height: 18})
|
||||||
|
model.screen = screenZones
|
||||||
|
model.accounts = []domain.RemoteAccount{{ID: "account-id", Name: "Primary"}}
|
||||||
|
model.zones = []domain.Zone{{ID: "zone-id", Name: "example.com", Provider: domain.ProviderCloudflare, AccountID: "account-id", PreferredCredentialID: "credential-current"}}
|
||||||
|
model.credentials = []domain.Credential{
|
||||||
|
{ID: "credential-current", Label: "Current", Provider: domain.ProviderCloudflare, Kind: domain.CredentialUserToken, Status: domain.CredentialValid, Capabilities: []string{"dns:read", "dns:write"}},
|
||||||
|
{ID: "credential-next", Label: "Next", Provider: domain.ProviderCloudflare, Kind: domain.CredentialAccountToken, AccountHint: "account-id", Status: domain.CredentialValid, Capabilities: []string{"dns:read"}},
|
||||||
|
}
|
||||||
|
|
||||||
|
_, _ = model.Update(tea.KeyPressMsg{Code: 'p', Text: "p"})
|
||||||
|
view := model.View().Content
|
||||||
|
if height := lipgloss.Height(view); height > 18 {
|
||||||
|
t.Fatalf("minimum-terminal preference modal height = %d\n%s", height, view)
|
||||||
|
}
|
||||||
|
for _, expected := range []string{"example.com", "zone-id", "Primary", "account-id", "credential-current", "Current", "current"} {
|
||||||
|
if !strings.Contains(view, expected) {
|
||||||
|
t.Fatalf("preference form does not show %q: %q", expected, view)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestCertificateRunRendersBoundedProgressAndCancelsSafely(t *testing.T) {
|
||||||
|
model := New(&fakeBackend{}, Options{})
|
||||||
|
_, _ = model.Update(tea.WindowSizeMsg{Width: 64, Height: 18})
|
||||||
|
ctx, cancel := context.WithCancel(context.Background())
|
||||||
|
model.beginCertificateRun("ISSUING WILDCARD CERTIFICATES", 2, ctx, cancel)
|
||||||
|
now := time.Now().UTC()
|
||||||
|
model.applyBackendEvent(app.Event{Kind: "certificate.progress", Value: domain.Job{
|
||||||
|
ID: "job-1", Kind: "certificate.issue", State: domain.JobWaitingForDNS,
|
||||||
|
Progress: 45, Message: "DNS challenge published for _acme-challenge.example.com.; waiting for authoritative propagation", UpdatedAt: now,
|
||||||
|
}})
|
||||||
|
view := model.View().Content
|
||||||
|
if height := lipgloss.Height(view); height > 18 {
|
||||||
|
t.Fatalf("certificate progress height = %d\n%s", height, view)
|
||||||
|
}
|
||||||
|
for _, expected := range []string{"ISSUING WILDCARD CERTIFICATES", "DNS", "DNS challenge published", "45%", "cancel safely"} {
|
||||||
|
if !strings.Contains(view, expected) {
|
||||||
|
t.Fatalf("certificate progress does not show %q: %q", expected, view)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
_, _ = model.Update(tea.KeyPressMsg{Code: 'b', Text: "b"})
|
||||||
|
if model.certificateRun.Visible || !strings.Contains(model.View().Content, "progress") {
|
||||||
|
t.Fatalf("backgrounded certificate run = visible:%v view:%q", model.certificateRun.Visible, model.View().Content)
|
||||||
|
}
|
||||||
|
_, quit := model.Update(tea.KeyPressMsg{Code: 'q', Text: "q"})
|
||||||
|
if quit != nil || !model.certificateRun.Visible || !strings.Contains(model.toast, "DNS cleanup") {
|
||||||
|
t.Fatalf("active certificate quit guard = cmd:%v visible:%v toast:%q", quit != nil, model.certificateRun.Visible, model.toast)
|
||||||
|
}
|
||||||
|
_, _ = model.Update(tea.KeyPressMsg{Code: 'b', Text: "b"})
|
||||||
|
_, _ = model.Update(tea.KeyPressMsg{Code: 'o', Text: "o"})
|
||||||
|
if !model.certificateRun.Visible {
|
||||||
|
t.Fatal("certificate progress shortcut did not reopen the console")
|
||||||
|
}
|
||||||
|
|
||||||
|
_, command := model.Update(tea.KeyPressMsg{Code: 'c', Text: "c"})
|
||||||
|
if command != nil || !model.certificateRun.CancelRequested {
|
||||||
|
t.Fatalf("cancel state = command:%v requested:%v", command != nil, model.certificateRun.CancelRequested)
|
||||||
|
}
|
||||||
|
select {
|
||||||
|
case <-ctx.Done():
|
||||||
|
default:
|
||||||
|
t.Fatal("certificate run context was not cancelled")
|
||||||
|
}
|
||||||
|
if view := model.View().Content; !strings.Contains(view, "CANCELLING SAFELY") || !strings.Contains(view, "cleanup to finish") {
|
||||||
|
t.Fatalf("cancelling progress view = %q", view)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestCertificateRunCompletionKeepsSummaryUntilDismissed(t *testing.T) {
|
||||||
|
model := New(&fakeBackend{}, Options{})
|
||||||
|
ctx, cancel := context.WithCancel(context.Background())
|
||||||
|
model.beginCertificateRun("ISSUING WILDCARD CERTIFICATES", 1, ctx, cancel)
|
||||||
|
_, _ = model.Update(operationMsg{message: "Issued 0 certificate(s)", err: errors.New("propagation deadline exceeded"), certificate: true})
|
||||||
|
if model.certificateRun == nil || !model.certificateRun.Done || !strings.Contains(model.View().Content, "propagation deadline exceeded") {
|
||||||
|
t.Fatalf("completion summary = %#v", model.certificateRun)
|
||||||
|
}
|
||||||
|
_, _ = model.Update(tea.KeyPressMsg{Code: tea.KeyEnter})
|
||||||
|
if model.certificateRun != nil {
|
||||||
|
t.Fatal("completed certificate summary was not dismissed")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestCertificateRunActivityCanScrollWithoutLosingTail(t *testing.T) {
|
||||||
|
model := New(&fakeBackend{}, Options{})
|
||||||
|
_, _ = model.Update(tea.WindowSizeMsg{Width: 76, Height: 18})
|
||||||
|
ctx, cancel := context.WithCancel(context.Background())
|
||||||
|
defer cancel()
|
||||||
|
model.beginCertificateRun("ISSUING WILDCARD CERTIFICATES", 1, ctx, cancel)
|
||||||
|
for index := range 10 {
|
||||||
|
model.applyBackendEvent(app.Event{Kind: "certificate.progress", Value: domain.Job{
|
||||||
|
ID: "job", State: domain.JobRunning, Progress: index + 1,
|
||||||
|
Message: fmt.Sprintf("stage-%02d", index), UpdatedAt: time.Now().Add(time.Duration(index) * time.Second),
|
||||||
|
}})
|
||||||
|
}
|
||||||
|
if view := model.View().Content; !strings.Contains(view, "stage-09") {
|
||||||
|
t.Fatalf("activity did not follow newest event: %q", view)
|
||||||
|
}
|
||||||
|
_, _ = model.Update(tea.KeyPressMsg{Code: tea.KeyHome})
|
||||||
|
if view := model.View().Content; !strings.Contains(view, "stage-00") || strings.Contains(view, "stage-09") {
|
||||||
|
t.Fatalf("activity home did not show oldest events: %q", view)
|
||||||
|
}
|
||||||
|
_, _ = model.Update(tea.KeyPressMsg{Code: tea.KeyEnd})
|
||||||
|
if view := model.View().Content; !strings.Contains(view, "stage-09") {
|
||||||
|
t.Fatalf("activity end did not return to live tail: %q", view)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestPreferredCredentialCancellationAndStaleRouteAreSafe(t *testing.T) {
|
||||||
|
backend := &fakeBackend{}
|
||||||
|
model := New(backend, Options{})
|
||||||
|
model.screen = screenZones
|
||||||
|
model.zones = []domain.Zone{{ID: "zone", Name: "example.com", Provider: domain.ProviderCloudflare, PreferredCredentialID: "old"}}
|
||||||
|
model.credentials = []domain.Credential{{ID: "new", Label: "New", Provider: domain.ProviderCloudflare, Status: domain.CredentialValid}}
|
||||||
|
|
||||||
|
_, _ = model.Update(tea.KeyPressMsg{Code: 'p', Text: "p"})
|
||||||
|
model.preferCredentialInputs[0].SetValue("new")
|
||||||
|
_, _ = model.Update(tea.KeyPressMsg{Code: tea.KeyEscape})
|
||||||
|
if model.preferCredential || model.preferZoneID != "" || model.preferResolvedCredentialID != "" || len(model.preferCredentialInputs) != 2 || model.preferCredentialInputs[0].Value() != "" {
|
||||||
|
t.Fatalf("cancel retained preference state: %#v", model)
|
||||||
|
}
|
||||||
|
|
||||||
|
_, _ = model.Update(tea.KeyPressMsg{Code: 'p', Text: "p"})
|
||||||
|
model.preferCredentialInputs[0].SetValue("new")
|
||||||
|
_, _ = model.Update(tea.KeyPressMsg{Code: tea.KeyEnter})
|
||||||
|
model.zones[0].PreferredCredentialID = "changed-elsewhere"
|
||||||
|
model.preferCredentialInputs[1].SetValue("example.com")
|
||||||
|
_, cmd := model.Update(tea.KeyPressMsg{Code: tea.KeyEnter})
|
||||||
|
if cmd != nil || model.err == nil || !strings.Contains(model.err.Error(), "route changed") || len(backend.preferredZones) != 0 {
|
||||||
|
t.Fatalf("stale route mutated: cmd=%v err=%v calls=%v", cmd != nil, model.err, backend.preferredZones)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestAccountAndZoneMutationsRespectRecoveryBusyAndLoadingGuards(t *testing.T) {
|
||||||
|
tests := []struct {
|
||||||
|
name string
|
||||||
|
screen screen
|
||||||
|
key rune
|
||||||
|
blocked func(*Model)
|
||||||
|
}{
|
||||||
|
{"remove recovery", screenAccounts, 'd', func(m *Model) { m.recoveryBlocked = true }},
|
||||||
|
{"remove busy", screenAccounts, 'd', func(m *Model) { m.busy = true }},
|
||||||
|
{"remove loading", screenAccounts, 'd', func(m *Model) { m.loading = true }},
|
||||||
|
{"prefer recovery", screenZones, 'p', func(m *Model) { m.recoveryBlocked = true }},
|
||||||
|
{"prefer busy", screenZones, 'p', func(m *Model) { m.busy = true }},
|
||||||
|
{"prefer loading", screenZones, 'p', func(m *Model) { m.loading = true }},
|
||||||
|
}
|
||||||
|
for _, test := range tests {
|
||||||
|
t.Run(test.name, func(t *testing.T) {
|
||||||
|
model := New(&fakeBackend{}, Options{})
|
||||||
|
model.screen = test.screen
|
||||||
|
model.credentials = []domain.Credential{{ID: "credential", Label: "Production", Provider: domain.ProviderCloudflare, Status: domain.CredentialValid}}
|
||||||
|
model.zones = []domain.Zone{{ID: "zone", Name: "example.com", Provider: domain.ProviderCloudflare}}
|
||||||
|
test.blocked(model)
|
||||||
|
_, cmd := model.Update(tea.KeyPressMsg{Code: test.key, Text: string(test.key)})
|
||||||
|
if cmd != nil || model.removeCredential || model.preferCredential || model.toast == "" {
|
||||||
|
t.Fatalf("blocked mutation = cmd:%v remove:%v prefer:%v toast:%q", cmd != nil, model.removeCredential, model.preferCredential, model.toast)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func TestFirstRunVaultRequiresConfirmation(t *testing.T) {
|
func TestFirstRunVaultRequiresConfirmation(t *testing.T) {
|
||||||
backend := &fakeBackend{locked: true}
|
backend := &fakeBackend{locked: true}
|
||||||
model := New(backend, Options{FirstRun: true})
|
model := New(backend, Options{FirstRun: true})
|
||||||
@@ -754,21 +1089,26 @@ func TestExistingVaultAcceptsLegacyShortPassword(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type fakeBackend struct {
|
type fakeBackend struct {
|
||||||
locked bool
|
locked bool
|
||||||
unlockCalls int
|
unlockCalls int
|
||||||
unlockNilCalls int
|
unlockNilCalls int
|
||||||
unlockErr error
|
unlockErr error
|
||||||
dnsZones []string
|
dnsZones []string
|
||||||
zones []domain.Zone
|
zones []domain.Zone
|
||||||
deleteCalls int
|
deleteCalls int
|
||||||
tlsSettings map[string]domain.EdgeTLSSettings
|
deletedCredentials []string
|
||||||
tlsErr error
|
deleteCredentialErr error
|
||||||
tlsZones []string
|
preferredZones []string
|
||||||
updateTLSZones []string
|
preferredCredentials []string
|
||||||
updateTLSDrafts []domain.EdgeTLSSettings
|
preferredCredentialErr error
|
||||||
issueRequests []app.IssueZonesRequest
|
tlsSettings map[string]domain.EdgeTLSSettings
|
||||||
revokeLineages []string
|
tlsErr error
|
||||||
revokeConfirmations []string
|
tlsZones []string
|
||||||
|
updateTLSZones []string
|
||||||
|
updateTLSDrafts []domain.EdgeTLSSettings
|
||||||
|
issueRequests []app.IssueZonesRequest
|
||||||
|
revokeLineages []string
|
||||||
|
revokeConfirmations []string
|
||||||
}
|
}
|
||||||
|
|
||||||
func (f *fakeBackend) VaultLocked() bool { return f.locked }
|
func (f *fakeBackend) VaultLocked() bool { return f.locked }
|
||||||
@@ -804,6 +1144,15 @@ func (f *fakeBackend) Audit(context.Context, int) ([]domain.AuditEvent, error) {
|
|||||||
func (f *fakeBackend) AddCloudflareCredential(context.Context, app.AddCredentialInput) (domain.Credential, error) {
|
func (f *fakeBackend) AddCloudflareCredential(context.Context, app.AddCredentialInput) (domain.Credential, error) {
|
||||||
return domain.Credential{}, nil
|
return domain.Credential{}, nil
|
||||||
}
|
}
|
||||||
|
func (f *fakeBackend) DeleteCredential(_ context.Context, credentialID string) error {
|
||||||
|
f.deletedCredentials = append(f.deletedCredentials, credentialID)
|
||||||
|
return f.deleteCredentialErr
|
||||||
|
}
|
||||||
|
func (f *fakeBackend) SetZonePreferredCredential(_ context.Context, zoneID, credentialID string) (domain.Zone, error) {
|
||||||
|
f.preferredZones = append(f.preferredZones, zoneID)
|
||||||
|
f.preferredCredentials = append(f.preferredCredentials, credentialID)
|
||||||
|
return domain.Zone{ID: zoneID, PreferredCredentialID: credentialID}, f.preferredCredentialErr
|
||||||
|
}
|
||||||
func (f *fakeBackend) SyncAll(context.Context) ([]domain.Job, error) { return nil, nil }
|
func (f *fakeBackend) SyncAll(context.Context) ([]domain.Job, error) { return nil, nil }
|
||||||
func (f *fakeBackend) CreateDNSRecord(context.Context, string, domain.DNSRecord) (domain.DNSRecord, error) {
|
func (f *fakeBackend) CreateDNSRecord(context.Context, string, domain.DNSRecord) (domain.DNSRecord, error) {
|
||||||
return domain.DNSRecord{}, nil
|
return domain.DNSRecord{}, nil
|
||||||
|
|||||||
+252
-4
@@ -29,6 +29,15 @@ func (m *Model) render() string {
|
|||||||
if m.addCredential {
|
if m.addCredential {
|
||||||
return m.renderCredentialForm()
|
return m.renderCredentialForm()
|
||||||
}
|
}
|
||||||
|
if m.removeCredential {
|
||||||
|
return m.renderRemoveCredentialForm()
|
||||||
|
}
|
||||||
|
if m.preferCredential {
|
||||||
|
return m.renderPreferredCredentialForm()
|
||||||
|
}
|
||||||
|
if m.certificateRun != nil && m.certificateRun.Visible {
|
||||||
|
return m.renderCertificateRun()
|
||||||
|
}
|
||||||
if m.editRecord {
|
if m.editRecord {
|
||||||
return m.renderRecordForm()
|
return m.renderRecordForm()
|
||||||
}
|
}
|
||||||
@@ -65,6 +74,114 @@ func (m *Model) render() string {
|
|||||||
return m.theme.app.Width(m.width).Height(m.height).Render(header + "\n" + body + "\n" + foot)
|
return m.theme.app.Width(m.width).Height(m.height).Render(header + "\n" + body + "\n" + foot)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (m *Model) renderCertificateRun() string {
|
||||||
|
run := m.certificateRun
|
||||||
|
contentWidth := max(36, min(86, m.width-14))
|
||||||
|
progress, succeeded, failed, waiting, running := certificateRunSummary(run)
|
||||||
|
state := m.theme.statusWarn.Render("◌ WORKING")
|
||||||
|
if run.CancelRequested && !run.Done {
|
||||||
|
state = m.theme.statusWarn.Render("◌ CANCELLING SAFELY")
|
||||||
|
}
|
||||||
|
if run.Done && run.Err == nil {
|
||||||
|
state = m.theme.statusOK.Render("● COMPLETE")
|
||||||
|
}
|
||||||
|
if run.Done && run.Err != nil {
|
||||||
|
state = m.theme.statusBad.Render("● FINISHED WITH ERRORS")
|
||||||
|
}
|
||||||
|
elapsed := time.Since(run.StartedAt).Round(time.Second)
|
||||||
|
remaining := time.Until(run.Deadline).Round(time.Second)
|
||||||
|
if remaining < 0 {
|
||||||
|
remaining = 0
|
||||||
|
}
|
||||||
|
lines := []string{
|
||||||
|
m.theme.brand.Render(run.Title),
|
||||||
|
state + m.theme.mutedText.Render(fmt.Sprintf(" %d/%d done · %d DNS · %d failed · %d active", succeeded, run.TargetCount, waiting, failed, running)),
|
||||||
|
renderProgressBar(m.theme, contentWidth, progress),
|
||||||
|
m.theme.mutedText.Render(certificateRunTiming(elapsed, remaining, run.Deadline)),
|
||||||
|
}
|
||||||
|
maxEntries := certificateActivityWindow(m.height)
|
||||||
|
end := max(0, len(run.Activity)-run.ActivityScroll)
|
||||||
|
start := max(0, end-maxEntries)
|
||||||
|
position := "empty"
|
||||||
|
if end > 0 {
|
||||||
|
position = fmt.Sprintf("%d–%d / %d", start+1, end, len(run.Activity))
|
||||||
|
}
|
||||||
|
lines = append(lines, m.theme.panelTitle.Render("ACTIVITY · "+position+" · ↑/↓ scroll"))
|
||||||
|
for _, activity := range run.Activity[start:end] {
|
||||||
|
icon := "◌"
|
||||||
|
style := m.theme.mutedText
|
||||||
|
switch activity.State {
|
||||||
|
case domain.JobSucceeded:
|
||||||
|
icon, style = "✓", m.theme.statusOK
|
||||||
|
case domain.JobFailed:
|
||||||
|
icon, style = "!", m.theme.statusBad
|
||||||
|
case domain.JobCancelled:
|
||||||
|
icon, style = "×", m.theme.statusWarn
|
||||||
|
case domain.JobWaitingForDNS:
|
||||||
|
icon, style = "↻", m.theme.statusWarn
|
||||||
|
}
|
||||||
|
message := activity.Message
|
||||||
|
if activity.Error != "" {
|
||||||
|
message += " · " + activity.Error
|
||||||
|
}
|
||||||
|
line := fmt.Sprintf("%s %s %3d%% %s", activity.At.Format("15:04:05"), icon, activity.Progress, message)
|
||||||
|
lines = append(lines, style.Render(truncate(line, contentWidth)))
|
||||||
|
}
|
||||||
|
if run.Done {
|
||||||
|
summary := run.Summary
|
||||||
|
if run.Err != nil {
|
||||||
|
summary += " · " + run.Err.Error()
|
||||||
|
}
|
||||||
|
lines = append(lines, m.theme.mutedText.Render(truncate(summary, contentWidth)), m.theme.mutedText.Render("Enter / Esc close"))
|
||||||
|
} else if run.CancelRequested {
|
||||||
|
lines = append(lines, m.theme.mutedText.Render("Waiting for ACME/DNS cleanup to finish…"))
|
||||||
|
} else {
|
||||||
|
lines = append(lines, m.theme.mutedText.Render("↑/↓ scroll · b background · c/Esc cancel safely"))
|
||||||
|
}
|
||||||
|
modal := m.theme.modal.Width(min(92, m.width-8)).Render(strings.Join(lines, "\n"))
|
||||||
|
return m.theme.app.Width(m.width).Height(m.height).Render(lipgloss.Place(m.width, m.height, lipgloss.Center, lipgloss.Center, modal))
|
||||||
|
}
|
||||||
|
|
||||||
|
func certificateRunTiming(elapsed, remaining time.Duration, deadline time.Time) string {
|
||||||
|
if deadline.IsZero() {
|
||||||
|
return fmt.Sprintf("Elapsed %s · bounded by the operation context", elapsed)
|
||||||
|
}
|
||||||
|
return fmt.Sprintf("Elapsed %s · safety deadline in %s", elapsed, remaining)
|
||||||
|
}
|
||||||
|
|
||||||
|
func certificateRunSummary(run *certificateRunState) (progress, succeeded, failed, waiting, running int) {
|
||||||
|
if run == nil || run.TargetCount < 1 {
|
||||||
|
return 0, 0, 0, 0, 0
|
||||||
|
}
|
||||||
|
total := 0
|
||||||
|
for _, job := range run.Jobs {
|
||||||
|
total += max(0, min(100, job.Progress))
|
||||||
|
switch job.State {
|
||||||
|
case domain.JobSucceeded:
|
||||||
|
succeeded++
|
||||||
|
case domain.JobFailed, domain.JobCancelled:
|
||||||
|
failed++
|
||||||
|
case domain.JobWaitingForDNS:
|
||||||
|
waiting++
|
||||||
|
case domain.JobRunning, domain.JobQueued:
|
||||||
|
running++
|
||||||
|
}
|
||||||
|
}
|
||||||
|
progress = min(100, total/run.TargetCount)
|
||||||
|
if run.Done && run.Err == nil {
|
||||||
|
progress = 100
|
||||||
|
}
|
||||||
|
return progress, succeeded, failed, waiting, running
|
||||||
|
}
|
||||||
|
|
||||||
|
func renderProgressBar(theme theme, width, progress int) string {
|
||||||
|
barWidth := max(10, width-2)
|
||||||
|
filled := barWidth * max(0, min(100, progress)) / 100
|
||||||
|
done := lipgloss.NewStyle().Background(theme.primary).Render(strings.Repeat(" ", filled))
|
||||||
|
pending := lipgloss.NewStyle().Background(theme.surface2).Render(strings.Repeat(" ", barWidth-filled))
|
||||||
|
return "[" + done + pending + "]"
|
||||||
|
}
|
||||||
|
|
||||||
func (m *Model) renderHeader() string {
|
func (m *Model) renderHeader() string {
|
||||||
brand := m.theme.brand.Render("◆ DOMAINOPS")
|
brand := m.theme.brand.Render("◆ DOMAINOPS")
|
||||||
section := m.theme.mutedText.Render(" / " + screens[m.screen].name)
|
section := m.theme.mutedText.Render(" / " + screens[m.screen].name)
|
||||||
@@ -87,6 +204,20 @@ func (m *Model) renderHeader() string {
|
|||||||
func (m *Model) renderFooter() string {
|
func (m *Model) renderFooter() string {
|
||||||
left := m.theme.key.Render("?") + " help " + m.theme.key.Render("Ctrl+K") + " commands " + m.theme.key.Render("/") + " filter"
|
left := m.theme.key.Render("?") + " help " + m.theme.key.Render("Ctrl+K") + " commands " + m.theme.key.Render("/") + " filter"
|
||||||
right := m.theme.key.Render("r") + " sync " + m.theme.key.Render("q") + " quit"
|
right := m.theme.key.Render("r") + " sync " + m.theme.key.Render("q") + " quit"
|
||||||
|
switch m.screen {
|
||||||
|
case screenAccounts:
|
||||||
|
right = m.theme.key.Render("a") + " add " + m.theme.key.Render("d") + " remove " + m.theme.key.Render("q") + " quit"
|
||||||
|
case screenZones:
|
||||||
|
right = m.theme.key.Render("p") + " set route " + m.theme.key.Render("Enter") + " DNS " + m.theme.key.Render("q") + " quit"
|
||||||
|
}
|
||||||
|
if m.certificateRun != nil && !m.certificateRun.Visible {
|
||||||
|
if m.width < 88 {
|
||||||
|
left = m.theme.key.Render("?") + " help"
|
||||||
|
right = m.theme.key.Render("o") + " progress"
|
||||||
|
} else {
|
||||||
|
right = m.theme.key.Render("o") + " progress " + right
|
||||||
|
}
|
||||||
|
}
|
||||||
if m.recoveryBlocked {
|
if m.recoveryBlocked {
|
||||||
right = m.theme.key.Render("R") + " retry recovery " + m.theme.key.Render("q") + " quit"
|
right = m.theme.key.Render("R") + " retry recovery " + m.theme.key.Render("q") + " quit"
|
||||||
}
|
}
|
||||||
@@ -221,7 +352,7 @@ func (m *Model) renderAccounts(width, height int) string {
|
|||||||
if len(values) == 0 {
|
if len(values) == 0 {
|
||||||
return m.emptyState("No Cloudflare accounts", "Press a to add a scoped API token.", width, height)
|
return m.emptyState("No Cloudflare accounts", "Press a to add a scoped API token.", width, height)
|
||||||
}
|
}
|
||||||
header := row(width, []cell{{"LABEL", 28}, {"TOKEN", 18}, {"STATUS", 14}, {"CAPABILITIES", 40}})
|
header := row(width, []cell{{"LABEL", 24}, {"CREDENTIAL ID", 28}, {"TOKEN", 16}, {"STATUS", 12}, {"CAPABILITIES", 30}})
|
||||||
rows := []string{m.theme.mutedText.Render(header)}
|
rows := []string{m.theme.mutedText.Render(header)}
|
||||||
reserved := 0
|
reserved := 0
|
||||||
if len(m.accounts) > 0 {
|
if len(m.accounts) > 0 {
|
||||||
@@ -232,7 +363,7 @@ func (m *Model) renderAccounts(width, height int) string {
|
|||||||
for i := start; i < len(values) && i < start+limit; i++ {
|
for i := start; i < len(values) && i < start+limit; i++ {
|
||||||
value := values[i]
|
value := values[i]
|
||||||
status := string(value.Status)
|
status := string(value.Status)
|
||||||
line := row(width, []cell{{value.Label, 28}, {string(value.Kind), 18}, {status, 14}, {strings.Join(value.Capabilities, ", "), 40}})
|
line := row(width, []cell{{value.Label, 24}, {value.ID, 28}, {string(value.Kind), 16}, {status, 12}, {strings.Join(value.Capabilities, ", "), 30}})
|
||||||
if i == m.rowOffset {
|
if i == m.rowOffset {
|
||||||
line = m.theme.selected.Width(width - 2).Render(line)
|
line = m.theme.selected.Width(width - 2).Render(line)
|
||||||
}
|
}
|
||||||
@@ -245,7 +376,7 @@ func (m *Model) renderAccounts(width, height int) string {
|
|||||||
}
|
}
|
||||||
rows = append(rows, "", m.theme.panelTitle.Render(fmt.Sprintf("REMOTE ACCOUNTS · %d", len(m.accounts))), m.theme.mutedText.Render(truncate(strings.Join(names, " · "), max(1, width-6))))
|
rows = append(rows, "", m.theme.panelTitle.Render(fmt.Sprintf("REMOTE ACCOUNTS · %d", len(m.accounts))), m.theme.mutedText.Render(truncate(strings.Join(names, " · "), max(1, width-6))))
|
||||||
}
|
}
|
||||||
return m.panel("CLOUDFLARE CONNECTIONS · a add · r sync", strings.Join(rows, "\n"), width, height)
|
return m.panel("CLOUDFLARE CONNECTIONS · a add · d safely remove · r sync", strings.Join(rows, "\n"), width, height)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *Model) renderZones(width, height int) string {
|
func (m *Model) renderZones(width, height int) string {
|
||||||
@@ -265,7 +396,7 @@ func (m *Model) renderZones(width, height int) string {
|
|||||||
}
|
}
|
||||||
rows = append(rows, line)
|
rows = append(rows, line)
|
||||||
}
|
}
|
||||||
return m.panel("ZONES · Enter open DNS · j/k select", strings.Join(rows, "\n"), width, height)
|
return m.panel("ZONES · Enter open DNS · p set preferred connection · j/k select", strings.Join(rows, "\n"), width, height)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *Model) accountLabel(id string) string {
|
func (m *Model) accountLabel(id string) string {
|
||||||
@@ -527,6 +658,122 @@ func (m *Model) renderCredentialForm() string {
|
|||||||
return m.theme.app.Width(m.width).Height(m.height).Render(lipgloss.Place(m.width, m.height, lipgloss.Center, lipgloss.Center, modal))
|
return m.theme.app.Width(m.width).Height(m.height).Render(lipgloss.Place(m.width, m.height, lipgloss.Center, lipgloss.Center, modal))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (m *Model) renderRemoveCredentialForm() string {
|
||||||
|
contentWidth := max(20, min(70, m.width-16))
|
||||||
|
affected := "No currently preferred zone routes use this connection."
|
||||||
|
if len(m.removeCredentialZoneIDs) > 0 {
|
||||||
|
names := m.removeCredentialZoneNames
|
||||||
|
shown := names
|
||||||
|
if len(shown) > 4 {
|
||||||
|
shown = shown[:4]
|
||||||
|
}
|
||||||
|
affected = fmt.Sprintf("%d preferred zone route(s): %s", len(names), strings.Join(shown, ", "))
|
||||||
|
if len(names) > len(shown) {
|
||||||
|
affected += fmt.Sprintf(" … and %d more", len(names)-len(shown))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
hint := m.removeCredentialAccountHint
|
||||||
|
if hint == "" {
|
||||||
|
hint = "all discovered accounts"
|
||||||
|
}
|
||||||
|
lines := []string{
|
||||||
|
m.theme.brand.Render("REMOVE CLOUDFLARE CONNECTION / TOKEN"),
|
||||||
|
m.theme.mutedText.Render(truncate("Connection: "+m.removeCredentialExpected+" · "+m.removeCredentialID, contentWidth)),
|
||||||
|
m.theme.mutedText.Render(truncate(fmt.Sprintf("Token: %s · account scope: %s", m.removeCredentialKind, hint), contentWidth)),
|
||||||
|
m.theme.mutedText.Render(truncate(affected, contentWidth)),
|
||||||
|
m.theme.statusWarn.Render("Routes may be reassigned after live verification."),
|
||||||
|
m.theme.statusWarn.Render("Fails closed unless every route has a proven replacement."),
|
||||||
|
m.theme.panelTitle.Render("Exact connection label"),
|
||||||
|
m.removeCredentialInput.View(),
|
||||||
|
}
|
||||||
|
if m.err != nil {
|
||||||
|
lines = append(lines, m.theme.statusBad.Render(truncate("! "+m.err.Error(), contentWidth)))
|
||||||
|
}
|
||||||
|
lines = append(lines, m.theme.mutedText.Render("Enter to remove · Esc to cancel"))
|
||||||
|
modal := m.theme.modal.Width(min(78, m.width-8)).Render(strings.Join(lines, "\n"))
|
||||||
|
return m.theme.app.Width(m.width).Height(m.height).Render(lipgloss.Place(m.width, m.height, lipgloss.Center, lipgloss.Center, modal))
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *Model) renderPreferredCredentialForm() string {
|
||||||
|
contentWidth := max(20, m.width-16)
|
||||||
|
current := "automatic / none"
|
||||||
|
if m.preferOriginalCredentialID != "" {
|
||||||
|
current = m.credentialLabel(m.preferOriginalCredentialID) + " · " + m.preferOriginalCredentialID
|
||||||
|
}
|
||||||
|
account := m.accountLabel(m.preferZoneAccountID)
|
||||||
|
if account == "" {
|
||||||
|
account = "unknown"
|
||||||
|
}
|
||||||
|
selectorLabel := m.theme.mutedText.Render("Credential ID or unique label")
|
||||||
|
confirmLabel := m.theme.mutedText.Render("Confirm exact zone name")
|
||||||
|
if m.preferCredentialFocus == 0 {
|
||||||
|
selectorLabel = m.theme.panelTitle.Render("Credential ID or unique label")
|
||||||
|
} else {
|
||||||
|
confirmLabel = m.theme.panelTitle.Render("Confirm exact zone name")
|
||||||
|
}
|
||||||
|
lines := []string{
|
||||||
|
m.theme.brand.Render("SET PREFERRED ZONE CONNECTION"),
|
||||||
|
m.theme.mutedText.Render(truncate("Zone: "+m.preferZoneExpectedName+" · "+m.preferZoneID, contentWidth)),
|
||||||
|
m.theme.mutedText.Render(truncate("Account: "+account+" · "+m.preferZoneAccountID, contentWidth)),
|
||||||
|
m.theme.mutedText.Render(truncate("Current route: "+current, contentWidth)),
|
||||||
|
selectorLabel,
|
||||||
|
m.preferCredentialInputs[0].View(),
|
||||||
|
confirmLabel,
|
||||||
|
m.preferCredentialInputs[1].View(),
|
||||||
|
m.theme.mutedText.Render("Connections · DNS read verified on apply:"),
|
||||||
|
}
|
||||||
|
validCandidates := 0
|
||||||
|
for _, credential := range m.credentials {
|
||||||
|
if credential.Provider == m.preferZoneProvider && credential.Status == domain.CredentialValid {
|
||||||
|
validCandidates++
|
||||||
|
}
|
||||||
|
}
|
||||||
|
candidateLimit := max(1, min(6, (m.height-16)/2))
|
||||||
|
shown := 0
|
||||||
|
for _, credential := range m.credentials {
|
||||||
|
if credential.Provider != m.preferZoneProvider || credential.Status != domain.CredentialValid {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
marker := " "
|
||||||
|
if credential.ID == m.preferOriginalCredentialID {
|
||||||
|
marker = "*"
|
||||||
|
}
|
||||||
|
hint := credential.AccountHint
|
||||||
|
if hint == "" {
|
||||||
|
hint = "all discovered accounts"
|
||||||
|
}
|
||||||
|
writeState := "dns:write observed before"
|
||||||
|
if !containsString(credential.Capabilities, "dns:write") {
|
||||||
|
writeState = "WRITE UNPROVEN"
|
||||||
|
}
|
||||||
|
labelWidth := max(1, contentWidth-len(credential.ID)-5)
|
||||||
|
candidate := fmt.Sprintf("%s %s · %s", marker, credential.ID, truncate(credential.Label, labelWidth))
|
||||||
|
details := fmt.Sprintf(" %s · %s · %s · %s", writeState, credential.Kind, hint, strings.Join(credential.Capabilities, ","))
|
||||||
|
lines = append(lines, m.theme.mutedText.Render(truncate(candidate, contentWidth)))
|
||||||
|
if writeState == "WRITE UNPROVEN" {
|
||||||
|
lines = append(lines, m.theme.statusWarn.Render(truncate(details, contentWidth)))
|
||||||
|
} else {
|
||||||
|
lines = append(lines, m.theme.mutedText.Render(truncate(details, contentWidth)))
|
||||||
|
}
|
||||||
|
shown++
|
||||||
|
if shown == candidateLimit {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if shown == 0 {
|
||||||
|
lines = append(lines, m.theme.statusWarn.Render(" No valid synchronized connection matches this zone provider."))
|
||||||
|
} else if validCandidates > shown {
|
||||||
|
lines = append(lines, m.theme.mutedText.Render(truncate(fmt.Sprintf(" … and %d more; full IDs are visible in Accounts", validCandidates-shown), contentWidth)))
|
||||||
|
}
|
||||||
|
lines = append(lines, m.theme.mutedText.Render("* current · write proven only by a real mutation"))
|
||||||
|
if m.err != nil {
|
||||||
|
lines = append(lines, m.theme.statusBad.Render(truncate("! "+m.err.Error(), contentWidth)))
|
||||||
|
}
|
||||||
|
lines = append(lines, m.theme.mutedText.Render("Tab move · Enter verify/apply · Esc cancel"))
|
||||||
|
modal := m.theme.modal.Width(min(84, m.width-8)).Render(strings.Join(lines, "\n"))
|
||||||
|
return m.theme.app.Width(m.width).Height(m.height).Render(lipgloss.Place(m.width, m.height, lipgloss.Center, lipgloss.Center, modal))
|
||||||
|
}
|
||||||
|
|
||||||
func (m *Model) renderRecordForm() string {
|
func (m *Model) renderRecordForm() string {
|
||||||
labels := []string{"Record type", "Name", "Content", "TTL", "Priority"}
|
labels := []string{"Record type", "Name", "Content", "TTL", "Priority"}
|
||||||
title := "CREATE DNS RECORD"
|
title := "CREATE DNS RECORD"
|
||||||
@@ -661,6 +908,7 @@ func (m *Model) renderHelp() string {
|
|||||||
m.theme.key.Render("1…7") + " Navigate sections", m.theme.key.Render("j / k") + " Move selection",
|
m.theme.key.Render("1…7") + " Navigate sections", m.theme.key.Render("j / k") + " Move selection",
|
||||||
m.theme.key.Render("/") + " Filter current view", m.theme.key.Render("Ctrl+K") + " Command palette",
|
m.theme.key.Render("/") + " Filter current view", m.theme.key.Render("Ctrl+K") + " Command palette",
|
||||||
m.theme.key.Render("r") + " Synchronize", m.theme.key.Render("a") + " Add Cloudflare connection",
|
m.theme.key.Render("r") + " Synchronize", m.theme.key.Render("a") + " Add Cloudflare connection",
|
||||||
|
m.theme.key.Render("d") + " Safely remove selected connection (Accounts)", m.theme.key.Render("p") + " Set preferred zone connection (Zones)",
|
||||||
m.theme.key.Render("n / e / d") + " New, edit, delete DNS record", m.theme.key.Render("?") + " Close this help",
|
m.theme.key.Render("n / e / d") + " New, edit, delete DNS record", m.theme.key.Render("?") + " Close this help",
|
||||||
m.theme.key.Render("n / u / i / x / d") + " Issue, renew due, import, export, revoke certificate",
|
m.theme.key.Render("n / u / i / x / d") + " Issue, renew due, import, export, revoke certificate",
|
||||||
"", m.theme.mutedText.Render("All operations are keyboard-accessible and safe over SSH."),
|
"", m.theme.mutedText.Render("All operations are keyboard-accessible and safe over SSH."),
|
||||||
|
|||||||
Reference in new issue
Block a user