main 0857610

tls.go RawHistoryFolder

1package dto
2
3import (
4	"time"
5
6	"github.com/bnema/gordon/internal/domain"
7)
8
9// TLSStatusResponse represents the public TLS/ACME status for the admin API.
10type TLSStatusResponse struct {
11	ACMEEnabled     bool                  `json:"acme_enabled"`
12	ConfiguredMode  string                `json:"configured_mode"`
13	EffectiveMode   string                `json:"effective_mode"`
14	SelectionReason string                `json:"selection_reason"`
15	TokenSource     string                `json:"token_source"`
16	Certificates    []TLSCertificateEntry `json:"certificates"`
17	Routes          []TLSRouteCoverage    `json:"routes"`
18	Errors          []string              `json:"errors,omitempty"`
19}
20
21// TLSCertificateEntry represents a managed certificate entry in the TLS status.
22type TLSCertificateEntry struct {
23	ID             string    `json:"id"`
24	Names          []string  `json:"names"`
25	Challenge      string    `json:"challenge"`
26	Status         string    `json:"status"`
27	NotAfter       time.Time `json:"not_after"`
28	LastError      string    `json:"last_error,omitempty"`
29	RenewalPending bool      `json:"renewal_pending"`
30}
31
32// TLSRouteCoverage represents a route's TLS coverage status.
33type TLSRouteCoverage struct {
34	Domain       string `json:"domain"`
35	Covered      bool   `json:"covered"`
36	CoveredBy    string `json:"covered_by,omitempty"`
37	RequiredACME bool   `json:"required_acme"`
38	Error        string `json:"error,omitempty"`
39}
40
41// TLSStatusFromDomain converts a public TLS domain status to its transport DTO.
42func TLSStatusFromDomain(s domain.PublicTLSStatus) TLSStatusResponse {
43	certs := make([]TLSCertificateEntry, 0, len(s.Certificates))
44	for _, c := range s.Certificates {
45		certs = append(certs, TLSCertificateEntry{
46			ID:             c.ID,
47			Names:          c.Names,
48			Challenge:      string(c.Challenge),
49			Status:         string(c.Status),
50			NotAfter:       c.NotAfter,
51			LastError:      c.LastError,
52			RenewalPending: c.RenewalPending,
53		})
54	}
55
56	routes := make([]TLSRouteCoverage, 0, len(s.Routes))
57	for _, r := range s.Routes {
58		routes = append(routes, TLSRouteCoverage{
59			Domain:       r.Domain,
60			Covered:      r.Covered,
61			CoveredBy:    r.CoveredBy,
62			RequiredACME: r.RequiredACME,
63			Error:        r.Error,
64		})
65	}
66
67	return TLSStatusResponse{
68		ACMEEnabled:     s.ACMEEnabled,
69		ConfiguredMode:  string(s.ConfiguredMode),
70		EffectiveMode:   string(s.EffectiveMode),
71		SelectionReason: s.SelectionReason,
72		TokenSource:     string(s.TokenSource),
73		Certificates:    certs,
74		Routes:          routes,
75		Errors:          s.Errors,
76	}
77}

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 7

Tags 106

↑↓ moveenter openesc close