feat: add safe multi-account routing and prepare public release
This commit is contained in:
71 files changed
+2882
-96
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@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||||
with:
|
with:
|
||||||
go-version: '1.26.x'
|
persist-credentials: false
|
||||||
|
- name: Set up Go
|
||||||
|
uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.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@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||||
|
with:
|
||||||
|
persist-credentials: false
|
||||||
|
- name: Set up Go
|
||||||
|
uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.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@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
- uses: goreleaser/goreleaser-action@v6
|
persist-credentials: false
|
||||||
|
- name: Check GoReleaser configuration
|
||||||
|
uses: goreleaser/goreleaser-action@1a80836c5c9d9e5755a25cb59ec6f45a3b5f41a8 # v7.2.1
|
||||||
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@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||||
with:
|
with:
|
||||||
go-version: '1.26.x'
|
persist-credentials: false
|
||||||
|
- name: Set up Go
|
||||||
|
uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.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@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||||
with:
|
with:
|
||||||
go-version: '1.26.x'
|
persist-credentials: false
|
||||||
|
- name: Set up Go
|
||||||
|
uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.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@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
- uses: actions/setup-go@v5
|
persist-credentials: false
|
||||||
|
- name: Set up Go
|
||||||
|
uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.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@1a80836c5c9d9e5755a25cb59ec6f45a3b5f41a8 # v7.2.1
|
||||||
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
|
||||||
@@ -19,3 +19,6 @@
|
|||||||
- 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.
|
||||||
@@ -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.
|
||||||
@@ -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,6 +79,8 @@ 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 |
|
||||||
| `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 |
|
||||||
@@ -212,10 +224,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,14 @@ 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.
|
||||||
|
|
||||||
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,8 @@ 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.
|
||||||
|
|
||||||
## ACME safety
|
## ACME safety
|
||||||
|
|
||||||
- Staging is the default issuance environment.
|
- Staging is the default issuance environment.
|
||||||
|
|||||||
+153
-51
@@ -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
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -177,6 +183,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 +391,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 +443,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 +617,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 +636,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 +707,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 +731,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 +772,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 +832,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 +900,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 +956,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 +967,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 +1010,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 +1049,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 +1062,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 +1073,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 +1088,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 +1114,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 +1123,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 +1147,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 +1177,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 +1237,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 +1274,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 +1355,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 +1379,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 +1412,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 +1423,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 +1443,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 +1454,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 +1564,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 +1576,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 +1585,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 +1611,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 +1637,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,37 +1769,65 @@ 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 account.ProviderID == "" {
|
if providerName == "" {
|
||||||
account.ProviderID = strings.TrimPrefix(account.ID, "cfacct_")
|
providerName = account.Provider
|
||||||
}
|
}
|
||||||
account.Provider = domain.ProviderCloudflare
|
if account.ProviderID == "" {
|
||||||
|
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
|
account.ID = "cfacct_" + account.ProviderID
|
||||||
|
} else {
|
||||||
|
account.ID = stableID("account", providerName, 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.ProviderID = zone.ID
|
||||||
|
if providerName == domain.ProviderCloudflare {
|
||||||
|
zone.ProviderID = strings.TrimPrefix(zone.ProviderID, "cfzone_")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
zone.Provider = providerName
|
||||||
|
if providerName == domain.ProviderCloudflare {
|
||||||
zone.ID = "cfzone_" + zone.ProviderID
|
zone.ID = "cfzone_" + zone.ProviderID
|
||||||
if !strings.HasPrefix(zone.AccountID, "cfacct_") {
|
if !strings.HasPrefix(zone.AccountID, "cfacct_") {
|
||||||
zone.AccountID = "cfacct_" + zone.AccountID
|
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 == "" {
|
||||||
zone.Status = domain.ZoneUnknown
|
zone.Status = domain.ZoneUnknown
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
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
|
record.ID = "cfrecord_" + record.ProviderID
|
||||||
|
} else {
|
||||||
|
record.ID = stableID("record", providerName, zoneID, 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 +1899,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,130 @@ 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 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 +1447,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) {
|
||||||
|
|||||||
@@ -76,7 +76,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 +97,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 +148,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 {
|
||||||
|
|||||||
@@ -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,
|
||||||
|
|||||||
+377
-3
@@ -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)
|
||||||
@@ -126,6 +128,26 @@ type Model struct {
|
|||||||
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
|
||||||
@@ -342,6 +364,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)
|
||||||
}
|
}
|
||||||
@@ -406,6 +434,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 +469,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 +829,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()
|
||||||
@@ -1383,12 +1727,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 +1839,25 @@ func (m *Model) updateOverlay(message tea.Msg) (tea.Model, tea.Cmd) {
|
|||||||
m.openCredentialForm()
|
m.openCredentialForm()
|
||||||
return m, textinput.Blink
|
return m, textinput.Blink
|
||||||
}
|
}
|
||||||
|
switch selected - len(screens) {
|
||||||
|
case 1:
|
||||||
m.busy = true
|
m.busy = true
|
||||||
return m, syncCmd(m.backend)
|
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 +2100,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 +2147,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",
|
||||||
|
)
|
||||||
}
|
}
|
||||||
@@ -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,254 @@ 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 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})
|
||||||
@@ -761,6 +1010,11 @@ type fakeBackend struct {
|
|||||||
dnsZones []string
|
dnsZones []string
|
||||||
zones []domain.Zone
|
zones []domain.Zone
|
||||||
deleteCalls int
|
deleteCalls int
|
||||||
|
deletedCredentials []string
|
||||||
|
deleteCredentialErr error
|
||||||
|
preferredZones []string
|
||||||
|
preferredCredentials []string
|
||||||
|
preferredCredentialErr error
|
||||||
tlsSettings map[string]domain.EdgeTLSSettings
|
tlsSettings map[string]domain.EdgeTLSSettings
|
||||||
tlsErr error
|
tlsErr error
|
||||||
tlsZones []string
|
tlsZones []string
|
||||||
@@ -804,6 +1058,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
|
||||||
|
|||||||
+133
-4
@@ -29,6 +29,12 @@ 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.editRecord {
|
if m.editRecord {
|
||||||
return m.renderRecordForm()
|
return m.renderRecordForm()
|
||||||
}
|
}
|
||||||
@@ -87,6 +93,12 @@ 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.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 +233,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 +244,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 +257,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 +277,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 +539,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 +789,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