mirror of
https://github.com/Control-D-Inc/ctrld.git
synced 2026-10-12 01:58:46 +02:00
fix(cli): carry the review fixes of the master port to v1.0
This commit is contained in:
1 parent
12ab2a0e71
commit
f52dfd0354
24 files changed
+993
-68
No files matched your search
@@ -182,14 +182,25 @@ func (um *upstreamMonitor) markUp(upstream, reason string) {
|
||||
// journalUpstreamName bounds the upstream name that a journal event carries.
|
||||
// ctrld generates upstream.os, upstream.<n>, and upstream.internal_<n>; every
|
||||
// other key is operator text that can hold a token, so it reads as
|
||||
// upstream.custom.
|
||||
// upstream.custom. An empty name holds no operator text and stays empty,
|
||||
// because a line that names no upstream must not read as a custom one.
|
||||
func journalUpstreamName(upstream string) string {
|
||||
if upstream == upstreamOS || generatedUpstreamKey(strings.TrimPrefix(upstream, upstreamPrefix)) {
|
||||
if upstream == "" || upstream == upstreamOS || generatedUpstreamKey(strings.TrimPrefix(upstream, upstreamPrefix)) {
|
||||
return upstream
|
||||
}
|
||||
return upstreamPrefix + "custom"
|
||||
}
|
||||
|
||||
// journalUpstreamNames bounds every name of a list, for a line that names
|
||||
// several upstreams.
|
||||
func journalUpstreamNames(upstreams []string) []string {
|
||||
names := make([]string, 0, len(upstreams))
|
||||
for _, upstream := range upstreams {
|
||||
names = append(names, journalUpstreamName(upstream))
|
||||
}
|
||||
return names
|
||||
}
|
||||
|
||||
// generatedUpstreamKey reports whether key is a number, or internal_ and a
|
||||
// number, the two shapes that ctrld writes itself.
|
||||
func generatedUpstreamKey(key string) bool {
|
||||
|
||||
Reference in new issue
Block a user