Compare commits
8 Commits
2023.2.20-
...
app-contro
Author | SHA1 | Date | |
---|---|---|---|
bd0d5a621a | |||
e13de5bd0d | |||
813b1519e4 | |||
f9b8d4f243 | |||
1ff29ae1fb | |||
3310c09320 | |||
2a828afc89 | |||
c049cf8047 |
4
.gitignore
vendored
4
.gitignore
vendored
@ -5,4 +5,6 @@ dist/
|
|||||||
/tmp
|
/tmp
|
||||||
/state.json
|
/state.json
|
||||||
/emissary.sqlite
|
/emissary.sqlite
|
||||||
/.gitea-release
|
/.gitea-release
|
||||||
|
/agent-key.json
|
||||||
|
/apps
|
@ -22,6 +22,7 @@ builds:
|
|||||||
goarch:
|
goarch:
|
||||||
- amd64
|
- amd64
|
||||||
- arm64
|
- arm64
|
||||||
|
- "386"
|
||||||
main: ./cmd/server
|
main: ./cmd/server
|
||||||
- id: emissary-agent
|
- id: emissary-agent
|
||||||
env:
|
env:
|
||||||
@ -43,6 +44,7 @@ builds:
|
|||||||
- amd64
|
- amd64
|
||||||
- arm64
|
- arm64
|
||||||
- arm
|
- arm
|
||||||
|
- "386"
|
||||||
main: ./cmd/agent
|
main: ./cmd/agent
|
||||||
archives:
|
archives:
|
||||||
- id: server
|
- id: server
|
||||||
@ -51,11 +53,13 @@ archives:
|
|||||||
files:
|
files:
|
||||||
- README.md
|
- README.md
|
||||||
- migrations
|
- migrations
|
||||||
|
- misc/packaging/common/config-server.yml
|
||||||
- id: agent
|
- id: agent
|
||||||
builds: ["emissary-agent"]
|
builds: ["emissary-agent"]
|
||||||
name_template: '{{ .ProjectName }}-agent_{{ .Version }}_{{ .Os }}_{{ .Arch }}{{ with .Arm }}v{{ . }}{{ end }}{{ with .Mips }}_{{ . }}{{ end }}{{ if not (eq .Amd64 "v1") }}{{ .Amd64 }}{{ end }}'
|
name_template: '{{ .ProjectName }}-agent_{{ .Version }}_{{ .Os }}_{{ .Arch }}{{ with .Arm }}v{{ . }}{{ end }}{{ with .Mips }}_{{ . }}{{ end }}{{ if not (eq .Amd64 "v1") }}{{ .Amd64 }}{{ end }}'
|
||||||
files:
|
files:
|
||||||
- README.md
|
- README.md
|
||||||
|
- misc/packaging/common/config-agent.yml
|
||||||
checksum:
|
checksum:
|
||||||
name_template: 'checksums.txt'
|
name_template: 'checksums.txt'
|
||||||
snapshot:
|
snapshot:
|
||||||
@ -97,6 +101,18 @@ nfpms:
|
|||||||
file_info:
|
file_info:
|
||||||
mode: 0755
|
mode: 0755
|
||||||
packager: apk
|
packager: apk
|
||||||
|
- dst: /var/lib/emissary
|
||||||
|
type: dir
|
||||||
|
file_info:
|
||||||
|
mode: 0700
|
||||||
|
- dst: /usr/share/emissary
|
||||||
|
type: dir
|
||||||
|
file_info:
|
||||||
|
mode: 0700
|
||||||
|
- dst: /var/log/emissary
|
||||||
|
type: dir
|
||||||
|
file_info:
|
||||||
|
mode: 0700
|
||||||
scripts:
|
scripts:
|
||||||
postinstall: "misc/packaging/common/postinstall-server.sh"
|
postinstall: "misc/packaging/common/postinstall-server.sh"
|
||||||
- id: emissary-agent
|
- id: emissary-agent
|
||||||
|
@ -5,6 +5,7 @@ import (
|
|||||||
|
|
||||||
"forge.cadoles.com/Cadoles/emissary/internal/command"
|
"forge.cadoles.com/Cadoles/emissary/internal/command"
|
||||||
"forge.cadoles.com/Cadoles/emissary/internal/command/agent"
|
"forge.cadoles.com/Cadoles/emissary/internal/command/agent"
|
||||||
|
"forge.cadoles.com/Cadoles/emissary/internal/command/client"
|
||||||
)
|
)
|
||||||
|
|
||||||
// nolint: gochecknoglobals
|
// nolint: gochecknoglobals
|
||||||
@ -16,5 +17,5 @@ var (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
command.Main(BuildDate, ProjectVersion, GitRef, DefaultConfigPath, agent.Root())
|
command.Main(BuildDate, ProjectVersion, GitRef, DefaultConfigPath, agent.Root(), client.Root())
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,7 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
|
|
||||||
"forge.cadoles.com/Cadoles/emissary/internal/command"
|
"forge.cadoles.com/Cadoles/emissary/internal/command"
|
||||||
|
"forge.cadoles.com/Cadoles/emissary/internal/command/client"
|
||||||
"forge.cadoles.com/Cadoles/emissary/internal/command/server"
|
"forge.cadoles.com/Cadoles/emissary/internal/command/server"
|
||||||
|
|
||||||
_ "github.com/jackc/pgx/v5/stdlib"
|
_ "github.com/jackc/pgx/v5/stdlib"
|
||||||
@ -19,5 +20,5 @@ var (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
command.Main(BuildDate, ProjectVersion, GitRef, DefaultConfigPath, server.Root())
|
command.Main(BuildDate, ProjectVersion, GitRef, DefaultConfigPath, server.Root(), client.Root())
|
||||||
}
|
}
|
||||||
|
76
go.mod
76
go.mod
@ -3,71 +3,105 @@ module forge.cadoles.com/Cadoles/emissary
|
|||||||
go 1.19
|
go 1.19
|
||||||
|
|
||||||
require (
|
require (
|
||||||
|
forge.cadoles.com/arcad/edge v0.0.0-20230303153719-6399196fe5c9
|
||||||
github.com/alecthomas/participle/v2 v2.0.0-beta.5
|
github.com/alecthomas/participle/v2 v2.0.0-beta.5
|
||||||
github.com/andreyvit/diff v0.0.0-20170406064948-c7f18ee00883
|
github.com/andreyvit/diff v0.0.0-20170406064948-c7f18ee00883
|
||||||
github.com/btcsuite/btcd/btcutil v1.1.3
|
github.com/btcsuite/btcd/btcutil v1.1.3
|
||||||
github.com/davecgh/go-spew v1.1.1
|
github.com/davecgh/go-spew v1.1.1
|
||||||
github.com/denisbrodbeck/machineid v1.0.1
|
github.com/denisbrodbeck/machineid v1.0.1
|
||||||
|
github.com/evanphx/json-patch/v5 v5.6.0
|
||||||
github.com/go-chi/chi v4.1.2+incompatible
|
github.com/go-chi/chi v4.1.2+incompatible
|
||||||
github.com/go-chi/cors v1.2.1
|
github.com/go-chi/cors v1.2.1
|
||||||
github.com/golang-migrate/migrate/v4 v4.15.2
|
github.com/golang-migrate/migrate/v4 v4.15.2
|
||||||
github.com/jackc/pgx/v5 v5.2.0
|
github.com/jackc/pgx/v5 v5.3.1
|
||||||
|
github.com/jedib0t/go-pretty/v6 v6.4.4
|
||||||
|
github.com/lestrrat-go/jwx/v2 v2.0.8
|
||||||
github.com/mitchellh/mapstructure v1.5.0
|
github.com/mitchellh/mapstructure v1.5.0
|
||||||
github.com/pkg/errors v0.9.1
|
github.com/pkg/errors v0.9.1
|
||||||
|
github.com/qri-io/jsonschema v0.2.1
|
||||||
github.com/santhosh-tekuri/jsonschema/v5 v5.1.1
|
github.com/santhosh-tekuri/jsonschema/v5 v5.1.1
|
||||||
github.com/urfave/cli/v2 v2.23.7
|
github.com/urfave/cli/v2 v2.24.4
|
||||||
gitlab.com/wpetit/goweb v0.0.0-20230206085656-dec695f0e2e9
|
gitlab.com/wpetit/goweb v0.0.0-20230227162855-a1f09bafccb3
|
||||||
gopkg.in/yaml.v3 v3.0.1
|
gopkg.in/yaml.v3 v3.0.1
|
||||||
modernc.org/sqlite v1.20.3
|
modernc.org/sqlite v1.21.0
|
||||||
)
|
)
|
||||||
|
|
||||||
require google.golang.org/genproto v0.0.0-20220728213248-dd149ef739b9 // indirect
|
require (
|
||||||
|
github.com/barnybug/go-cast v0.0.0-20201201064555-a87ccbc26692 // indirect
|
||||||
|
github.com/dop251/goja v0.0.0-20230226152633-7c93113e17ac // indirect
|
||||||
|
github.com/dop251/goja_nodejs v0.0.0-20230226152057-060fa99b809f // indirect
|
||||||
|
github.com/gabriel-vasile/mimetype v1.4.1 // indirect
|
||||||
|
github.com/go-sourcemap/sourcemap v2.1.3+incompatible // indirect
|
||||||
|
github.com/gogo/protobuf v1.3.2 // indirect
|
||||||
|
github.com/golang-jwt/jwt v3.2.2+incompatible // indirect
|
||||||
|
github.com/gorilla/websocket v1.5.0 // indirect
|
||||||
|
github.com/hashicorp/go.net v0.0.1 // indirect
|
||||||
|
github.com/hashicorp/mdns v1.0.5 // indirect
|
||||||
|
github.com/igm/sockjs-go/v3 v3.0.2 // indirect
|
||||||
|
github.com/miekg/dns v1.1.51 // indirect
|
||||||
|
github.com/oklog/ulid/v2 v2.1.0 // indirect
|
||||||
|
github.com/orcaman/concurrent-map v1.0.0 // indirect
|
||||||
|
golang.org/x/net v0.7.0 // indirect
|
||||||
|
google.golang.org/genproto v0.0.0-20220728213248-dd149ef739b9 // indirect
|
||||||
|
gopkg.in/yaml.v2 v2.4.0 // indirect
|
||||||
|
)
|
||||||
|
|
||||||
require (
|
require (
|
||||||
cdr.dev/slog v1.4.1 // indirect
|
cdr.dev/slog v1.4.1 // indirect
|
||||||
github.com/alecthomas/chroma v0.10.0 // indirect
|
github.com/alecthomas/chroma v0.10.0 // indirect
|
||||||
github.com/cpuguy83/go-md2man/v2 v2.0.2 // indirect
|
github.com/cpuguy83/go-md2man/v2 v2.0.2 // indirect
|
||||||
github.com/dlclark/regexp2 v1.8.0 // indirect
|
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.1.0 // indirect
|
||||||
github.com/dustin/go-humanize v1.0.0 // indirect
|
github.com/dlclark/regexp2 v1.8.1 // indirect
|
||||||
github.com/fatih/color v1.13.0 // indirect
|
github.com/dustin/go-humanize v1.0.1 // indirect
|
||||||
|
github.com/fatih/color v1.14.1 // indirect
|
||||||
|
github.com/go-chi/chi/v5 v5.0.8
|
||||||
github.com/go-playground/locales v0.14.1 // indirect
|
github.com/go-playground/locales v0.14.1 // indirect
|
||||||
github.com/go-playground/universal-translator v0.18.1 // indirect
|
github.com/go-playground/universal-translator v0.18.1 // indirect
|
||||||
|
github.com/goccy/go-json v0.9.11 // indirect
|
||||||
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
|
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
|
||||||
github.com/google/uuid v1.3.0 // indirect
|
github.com/google/uuid v1.3.0 // indirect
|
||||||
github.com/hashicorp/errwrap v1.1.0 // indirect
|
github.com/hashicorp/errwrap v1.1.0 // indirect
|
||||||
github.com/hashicorp/go-multierror v1.1.1 // indirect
|
github.com/hashicorp/go-multierror v1.1.1 // indirect
|
||||||
github.com/jackc/pgpassfile v1.0.0 // indirect
|
github.com/jackc/pgpassfile v1.0.0 // indirect
|
||||||
github.com/jackc/pgservicefile v0.0.0-20221227161230-091c0ba34f0a // indirect
|
github.com/jackc/pgservicefile v0.0.0-20221227161230-091c0ba34f0a // indirect
|
||||||
github.com/jackc/puddle/v2 v2.1.2 // indirect
|
github.com/jackc/puddle/v2 v2.2.0 // indirect
|
||||||
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 // indirect
|
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 // indirect
|
||||||
github.com/leodido/go-urn v1.2.1 // indirect
|
github.com/leodido/go-urn v1.2.2 // indirect
|
||||||
|
github.com/lestrrat-go/blackmagic v1.0.1 // indirect
|
||||||
|
github.com/lestrrat-go/httpcc v1.0.1 // indirect
|
||||||
|
github.com/lestrrat-go/httprc v1.0.4 // indirect
|
||||||
|
github.com/lestrrat-go/iter v1.0.2 // indirect
|
||||||
|
github.com/lestrrat-go/option v1.0.0 // indirect
|
||||||
github.com/lib/pq v1.10.7 // indirect
|
github.com/lib/pq v1.10.7 // indirect
|
||||||
github.com/mattn/go-colorable v0.1.13 // indirect
|
github.com/mattn/go-colorable v0.1.13 // indirect
|
||||||
github.com/mattn/go-isatty v0.0.17 // indirect
|
github.com/mattn/go-isatty v0.0.17 // indirect
|
||||||
github.com/remyoudompheng/bigfft v0.0.0-20200410134404-eec4a21b6bb0 // indirect
|
github.com/mattn/go-runewidth v0.0.13 // indirect
|
||||||
|
github.com/qri-io/jsonpointer v0.1.1 // indirect
|
||||||
|
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec // indirect
|
||||||
|
github.com/rivo/uniseg v0.2.0 // indirect
|
||||||
github.com/rogpeppe/go-internal v1.9.0 // indirect
|
github.com/rogpeppe/go-internal v1.9.0 // indirect
|
||||||
github.com/russross/blackfriday/v2 v2.1.0 // indirect
|
github.com/russross/blackfriday/v2 v2.1.0 // indirect
|
||||||
github.com/sergi/go-diff v1.3.1 // indirect
|
github.com/sergi/go-diff v1.3.1 // indirect
|
||||||
github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 // indirect
|
github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 // indirect
|
||||||
go.opencensus.io v0.24.0 // indirect
|
go.opencensus.io v0.24.0 // indirect
|
||||||
go.uber.org/atomic v1.10.0 // indirect
|
go.uber.org/atomic v1.10.0 // indirect
|
||||||
golang.org/x/crypto v0.5.0 // indirect
|
golang.org/x/crypto v0.6.0 // indirect
|
||||||
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4 // indirect
|
golang.org/x/mod v0.8.0 // indirect
|
||||||
golang.org/x/sync v0.0.0-20220923202941-7f9b1623fab7 // indirect
|
golang.org/x/sync v0.1.0 // indirect
|
||||||
golang.org/x/sys v0.4.0 // indirect
|
golang.org/x/sys v0.5.0 // indirect
|
||||||
golang.org/x/term v0.4.0 // indirect
|
golang.org/x/term v0.5.0 // indirect
|
||||||
golang.org/x/text v0.6.0 // indirect
|
golang.org/x/text v0.7.0 // indirect
|
||||||
golang.org/x/tools v0.1.12 // indirect
|
golang.org/x/tools v0.6.0 // indirect
|
||||||
golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect
|
golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect
|
||||||
google.golang.org/protobuf v1.28.1 // indirect
|
google.golang.org/protobuf v1.28.1 // indirect
|
||||||
gopkg.in/go-playground/validator.v9 v9.31.0 // indirect
|
gopkg.in/go-playground/validator.v9 v9.31.0 // indirect
|
||||||
lukechampine.com/uint128 v1.2.0 // indirect
|
lukechampine.com/uint128 v1.2.0 // indirect
|
||||||
modernc.org/cc/v3 v3.40.0 // indirect
|
modernc.org/cc/v3 v3.40.0 // indirect
|
||||||
modernc.org/ccgo/v3 v3.16.13 // indirect
|
modernc.org/ccgo/v3 v3.16.13 // indirect
|
||||||
modernc.org/libc v1.22.2 // indirect
|
modernc.org/libc v1.22.3 // indirect
|
||||||
modernc.org/mathutil v1.5.0 // indirect
|
modernc.org/mathutil v1.5.0 // indirect
|
||||||
modernc.org/memory v1.4.0 // indirect
|
modernc.org/memory v1.5.0 // indirect
|
||||||
modernc.org/opt v0.1.3 // indirect
|
modernc.org/opt v0.1.3 // indirect
|
||||||
modernc.org/strutil v1.1.3 // indirect
|
modernc.org/strutil v1.1.3 // indirect
|
||||||
modernc.org/token v1.0.1 // indirect
|
modernc.org/token v1.1.0 // indirect
|
||||||
)
|
)
|
||||||
|
162
go.sum
162
go.sum
@ -54,6 +54,14 @@ cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohl
|
|||||||
cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs=
|
cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs=
|
||||||
cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0=
|
cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0=
|
||||||
dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU=
|
dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU=
|
||||||
|
forge.cadoles.com/arcad/edge v0.0.0-20230303104220-0bb7f2cd8500 h1:TKjlNgXdxxTUXRY1EzwaY+hcjoPbrUg3z+iw2Wvk/eA=
|
||||||
|
forge.cadoles.com/arcad/edge v0.0.0-20230303104220-0bb7f2cd8500/go.mod h1:pl9EMtSLSVr4wbDgQBDjr4aizwtmwasE686dm5arYPw=
|
||||||
|
forge.cadoles.com/arcad/edge v0.0.0-20230303145523-a9d2c282f2e0 h1:mLOkZAa9/anqFY22uolxOjeBnAv5b6fpLEEJ4aXn2d0=
|
||||||
|
forge.cadoles.com/arcad/edge v0.0.0-20230303145523-a9d2c282f2e0/go.mod h1:pl9EMtSLSVr4wbDgQBDjr4aizwtmwasE686dm5arYPw=
|
||||||
|
forge.cadoles.com/arcad/edge v0.0.0-20230303153324-fef03214759c h1:xmTr/6Ehh/9gmPzeK9zlDdoqc272Q7EctqXs8Y78LY0=
|
||||||
|
forge.cadoles.com/arcad/edge v0.0.0-20230303153324-fef03214759c/go.mod h1:pl9EMtSLSVr4wbDgQBDjr4aizwtmwasE686dm5arYPw=
|
||||||
|
forge.cadoles.com/arcad/edge v0.0.0-20230303153719-6399196fe5c9 h1:dleaaf/rV2GWtGvrPunRakjrKVDfXoANxAy8/1ctMVs=
|
||||||
|
forge.cadoles.com/arcad/edge v0.0.0-20230303153719-6399196fe5c9/go.mod h1:pl9EMtSLSVr4wbDgQBDjr4aizwtmwasE686dm5arYPw=
|
||||||
gioui.org v0.0.0-20210308172011-57750fc8a0a6/go.mod h1:RSH6KIUZ0p2xy5zHDxgAM4zumjgTw83q2ge/PI+yyw8=
|
gioui.org v0.0.0-20210308172011-57750fc8a0a6/go.mod h1:RSH6KIUZ0p2xy5zHDxgAM4zumjgTw83q2ge/PI+yyw8=
|
||||||
github.com/AdaLogics/go-fuzz-headers v0.0.0-20210715213245-6c3934b029d8/go.mod h1:CzsSbkDixRphAF5hS6wbMKq0eI6ccJRb7/A0M6JBnwg=
|
github.com/AdaLogics/go-fuzz-headers v0.0.0-20210715213245-6c3934b029d8/go.mod h1:CzsSbkDixRphAF5hS6wbMKq0eI6ccJRb7/A0M6JBnwg=
|
||||||
github.com/Azure/azure-pipeline-go v0.2.3/go.mod h1:x841ezTBIMG6O3lAcl8ATHnsOPVl2bqk7S3ta6S6u4k=
|
github.com/Azure/azure-pipeline-go v0.2.3/go.mod h1:x841ezTBIMG6O3lAcl8ATHnsOPVl2bqk7S3ta6S6u4k=
|
||||||
@ -178,6 +186,8 @@ github.com/aws/aws-sdk-go-v2/service/sts v1.6.1/go.mod h1:hLZ/AnkIKHLuPGjEiyghNE
|
|||||||
github.com/aws/aws-sdk-go-v2/service/sts v1.7.2/go.mod h1:8EzeIqfWt2wWT4rJVu3f21TfrhJ8AEMzVybRNSb/b4g=
|
github.com/aws/aws-sdk-go-v2/service/sts v1.7.2/go.mod h1:8EzeIqfWt2wWT4rJVu3f21TfrhJ8AEMzVybRNSb/b4g=
|
||||||
github.com/aws/smithy-go v1.7.0/go.mod h1:SObp3lf9smib00L/v3U2eAKG8FyQ7iLrJnQiAmR5n+E=
|
github.com/aws/smithy-go v1.7.0/go.mod h1:SObp3lf9smib00L/v3U2eAKG8FyQ7iLrJnQiAmR5n+E=
|
||||||
github.com/aws/smithy-go v1.8.0/go.mod h1:SObp3lf9smib00L/v3U2eAKG8FyQ7iLrJnQiAmR5n+E=
|
github.com/aws/smithy-go v1.8.0/go.mod h1:SObp3lf9smib00L/v3U2eAKG8FyQ7iLrJnQiAmR5n+E=
|
||||||
|
github.com/barnybug/go-cast v0.0.0-20201201064555-a87ccbc26692 h1:JW4WZlqyaNWUUahfr7MigeDW6jmtam5cTzzo1lwsFhE=
|
||||||
|
github.com/barnybug/go-cast v0.0.0-20201201064555-a87ccbc26692/go.mod h1:Au0ipPuCBA7zsOC61SnyrYetm8VT3vo1UJtwHeYke44=
|
||||||
github.com/benbjohnson/clock v1.0.3/go.mod h1:bGMdMPoPVvcYyt1gHDf4J2KE153Yf9BuiUKYMaxlTDM=
|
github.com/benbjohnson/clock v1.0.3/go.mod h1:bGMdMPoPVvcYyt1gHDf4J2KE153Yf9BuiUKYMaxlTDM=
|
||||||
github.com/beorn7/perks v0.0.0-20160804104726-4c0e84591b9a/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q=
|
github.com/beorn7/perks v0.0.0-20160804104726-4c0e84591b9a/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q=
|
||||||
github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q=
|
github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q=
|
||||||
@ -390,11 +400,14 @@ github.com/d2g/hardwareaddr v0.0.0-20190221164911-e7d9fbe030e4/go.mod h1:bMl4RjI
|
|||||||
github.com/daaku/go.zipexe v1.0.0/go.mod h1:z8IiR6TsVLEYKwXAoE/I+8ys/sDkgTzSL0CLnGVd57E=
|
github.com/daaku/go.zipexe v1.0.0/go.mod h1:z8IiR6TsVLEYKwXAoE/I+8ys/sDkgTzSL0CLnGVd57E=
|
||||||
github.com/danwakefield/fnmatch v0.0.0-20160403171240-cbb64ac3d964/go.mod h1:Xd9hchkHSWYkEqJwUGisez3G1QY8Ryz0sdWrLPMGjLk=
|
github.com/danwakefield/fnmatch v0.0.0-20160403171240-cbb64ac3d964/go.mod h1:Xd9hchkHSWYkEqJwUGisez3G1QY8Ryz0sdWrLPMGjLk=
|
||||||
github.com/davecgh/go-spew v0.0.0-20171005155431-ecdeabc65495/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
github.com/davecgh/go-spew v0.0.0-20171005155431-ecdeabc65495/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
|
github.com/davecgh/go-spew v1.0.1-0.20160907170601-6d212800a42e/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
github.com/decred/dcrd/crypto/blake256 v1.0.0/go.mod h1:sQl2p6Y26YV+ZOcSTP6thNdn47hh8kt6rqSlvmrXFAc=
|
github.com/decred/dcrd/crypto/blake256 v1.0.0/go.mod h1:sQl2p6Y26YV+ZOcSTP6thNdn47hh8kt6rqSlvmrXFAc=
|
||||||
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1/go.mod h1:hyedUtir6IdtD/7lIxGeCxkaw7y45JueMRL4DIyJDKs=
|
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1/go.mod h1:hyedUtir6IdtD/7lIxGeCxkaw7y45JueMRL4DIyJDKs=
|
||||||
|
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.1.0 h1:HbphB4TFFXpv7MNrT52FGrrgVXF1owhMVTHFZIlnvd4=
|
||||||
|
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.1.0/go.mod h1:DZGJHZMqrU4JJqFAWUS2UO1+lbSKsdiOoYi9Zzey7Fc=
|
||||||
github.com/decred/dcrd/lru v1.0.0/go.mod h1:mxKOwFd7lFjN2GZYsiz/ecgqR6kkYAl+0pz0tEMk218=
|
github.com/decred/dcrd/lru v1.0.0/go.mod h1:mxKOwFd7lFjN2GZYsiz/ecgqR6kkYAl+0pz0tEMk218=
|
||||||
github.com/denisbrodbeck/machineid v1.0.1 h1:geKr9qtkB876mXguW2X6TU4ZynleN6ezuMSRhl4D7AQ=
|
github.com/denisbrodbeck/machineid v1.0.1 h1:geKr9qtkB876mXguW2X6TU4ZynleN6ezuMSRhl4D7AQ=
|
||||||
github.com/denisbrodbeck/machineid v1.0.1/go.mod h1:dJUwb7PTidGDeYyUBmXZ2GphQBbjJCrnectwCyxcUSI=
|
github.com/denisbrodbeck/machineid v1.0.1/go.mod h1:dJUwb7PTidGDeYyUBmXZ2GphQBbjJCrnectwCyxcUSI=
|
||||||
@ -408,8 +421,12 @@ github.com/dhui/dktest v0.3.10/go.mod h1:h5Enh0nG3Qbo9WjNFRrwmKUaePEBhXMOygbz3Ww
|
|||||||
github.com/dlclark/regexp2 v1.1.6/go.mod h1:2pZnwuY/m+8K6iRw6wQdMtk+rH5tNGR1i55kozfMjCc=
|
github.com/dlclark/regexp2 v1.1.6/go.mod h1:2pZnwuY/m+8K6iRw6wQdMtk+rH5tNGR1i55kozfMjCc=
|
||||||
github.com/dlclark/regexp2 v1.2.0/go.mod h1:2pZnwuY/m+8K6iRw6wQdMtk+rH5tNGR1i55kozfMjCc=
|
github.com/dlclark/regexp2 v1.2.0/go.mod h1:2pZnwuY/m+8K6iRw6wQdMtk+rH5tNGR1i55kozfMjCc=
|
||||||
github.com/dlclark/regexp2 v1.4.0/go.mod h1:2pZnwuY/m+8K6iRw6wQdMtk+rH5tNGR1i55kozfMjCc=
|
github.com/dlclark/regexp2 v1.4.0/go.mod h1:2pZnwuY/m+8K6iRw6wQdMtk+rH5tNGR1i55kozfMjCc=
|
||||||
|
github.com/dlclark/regexp2 v1.4.1-0.20201116162257-a2a8dda75c91/go.mod h1:2pZnwuY/m+8K6iRw6wQdMtk+rH5tNGR1i55kozfMjCc=
|
||||||
|
github.com/dlclark/regexp2 v1.7.0/go.mod h1:DHkYz0B9wPfa6wondMfaivmHpzrQ3v9q8cnmRbL6yW8=
|
||||||
github.com/dlclark/regexp2 v1.8.0 h1:rJD5HeGIT/2b5CDk63FVCwZA3qgYElfg+oQK7uH5pfE=
|
github.com/dlclark/regexp2 v1.8.0 h1:rJD5HeGIT/2b5CDk63FVCwZA3qgYElfg+oQK7uH5pfE=
|
||||||
github.com/dlclark/regexp2 v1.8.0/go.mod h1:DHkYz0B9wPfa6wondMfaivmHpzrQ3v9q8cnmRbL6yW8=
|
github.com/dlclark/regexp2 v1.8.0/go.mod h1:DHkYz0B9wPfa6wondMfaivmHpzrQ3v9q8cnmRbL6yW8=
|
||||||
|
github.com/dlclark/regexp2 v1.8.1 h1:6Lcdwya6GjPUNsBct8Lg/yRPwMhABj269AAzdGSiR+0=
|
||||||
|
github.com/dlclark/regexp2 v1.8.1/go.mod h1:DHkYz0B9wPfa6wondMfaivmHpzrQ3v9q8cnmRbL6yW8=
|
||||||
github.com/dnaeon/go-vcr v1.0.1/go.mod h1:aBB1+wY4s93YsC3HHjMBMrwTj2R9FHDzUr9KyGc8n1E=
|
github.com/dnaeon/go-vcr v1.0.1/go.mod h1:aBB1+wY4s93YsC3HHjMBMrwTj2R9FHDzUr9KyGc8n1E=
|
||||||
github.com/docker/cli v0.0.0-20191017083524-a8ff7f821017/go.mod h1:JLrzqnKDaYBop7H2jaqPtU4hHvMKP+vjCwu2uszcLI8=
|
github.com/docker/cli v0.0.0-20191017083524-a8ff7f821017/go.mod h1:JLrzqnKDaYBop7H2jaqPtU4hHvMKP+vjCwu2uszcLI8=
|
||||||
github.com/docker/distribution v0.0.0-20190905152932-14b96e55d84c/go.mod h1:0+TTO4EOBfRPhZXAeF1Vu+W3hHZ8eLp8PgKVZlcvtFY=
|
github.com/docker/distribution v0.0.0-20190905152932-14b96e55d84c/go.mod h1:0+TTO4EOBfRPhZXAeF1Vu+W3hHZ8eLp8PgKVZlcvtFY=
|
||||||
@ -432,9 +449,19 @@ github.com/docker/go-units v0.4.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDD
|
|||||||
github.com/docker/libtrust v0.0.0-20150114040149-fa567046d9b1/go.mod h1:cyGadeNEkKy96OOhEzfZl+yxihPEzKnqJwvfuSUqbZE=
|
github.com/docker/libtrust v0.0.0-20150114040149-fa567046d9b1/go.mod h1:cyGadeNEkKy96OOhEzfZl+yxihPEzKnqJwvfuSUqbZE=
|
||||||
github.com/docker/spdystream v0.0.0-20160310174837-449fdfce4d96/go.mod h1:Qh8CwZgvJUkLughtfhJv5dyTYa91l1fOUCrgjqmcifM=
|
github.com/docker/spdystream v0.0.0-20160310174837-449fdfce4d96/go.mod h1:Qh8CwZgvJUkLughtfhJv5dyTYa91l1fOUCrgjqmcifM=
|
||||||
github.com/docopt/docopt-go v0.0.0-20180111231733-ee0de3bc6815/go.mod h1:WwZ+bS3ebgob9U8Nd0kOddGdZWjyMGR8Wziv+TBNwSE=
|
github.com/docopt/docopt-go v0.0.0-20180111231733-ee0de3bc6815/go.mod h1:WwZ+bS3ebgob9U8Nd0kOddGdZWjyMGR8Wziv+TBNwSE=
|
||||||
|
github.com/dop251/goja v0.0.0-20211022113120-dc8c55024d06/go.mod h1:R9ET47fwRVRPZnOGvHxxhuZcbrMCuiqOz3Rlrh4KSnk=
|
||||||
|
github.com/dop251/goja v0.0.0-20221118162653-d4bf6fde1b86/go.mod h1:yRkwfj0CBpOGre+TwBsqPV0IH0Pk73e4PXJOeNDboGs=
|
||||||
|
github.com/dop251/goja v0.0.0-20230226152633-7c93113e17ac h1:NGu46Adk2oPN3tinGFItahy4W9l+9uhEf03ZxbwmdVE=
|
||||||
|
github.com/dop251/goja v0.0.0-20230226152633-7c93113e17ac/go.mod h1:yRkwfj0CBpOGre+TwBsqPV0IH0Pk73e4PXJOeNDboGs=
|
||||||
|
github.com/dop251/goja_nodejs v0.0.0-20210225215109-d91c329300e7/go.mod h1:hn7BA7c8pLvoGndExHudxTDKZ84Pyvv+90pbBjbTz0Y=
|
||||||
|
github.com/dop251/goja_nodejs v0.0.0-20211022123610-8dd9abb0616d/go.mod h1:DngW8aVqWbuLRMHItjPUyqdj+HWPvnQe8V8y1nDpIbM=
|
||||||
|
github.com/dop251/goja_nodejs v0.0.0-20230226152057-060fa99b809f h1:mmnNidRg3cMfcgyeNtIBSDZgjf/85lA/2pplccwSxYg=
|
||||||
|
github.com/dop251/goja_nodejs v0.0.0-20230226152057-060fa99b809f/go.mod h1:0tlktQL7yHfYEtjcRGi/eiOkbDR5XF7gyFFvbC5//E0=
|
||||||
github.com/dustin/go-humanize v0.0.0-20171111073723-bb3d318650d4/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk=
|
github.com/dustin/go-humanize v0.0.0-20171111073723-bb3d318650d4/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk=
|
||||||
github.com/dustin/go-humanize v1.0.0 h1:VSnTsYCnlFHaM2/igO1h6X3HA71jcobQuxemgkq4zYo=
|
github.com/dustin/go-humanize v1.0.0 h1:VSnTsYCnlFHaM2/igO1h6X3HA71jcobQuxemgkq4zYo=
|
||||||
github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk=
|
github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk=
|
||||||
|
github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY=
|
||||||
|
github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto=
|
||||||
github.com/edsrzf/mmap-go v0.0.0-20170320065105-0bce6a688712/go.mod h1:YO35OhQPt3KJa3ryjFM5Bs14WD66h8eGKpfaBNrHW5M=
|
github.com/edsrzf/mmap-go v0.0.0-20170320065105-0bce6a688712/go.mod h1:YO35OhQPt3KJa3ryjFM5Bs14WD66h8eGKpfaBNrHW5M=
|
||||||
github.com/elazarl/goproxy v0.0.0-20180725130230-947c36da3153/go.mod h1:/Zj4wYkgs4iZTTu3o/KG3Itv/qCCa8VVMlb3i9OVuzc=
|
github.com/elazarl/goproxy v0.0.0-20180725130230-947c36da3153/go.mod h1:/Zj4wYkgs4iZTTu3o/KG3Itv/qCCa8VVMlb3i9OVuzc=
|
||||||
github.com/emicklei/go-restful v0.0.0-20170410110728-ff4f55a20633/go.mod h1:otzb+WCGbkyDHkqmQmT5YD2WR4BBwUdeQoFo8l/7tVs=
|
github.com/emicklei/go-restful v0.0.0-20170410110728-ff4f55a20633/go.mod h1:otzb+WCGbkyDHkqmQmT5YD2WR4BBwUdeQoFo8l/7tVs=
|
||||||
@ -452,10 +479,14 @@ github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7
|
|||||||
github.com/envoyproxy/protoc-gen-validate v0.6.2/go.mod h1:2t7qjJNvHPx8IjnBOzl9E9/baC+qXE/TeeyBRzgJDws=
|
github.com/envoyproxy/protoc-gen-validate v0.6.2/go.mod h1:2t7qjJNvHPx8IjnBOzl9E9/baC+qXE/TeeyBRzgJDws=
|
||||||
github.com/evanphx/json-patch v4.9.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk=
|
github.com/evanphx/json-patch v4.9.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk=
|
||||||
github.com/evanphx/json-patch v4.11.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk=
|
github.com/evanphx/json-patch v4.11.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk=
|
||||||
|
github.com/evanphx/json-patch/v5 v5.6.0 h1:b91NhWfaz02IuVxO9faSllyAtNXHMPkC5J8sJCLunww=
|
||||||
|
github.com/evanphx/json-patch/v5 v5.6.0/go.mod h1:G79N1coSVB93tBe7j6PhzjmR3/2VvlbKOFpnXhI9Bw4=
|
||||||
github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=
|
github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=
|
||||||
github.com/fatih/color v1.12.0/go.mod h1:ELkj/draVOlAH/xkhN6mQ50Qd0MPOk5AAr3maGEBuJM=
|
github.com/fatih/color v1.12.0/go.mod h1:ELkj/draVOlAH/xkhN6mQ50Qd0MPOk5AAr3maGEBuJM=
|
||||||
github.com/fatih/color v1.13.0 h1:8LOYc1KYPPmyKMuN8QV2DNRWNbLo6LZ0iLs8+mlH53w=
|
github.com/fatih/color v1.13.0 h1:8LOYc1KYPPmyKMuN8QV2DNRWNbLo6LZ0iLs8+mlH53w=
|
||||||
github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk=
|
github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk=
|
||||||
|
github.com/fatih/color v1.14.1 h1:qfhVLaG5s+nCROl1zJsZRxFeYrHLqWroPOQ8BWiNb4w=
|
||||||
|
github.com/fatih/color v1.14.1/go.mod h1:2oHN61fhTpgcxD3TSWCgKDiH1+x4OiDVVGH8WlgGZGg=
|
||||||
github.com/felixge/httpsnoop v1.0.1/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U=
|
github.com/felixge/httpsnoop v1.0.1/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U=
|
||||||
github.com/fogleman/gg v1.2.1-0.20190220221249-0403632d5b90/go.mod h1:R/bRT+9gY/C5z7JzPU0zXsXHKM4/ayA+zqcVNZzPa1k=
|
github.com/fogleman/gg v1.2.1-0.20190220221249-0403632d5b90/go.mod h1:R/bRT+9gY/C5z7JzPU0zXsXHKM4/ayA+zqcVNZzPa1k=
|
||||||
github.com/fogleman/gg v1.3.0/go.mod h1:R/bRT+9gY/C5z7JzPU0zXsXHKM4/ayA+zqcVNZzPa1k=
|
github.com/fogleman/gg v1.3.0/go.mod h1:R/bRT+9gY/C5z7JzPU0zXsXHKM4/ayA+zqcVNZzPa1k=
|
||||||
@ -469,6 +500,8 @@ github.com/fsouza/fake-gcs-server v1.17.0/go.mod h1:D1rTE4YCyHFNa99oyJJ5HyclvN/0
|
|||||||
github.com/fullsailor/pkcs7 v0.0.0-20190404230743-d7302db945fa/go.mod h1:KnogPXtdwXqoenmZCw6S+25EAm2MkxbG0deNDu4cbSA=
|
github.com/fullsailor/pkcs7 v0.0.0-20190404230743-d7302db945fa/go.mod h1:KnogPXtdwXqoenmZCw6S+25EAm2MkxbG0deNDu4cbSA=
|
||||||
github.com/gabriel-vasile/mimetype v1.3.1/go.mod h1:fA8fi6KUiG7MgQQ+mEWotXoEOvmxRtOJlERCzSmRvr8=
|
github.com/gabriel-vasile/mimetype v1.3.1/go.mod h1:fA8fi6KUiG7MgQQ+mEWotXoEOvmxRtOJlERCzSmRvr8=
|
||||||
github.com/gabriel-vasile/mimetype v1.4.0/go.mod h1:fA8fi6KUiG7MgQQ+mEWotXoEOvmxRtOJlERCzSmRvr8=
|
github.com/gabriel-vasile/mimetype v1.4.0/go.mod h1:fA8fi6KUiG7MgQQ+mEWotXoEOvmxRtOJlERCzSmRvr8=
|
||||||
|
github.com/gabriel-vasile/mimetype v1.4.1 h1:TRWk7se+TOjCYgRth7+1/OYLNiRNIotknkFtf/dnN7Q=
|
||||||
|
github.com/gabriel-vasile/mimetype v1.4.1/go.mod h1:05Vi0w3Y9c/lNvJOdmIwvrrAhX3rYhfQQCaf9VJcv7M=
|
||||||
github.com/garyburd/redigo v0.0.0-20150301180006-535138d7bcd7/go.mod h1:NR3MbYisc3/PwhQ00EMzDiPmrwpPxAn5GI05/YaO1SY=
|
github.com/garyburd/redigo v0.0.0-20150301180006-535138d7bcd7/go.mod h1:NR3MbYisc3/PwhQ00EMzDiPmrwpPxAn5GI05/YaO1SY=
|
||||||
github.com/getsentry/raven-go v0.2.0/go.mod h1:KungGk8q33+aIAZUIVWZDr2OfAEBsO49PX4NzFV5kcQ=
|
github.com/getsentry/raven-go v0.2.0/go.mod h1:KungGk8q33+aIAZUIVWZDr2OfAEBsO49PX4NzFV5kcQ=
|
||||||
github.com/ghodss/yaml v0.0.0-20150909031657-73d445a93680/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
|
github.com/ghodss/yaml v0.0.0-20150909031657-73d445a93680/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
|
||||||
@ -476,6 +509,8 @@ github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeME
|
|||||||
github.com/go-chi/chi v4.0.2+incompatible/go.mod h1:eB3wogJHnLi3x/kFX2A+IbTBlXxmMeXJVKy9tTv1XzQ=
|
github.com/go-chi/chi v4.0.2+incompatible/go.mod h1:eB3wogJHnLi3x/kFX2A+IbTBlXxmMeXJVKy9tTv1XzQ=
|
||||||
github.com/go-chi/chi v4.1.2+incompatible h1:fGFk2Gmi/YKXk0OmGfBh0WgmN3XB8lVnEyNz34tQRec=
|
github.com/go-chi/chi v4.1.2+incompatible h1:fGFk2Gmi/YKXk0OmGfBh0WgmN3XB8lVnEyNz34tQRec=
|
||||||
github.com/go-chi/chi v4.1.2+incompatible/go.mod h1:eB3wogJHnLi3x/kFX2A+IbTBlXxmMeXJVKy9tTv1XzQ=
|
github.com/go-chi/chi v4.1.2+incompatible/go.mod h1:eB3wogJHnLi3x/kFX2A+IbTBlXxmMeXJVKy9tTv1XzQ=
|
||||||
|
github.com/go-chi/chi/v5 v5.0.8 h1:lD+NLqFcAi1ovnVZpsnObHGW4xb4J8lNmoYVfECH1Y0=
|
||||||
|
github.com/go-chi/chi/v5 v5.0.8/go.mod h1:DslCQbL2OYiznFReuXYUmQ2hGd1aDpCnlMNITLSKoi8=
|
||||||
github.com/go-chi/cors v1.2.1 h1:xEC8UT3Rlp2QuWNEr4Fs/c2EAGVKBwy/1vHx3bppil4=
|
github.com/go-chi/cors v1.2.1 h1:xEC8UT3Rlp2QuWNEr4Fs/c2EAGVKBwy/1vHx3bppil4=
|
||||||
github.com/go-chi/cors v1.2.1/go.mod h1:sSbTewc+6wYHBBCW7ytsFSn836hqM7JxpglAy2Vzc58=
|
github.com/go-chi/cors v1.2.1/go.mod h1:sSbTewc+6wYHBBCW7ytsFSn836hqM7JxpglAy2Vzc58=
|
||||||
github.com/go-fonts/dejavu v0.1.0/go.mod h1:4Wt4I4OU2Nq9asgDCteaAaWZOV24E+0/Pwo0gppep4g=
|
github.com/go-fonts/dejavu v0.1.0/go.mod h1:4Wt4I4OU2Nq9asgDCteaAaWZOV24E+0/Pwo0gppep4g=
|
||||||
@ -521,6 +556,8 @@ github.com/go-playground/locales v0.14.1/go.mod h1:hxrqLVvrK65+Rwrd5Fc6F2O76J/Nu
|
|||||||
github.com/go-playground/universal-translator v0.16.0/go.mod h1:1AnU7NaIRDWWzGEKwgtJRd2xk99HeFyHw3yid4rvQIY=
|
github.com/go-playground/universal-translator v0.16.0/go.mod h1:1AnU7NaIRDWWzGEKwgtJRd2xk99HeFyHw3yid4rvQIY=
|
||||||
github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJnYK9S473LQFuzCbDbfSFY=
|
github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJnYK9S473LQFuzCbDbfSFY=
|
||||||
github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY=
|
github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY=
|
||||||
|
github.com/go-sourcemap/sourcemap v2.1.3+incompatible h1:W1iEw64niKVGogNgBN3ePyLFfuisuzeidWPMPWmECqU=
|
||||||
|
github.com/go-sourcemap/sourcemap v2.1.3+incompatible/go.mod h1:F8jJfvm2KbVjc5NqelyYJmf/v5J0dwNLS2mL4sNA1Jg=
|
||||||
github.com/go-sql-driver/mysql v1.4.0/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w=
|
github.com/go-sql-driver/mysql v1.4.0/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w=
|
||||||
github.com/go-sql-driver/mysql v1.5.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg=
|
github.com/go-sql-driver/mysql v1.5.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg=
|
||||||
github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY=
|
github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY=
|
||||||
@ -550,6 +587,8 @@ github.com/gobuffalo/packd v0.1.0/go.mod h1:M2Juc+hhDXf/PnmBANFCqx4DM3wRbgDvnVWe
|
|||||||
github.com/gobuffalo/packr/v2 v2.0.9/go.mod h1:emmyGweYTm6Kdper+iywB6YK5YzuKchGtJQZ0Odn4pQ=
|
github.com/gobuffalo/packr/v2 v2.0.9/go.mod h1:emmyGweYTm6Kdper+iywB6YK5YzuKchGtJQZ0Odn4pQ=
|
||||||
github.com/gobuffalo/packr/v2 v2.2.0/go.mod h1:CaAwI0GPIAv+5wKLtv8Afwl+Cm78K/I/VCm/3ptBN+0=
|
github.com/gobuffalo/packr/v2 v2.2.0/go.mod h1:CaAwI0GPIAv+5wKLtv8Afwl+Cm78K/I/VCm/3ptBN+0=
|
||||||
github.com/gobuffalo/syncx v0.0.0-20190224160051-33c29581e754/go.mod h1:HhnNqWY95UYwwW3uSASeV7vtgYkT2t16hJgV3AEPUpw=
|
github.com/gobuffalo/syncx v0.0.0-20190224160051-33c29581e754/go.mod h1:HhnNqWY95UYwwW3uSASeV7vtgYkT2t16hJgV3AEPUpw=
|
||||||
|
github.com/goccy/go-json v0.9.11 h1:/pAaQDLHEoCq/5FFmSKBswWmK6H0e8g4159Kc/X/nqk=
|
||||||
|
github.com/goccy/go-json v0.9.11/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I=
|
||||||
github.com/gocql/gocql v0.0.0-20210515062232-b7ef815b4556/go.mod h1:DL0ekTmBSTdlNF25Orwt/JMzqIq3EJ4MVa/J/uK64OY=
|
github.com/gocql/gocql v0.0.0-20210515062232-b7ef815b4556/go.mod h1:DL0ekTmBSTdlNF25Orwt/JMzqIq3EJ4MVa/J/uK64OY=
|
||||||
github.com/godbus/dbus v0.0.0-20151105175453-c7fdd8b5cd55/go.mod h1:/YcGZj5zSblfDWMMoOzV4fas9FZnQYTkDnsGvmh2Grw=
|
github.com/godbus/dbus v0.0.0-20151105175453-c7fdd8b5cd55/go.mod h1:/YcGZj5zSblfDWMMoOzV4fas9FZnQYTkDnsGvmh2Grw=
|
||||||
github.com/godbus/dbus v0.0.0-20180201030542-885f9cc04c9c/go.mod h1:/YcGZj5zSblfDWMMoOzV4fas9FZnQYTkDnsGvmh2Grw=
|
github.com/godbus/dbus v0.0.0-20180201030542-885f9cc04c9c/go.mod h1:/YcGZj5zSblfDWMMoOzV4fas9FZnQYTkDnsGvmh2Grw=
|
||||||
@ -561,6 +600,7 @@ github.com/gofrs/uuid v3.2.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRx
|
|||||||
github.com/gofrs/uuid v4.0.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM=
|
github.com/gofrs/uuid v4.0.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM=
|
||||||
github.com/gogo/googleapis v1.2.0/go.mod h1:Njal3psf3qN6dwBtQfUmBZh2ybovJ0tlu3o/AC7HYjU=
|
github.com/gogo/googleapis v1.2.0/go.mod h1:Njal3psf3qN6dwBtQfUmBZh2ybovJ0tlu3o/AC7HYjU=
|
||||||
github.com/gogo/googleapis v1.4.0/go.mod h1:5YRNX2z1oM5gXdAkurHa942MDgEJyk02w4OecKY87+c=
|
github.com/gogo/googleapis v1.4.0/go.mod h1:5YRNX2z1oM5gXdAkurHa942MDgEJyk02w4OecKY87+c=
|
||||||
|
github.com/gogo/protobuf v0.0.0-20161014173244-50d1bd39ce4e/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ=
|
||||||
github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ=
|
github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ=
|
||||||
github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4=
|
github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4=
|
||||||
github.com/gogo/protobuf v1.2.2-0.20190723190241-65acae22fc9d/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o=
|
github.com/gogo/protobuf v1.2.2-0.20190723190241-65acae22fc9d/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o=
|
||||||
@ -568,6 +608,8 @@ github.com/gogo/protobuf v1.3.0/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXP
|
|||||||
github.com/gogo/protobuf v1.3.1/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o=
|
github.com/gogo/protobuf v1.3.1/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o=
|
||||||
github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q=
|
github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q=
|
||||||
github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q=
|
github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q=
|
||||||
|
github.com/golang-jwt/jwt v3.2.2+incompatible h1:IfV12K8xAKAnZqdXVzCZ+TOjboZ2keLg81eXfW3O+oY=
|
||||||
|
github.com/golang-jwt/jwt v3.2.2+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzqecmYZeUEB8OUGHkxJ+I=
|
||||||
github.com/golang-jwt/jwt/v4 v4.0.0/go.mod h1:/xlHOz8bRuivTWchD4jCa+NbatV+wEUSzwAxVc6locg=
|
github.com/golang-jwt/jwt/v4 v4.0.0/go.mod h1:/xlHOz8bRuivTWchD4jCa+NbatV+wEUSzwAxVc6locg=
|
||||||
github.com/golang-jwt/jwt/v4 v4.1.0/go.mod h1:/xlHOz8bRuivTWchD4jCa+NbatV+wEUSzwAxVc6locg=
|
github.com/golang-jwt/jwt/v4 v4.1.0/go.mod h1:/xlHOz8bRuivTWchD4jCa+NbatV+wEUSzwAxVc6locg=
|
||||||
github.com/golang-migrate/migrate/v4 v4.15.2 h1:vU+M05vs6jWHKDdmE1Ecwj0BznygFc4QsdRe2E/L7kc=
|
github.com/golang-migrate/migrate/v4 v4.15.2 h1:vU+M05vs6jWHKDdmE1Ecwj0BznygFc4QsdRe2E/L7kc=
|
||||||
@ -686,6 +728,8 @@ github.com/gorilla/sessions v1.2.0/go.mod h1:dk2InVEVJ0sfLlnXv9EAgkf6ecYs/i80K/z
|
|||||||
github.com/gorilla/websocket v0.0.0-20170926233335-4201258b820c/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ=
|
github.com/gorilla/websocket v0.0.0-20170926233335-4201258b820c/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ=
|
||||||
github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ=
|
github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ=
|
||||||
github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
|
github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
|
||||||
|
github.com/gorilla/websocket v1.5.0 h1:PPwGk2jz7EePpoHN/+ClbZu8SPxiqlu12wZP/3sWmnc=
|
||||||
|
github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
|
||||||
github.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7/go.mod h1:FecbI9+v66THATjSRHfNgh1IVFe/9kFxbXtjV0ctIMA=
|
github.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7/go.mod h1:FecbI9+v66THATjSRHfNgh1IVFe/9kFxbXtjV0ctIMA=
|
||||||
github.com/grpc-ecosystem/go-grpc-middleware v1.0.0/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs=
|
github.com/grpc-ecosystem/go-grpc-middleware v1.0.0/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs=
|
||||||
github.com/grpc-ecosystem/go-grpc-middleware v1.0.1-0.20190118093823-f849b5445de4/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs=
|
github.com/grpc-ecosystem/go-grpc-middleware v1.0.1-0.20190118093823-f849b5445de4/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs=
|
||||||
@ -713,12 +757,17 @@ github.com/hashicorp/go-sockaddr v1.0.0/go.mod h1:7Xibr9yA9JjQq1JpNB2Vw7kxv8xerX
|
|||||||
github.com/hashicorp/go-syslog v1.0.0/go.mod h1:qPfqrKkXGihmCqbJM2mZgkZGvKG1dFdvsLplgctolz4=
|
github.com/hashicorp/go-syslog v1.0.0/go.mod h1:qPfqrKkXGihmCqbJM2mZgkZGvKG1dFdvsLplgctolz4=
|
||||||
github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro=
|
github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro=
|
||||||
github.com/hashicorp/go-uuid v1.0.1/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro=
|
github.com/hashicorp/go-uuid v1.0.1/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro=
|
||||||
|
github.com/hashicorp/go.net v0.0.0-20151006203346-104dcad90073/go.mod h1:hjKkEWcCURg++eb33jQU7oqQcI9XDCnUzHA0oac0k90=
|
||||||
|
github.com/hashicorp/go.net v0.0.1 h1:sNCoNyDEvN1xa+X0baata4RdcpKwcMS6DH+xwfqPgjw=
|
||||||
github.com/hashicorp/go.net v0.0.1/go.mod h1:hjKkEWcCURg++eb33jQU7oqQcI9XDCnUzHA0oac0k90=
|
github.com/hashicorp/go.net v0.0.1/go.mod h1:hjKkEWcCURg++eb33jQU7oqQcI9XDCnUzHA0oac0k90=
|
||||||
github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
|
github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
|
||||||
github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
|
github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
|
||||||
github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ=
|
github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ=
|
||||||
github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO+LraFDTW64=
|
github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO+LraFDTW64=
|
||||||
|
github.com/hashicorp/mdns v0.0.0-20151206042412-9d85cf22f9f8/go.mod h1:aa76Av3qgPeIQp9Y3qIkTBPieQYNkQ13Kxe7pze9Wb0=
|
||||||
github.com/hashicorp/mdns v1.0.0/go.mod h1:tL+uN++7HEJ6SQLQ2/p+z2pH24WQKWjBPkE0mNTz8vQ=
|
github.com/hashicorp/mdns v1.0.0/go.mod h1:tL+uN++7HEJ6SQLQ2/p+z2pH24WQKWjBPkE0mNTz8vQ=
|
||||||
|
github.com/hashicorp/mdns v1.0.5 h1:1M5hW1cunYeoXOqHwEb/GBDDHAFo0Yqb/uz/beC6LbE=
|
||||||
|
github.com/hashicorp/mdns v1.0.5/go.mod h1:mtBihi+LeNXGtG8L9dX59gAEa12BDtBQSp4v/YAJqrc=
|
||||||
github.com/hashicorp/memberlist v0.1.3/go.mod h1:ajVTdAv/9Im8oMAAj5G31PhhMCZJV2pPBoIllUwCN7I=
|
github.com/hashicorp/memberlist v0.1.3/go.mod h1:ajVTdAv/9Im8oMAAj5G31PhhMCZJV2pPBoIllUwCN7I=
|
||||||
github.com/hashicorp/serf v0.8.2/go.mod h1:6hOLApaqBFA1NXqRQAsxw9QxuDEvNxSQRwA/JwenrHc=
|
github.com/hashicorp/serf v0.8.2/go.mod h1:6hOLApaqBFA1NXqRQAsxw9QxuDEvNxSQRwA/JwenrHc=
|
||||||
github.com/hexops/gotextdiff v1.0.3 h1:gitA9+qJrrTCsiCl7+kh75nPqQt1cx4ZkudSTLoUqJM=
|
github.com/hexops/gotextdiff v1.0.3 h1:gitA9+qJrrTCsiCl7+kh75nPqQt1cx4ZkudSTLoUqJM=
|
||||||
@ -726,6 +775,8 @@ github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpO
|
|||||||
github.com/iancoleman/strcase v0.2.0/go.mod h1:iwCmte+B7n89clKwxIoIXy/HfoL7AsD47ZCWhYzw7ho=
|
github.com/iancoleman/strcase v0.2.0/go.mod h1:iwCmte+B7n89clKwxIoIXy/HfoL7AsD47ZCWhYzw7ho=
|
||||||
github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
|
github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
|
||||||
github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
|
github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
|
||||||
|
github.com/igm/sockjs-go/v3 v3.0.2 h1:2m0k53w0DBiGozeQUIEPR6snZFmpFpYvVsGnfLPNXbE=
|
||||||
|
github.com/igm/sockjs-go/v3 v3.0.2/go.mod h1:UqchsOjeagIBFHvd+RZpLaVRbCwGilEC08EDHsD1jYE=
|
||||||
github.com/imdario/mergo v0.3.5/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA=
|
github.com/imdario/mergo v0.3.5/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA=
|
||||||
github.com/imdario/mergo v0.3.8/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA=
|
github.com/imdario/mergo v0.3.8/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA=
|
||||||
github.com/imdario/mergo v0.3.10/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA=
|
github.com/imdario/mergo v0.3.10/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA=
|
||||||
@ -778,6 +829,8 @@ github.com/jackc/pgx/v4 v4.6.1-0.20200606145419-4e5062306904/go.mod h1:ZDaNWkt9s
|
|||||||
github.com/jackc/pgx/v4 v4.10.1/go.mod h1:QlrWebbs3kqEZPHCTGyxecvzG6tvIsYu+A5b1raylkA=
|
github.com/jackc/pgx/v4 v4.10.1/go.mod h1:QlrWebbs3kqEZPHCTGyxecvzG6tvIsYu+A5b1raylkA=
|
||||||
github.com/jackc/pgx/v5 v5.2.0 h1:NdPpngX0Y6z6XDFKqmFQaE+bCtkqzvQIOt1wvBlAqs8=
|
github.com/jackc/pgx/v5 v5.2.0 h1:NdPpngX0Y6z6XDFKqmFQaE+bCtkqzvQIOt1wvBlAqs8=
|
||||||
github.com/jackc/pgx/v5 v5.2.0/go.mod h1:Ptn7zmohNsWEsdxRawMzk3gaKma2obW+NWTnKa0S4nk=
|
github.com/jackc/pgx/v5 v5.2.0/go.mod h1:Ptn7zmohNsWEsdxRawMzk3gaKma2obW+NWTnKa0S4nk=
|
||||||
|
github.com/jackc/pgx/v5 v5.3.1 h1:Fcr8QJ1ZeLi5zsPZqQeUZhNhxfkkKBOgJuYkJHoBOtU=
|
||||||
|
github.com/jackc/pgx/v5 v5.3.1/go.mod h1:t3JDKnCBlYIc0ewLF0Q7B8MXmoIaBOZj/ic7iHozM/8=
|
||||||
github.com/jackc/puddle v0.0.0-20190413234325-e4ced69a3a2b/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk=
|
github.com/jackc/puddle v0.0.0-20190413234325-e4ced69a3a2b/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk=
|
||||||
github.com/jackc/puddle v0.0.0-20190608224051-11cab39313c9/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk=
|
github.com/jackc/puddle v0.0.0-20190608224051-11cab39313c9/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk=
|
||||||
github.com/jackc/puddle v1.1.0/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk=
|
github.com/jackc/puddle v1.1.0/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk=
|
||||||
@ -785,6 +838,10 @@ github.com/jackc/puddle v1.1.1/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dv
|
|||||||
github.com/jackc/puddle v1.1.3/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk=
|
github.com/jackc/puddle v1.1.3/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk=
|
||||||
github.com/jackc/puddle/v2 v2.1.2 h1:0f7vaaXINONKTsxYDn4otOAiJanX/BMeAtY//BXqzlg=
|
github.com/jackc/puddle/v2 v2.1.2 h1:0f7vaaXINONKTsxYDn4otOAiJanX/BMeAtY//BXqzlg=
|
||||||
github.com/jackc/puddle/v2 v2.1.2/go.mod h1:2lpufsF5mRHO6SuZkm0fNYxM6SWHfvyFj62KwNzgels=
|
github.com/jackc/puddle/v2 v2.1.2/go.mod h1:2lpufsF5mRHO6SuZkm0fNYxM6SWHfvyFj62KwNzgels=
|
||||||
|
github.com/jackc/puddle/v2 v2.2.0 h1:RdcDk92EJBuBS55nQMMYFXTxwstHug4jkhT5pq8VxPk=
|
||||||
|
github.com/jackc/puddle/v2 v2.2.0/go.mod h1:vriiEXHvEE654aYKXXjOvZM39qJ0q+azkZFrfEOc3H4=
|
||||||
|
github.com/jedib0t/go-pretty/v6 v6.4.4 h1:N+gz6UngBPF4M288kiMURPHELDMIhF/Em35aYuKrsSc=
|
||||||
|
github.com/jedib0t/go-pretty/v6 v6.4.4/go.mod h1:MgmISkTWDSFu0xOqiZ0mKNntMQ2mDgOcwOkwBEkMDJI=
|
||||||
github.com/jessevdk/go-flags v0.0.0-20141203071132-1679536dcc89/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI=
|
github.com/jessevdk/go-flags v0.0.0-20141203071132-1679536dcc89/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI=
|
||||||
github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI=
|
github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI=
|
||||||
github.com/jinzhu/inflection v1.0.0/go.mod h1:h+uFLlag+Qp1Va5pdKtLDYj+kHp5pxUVkryuEj+Srlc=
|
github.com/jinzhu/inflection v1.0.0/go.mod h1:h+uFLlag+Qp1Va5pdKtLDYj+kHp5pxUVkryuEj+Srlc=
|
||||||
@ -842,6 +899,7 @@ github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORN
|
|||||||
github.com/kr/pretty v0.2.0/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
|
github.com/kr/pretty v0.2.0/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
|
||||||
github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
|
github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
|
||||||
github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0=
|
github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0=
|
||||||
|
github.com/kr/pretty v0.3.0/go.mod h1:640gp4NfQd8pI5XOwp5fnNeVWj67G7CFk/SaSQn7NBk=
|
||||||
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
|
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
|
||||||
github.com/kr/pty v1.1.5/go.mod h1:9r2w37qlBe7rQ6e1fg1S/9xpWHSnaqNdHD3WcMdbPDA=
|
github.com/kr/pty v1.1.5/go.mod h1:9r2w37qlBe7rQ6e1fg1S/9xpWHSnaqNdHD3WcMdbPDA=
|
||||||
github.com/kr/pty v1.1.8/go.mod h1:O1sed60cT9XZ5uDucP5qwvh+TE3NnUj51EiZO/lmSfw=
|
github.com/kr/pty v1.1.8/go.mod h1:O1sed60cT9XZ5uDucP5qwvh+TE3NnUj51EiZO/lmSfw=
|
||||||
@ -850,8 +908,20 @@ github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
|
|||||||
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
|
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
|
||||||
github.com/ktrysmt/go-bitbucket v0.6.4/go.mod h1:9u0v3hsd2rqCHRIpbir1oP7F58uo5dq19sBYvuMoyQ4=
|
github.com/ktrysmt/go-bitbucket v0.6.4/go.mod h1:9u0v3hsd2rqCHRIpbir1oP7F58uo5dq19sBYvuMoyQ4=
|
||||||
github.com/leodido/go-urn v1.1.0/go.mod h1:+cyI34gQWZcE1eQU7NVgKkkzdXDQHr1dBMtdAPozLkw=
|
github.com/leodido/go-urn v1.1.0/go.mod h1:+cyI34gQWZcE1eQU7NVgKkkzdXDQHr1dBMtdAPozLkw=
|
||||||
github.com/leodido/go-urn v1.2.1 h1:BqpAaACuzVSgi/VLzGZIobT2z4v53pjosyNd9Yv6n/w=
|
github.com/leodido/go-urn v1.2.2 h1:7z68G0FCGvDk646jz1AelTYNYWrTNm0bEcFAo147wt4=
|
||||||
github.com/leodido/go-urn v1.2.1/go.mod h1:zt4jvISO2HfUBqxjfIshjdMTYS56ZS/qv49ictyFfxY=
|
github.com/leodido/go-urn v1.2.2/go.mod h1:kUaIbLZWttglzwNuG0pgsh5vuV6u2YcGBYz1hIPjtOQ=
|
||||||
|
github.com/lestrrat-go/blackmagic v1.0.1 h1:lS5Zts+5HIC/8og6cGHb0uCcNCa3OUt1ygh3Qz2Fe80=
|
||||||
|
github.com/lestrrat-go/blackmagic v1.0.1/go.mod h1:UrEqBzIR2U6CnzVyUtfM6oZNMt/7O7Vohk2J0OGSAtU=
|
||||||
|
github.com/lestrrat-go/httpcc v1.0.1 h1:ydWCStUeJLkpYyjLDHihupbn2tYmZ7m22BGkcvZZrIE=
|
||||||
|
github.com/lestrrat-go/httpcc v1.0.1/go.mod h1:qiltp3Mt56+55GPVCbTdM9MlqhvzyuL6W/NMDA8vA5E=
|
||||||
|
github.com/lestrrat-go/httprc v1.0.4 h1:bAZymwoZQb+Oq8MEbyipag7iSq6YIga8Wj6GOiJGdI8=
|
||||||
|
github.com/lestrrat-go/httprc v1.0.4/go.mod h1:mwwz3JMTPBjHUkkDv/IGJ39aALInZLrhBp0X7KGUZlo=
|
||||||
|
github.com/lestrrat-go/iter v1.0.2 h1:gMXo1q4c2pHmC3dn8LzRhJfP1ceCbgSiT9lUydIzltI=
|
||||||
|
github.com/lestrrat-go/iter v1.0.2/go.mod h1:Momfcq3AnRlRjI5b5O8/G5/BvpzrhoFTZcn06fEOPt4=
|
||||||
|
github.com/lestrrat-go/jwx/v2 v2.0.8 h1:jCFT8oc0hEDVjgUgsBy1F9cbjsjAVZSXNi7JaU9HR/Q=
|
||||||
|
github.com/lestrrat-go/jwx/v2 v2.0.8/go.mod h1:zLxnyv9rTlEvOUHbc48FAfIL8iYu2hHvIRaTFGc8mT0=
|
||||||
|
github.com/lestrrat-go/option v1.0.0 h1:WqAWL8kh8VcSoD6xjSH34/1m8yxluXQbDeKNfvFeEO4=
|
||||||
|
github.com/lestrrat-go/option v1.0.0/go.mod h1:5ZHFbivi4xwXxhxY9XHDe2FHo6/Z7WWmtT7T5nBBp3I=
|
||||||
github.com/lib/pq v1.0.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
|
github.com/lib/pq v1.0.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
|
||||||
github.com/lib/pq v1.1.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
|
github.com/lib/pq v1.1.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
|
||||||
github.com/lib/pq v1.2.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
|
github.com/lib/pq v1.2.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
|
||||||
@ -896,6 +966,8 @@ github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/
|
|||||||
github.com/mattn/go-isatty v0.0.17 h1:BTarxUcIeDqL27Mc+vyvdWYSL28zpIhv3RoTdsLMPng=
|
github.com/mattn/go-isatty v0.0.17 h1:BTarxUcIeDqL27Mc+vyvdWYSL28zpIhv3RoTdsLMPng=
|
||||||
github.com/mattn/go-isatty v0.0.17/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
|
github.com/mattn/go-isatty v0.0.17/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
|
||||||
github.com/mattn/go-runewidth v0.0.2/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU=
|
github.com/mattn/go-runewidth v0.0.2/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU=
|
||||||
|
github.com/mattn/go-runewidth v0.0.13 h1:lTGmDsbAYt5DmK6OnoV7EuIF1wEIFAcxld6ypU4OSgU=
|
||||||
|
github.com/mattn/go-runewidth v0.0.13/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
|
||||||
github.com/mattn/go-shellwords v1.0.3/go.mod h1:3xCvwCdWdlDJUrvuMn7Wuy9eWs4pE8vqg+NOMyg4B2o=
|
github.com/mattn/go-shellwords v1.0.3/go.mod h1:3xCvwCdWdlDJUrvuMn7Wuy9eWs4pE8vqg+NOMyg4B2o=
|
||||||
github.com/mattn/go-shellwords v1.0.6/go.mod h1:3xCvwCdWdlDJUrvuMn7Wuy9eWs4pE8vqg+NOMyg4B2o=
|
github.com/mattn/go-shellwords v1.0.6/go.mod h1:3xCvwCdWdlDJUrvuMn7Wuy9eWs4pE8vqg+NOMyg4B2o=
|
||||||
github.com/mattn/go-shellwords v1.0.12/go.mod h1:EZzvwXDESEeg03EKmM+RmDnNOPKG4lLtQsUlTZDWQ8Y=
|
github.com/mattn/go-shellwords v1.0.12/go.mod h1:EZzvwXDESEeg03EKmM+RmDnNOPKG4lLtQsUlTZDWQ8Y=
|
||||||
@ -903,10 +975,15 @@ github.com/mattn/go-sqlite3 v1.9.0/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOq
|
|||||||
github.com/mattn/go-sqlite3 v1.14.6/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU=
|
github.com/mattn/go-sqlite3 v1.14.6/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU=
|
||||||
github.com/mattn/go-sqlite3 v1.14.10/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU=
|
github.com/mattn/go-sqlite3 v1.14.10/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU=
|
||||||
github.com/mattn/go-sqlite3 v1.14.15 h1:vfoHhTN1af61xCRSWzFIWzx2YskyMTwHLrExkBOjvxI=
|
github.com/mattn/go-sqlite3 v1.14.15 h1:vfoHhTN1af61xCRSWzFIWzx2YskyMTwHLrExkBOjvxI=
|
||||||
|
github.com/mattn/go-sqlite3 v1.14.16 h1:yOQRA0RpS5PFz/oikGwBEqvAWhWg5ufRz4ETLjwpU1Y=
|
||||||
github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=
|
github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=
|
||||||
github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4=
|
github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4=
|
||||||
github.com/maxbrunsfeld/counterfeiter/v6 v6.2.2/go.mod h1:eD9eIE7cdwcMi9rYluz88Jz2VyhSmden33/aXg4oVIY=
|
github.com/maxbrunsfeld/counterfeiter/v6 v6.2.2/go.mod h1:eD9eIE7cdwcMi9rYluz88Jz2VyhSmden33/aXg4oVIY=
|
||||||
|
github.com/miekg/dns v0.0.0-20161006100029-fc4e1e2843d8/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg=
|
||||||
github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg=
|
github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg=
|
||||||
|
github.com/miekg/dns v1.1.41/go.mod h1:p6aan82bvRIyn+zDIv9xYNUpwa73JcSh9BKwknJysuI=
|
||||||
|
github.com/miekg/dns v1.1.51 h1:0+Xg7vObnhrz/4ZCZcZh7zPXlmU0aveS2HDBd0m0qSo=
|
||||||
|
github.com/miekg/dns v1.1.51/go.mod h1:2Z9d3CP1LQWihRZUf29mQ19yDThaI4DAYzte2CaQW5c=
|
||||||
github.com/miekg/pkcs11 v1.0.3/go.mod h1:XsNlhZGX73bx86s2hdc/FuaLm2CPZJemRLMA+WTFxgs=
|
github.com/miekg/pkcs11 v1.0.3/go.mod h1:XsNlhZGX73bx86s2hdc/FuaLm2CPZJemRLMA+WTFxgs=
|
||||||
github.com/mistifyio/go-zfs v2.1.2-0.20190413222219-f784269be439+incompatible/go.mod h1:8AuVvqP/mXw1px98n46wfvcGfQ4ci2FwoAjKYxuo3Z4=
|
github.com/mistifyio/go-zfs v2.1.2-0.20190413222219-f784269be439+incompatible/go.mod h1:8AuVvqP/mXw1px98n46wfvcGfQ4ci2FwoAjKYxuo3Z4=
|
||||||
github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc=
|
github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc=
|
||||||
@ -955,7 +1032,10 @@ github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLA
|
|||||||
github.com/nkovacs/streamquote v0.0.0-20170412213628-49af9bddb229/go.mod h1:0aYXnNPJ8l7uZxf45rWW1a/uME32OF0rhiYGNQ2oF2E=
|
github.com/nkovacs/streamquote v0.0.0-20170412213628-49af9bddb229/go.mod h1:0aYXnNPJ8l7uZxf45rWW1a/uME32OF0rhiYGNQ2oF2E=
|
||||||
github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A=
|
github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A=
|
||||||
github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU=
|
github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU=
|
||||||
|
github.com/oklog/ulid v1.3.1 h1:EGfNDEx6MqHz8B3uNV6QAib1UR2Lm97sHi3ocA6ESJ4=
|
||||||
github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U=
|
github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U=
|
||||||
|
github.com/oklog/ulid/v2 v2.1.0 h1:+9lhoxAP56we25tyYETBBY1YLA2SaoLvUFgrP2miPJU=
|
||||||
|
github.com/oklog/ulid/v2 v2.1.0/go.mod h1:rcEKHmBBKfef9DhnvX7y1HZBYxjXb0cP5ExxNsTT1QQ=
|
||||||
github.com/olekukonko/tablewriter v0.0.0-20170122224234-a0225b3f23b5/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo=
|
github.com/olekukonko/tablewriter v0.0.0-20170122224234-a0225b3f23b5/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo=
|
||||||
github.com/onsi/ginkgo v0.0.0-20151202141238-7f8ab55aaf3b/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
|
github.com/onsi/ginkgo v0.0.0-20151202141238-7f8ab55aaf3b/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
|
||||||
github.com/onsi/ginkgo v0.0.0-20170829012221-11459a886d9c/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
|
github.com/onsi/ginkgo v0.0.0-20170829012221-11459a886d9c/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
|
||||||
@ -1011,8 +1091,11 @@ github.com/opencontainers/selinux v1.8.0/go.mod h1:RScLhm78qiWa2gbVCcGkC7tCGdgk3
|
|||||||
github.com/opencontainers/selinux v1.8.2/go.mod h1:MUIHuUEvKB1wtJjQdOyYRgOnLD2xAPP8dBsCoU0KuF8=
|
github.com/opencontainers/selinux v1.8.2/go.mod h1:MUIHuUEvKB1wtJjQdOyYRgOnLD2xAPP8dBsCoU0KuF8=
|
||||||
github.com/opencontainers/selinux v1.10.0/go.mod h1:2i0OySw99QjzBBQByd1Gr9gSjvuho1lHsJxIJ3gGbJI=
|
github.com/opencontainers/selinux v1.10.0/go.mod h1:2i0OySw99QjzBBQByd1Gr9gSjvuho1lHsJxIJ3gGbJI=
|
||||||
github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o=
|
github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o=
|
||||||
|
github.com/orcaman/concurrent-map v1.0.0 h1:I/2A2XPCb4IuQWcQhBhSwGfiuybl/J0ev9HDbW65HOY=
|
||||||
|
github.com/orcaman/concurrent-map v1.0.0/go.mod h1:Lu3tH6HLW3feq74c2GC+jIMS/K2CFcDWnWD9XkenwhI=
|
||||||
github.com/oxtoacart/bpool v0.0.0-20190530202638-03653db5a59c/go.mod h1:X07ZCGwUbLaax7L0S3Tw4hpejzu63ZrrQiUe6W0hcy0=
|
github.com/oxtoacart/bpool v0.0.0-20190530202638-03653db5a59c/go.mod h1:X07ZCGwUbLaax7L0S3Tw4hpejzu63ZrrQiUe6W0hcy0=
|
||||||
github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc=
|
github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc=
|
||||||
|
github.com/pborman/getopt v0.0.0-20170112200414-7148bc3a4c30/go.mod h1:85jBQOZwpVEaDAr341tbn15RS4fCAsIst0qp7i8ex1o=
|
||||||
github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic=
|
github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic=
|
||||||
github.com/pelletier/go-toml v1.7.0/go.mod h1:vwGMzjaWMwyfHwgIBhI2YUM4fB6nL6lVAvS1LBMMhTE=
|
github.com/pelletier/go-toml v1.7.0/go.mod h1:vwGMzjaWMwyfHwgIBhI2YUM4fB6nL6lVAvS1LBMMhTE=
|
||||||
github.com/pelletier/go-toml v1.8.1/go.mod h1:T2/BmBdy8dvIRq1a/8aqjN41wvWlN4lrapLU/GW4pbc=
|
github.com/pelletier/go-toml v1.8.1/go.mod h1:T2/BmBdy8dvIRq1a/8aqjN41wvWlN4lrapLU/GW4pbc=
|
||||||
@ -1029,7 +1112,9 @@ github.com/pkg/errors v0.8.1-0.20171018195549-f15c970de5b7/go.mod h1:bwawxfHBFNV
|
|||||||
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||||
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
|
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
|
||||||
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||||
|
github.com/pkg/profile v1.6.0/go.mod h1:qBsxPvzyUincmltOk6iyRVxHYg4adc0OFOv72ZdLa18=
|
||||||
github.com/pkg/sftp v1.10.1/go.mod h1:lYOWFsE0bwd1+KfKJaKeuokY15vzFx25BLbzYYoAxZI=
|
github.com/pkg/sftp v1.10.1/go.mod h1:lYOWFsE0bwd1+KfKJaKeuokY15vzFx25BLbzYYoAxZI=
|
||||||
|
github.com/pmezard/go-difflib v0.0.0-20151028094244-d8ed2627bdf0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||||
github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI=
|
github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI=
|
||||||
@ -1067,14 +1152,23 @@ github.com/prometheus/procfs v0.2.0/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4O
|
|||||||
github.com/prometheus/procfs v0.6.0/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA=
|
github.com/prometheus/procfs v0.6.0/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA=
|
||||||
github.com/prometheus/procfs v0.7.3/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA=
|
github.com/prometheus/procfs v0.7.3/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA=
|
||||||
github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU=
|
github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU=
|
||||||
|
github.com/qri-io/jsonpointer v0.1.1 h1:prVZBZLL6TW5vsSB9fFHFAMBLI4b0ri5vribQlTJiBA=
|
||||||
|
github.com/qri-io/jsonpointer v0.1.1/go.mod h1:DnJPaYgiKu56EuDp8TU5wFLdZIcAnb/uH9v37ZaMV64=
|
||||||
|
github.com/qri-io/jsonschema v0.2.1 h1:NNFoKms+kut6ABPf6xiKNM5214jzxAhDBrPHCJ97Wg0=
|
||||||
|
github.com/qri-io/jsonschema v0.2.1/go.mod h1:g7DPkiOsK1xv6T/Ao5scXRkd+yTFygcANPBaaqW+VrI=
|
||||||
github.com/remyoudompheng/bigfft v0.0.0-20190728182440-6a916e37a237/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo=
|
github.com/remyoudompheng/bigfft v0.0.0-20190728182440-6a916e37a237/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo=
|
||||||
github.com/remyoudompheng/bigfft v0.0.0-20200410134404-eec4a21b6bb0 h1:OdAsTTz6OkFY5QxjkYwrChwuRruF69c169dPK26NUlk=
|
github.com/remyoudompheng/bigfft v0.0.0-20200410134404-eec4a21b6bb0 h1:OdAsTTz6OkFY5QxjkYwrChwuRruF69c169dPK26NUlk=
|
||||||
github.com/remyoudompheng/bigfft v0.0.0-20200410134404-eec4a21b6bb0/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo=
|
github.com/remyoudompheng/bigfft v0.0.0-20200410134404-eec4a21b6bb0/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo=
|
||||||
|
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec h1:W09IVJc94icq4NjY3clb7Lk8O1qJ8BdBEF8z0ibU0rE=
|
||||||
|
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo=
|
||||||
|
github.com/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY=
|
||||||
|
github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
|
||||||
github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg=
|
github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg=
|
||||||
github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ=
|
github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ=
|
||||||
github.com/rogpeppe/go-internal v1.1.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
|
github.com/rogpeppe/go-internal v1.1.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
|
||||||
github.com/rogpeppe/go-internal v1.2.2/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
|
github.com/rogpeppe/go-internal v1.2.2/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
|
||||||
github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
|
github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
|
||||||
|
github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc=
|
||||||
github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8=
|
github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8=
|
||||||
github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs=
|
github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs=
|
||||||
github.com/rs/xid v1.2.1/go.mod h1:+uKXf+4Djp6Md1KODXJxgGQPKngRmWyn10oCKFzNHOQ=
|
github.com/rs/xid v1.2.1/go.mod h1:+uKXf+4Djp6Md1KODXJxgGQPKngRmWyn10oCKFzNHOQ=
|
||||||
@ -1084,6 +1178,7 @@ github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQD
|
|||||||
github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk=
|
github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk=
|
||||||
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
|
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
|
||||||
github.com/ruudk/golang-pdf417 v0.0.0-20181029194003-1af4ab5afa58/go.mod h1:6lfFZQK844Gfx8o5WFuvpxWRwnSoipWe/p622j1v06w=
|
github.com/ruudk/golang-pdf417 v0.0.0-20181029194003-1af4ab5afa58/go.mod h1:6lfFZQK844Gfx8o5WFuvpxWRwnSoipWe/p622j1v06w=
|
||||||
|
github.com/rwtodd/Go.Sed v0.0.0-20210816025313-55464686f9ef/go.mod h1:8AEUvGVi2uQ5b24BIhcr0GCcpd/RNAFWaN2CJFrWIIQ=
|
||||||
github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts=
|
github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts=
|
||||||
github.com/safchain/ethtool v0.0.0-20190326074333-42ed695e3de8/go.mod h1:Z0q5wiBQGYcxhMZ6gUqHn6pYNLypFAvaL3UvgZLR0U4=
|
github.com/safchain/ethtool v0.0.0-20190326074333-42ed695e3de8/go.mod h1:Z0q5wiBQGYcxhMZ6gUqHn6pYNLypFAvaL3UvgZLR0U4=
|
||||||
github.com/safchain/ethtool v0.0.0-20210803160452-9aa261dae9b1/go.mod h1:Z0q5wiBQGYcxhMZ6gUqHn6pYNLypFAvaL3UvgZLR0U4=
|
github.com/safchain/ethtool v0.0.0-20210803160452-9aa261dae9b1/go.mod h1:Z0q5wiBQGYcxhMZ6gUqHn6pYNLypFAvaL3UvgZLR0U4=
|
||||||
@ -1145,6 +1240,7 @@ github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoH
|
|||||||
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
|
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
|
||||||
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
|
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
|
||||||
github.com/stretchr/testify v0.0.0-20180303142811-b89eecf5ca5d/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
|
github.com/stretchr/testify v0.0.0-20180303142811-b89eecf5ca5d/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
|
||||||
|
github.com/stretchr/testify v1.1.5-0.20160925220609-976c720a22c8/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
|
||||||
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
|
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
|
||||||
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
||||||
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
|
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
|
||||||
@ -1152,9 +1248,11 @@ github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5
|
|||||||
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||||
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||||
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||||
|
github.com/stretchr/testify v1.7.4/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
|
||||||
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
|
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
|
||||||
github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk=
|
|
||||||
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
|
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
|
||||||
|
github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8=
|
||||||
|
github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
|
||||||
github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw=
|
github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw=
|
||||||
github.com/syndtr/gocapability v0.0.0-20170704070218-db04d3cc01c8/go.mod h1:hkRG7XYTFWNJGYcbNJQlaLq0fg1yr4J4t/NcTQtrfww=
|
github.com/syndtr/gocapability v0.0.0-20170704070218-db04d3cc01c8/go.mod h1:hkRG7XYTFWNJGYcbNJQlaLq0fg1yr4J4t/NcTQtrfww=
|
||||||
github.com/syndtr/gocapability v0.0.0-20180916011248-d98352740cb2/go.mod h1:hkRG7XYTFWNJGYcbNJQlaLq0fg1yr4J4t/NcTQtrfww=
|
github.com/syndtr/gocapability v0.0.0-20180916011248-d98352740cb2/go.mod h1:hkRG7XYTFWNJGYcbNJQlaLq0fg1yr4J4t/NcTQtrfww=
|
||||||
@ -1173,6 +1271,10 @@ github.com/urfave/cli v1.22.1/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtX
|
|||||||
github.com/urfave/cli v1.22.2/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0=
|
github.com/urfave/cli v1.22.2/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0=
|
||||||
github.com/urfave/cli/v2 v2.23.7 h1:YHDQ46s3VghFHFf1DdF+Sh7H4RqhcM+t0TmZRJx4oJY=
|
github.com/urfave/cli/v2 v2.23.7 h1:YHDQ46s3VghFHFf1DdF+Sh7H4RqhcM+t0TmZRJx4oJY=
|
||||||
github.com/urfave/cli/v2 v2.23.7/go.mod h1:GHupkWPMM0M/sj1a2b4wUrWBPzazNrIjouW6fmdJLxc=
|
github.com/urfave/cli/v2 v2.23.7/go.mod h1:GHupkWPMM0M/sj1a2b4wUrWBPzazNrIjouW6fmdJLxc=
|
||||||
|
github.com/urfave/cli/v2 v2.24.3 h1:7Q1w8VN8yE0MJEHP06bv89PjYsN4IHWED2s1v/Zlfm0=
|
||||||
|
github.com/urfave/cli/v2 v2.24.3/go.mod h1:GHupkWPMM0M/sj1a2b4wUrWBPzazNrIjouW6fmdJLxc=
|
||||||
|
github.com/urfave/cli/v2 v2.24.4 h1:0gyJJEBYtCV87zI/x2nZCPyDxD51K6xM8SkwjHFCNEU=
|
||||||
|
github.com/urfave/cli/v2 v2.24.4/go.mod h1:GHupkWPMM0M/sj1a2b4wUrWBPzazNrIjouW6fmdJLxc=
|
||||||
github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc=
|
github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc=
|
||||||
github.com/valyala/fasttemplate v1.0.1/go.mod h1:UQGH1tvbgY+Nz5t2n7tXsz52dQxojPUpymEIMZ47gx8=
|
github.com/valyala/fasttemplate v1.0.1/go.mod h1:UQGH1tvbgY+Nz5t2n7tXsz52dQxojPUpymEIMZ47gx8=
|
||||||
github.com/vishvananda/netlink v0.0.0-20181108222139-023a6dafdcdf/go.mod h1:+SR5DhBJrl6ZM7CoCKvpw5BKroDKQ+PJqOg65H/2ktk=
|
github.com/vishvananda/netlink v0.0.0-20181108222139-023a6dafdcdf/go.mod h1:+SR5DhBJrl6ZM7CoCKvpw5BKroDKQ+PJqOg65H/2ktk=
|
||||||
@ -1202,13 +1304,14 @@ github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9de
|
|||||||
github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
|
github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
|
||||||
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
|
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
|
||||||
github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
|
github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
|
||||||
|
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
|
||||||
github.com/yvasiyarov/go-metrics v0.0.0-20140926110328-57bccd1ccd43/go.mod h1:aX5oPXxHm3bOH+xeAttToC8pqch2ScQN/JoXYupl6xs=
|
github.com/yvasiyarov/go-metrics v0.0.0-20140926110328-57bccd1ccd43/go.mod h1:aX5oPXxHm3bOH+xeAttToC8pqch2ScQN/JoXYupl6xs=
|
||||||
github.com/yvasiyarov/gorelic v0.0.0-20141212073537-a9bba5b9ab50/go.mod h1:NUSPSUX/bi6SeDMUh6brw0nXpxHnc96TguQh0+r/ssA=
|
github.com/yvasiyarov/gorelic v0.0.0-20141212073537-a9bba5b9ab50/go.mod h1:NUSPSUX/bi6SeDMUh6brw0nXpxHnc96TguQh0+r/ssA=
|
||||||
github.com/yvasiyarov/newrelic_platform_go v0.0.0-20140908184405-b21fdbd4370f/go.mod h1:GlGEuHIJweS1mbCqG+7vt2nvWLzLLnRHbXz5JKd/Qbg=
|
github.com/yvasiyarov/newrelic_platform_go v0.0.0-20140908184405-b21fdbd4370f/go.mod h1:GlGEuHIJweS1mbCqG+7vt2nvWLzLLnRHbXz5JKd/Qbg=
|
||||||
github.com/zenazn/goji v0.9.0/go.mod h1:7S9M489iMyHBNxwZnk9/EHS098H4/F6TATF2mIxtB1Q=
|
github.com/zenazn/goji v0.9.0/go.mod h1:7S9M489iMyHBNxwZnk9/EHS098H4/F6TATF2mIxtB1Q=
|
||||||
gitlab.com/nyarla/go-crypt v0.0.0-20160106005555-d9a5dc2b789b/go.mod h1:T3BPAOm2cqquPa0MKWeNkmOM5RQsRhkrwMWonFMN7fE=
|
gitlab.com/nyarla/go-crypt v0.0.0-20160106005555-d9a5dc2b789b/go.mod h1:T3BPAOm2cqquPa0MKWeNkmOM5RQsRhkrwMWonFMN7fE=
|
||||||
gitlab.com/wpetit/goweb v0.0.0-20230206085656-dec695f0e2e9 h1:6JlkcdjYVQglPWYuemK2MoZAtRE4vFx85zLXflGIyI8=
|
gitlab.com/wpetit/goweb v0.0.0-20230227162855-a1f09bafccb3 h1:ddXRTeqEr7LcHQEtkd6gogZOh9tI1Y6Gappr0a1oa2I=
|
||||||
gitlab.com/wpetit/goweb v0.0.0-20230206085656-dec695f0e2e9/go.mod h1:3sus4zjoUv1GB7eDLL60QaPkUnXJCWBpjvbe0jWifeY=
|
gitlab.com/wpetit/goweb v0.0.0-20230227162855-a1f09bafccb3/go.mod h1:3sus4zjoUv1GB7eDLL60QaPkUnXJCWBpjvbe0jWifeY=
|
||||||
go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU=
|
go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU=
|
||||||
go.etcd.io/bbolt v1.3.3/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU=
|
go.etcd.io/bbolt v1.3.3/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU=
|
||||||
go.etcd.io/bbolt v1.3.5/go.mod h1:G5EMThwa9y8QZGBClrRx5EY+Yw9kAhnjy3bSjsnlVTQ=
|
go.etcd.io/bbolt v1.3.5/go.mod h1:G5EMThwa9y8QZGBClrRx5EY+Yw9kAhnjy3bSjsnlVTQ=
|
||||||
@ -1294,8 +1397,11 @@ golang.org/x/crypto v0.0.0-20210220033148-5ea612d1eb83/go.mod h1:jdWPYTVW3xRLrWP
|
|||||||
golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4=
|
golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4=
|
||||||
golang.org/x/crypto v0.0.0-20210817164053-32db794688a5/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
|
golang.org/x/crypto v0.0.0-20210817164053-32db794688a5/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
|
||||||
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
|
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
|
||||||
|
golang.org/x/crypto v0.0.0-20220427172511-eb4f295cb31f/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
|
||||||
golang.org/x/crypto v0.5.0 h1:U/0M97KRkSFvyD/3FSmdP5W5swImpNgle/EHFhOsQPE=
|
golang.org/x/crypto v0.5.0 h1:U/0M97KRkSFvyD/3FSmdP5W5swImpNgle/EHFhOsQPE=
|
||||||
golang.org/x/crypto v0.5.0/go.mod h1:NK/OQwhpMQP3MwtdjgLlYHnH9ebylxKWv3e0fK+mkQU=
|
golang.org/x/crypto v0.5.0/go.mod h1:NK/OQwhpMQP3MwtdjgLlYHnH9ebylxKWv3e0fK+mkQU=
|
||||||
|
golang.org/x/crypto v0.6.0 h1:qfktjS5LUO+fFKeJXZ+ikTRijMmljikvG68fpMMruSc=
|
||||||
|
golang.org/x/crypto v0.6.0/go.mod h1:OFC/31mSvZgRz0V1QTNCzfAI1aIRzbiufJtkMIlEp58=
|
||||||
golang.org/x/exp v0.0.0-20180321215751-8460e604b9de/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
golang.org/x/exp v0.0.0-20180321215751-8460e604b9de/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
||||||
golang.org/x/exp v0.0.0-20180807140117-3d87b88a115f/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
golang.org/x/exp v0.0.0-20180807140117-3d87b88a115f/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
||||||
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
||||||
@ -1345,6 +1451,10 @@ golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
|
|||||||
golang.org/x/mod v0.5.0/go.mod h1:5OXOZSfqPIIbmVBIIKWRFfZjPR0E5r58TLhUjH0a2Ro=
|
golang.org/x/mod v0.5.0/go.mod h1:5OXOZSfqPIIbmVBIIKWRFfZjPR0E5r58TLhUjH0a2Ro=
|
||||||
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4 h1:6zppjxzCulZykYSLyVDYbneBfbaBIQPYMevg0bEwv2s=
|
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4 h1:6zppjxzCulZykYSLyVDYbneBfbaBIQPYMevg0bEwv2s=
|
||||||
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
|
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
|
||||||
|
golang.org/x/mod v0.7.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
|
||||||
|
golang.org/x/mod v0.8.0 h1:LUYupSeNrTNCGzR/hVBk2NHZO4hXcVaW1k4Qx7rjPx8=
|
||||||
|
golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
|
||||||
|
golang.org/x/net v0.0.0-20161013035702-8b4af36cd21a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||||
golang.org/x/net v0.0.0-20180218175443-cbe0f9307d01/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
golang.org/x/net v0.0.0-20180218175443-cbe0f9307d01/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||||
golang.org/x/net v0.0.0-20180719180050-a680a1efc54d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
golang.org/x/net v0.0.0-20180719180050-a680a1efc54d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||||
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||||
@ -1401,6 +1511,7 @@ golang.org/x/net v0.0.0-20210119194325-5f4716e94777/go.mod h1:m0MpNAwzfU5UDzcl9v
|
|||||||
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
|
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
|
||||||
golang.org/x/net v0.0.0-20210316092652-d523dce5a7f4/go.mod h1:RBQZq4jEuRlivfhVLdyRGr576XBO4/greRjx4P4O3yc=
|
golang.org/x/net v0.0.0-20210316092652-d523dce5a7f4/go.mod h1:RBQZq4jEuRlivfhVLdyRGr576XBO4/greRjx4P4O3yc=
|
||||||
golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM=
|
golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM=
|
||||||
|
golang.org/x/net v0.0.0-20210410081132-afb366fc7cd1/go.mod h1:9tjilg8BloeKEkVJvy7fQ90B1CfIiPueXVOjqfkSzI8=
|
||||||
golang.org/x/net v0.0.0-20210428140749-89ef3d95e781/go.mod h1:OJAsFXCWl8Ukc7SiCT/9KSuxbyM7479/AVlXFRxuMCk=
|
golang.org/x/net v0.0.0-20210428140749-89ef3d95e781/go.mod h1:OJAsFXCWl8Ukc7SiCT/9KSuxbyM7479/AVlXFRxuMCk=
|
||||||
golang.org/x/net v0.0.0-20210503060351-7fd8e65b6420/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
|
golang.org/x/net v0.0.0-20210503060351-7fd8e65b6420/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
|
||||||
golang.org/x/net v0.0.0-20210505024714-0287a6fb4125/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
|
golang.org/x/net v0.0.0-20210505024714-0287a6fb4125/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
|
||||||
@ -1409,11 +1520,19 @@ golang.org/x/net v0.0.0-20210525063256-abc453219eb5/go.mod h1:9nx3DQGgdP8bBQD5qx
|
|||||||
golang.org/x/net v0.0.0-20210614182718-04defd469f4e/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
|
golang.org/x/net v0.0.0-20210614182718-04defd469f4e/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
|
||||||
golang.org/x/net v0.0.0-20210813160813-60bc85c4be6d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
|
golang.org/x/net v0.0.0-20210813160813-60bc85c4be6d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
|
||||||
golang.org/x/net v0.0.0-20210825183410-e898025ed96a/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
|
golang.org/x/net v0.0.0-20210825183410-e898025ed96a/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
|
||||||
|
golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
|
||||||
golang.org/x/net v0.0.0-20211209124913-491a49abca63/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
|
golang.org/x/net v0.0.0-20211209124913-491a49abca63/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
|
||||||
golang.org/x/net v0.0.0-20211216030914-fe4d6282115f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
|
golang.org/x/net v0.0.0-20211216030914-fe4d6282115f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
|
||||||
golang.org/x/net v0.0.0-20220111093109-d55c255bac03/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
|
golang.org/x/net v0.0.0-20220111093109-d55c255bac03/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
|
||||||
golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk=
|
golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk=
|
||||||
|
golang.org/x/net v0.0.0-20220624214902-1bab6f366d9e/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
|
||||||
|
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
|
||||||
|
golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY=
|
||||||
|
golang.org/x/net v0.4.0/go.mod h1:MBQ8lrhLObU/6UmLb4fmbmk5OcyYmqtbGd/9yIeKjEE=
|
||||||
golang.org/x/net v0.5.0 h1:GyT4nK/YDHSqa1c4753ouYCDajOYKTja9Xb/OHtgvSw=
|
golang.org/x/net v0.5.0 h1:GyT4nK/YDHSqa1c4753ouYCDajOYKTja9Xb/OHtgvSw=
|
||||||
|
golang.org/x/net v0.5.0/go.mod h1:DivGGAXEgPSlEBzxGzZI+ZLohi+xUj054jfeKui00ws=
|
||||||
|
golang.org/x/net v0.7.0 h1:rJrUqqhjsgNp7KqAIc25s9pZnjU7TUcSY7HcVZjdn1g=
|
||||||
|
golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
|
||||||
golang.org/x/oauth2 v0.0.0-20180227000427-d7d64896b5ff/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
|
golang.org/x/oauth2 v0.0.0-20180227000427-d7d64896b5ff/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
|
||||||
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
|
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
|
||||||
golang.org/x/oauth2 v0.0.0-20181106182150-f42d05182288/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
|
golang.org/x/oauth2 v0.0.0-20181106182150-f42d05182288/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
|
||||||
@ -1444,8 +1563,11 @@ golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJ
|
|||||||
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
|
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
golang.org/x/sync v0.0.0-20220923202941-7f9b1623fab7 h1:ZrnxWX62AgTKOSagEqxvb3ffipvEDX2pl7E1TdqLqIc=
|
golang.org/x/sync v0.0.0-20220923202941-7f9b1623fab7 h1:ZrnxWX62AgTKOSagEqxvb3ffipvEDX2pl7E1TdqLqIc=
|
||||||
golang.org/x/sync v0.0.0-20220923202941-7f9b1623fab7/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
golang.org/x/sync v0.0.0-20220923202941-7f9b1623fab7/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
|
golang.org/x/sync v0.1.0 h1:wsuoTGHzEhffawBOhz5CYhcrV4IdKZbEyZjBMuTp12o=
|
||||||
|
golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
golang.org/x/sys v0.0.0-20180224232135-f6cff0780e54/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
golang.org/x/sys v0.0.0-20180224232135-f6cff0780e54/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||||
golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||||
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||||
@ -1535,6 +1657,7 @@ golang.org/x/sys v0.0.0-20210112080510-489259a85091/go.mod h1:h1NjWce9XRLGQEsW7w
|
|||||||
golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
golang.org/x/sys v0.0.0-20210220050731-9a76102bfb43/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
golang.org/x/sys v0.0.0-20210220050731-9a76102bfb43/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
|
golang.org/x/sys v0.0.0-20210303074136-134d130e1a04/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
golang.org/x/sys v0.0.0-20210304124612-50617c2ba197/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
golang.org/x/sys v0.0.0-20210304124612-50617c2ba197/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
golang.org/x/sys v0.0.0-20210305230114-8fe3ee5dd75b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
golang.org/x/sys v0.0.0-20210305230114-8fe3ee5dd75b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
golang.org/x/sys v0.0.0-20210315160823-c6e025ad8005/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
golang.org/x/sys v0.0.0-20210315160823-c6e025ad8005/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
@ -1569,16 +1692,26 @@ golang.org/x/sys v0.0.0-20211205182925-97ca703d548d/go.mod h1:oPkhp1MJrh7nUepCBc
|
|||||||
golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
golang.org/x/sys v0.0.0-20220111092808-5a964db01320/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
golang.org/x/sys v0.0.0-20220111092808-5a964db01320/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
golang.org/x/sys v0.0.0-20220317061510-51cd9980dadf/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
golang.org/x/sys v0.0.0-20220317061510-51cd9980dadf/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
|
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
|
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
|
golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
|
golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
golang.org/x/sys v0.4.0 h1:Zr2JFtRQNX3BCZ8YtxRE9hNJYC8J6I1MVbMg6owUp18=
|
golang.org/x/sys v0.4.0 h1:Zr2JFtRQNX3BCZ8YtxRE9hNJYC8J6I1MVbMg6owUp18=
|
||||||
golang.org/x/sys v0.4.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
golang.org/x/sys v0.4.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
|
golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU=
|
||||||
|
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw=
|
golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw=
|
||||||
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
||||||
golang.org/x/term v0.0.0-20210220032956-6a3ed077a48d/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
golang.org/x/term v0.0.0-20210220032956-6a3ed077a48d/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
||||||
golang.org/x/term v0.0.0-20210615171337-6886f2dfbf5b/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
|
golang.org/x/term v0.0.0-20210615171337-6886f2dfbf5b/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
|
||||||
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
|
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
|
||||||
|
golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc=
|
||||||
|
golang.org/x/term v0.3.0/go.mod h1:q750SLmJuPmVoN1blW3UFBPREJfb1KmY3vwxfr+nFDA=
|
||||||
golang.org/x/term v0.4.0 h1:O7UWfv5+A2qiuulQk30kVinPoMtoIPeVaKLEgLpVkvg=
|
golang.org/x/term v0.4.0 h1:O7UWfv5+A2qiuulQk30kVinPoMtoIPeVaKLEgLpVkvg=
|
||||||
golang.org/x/term v0.4.0/go.mod h1:9P2UbLfCdcvo3p/nzKvsmas4TnlujnuoV9hGgYzW1lQ=
|
golang.org/x/term v0.4.0/go.mod h1:9P2UbLfCdcvo3p/nzKvsmas4TnlujnuoV9hGgYzW1lQ=
|
||||||
|
golang.org/x/term v0.5.0 h1:n2a8QNdAb0sZNpU9R1ALUXBbY+w51fCQDN+7EdxNBsY=
|
||||||
|
golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k=
|
||||||
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||||
golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||||
@ -1588,8 +1721,12 @@ golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
|||||||
golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||||
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||||
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
|
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
|
||||||
|
golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
|
||||||
|
golang.org/x/text v0.5.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
|
||||||
golang.org/x/text v0.6.0 h1:3XmdazWV+ubf7QgHSTWeykHOci5oeekaGJBLkrkaw4k=
|
golang.org/x/text v0.6.0 h1:3XmdazWV+ubf7QgHSTWeykHOci5oeekaGJBLkrkaw4k=
|
||||||
golang.org/x/text v0.6.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
|
golang.org/x/text v0.6.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
|
||||||
|
golang.org/x/text v0.7.0 h1:4BRB4x83lYWy72KwLD/qYDuTu7q9PjSagHvijDw7cLo=
|
||||||
|
golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
|
||||||
golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
||||||
golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
||||||
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
||||||
@ -1679,6 +1816,9 @@ golang.org/x/tools v0.1.4/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
|
|||||||
golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
|
golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
|
||||||
golang.org/x/tools v0.1.12 h1:VveCTK38A2rkS8ZqFY25HIDFscX5X9OoEhJd3quQmXU=
|
golang.org/x/tools v0.1.12 h1:VveCTK38A2rkS8ZqFY25HIDFscX5X9OoEhJd3quQmXU=
|
||||||
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
|
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
|
||||||
|
golang.org/x/tools v0.3.0/go.mod h1:/rWhSS2+zyEVwoJf8YAX6L2f0ntZ7Kn/mGgAWcipA5k=
|
||||||
|
golang.org/x/tools v0.6.0 h1:BOw41kyTf3PuCW1pVQf8+Cyg8pMlkYB1oo9iJ6D/lKM=
|
||||||
|
golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU=
|
||||||
golang.org/x/xerrors v0.0.0-20190410155217-1f06c39b4373/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
golang.org/x/xerrors v0.0.0-20190410155217-1f06c39b4373/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||||
golang.org/x/xerrors v0.0.0-20190513163551-3ee3066db522/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
golang.org/x/xerrors v0.0.0-20190513163551-3ee3066db522/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||||
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||||
@ -1893,6 +2033,7 @@ gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
|||||||
gopkg.in/yaml.v2 v2.2.7/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
gopkg.in/yaml.v2 v2.2.7/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||||
gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||||
gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||||
|
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
|
||||||
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
|
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
|
||||||
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||||
gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||||
@ -1977,6 +2118,8 @@ modernc.org/libc v1.7.13-0.20210308123627-12f642a52bb8/go.mod h1:U1eq8YWr/Kc1RWC
|
|||||||
modernc.org/libc v1.9.5/go.mod h1:U1eq8YWr/Kc1RWCMFUWEdkTg8OTcfLw2kY8EDwl039w=
|
modernc.org/libc v1.9.5/go.mod h1:U1eq8YWr/Kc1RWCMFUWEdkTg8OTcfLw2kY8EDwl039w=
|
||||||
modernc.org/libc v1.22.2 h1:4U7v51GyhlWqQmwCHj28Rdq2Yzwk55ovjFrdPjs8Hb0=
|
modernc.org/libc v1.22.2 h1:4U7v51GyhlWqQmwCHj28Rdq2Yzwk55ovjFrdPjs8Hb0=
|
||||||
modernc.org/libc v1.22.2/go.mod h1:uvQavJ1pZ0hIoC/jfqNoMLURIMhKzINIWypNM17puug=
|
modernc.org/libc v1.22.2/go.mod h1:uvQavJ1pZ0hIoC/jfqNoMLURIMhKzINIWypNM17puug=
|
||||||
|
modernc.org/libc v1.22.3 h1:D/g6O5ftAfavceqlLOFwaZuA5KYafKwmr30A6iSqoyY=
|
||||||
|
modernc.org/libc v1.22.3/go.mod h1:MQrloYP209xa2zHome2a8HLiLm6k0UT8CoHpV74tOFw=
|
||||||
modernc.org/lldb v1.0.0/go.mod h1:jcRvJGWfCGodDZz8BPwiKMJxGJngQ/5DrRapkQnLob8=
|
modernc.org/lldb v1.0.0/go.mod h1:jcRvJGWfCGodDZz8BPwiKMJxGJngQ/5DrRapkQnLob8=
|
||||||
modernc.org/mathutil v1.0.0/go.mod h1:wU0vUrJsVWBZ4P6e7xtFJEhFSNsfRLJ8H458uRjg03k=
|
modernc.org/mathutil v1.0.0/go.mod h1:wU0vUrJsVWBZ4P6e7xtFJEhFSNsfRLJ8H458uRjg03k=
|
||||||
modernc.org/mathutil v1.1.1/go.mod h1:mZW8CKdRPY1v87qxC/wUdX5O1qDzXMP5TH3wjfpga6E=
|
modernc.org/mathutil v1.1.1/go.mod h1:mZW8CKdRPY1v87qxC/wUdX5O1qDzXMP5TH3wjfpga6E=
|
||||||
@ -1986,6 +2129,8 @@ modernc.org/mathutil v1.5.0/go.mod h1:mZW8CKdRPY1v87qxC/wUdX5O1qDzXMP5TH3wjfpga6
|
|||||||
modernc.org/memory v1.0.4/go.mod h1:nV2OApxradM3/OVbs2/0OsP6nPfakXpi50C7dcoHXlc=
|
modernc.org/memory v1.0.4/go.mod h1:nV2OApxradM3/OVbs2/0OsP6nPfakXpi50C7dcoHXlc=
|
||||||
modernc.org/memory v1.4.0 h1:crykUfNSnMAXaOJnnxcSzbUGMqkLWjklJKkBK2nwZwk=
|
modernc.org/memory v1.4.0 h1:crykUfNSnMAXaOJnnxcSzbUGMqkLWjklJKkBK2nwZwk=
|
||||||
modernc.org/memory v1.4.0/go.mod h1:PkUhL0Mugw21sHPeskwZW4D6VscE/GQJOnIpCnW6pSU=
|
modernc.org/memory v1.4.0/go.mod h1:PkUhL0Mugw21sHPeskwZW4D6VscE/GQJOnIpCnW6pSU=
|
||||||
|
modernc.org/memory v1.5.0 h1:N+/8c5rE6EqugZwHii4IFsaJ7MUhoWX07J5tC/iI5Ds=
|
||||||
|
modernc.org/memory v1.5.0/go.mod h1:PkUhL0Mugw21sHPeskwZW4D6VscE/GQJOnIpCnW6pSU=
|
||||||
modernc.org/opt v0.1.1/go.mod h1:WdSiB5evDcignE70guQKxYUl14mgWtbClRi5wmkkTX0=
|
modernc.org/opt v0.1.1/go.mod h1:WdSiB5evDcignE70guQKxYUl14mgWtbClRi5wmkkTX0=
|
||||||
modernc.org/opt v0.1.3 h1:3XOZf2yznlhC+ibLltsDGzABUGVx8J6pnFMS3E4dcq4=
|
modernc.org/opt v0.1.3 h1:3XOZf2yznlhC+ibLltsDGzABUGVx8J6pnFMS3E4dcq4=
|
||||||
modernc.org/opt v0.1.3/go.mod h1:WdSiB5evDcignE70guQKxYUl14mgWtbClRi5wmkkTX0=
|
modernc.org/opt v0.1.3/go.mod h1:WdSiB5evDcignE70guQKxYUl14mgWtbClRi5wmkkTX0=
|
||||||
@ -1994,14 +2139,21 @@ modernc.org/sortutil v1.1.0/go.mod h1:ZyL98OQHJgH9IEfN71VsamvJgrtRX9Dj2gX+vH86L1
|
|||||||
modernc.org/sqlite v1.10.6/go.mod h1:Z9FEjUtZP4qFEg6/SiADg9XCER7aYy9a/j7Pg9P7CPs=
|
modernc.org/sqlite v1.10.6/go.mod h1:Z9FEjUtZP4qFEg6/SiADg9XCER7aYy9a/j7Pg9P7CPs=
|
||||||
modernc.org/sqlite v1.20.3 h1:SqGJMMxjj1PHusLxdYxeQSodg7Jxn9WWkaAQjKrntZs=
|
modernc.org/sqlite v1.20.3 h1:SqGJMMxjj1PHusLxdYxeQSodg7Jxn9WWkaAQjKrntZs=
|
||||||
modernc.org/sqlite v1.20.3/go.mod h1:zKcGyrICaxNTMEHSr1HQ2GUraP0j+845GYw37+EyT6A=
|
modernc.org/sqlite v1.20.3/go.mod h1:zKcGyrICaxNTMEHSr1HQ2GUraP0j+845GYw37+EyT6A=
|
||||||
|
modernc.org/sqlite v1.20.4 h1:J8+m2trkN+KKoE7jglyHYYYiaq5xmz2HoHJIiBlRzbE=
|
||||||
|
modernc.org/sqlite v1.20.4/go.mod h1:zKcGyrICaxNTMEHSr1HQ2GUraP0j+845GYw37+EyT6A=
|
||||||
|
modernc.org/sqlite v1.21.0 h1:4aP4MdUf15i3R3M2mx6Q90WHKz3nZLoz96zlB6tNdow=
|
||||||
|
modernc.org/sqlite v1.21.0/go.mod h1:XwQ0wZPIh1iKb5mkvCJ3szzbhk+tykC8ZWqTRTgYRwI=
|
||||||
modernc.org/strutil v1.1.0/go.mod h1:lstksw84oURvj9y3tn8lGvRxyRC1S2+g5uuIzNfIOBs=
|
modernc.org/strutil v1.1.0/go.mod h1:lstksw84oURvj9y3tn8lGvRxyRC1S2+g5uuIzNfIOBs=
|
||||||
modernc.org/strutil v1.1.3 h1:fNMm+oJklMGYfU9Ylcywl0CO5O6nTfaowNsh2wpPjzY=
|
modernc.org/strutil v1.1.3 h1:fNMm+oJklMGYfU9Ylcywl0CO5O6nTfaowNsh2wpPjzY=
|
||||||
modernc.org/strutil v1.1.3/go.mod h1:MEHNA7PdEnEwLvspRMtWTNnp2nnyvMfkimT1NKNAGbw=
|
modernc.org/strutil v1.1.3/go.mod h1:MEHNA7PdEnEwLvspRMtWTNnp2nnyvMfkimT1NKNAGbw=
|
||||||
modernc.org/tcl v1.5.2/go.mod h1:pmJYOLgpiys3oI4AeAafkcUfE+TKKilminxNyU/+Zlo=
|
modernc.org/tcl v1.5.2/go.mod h1:pmJYOLgpiys3oI4AeAafkcUfE+TKKilminxNyU/+Zlo=
|
||||||
modernc.org/tcl v1.15.0 h1:oY+JeD11qVVSgVvodMJsu7Edf8tr5E/7tuhF5cNYz34=
|
modernc.org/tcl v1.15.0 h1:oY+JeD11qVVSgVvodMJsu7Edf8tr5E/7tuhF5cNYz34=
|
||||||
|
modernc.org/tcl v1.15.1 h1:mOQwiEK4p7HruMZcwKTZPw/aqtGM4aY00uzWhlKKYws=
|
||||||
modernc.org/token v1.0.0/go.mod h1:UGzOrNV1mAFSEB63lOFHIpNRUVMvYTc6yu1SMY/XTDM=
|
modernc.org/token v1.0.0/go.mod h1:UGzOrNV1mAFSEB63lOFHIpNRUVMvYTc6yu1SMY/XTDM=
|
||||||
modernc.org/token v1.0.1 h1:A3qvTqOwexpfZZeyI0FeGPDlSWX5pjZu9hF4lU+EKWg=
|
modernc.org/token v1.0.1 h1:A3qvTqOwexpfZZeyI0FeGPDlSWX5pjZu9hF4lU+EKWg=
|
||||||
modernc.org/token v1.0.1/go.mod h1:UGzOrNV1mAFSEB63lOFHIpNRUVMvYTc6yu1SMY/XTDM=
|
modernc.org/token v1.0.1/go.mod h1:UGzOrNV1mAFSEB63lOFHIpNRUVMvYTc6yu1SMY/XTDM=
|
||||||
|
modernc.org/token v1.1.0 h1:Xl7Ap9dKaEs5kLoOQeQmPWevfnk/DM5qcLcYlA8ys6Y=
|
||||||
|
modernc.org/token v1.1.0/go.mod h1:UGzOrNV1mAFSEB63lOFHIpNRUVMvYTc6yu1SMY/XTDM=
|
||||||
modernc.org/z v1.0.1-0.20210308123920-1f282aa71362/go.mod h1:8/SRk5C/HgiQWCgXdfpb+1RvhORdkz5sw72d3jjtyqA=
|
modernc.org/z v1.0.1-0.20210308123920-1f282aa71362/go.mod h1:8/SRk5C/HgiQWCgXdfpb+1RvhORdkz5sw72d3jjtyqA=
|
||||||
modernc.org/z v1.0.1/go.mod h1:8/SRk5C/HgiQWCgXdfpb+1RvhORdkz5sw72d3jjtyqA=
|
modernc.org/z v1.0.1/go.mod h1:8/SRk5C/HgiQWCgXdfpb+1RvhORdkz5sw72d3jjtyqA=
|
||||||
modernc.org/z v1.7.0 h1:xkDw/KepgEjeizO2sNco+hqYkU12taxQFqPEmgm1GWE=
|
modernc.org/z v1.7.0 h1:xkDw/KepgEjeizO2sNco+hqYkU12taxQFqPEmgm1GWE=
|
||||||
|
@ -4,13 +4,21 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"forge.cadoles.com/Cadoles/emissary/internal/agent/metadata"
|
||||||
|
"forge.cadoles.com/Cadoles/emissary/internal/client"
|
||||||
|
"forge.cadoles.com/Cadoles/emissary/internal/jwk"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
|
"gitlab.com/wpetit/goweb/api"
|
||||||
"gitlab.com/wpetit/goweb/logger"
|
"gitlab.com/wpetit/goweb/logger"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Agent struct {
|
type Agent struct {
|
||||||
|
thumbprint string
|
||||||
|
privateKey jwk.Key
|
||||||
|
client *client.Client
|
||||||
controllers []Controller
|
controllers []Controller
|
||||||
interval time.Duration
|
interval time.Duration
|
||||||
|
collectors []metadata.Collector
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *Agent) Run(ctx context.Context) error {
|
func (a *Agent) Run(ctx context.Context) error {
|
||||||
@ -21,10 +29,20 @@ func (a *Agent) Run(ctx context.Context) error {
|
|||||||
ticker := time.NewTicker(a.interval)
|
ticker := time.NewTicker(a.interval)
|
||||||
defer ticker.Stop()
|
defer ticker.Stop()
|
||||||
|
|
||||||
|
ctx = withClient(ctx, a.client)
|
||||||
|
|
||||||
for {
|
for {
|
||||||
select {
|
select {
|
||||||
case <-ticker.C:
|
case <-ticker.C:
|
||||||
|
|
||||||
|
logger.Debug(ctx, "registering agent")
|
||||||
|
|
||||||
|
if err := a.registerAgent(ctx, state); err != nil {
|
||||||
|
logger.Error(ctx, "could not register agent", logger.E(errors.WithStack(err)))
|
||||||
|
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
logger.Debug(ctx, "state before reconciliation", logger.F("state", state))
|
logger.Debug(ctx, "state before reconciliation", logger.F("state", state))
|
||||||
|
|
||||||
if err := a.Reconcile(ctx, state); err != nil {
|
if err := a.Reconcile(ctx, state); err != nil {
|
||||||
@ -58,14 +76,67 @@ func (a *Agent) Reconcile(ctx context.Context, state *State) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func New(funcs ...OptionFunc) *Agent {
|
func (a *Agent) registerAgent(ctx context.Context, state *State) error {
|
||||||
|
meta, err := a.collectMetadata(ctx)
|
||||||
|
if err != nil {
|
||||||
|
return errors.WithStack(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
sorted := metadata.Sort(meta)
|
||||||
|
|
||||||
|
agent, err := a.client.RegisterAgent(ctx, a.privateKey, a.thumbprint, sorted)
|
||||||
|
if err != nil {
|
||||||
|
return errors.WithStack(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
state.agentID = agent.ID
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (a *Agent) collectMetadata(ctx context.Context) (map[string]any, error) {
|
||||||
|
metadata := make(map[string]any)
|
||||||
|
|
||||||
|
for _, collector := range a.collectors {
|
||||||
|
name, value, err := collector.Collect(ctx)
|
||||||
|
if err != nil {
|
||||||
|
logger.Error(
|
||||||
|
ctx, "could not collect metadata",
|
||||||
|
logger.E(errors.WithStack(err)), logger.F("name", name),
|
||||||
|
)
|
||||||
|
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
metadata[name] = value
|
||||||
|
}
|
||||||
|
|
||||||
|
return metadata, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func isAPIError(err error, code api.ErrorCode) (bool, any) {
|
||||||
|
apiError := &api.Error{}
|
||||||
|
if errors.As(err, &apiError) && apiError.Code == code {
|
||||||
|
return true, apiError.Data
|
||||||
|
}
|
||||||
|
|
||||||
|
return false, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func New(serverURL string, privateKey jwk.Key, thumbprint string, funcs ...OptionFunc) *Agent {
|
||||||
opt := defaultOption()
|
opt := defaultOption()
|
||||||
for _, fn := range funcs {
|
for _, fn := range funcs {
|
||||||
fn(opt)
|
fn(opt)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
client := client.New(serverURL)
|
||||||
|
|
||||||
return &Agent{
|
return &Agent{
|
||||||
|
privateKey: privateKey,
|
||||||
|
thumbprint: thumbprint,
|
||||||
|
client: client,
|
||||||
controllers: opt.Controllers,
|
controllers: opt.Controllers,
|
||||||
interval: opt.Interval,
|
interval: opt.Interval,
|
||||||
|
collectors: opt.Collectors,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
27
internal/agent/context.go
Normal file
27
internal/agent/context.go
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
package agent
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
|
||||||
|
"forge.cadoles.com/Cadoles/emissary/internal/client"
|
||||||
|
"github.com/pkg/errors"
|
||||||
|
)
|
||||||
|
|
||||||
|
type contextKey string
|
||||||
|
|
||||||
|
const (
|
||||||
|
contextKeyClient contextKey = "client"
|
||||||
|
)
|
||||||
|
|
||||||
|
func withClient(ctx context.Context, client *client.Client) context.Context {
|
||||||
|
return context.WithValue(ctx, contextKeyClient, client)
|
||||||
|
}
|
||||||
|
|
||||||
|
func Client(ctx context.Context) *client.Client {
|
||||||
|
client, ok := ctx.Value(contextKeyClient).(*client.Client)
|
||||||
|
if !ok {
|
||||||
|
panic(errors.New("could not retrieve client from context"))
|
||||||
|
}
|
||||||
|
|
||||||
|
return client
|
||||||
|
}
|
286
internal/agent/controller/app/controller.go
Normal file
286
internal/agent/controller/app/controller.go
Normal file
@ -0,0 +1,286 @@
|
|||||||
|
package app
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"io"
|
||||||
|
"net/http"
|
||||||
|
"os"
|
||||||
|
"path/filepath"
|
||||||
|
|
||||||
|
"forge.cadoles.com/Cadoles/emissary/internal/agent"
|
||||||
|
"forge.cadoles.com/Cadoles/emissary/internal/spec/app"
|
||||||
|
"forge.cadoles.com/arcad/edge/pkg/bundle"
|
||||||
|
"forge.cadoles.com/arcad/edge/pkg/storage/sqlite"
|
||||||
|
"github.com/pkg/errors"
|
||||||
|
"gitlab.com/wpetit/goweb/logger"
|
||||||
|
)
|
||||||
|
|
||||||
|
type Controller struct {
|
||||||
|
currentSpecRevision int
|
||||||
|
client *http.Client
|
||||||
|
downloadDir string
|
||||||
|
dataDir string
|
||||||
|
servers map[string]*Server
|
||||||
|
}
|
||||||
|
|
||||||
|
// Name implements node.Controller.
|
||||||
|
func (c *Controller) Name() string {
|
||||||
|
return "app-controller"
|
||||||
|
}
|
||||||
|
|
||||||
|
// Reconcile implements node.Controller.
|
||||||
|
func (c *Controller) Reconcile(ctx context.Context, state *agent.State) error {
|
||||||
|
appSpec := app.NewSpec()
|
||||||
|
|
||||||
|
if err := state.GetSpec(app.NameApp, appSpec); err != nil {
|
||||||
|
if errors.Is(err, agent.ErrSpecNotFound) {
|
||||||
|
logger.Info(ctx, "could not find app spec, stopping all remaining apps")
|
||||||
|
|
||||||
|
c.stopAllApps(ctx)
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
return errors.WithStack(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
logger.Info(ctx, "retrieved spec", logger.F("spec", appSpec.SpecName()), logger.F("revision", appSpec.SpecRevision()))
|
||||||
|
|
||||||
|
if c.currentSpecRevision == appSpec.SpecRevision() {
|
||||||
|
logger.Info(ctx, "spec revision did not change, doing nothing")
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
c.updateApps(ctx, appSpec)
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Controller) stopAllApps(ctx context.Context) {
|
||||||
|
for appID, server := range c.servers {
|
||||||
|
logger.Info(ctx, "stopping app", logger.F("appID", appID))
|
||||||
|
|
||||||
|
if err := server.Stop(); err != nil {
|
||||||
|
logger.Error(
|
||||||
|
ctx, "error while stopping app",
|
||||||
|
logger.F("appID", appID),
|
||||||
|
logger.E(errors.WithStack(err)),
|
||||||
|
)
|
||||||
|
|
||||||
|
delete(c.servers, appID)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Controller) updateApps(ctx context.Context, spec *app.Spec) {
|
||||||
|
hadError := false
|
||||||
|
|
||||||
|
// Stop and remove obsolete apps
|
||||||
|
for appID, server := range c.servers {
|
||||||
|
if _, exists := spec.Apps[appID]; exists {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
logger.Info(ctx, "stopping app", logger.F("appID", appID))
|
||||||
|
|
||||||
|
if err := server.Stop(); err != nil {
|
||||||
|
logger.Error(
|
||||||
|
ctx, "error while stopping app",
|
||||||
|
logger.F("gatewayID", appID),
|
||||||
|
logger.E(errors.WithStack(err)),
|
||||||
|
)
|
||||||
|
|
||||||
|
delete(c.servers, appID)
|
||||||
|
|
||||||
|
hadError = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// (Re)start apps
|
||||||
|
for appID, appSpec := range spec.Apps {
|
||||||
|
appCtx := logger.With(ctx, logger.F("appID", appID))
|
||||||
|
|
||||||
|
if err := c.updateApp(ctx, appID, appSpec); err != nil {
|
||||||
|
logger.Error(appCtx, "could not update app", logger.E(errors.WithStack(err)))
|
||||||
|
|
||||||
|
hadError = true
|
||||||
|
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if !hadError {
|
||||||
|
c.currentSpecRevision = spec.SpecRevision()
|
||||||
|
logger.Info(ctx, "updating current spec revision", logger.F("revision", c.currentSpecRevision))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Controller) updateApp(ctx context.Context, appID string, appSpec app.AppEntry) error {
|
||||||
|
bundle, sha256sum, err := c.ensureAppBundle(ctx, appID, appSpec)
|
||||||
|
if err != nil {
|
||||||
|
return errors.Wrap(err, "could not download app bundle")
|
||||||
|
}
|
||||||
|
|
||||||
|
dataDir, err := c.ensureAppDataDir(ctx, appID)
|
||||||
|
if err != nil {
|
||||||
|
return errors.Wrap(err, "could not retrieve app data dir")
|
||||||
|
}
|
||||||
|
|
||||||
|
server, exists := c.servers[appID]
|
||||||
|
if !exists {
|
||||||
|
logger.Info(ctx, "app currently not running")
|
||||||
|
} else if sha256sum != appSpec.SHA256Sum {
|
||||||
|
logger.Info(
|
||||||
|
ctx, "bundle hash mismatch, stopping app",
|
||||||
|
logger.F("currentHash", sha256sum),
|
||||||
|
logger.F("specHash", appSpec.SHA256Sum),
|
||||||
|
)
|
||||||
|
|
||||||
|
if err := server.Stop(); err != nil {
|
||||||
|
return errors.Wrap(err, "could not stop app")
|
||||||
|
}
|
||||||
|
|
||||||
|
server = nil
|
||||||
|
}
|
||||||
|
|
||||||
|
if server == nil {
|
||||||
|
dbFile := filepath.Join(dataDir, appID+".sqlite")
|
||||||
|
db, err := sqlite.Open(dbFile)
|
||||||
|
if err != nil {
|
||||||
|
return errors.Wrapf(err, "could not opend database file '%s'", dbFile)
|
||||||
|
}
|
||||||
|
|
||||||
|
server = NewServer(bundle, db)
|
||||||
|
c.servers[appID] = server
|
||||||
|
}
|
||||||
|
|
||||||
|
logger.Info(
|
||||||
|
ctx, "starting app",
|
||||||
|
logger.F("address", appSpec.Address),
|
||||||
|
)
|
||||||
|
|
||||||
|
if err := server.Start(ctx, appSpec.Address); err != nil {
|
||||||
|
delete(c.servers, appID)
|
||||||
|
|
||||||
|
return errors.Wrap(err, "could not start app")
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Controller) ensureAppBundle(ctx context.Context, appID string, spec app.AppEntry) (bundle.Bundle, string, error) {
|
||||||
|
if err := os.MkdirAll(c.downloadDir, os.ModePerm); err != nil {
|
||||||
|
return nil, "", errors.WithStack(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
bundlePath := filepath.Join(c.downloadDir, appID+"."+spec.Format)
|
||||||
|
|
||||||
|
_, err := os.Stat(bundlePath)
|
||||||
|
if err != nil && !errors.Is(err, os.ErrNotExist) {
|
||||||
|
return nil, "", errors.WithStack(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if errors.Is(err, os.ErrNotExist) {
|
||||||
|
if err := c.downloadFile(spec.URL, spec.SHA256Sum, bundlePath); err != nil {
|
||||||
|
return nil, "", errors.WithStack(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
sha256sum, err := hash(bundlePath)
|
||||||
|
if err != nil {
|
||||||
|
return nil, "", errors.WithStack(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if sha256sum == spec.SHA256Sum {
|
||||||
|
bdle, err := bundle.FromPath(bundlePath)
|
||||||
|
if err != nil {
|
||||||
|
return nil, "", errors.WithStack(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
return bdle, sha256sum, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
logger.Info(ctx, "bundle hash mismatch, downloading app", logger.F("url", spec.URL))
|
||||||
|
|
||||||
|
if err := c.downloadFile(spec.URL, spec.SHA256Sum, bundlePath); err != nil {
|
||||||
|
return nil, "", errors.WithStack(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
bdle, err := bundle.FromPath(bundlePath)
|
||||||
|
if err != nil {
|
||||||
|
return nil, "", errors.WithStack(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
return bdle, "", nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Controller) downloadFile(url string, sha256sum string, dest string) error {
|
||||||
|
res, err := c.client.Get(url)
|
||||||
|
if err != nil {
|
||||||
|
return errors.WithStack(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
defer func() {
|
||||||
|
if err := res.Body.Close(); err != nil && !errors.Is(err, os.ErrClosed) {
|
||||||
|
panic(errors.WithStack(err))
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
|
||||||
|
tmp, err := os.CreateTemp(filepath.Dir(dest), "download_")
|
||||||
|
if err != nil {
|
||||||
|
return errors.WithStack(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
defer func() {
|
||||||
|
if err := os.Remove(tmp.Name()); err != nil && !os.IsNotExist(err) {
|
||||||
|
panic(errors.WithStack(err))
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
|
||||||
|
if _, err := io.Copy(tmp, res.Body); err != nil {
|
||||||
|
return errors.WithStack(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
tmpFileHash, err := hash(tmp.Name())
|
||||||
|
if err != nil {
|
||||||
|
return errors.WithStack(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if tmpFileHash != sha256sum {
|
||||||
|
return errors.Errorf("sha256 sum mismatch: expected '%s', got '%s'", sha256sum, tmpFileHash)
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := os.Rename(tmp.Name(), dest); err != nil {
|
||||||
|
return errors.WithStack(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Controller) ensureAppDataDir(ctx context.Context, appID string) (string, error) {
|
||||||
|
dataDir := filepath.Join(c.dataDir, appID)
|
||||||
|
|
||||||
|
if err := os.MkdirAll(dataDir, os.ModePerm); err != nil {
|
||||||
|
return "", errors.WithStack(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
return dataDir, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewController(funcs ...OptionFunc) *Controller {
|
||||||
|
opts := defaultOptions()
|
||||||
|
for _, fn := range funcs {
|
||||||
|
fn(opts)
|
||||||
|
}
|
||||||
|
|
||||||
|
return &Controller{
|
||||||
|
client: opts.Client,
|
||||||
|
downloadDir: opts.DownloadDir,
|
||||||
|
dataDir: opts.DataDir,
|
||||||
|
currentSpecRevision: -1,
|
||||||
|
servers: make(map[string]*Server),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var _ agent.Controller = &Controller{}
|
31
internal/agent/controller/app/hash.go
Normal file
31
internal/agent/controller/app/hash.go
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
package app
|
||||||
|
|
||||||
|
import (
|
||||||
|
"crypto/sha256"
|
||||||
|
"encoding/hex"
|
||||||
|
"io"
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"github.com/pkg/errors"
|
||||||
|
)
|
||||||
|
|
||||||
|
func hash(path string) (string, error) {
|
||||||
|
file, err := os.Open(path)
|
||||||
|
if err != nil {
|
||||||
|
return "", errors.WithStack(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
hasher := sha256.New()
|
||||||
|
|
||||||
|
defer func() {
|
||||||
|
if err := file.Close(); err != nil {
|
||||||
|
panic(errors.WithStack(err))
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
|
||||||
|
if _, err := io.Copy(hasher, file); err != nil {
|
||||||
|
return "", errors.WithStack(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
return hex.EncodeToString(hasher.Sum(nil)), nil
|
||||||
|
}
|
37
internal/agent/controller/app/options.go
Normal file
37
internal/agent/controller/app/options.go
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
package app
|
||||||
|
|
||||||
|
import "net/http"
|
||||||
|
|
||||||
|
type Options struct {
|
||||||
|
DataDir string
|
||||||
|
DownloadDir string
|
||||||
|
Client *http.Client
|
||||||
|
}
|
||||||
|
|
||||||
|
func defaultOptions() *Options {
|
||||||
|
return &Options{
|
||||||
|
DataDir: "apps/data",
|
||||||
|
DownloadDir: "apps/download",
|
||||||
|
Client: &http.Client{},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
type OptionFunc func(*Options)
|
||||||
|
|
||||||
|
func WithDataDir(dataDir string) OptionFunc {
|
||||||
|
return func(o *Options) {
|
||||||
|
o.DataDir = dataDir
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func WithDownloadDir(downloadDir string) OptionFunc {
|
||||||
|
return func(o *Options) {
|
||||||
|
o.DownloadDir = downloadDir
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func WithClient(client *http.Client) OptionFunc {
|
||||||
|
return func(o *Options) {
|
||||||
|
o.Client = client
|
||||||
|
}
|
||||||
|
}
|
125
internal/agent/controller/app/server.go
Normal file
125
internal/agent/controller/app/server.go
Normal file
@ -0,0 +1,125 @@
|
|||||||
|
package app
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"database/sql"
|
||||||
|
"net/http"
|
||||||
|
|
||||||
|
"forge.cadoles.com/arcad/edge/pkg/app"
|
||||||
|
"forge.cadoles.com/arcad/edge/pkg/bus"
|
||||||
|
"forge.cadoles.com/arcad/edge/pkg/bus/memory"
|
||||||
|
edgeHTTP "forge.cadoles.com/arcad/edge/pkg/http"
|
||||||
|
"forge.cadoles.com/arcad/edge/pkg/module"
|
||||||
|
"forge.cadoles.com/arcad/edge/pkg/module/cast"
|
||||||
|
"forge.cadoles.com/arcad/edge/pkg/module/net"
|
||||||
|
"forge.cadoles.com/arcad/edge/pkg/storage"
|
||||||
|
"forge.cadoles.com/arcad/edge/pkg/storage/sqlite"
|
||||||
|
|
||||||
|
"forge.cadoles.com/arcad/edge/pkg/bundle"
|
||||||
|
"github.com/go-chi/chi/middleware"
|
||||||
|
"github.com/go-chi/chi/v5"
|
||||||
|
"github.com/pkg/errors"
|
||||||
|
)
|
||||||
|
|
||||||
|
type Server struct {
|
||||||
|
bundle bundle.Bundle
|
||||||
|
db *sql.DB
|
||||||
|
server *http.Server
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *Server) Start(ctx context.Context, addr string) error {
|
||||||
|
if s.server != nil {
|
||||||
|
if err := s.Stop(); err != nil {
|
||||||
|
return errors.WithStack(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
router := chi.NewRouter()
|
||||||
|
|
||||||
|
router.Use(middleware.Logger)
|
||||||
|
|
||||||
|
bus := memory.NewBus()
|
||||||
|
ds := sqlite.NewDocumentStoreWithDB(s.db)
|
||||||
|
bs := sqlite.NewBlobStoreWithDB(s.db)
|
||||||
|
|
||||||
|
handler := edgeHTTP.NewHandler(
|
||||||
|
edgeHTTP.WithBus(bus),
|
||||||
|
edgeHTTP.WithServerModules(s.getAppModules(bus, ds, bs)...),
|
||||||
|
)
|
||||||
|
if err := handler.Load(s.bundle); err != nil {
|
||||||
|
return errors.Wrap(err, "could not load app bundle")
|
||||||
|
}
|
||||||
|
|
||||||
|
router.Handle("/*", handler)
|
||||||
|
|
||||||
|
server := &http.Server{
|
||||||
|
Addr: addr,
|
||||||
|
Handler: router,
|
||||||
|
}
|
||||||
|
|
||||||
|
go func() {
|
||||||
|
defer func() {
|
||||||
|
if err := s.Stop(); err != nil {
|
||||||
|
panic(errors.WithStack(err))
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
|
||||||
|
if err := server.ListenAndServe(); err != nil && !errors.Is(err, http.ErrServerClosed) {
|
||||||
|
panic(errors.WithStack(err))
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
|
||||||
|
s.server = server
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *Server) Stop() error {
|
||||||
|
if s.server == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
defer func() {
|
||||||
|
s.server = nil
|
||||||
|
}()
|
||||||
|
|
||||||
|
if err := s.server.Close(); err != nil {
|
||||||
|
panic(errors.WithStack(err))
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *Server) getAppModules(bus bus.Bus, ds storage.DocumentStore, bs storage.BlobStore) []app.ServerModuleFactory {
|
||||||
|
return []app.ServerModuleFactory{
|
||||||
|
module.ContextModuleFactory(),
|
||||||
|
module.ConsoleModuleFactory(),
|
||||||
|
cast.CastModuleFactory(),
|
||||||
|
module.LifecycleModuleFactory(),
|
||||||
|
net.ModuleFactory(bus),
|
||||||
|
module.RPCModuleFactory(bus),
|
||||||
|
module.StoreModuleFactory(ds),
|
||||||
|
module.BlobModuleFactory(bus, bs),
|
||||||
|
// module.Extends(
|
||||||
|
// auth.ModuleFactory(
|
||||||
|
// auth.WithJWT(dummyKeyFunc),
|
||||||
|
// ),
|
||||||
|
// func(o *goja.Object) {
|
||||||
|
// if err := o.Set("CLAIM_ROLE", "role"); err != nil {
|
||||||
|
// panic(errors.New("could not set 'CLAIM_ROLE' property"))
|
||||||
|
// }
|
||||||
|
|
||||||
|
// if err := o.Set("CLAIM_PREFERRED_USERNAME", "preferred_username"); err != nil {
|
||||||
|
// panic(errors.New("could not set 'CLAIM_PREFERRED_USERNAME' property"))
|
||||||
|
// }
|
||||||
|
// },
|
||||||
|
// ),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewServer(bundle bundle.Bundle, db *sql.DB) *Server {
|
||||||
|
return &Server{
|
||||||
|
bundle: bundle,
|
||||||
|
db: db,
|
||||||
|
}
|
||||||
|
}
|
@ -4,13 +4,13 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
|
|
||||||
"forge.cadoles.com/Cadoles/emissary/internal/agent"
|
"forge.cadoles.com/Cadoles/emissary/internal/agent"
|
||||||
"forge.cadoles.com/Cadoles/emissary/internal/spec"
|
"forge.cadoles.com/Cadoles/emissary/internal/spec/gateway"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
"gitlab.com/wpetit/goweb/logger"
|
"gitlab.com/wpetit/goweb/logger"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Controller struct {
|
type Controller struct {
|
||||||
proxies map[spec.GatewayID]*ReverseProxy
|
proxies map[gateway.ID]*ReverseProxy
|
||||||
currentSpecRevision int
|
currentSpecRevision int
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -21,9 +21,9 @@ func (c *Controller) Name() string {
|
|||||||
|
|
||||||
// Reconcile implements node.Controller.
|
// Reconcile implements node.Controller.
|
||||||
func (c *Controller) Reconcile(ctx context.Context, state *agent.State) error {
|
func (c *Controller) Reconcile(ctx context.Context, state *agent.State) error {
|
||||||
gatewaySpec := spec.NewGatewaySpec()
|
gatewaySpec := gateway.NewSpec()
|
||||||
|
|
||||||
if err := state.GetSpec(spec.NameGateway, gatewaySpec); err != nil {
|
if err := state.GetSpec(gateway.NameGateway, gatewaySpec); err != nil {
|
||||||
if errors.Is(err, agent.ErrSpecNotFound) {
|
if errors.Is(err, agent.ErrSpecNotFound) {
|
||||||
logger.Info(ctx, "could not find gateway spec, stopping all remaining proxies")
|
logger.Info(ctx, "could not find gateway spec, stopping all remaining proxies")
|
||||||
|
|
||||||
@ -67,7 +67,7 @@ func (c *Controller) stopAllProxies(ctx context.Context) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Controller) updateProxies(ctx context.Context, spec *spec.Gateway) {
|
func (c *Controller) updateProxies(ctx context.Context, spec *gateway.Spec) {
|
||||||
// Stop and remove obsolete gateways
|
// Stop and remove obsolete gateways
|
||||||
for gatewayID, proxy := range c.proxies {
|
for gatewayID, proxy := range c.proxies {
|
||||||
if _, exists := spec.Gateways[gatewayID]; exists {
|
if _, exists := spec.Gateways[gatewayID]; exists {
|
||||||
@ -116,7 +116,7 @@ func (c *Controller) updateProxies(ctx context.Context, spec *spec.Gateway) {
|
|||||||
|
|
||||||
func NewController() *Controller {
|
func NewController() *Controller {
|
||||||
return &Controller{
|
return &Controller{
|
||||||
proxies: make(map[spec.GatewayID]*ReverseProxy),
|
proxies: make(map[gateway.ID]*ReverseProxy),
|
||||||
currentSpecRevision: -1,
|
currentSpecRevision: -1,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,7 @@ import (
|
|||||||
|
|
||||||
"forge.cadoles.com/Cadoles/emissary/internal/agent"
|
"forge.cadoles.com/Cadoles/emissary/internal/agent"
|
||||||
"forge.cadoles.com/Cadoles/emissary/internal/openwrt/uci"
|
"forge.cadoles.com/Cadoles/emissary/internal/openwrt/uci"
|
||||||
"forge.cadoles.com/Cadoles/emissary/internal/spec"
|
ucispec "forge.cadoles.com/Cadoles/emissary/internal/spec/uci"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
"gitlab.com/wpetit/goweb/logger"
|
"gitlab.com/wpetit/goweb/logger"
|
||||||
)
|
)
|
||||||
@ -25,9 +25,9 @@ func (*UCIController) Name() string {
|
|||||||
|
|
||||||
// Reconcile implements node.Controller.
|
// Reconcile implements node.Controller.
|
||||||
func (c *UCIController) Reconcile(ctx context.Context, state *agent.State) error {
|
func (c *UCIController) Reconcile(ctx context.Context, state *agent.State) error {
|
||||||
uciSpec := spec.NewUCISpec()
|
uciSpec := ucispec.NewSpec()
|
||||||
|
|
||||||
if err := state.GetSpec(spec.NameUCI, uciSpec); err != nil {
|
if err := state.GetSpec(ucispec.NameUCI, uciSpec); err != nil {
|
||||||
if errors.Is(err, agent.ErrSpecNotFound) {
|
if errors.Is(err, agent.ErrSpecNotFound) {
|
||||||
logger.Info(ctx, "could not find uci spec, doing nothing")
|
logger.Info(ctx, "could not find uci spec, doing nothing")
|
||||||
|
|
||||||
@ -57,7 +57,7 @@ func (c *UCIController) Reconcile(ctx context.Context, state *agent.State) error
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *UCIController) updateConfiguration(ctx context.Context, spec *spec.UCI) error {
|
func (c *UCIController) updateConfiguration(ctx context.Context, spec *ucispec.Spec) error {
|
||||||
logger.Info(ctx, "importing uci config")
|
logger.Info(ctx, "importing uci config")
|
||||||
|
|
||||||
if err := c.importConfig(ctx, spec.Config); err != nil {
|
if err := c.importConfig(ctx, spec.Config); err != nil {
|
||||||
@ -91,7 +91,7 @@ func (c *UCIController) importConfig(ctx context.Context, uci *uci.UCI) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *UCIController) execPostImportCommands(ctx context.Context, commands []*spec.UCIPostImportCommand) error {
|
func (c *UCIController) execPostImportCommands(ctx context.Context, commands []*ucispec.UCIPostImportCommand) error {
|
||||||
for _, postImportCmd := range commands {
|
for _, postImportCmd := range commands {
|
||||||
cmd := exec.CommandContext(ctx, postImportCmd.Command, postImportCmd.Args...)
|
cmd := exec.CommandContext(ctx, postImportCmd.Command, postImportCmd.Args...)
|
||||||
|
|
||||||
|
@ -4,18 +4,13 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
|
|
||||||
"forge.cadoles.com/Cadoles/emissary/internal/agent"
|
"forge.cadoles.com/Cadoles/emissary/internal/agent"
|
||||||
"forge.cadoles.com/Cadoles/emissary/internal/agent/machineid"
|
|
||||||
"forge.cadoles.com/Cadoles/emissary/internal/client"
|
"forge.cadoles.com/Cadoles/emissary/internal/client"
|
||||||
"forge.cadoles.com/Cadoles/emissary/internal/datastore"
|
"forge.cadoles.com/Cadoles/emissary/internal/datastore"
|
||||||
"forge.cadoles.com/Cadoles/emissary/internal/server"
|
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
"gitlab.com/wpetit/goweb/api"
|
|
||||||
"gitlab.com/wpetit/goweb/logger"
|
"gitlab.com/wpetit/goweb/logger"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Controller struct {
|
type Controller struct{}
|
||||||
client *client.Client
|
|
||||||
}
|
|
||||||
|
|
||||||
// Name implements node.Controller.
|
// Name implements node.Controller.
|
||||||
func (c *Controller) Name() string {
|
func (c *Controller) Name() string {
|
||||||
@ -24,56 +19,31 @@ func (c *Controller) Name() string {
|
|||||||
|
|
||||||
// Reconcile implements node.Controller.
|
// Reconcile implements node.Controller.
|
||||||
func (c *Controller) Reconcile(ctx context.Context, state *agent.State) error {
|
func (c *Controller) Reconcile(ctx context.Context, state *agent.State) error {
|
||||||
machineID, err := machineid.Get()
|
cl := agent.Client(ctx)
|
||||||
|
|
||||||
|
agents, _, err := cl.QueryAgents(
|
||||||
|
ctx,
|
||||||
|
client.WithQueryAgentsLimit(1),
|
||||||
|
client.WithQueryAgentsID(state.AgentID()),
|
||||||
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return errors.WithStack(err)
|
return errors.WithStack(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx = logger.With(ctx, logger.F("machineID", machineID))
|
if len(agents) == 0 {
|
||||||
|
logger.Error(ctx, "could not find remote matching agent")
|
||||||
agent, err := c.client.RegisterAgent(ctx, machineID)
|
|
||||||
isAlreadyRegisteredErr, _ := isAPIError(err, server.ErrCodeAlreadyRegistered)
|
|
||||||
|
|
||||||
switch {
|
|
||||||
case isAlreadyRegisteredErr:
|
|
||||||
agents, _, err := c.client.QueryAgents(
|
|
||||||
ctx,
|
|
||||||
client.WithQueryAgentsLimit(1),
|
|
||||||
client.WithQueryAgentsRemoteID(machineID),
|
|
||||||
)
|
|
||||||
if err != nil {
|
|
||||||
return errors.WithStack(err)
|
|
||||||
}
|
|
||||||
|
|
||||||
if len(agents) == 0 {
|
|
||||||
logger.Error(ctx, "could not find remote matching agent")
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
if err := c.reconcileAgent(ctx, state, agents[0]); err != nil {
|
|
||||||
return errors.WithStack(err)
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
case agent != nil:
|
if err := c.reconcileAgent(ctx, cl, state, agents[0]); err != nil {
|
||||||
if err := c.reconcileAgent(ctx, state, agent); err != nil {
|
return errors.WithStack(err)
|
||||||
return errors.WithStack(err)
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
|
|
||||||
case err != nil:
|
|
||||||
logger.Error(ctx, "could not contact server", logger.E(errors.WithStack(err)))
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Controller) reconcileAgent(ctx context.Context, state *agent.State, agent *datastore.Agent) error {
|
func (c *Controller) reconcileAgent(ctx context.Context, client *client.Client, state *agent.State, agent *datastore.Agent) error {
|
||||||
ctx = logger.With(ctx, logger.F("agentID", agent.ID))
|
ctx = logger.With(ctx, logger.F("agentID", agent.ID))
|
||||||
|
|
||||||
if agent.Status != datastore.AgentStatusAccepted {
|
if agent.Status != datastore.AgentStatusAccepted {
|
||||||
@ -82,7 +52,7 @@ func (c *Controller) reconcileAgent(ctx context.Context, state *agent.State, age
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
specs, err := c.client.GetAgentSpecs(ctx, agent.ID)
|
specs, err := client.GetAgentSpecs(ctx, agent.ID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.Error(ctx, "could not retrieve agent specs", logger.E(errors.WithStack(err)))
|
logger.Error(ctx, "could not retrieve agent specs", logger.E(errors.WithStack(err)))
|
||||||
|
|
||||||
@ -98,19 +68,8 @@ func (c *Controller) reconcileAgent(ctx context.Context, state *agent.State, age
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewController(serverURL string) *Controller {
|
func NewController() *Controller {
|
||||||
client := client.New(serverURL)
|
return &Controller{}
|
||||||
|
|
||||||
return &Controller{client}
|
|
||||||
}
|
|
||||||
|
|
||||||
func isAPIError(err error, code api.ErrorCode) (bool, any) {
|
|
||||||
apiError := &api.Error{}
|
|
||||||
if errors.As(err, &apiError) && apiError.Code == code {
|
|
||||||
return true, apiError.Data
|
|
||||||
}
|
|
||||||
|
|
||||||
return false, nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var _ agent.Controller = &Controller{}
|
var _ agent.Controller = &Controller{}
|
||||||
|
12
internal/agent/metadata/collector.go
Normal file
12
internal/agent/metadata/collector.go
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
package metadata
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"errors"
|
||||||
|
)
|
||||||
|
|
||||||
|
var ErrMetadataNotAvailable = errors.New("metadata not available")
|
||||||
|
|
||||||
|
type Collector interface {
|
||||||
|
Collect(context.Context) (string, string, error)
|
||||||
|
}
|
31
internal/agent/metadata/collector/buildinfo/collector.go
Normal file
31
internal/agent/metadata/collector/buildinfo/collector.go
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
package buildinfo
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"runtime/debug"
|
||||||
|
|
||||||
|
"forge.cadoles.com/Cadoles/emissary/internal/agent/metadata"
|
||||||
|
"github.com/pkg/errors"
|
||||||
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
MetadataBuildInfo = "buildinfo"
|
||||||
|
)
|
||||||
|
|
||||||
|
type Collector struct{}
|
||||||
|
|
||||||
|
// Collect implements agent.MetadataCollector
|
||||||
|
func (c *Collector) Collect(ctx context.Context) (string, string, error) {
|
||||||
|
buildInfo, ok := debug.ReadBuildInfo()
|
||||||
|
if !ok {
|
||||||
|
return "", "", errors.WithStack(metadata.ErrMetadataNotAvailable)
|
||||||
|
}
|
||||||
|
|
||||||
|
return MetadataBuildInfo, buildInfo.String(), nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewCollector() *Collector {
|
||||||
|
return &Collector{}
|
||||||
|
}
|
||||||
|
|
||||||
|
var _ metadata.Collector = &Collector{}
|
46
internal/agent/metadata/collector/shell/collector.go
Normal file
46
internal/agent/metadata/collector/shell/collector.go
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
package shell
|
||||||
|
|
||||||
|
import (
|
||||||
|
"bytes"
|
||||||
|
"context"
|
||||||
|
"os"
|
||||||
|
"os/exec"
|
||||||
|
"strings"
|
||||||
|
|
||||||
|
"forge.cadoles.com/Cadoles/emissary/internal/agent/metadata"
|
||||||
|
"github.com/pkg/errors"
|
||||||
|
)
|
||||||
|
|
||||||
|
type Collector struct {
|
||||||
|
name string
|
||||||
|
command string
|
||||||
|
args []string
|
||||||
|
}
|
||||||
|
|
||||||
|
// Collect implements agent.MetadataCollector
|
||||||
|
func (c *Collector) Collect(ctx context.Context) (string, string, error) {
|
||||||
|
cmd := exec.CommandContext(ctx, c.command, c.args...)
|
||||||
|
|
||||||
|
var buf bytes.Buffer
|
||||||
|
|
||||||
|
cmd.Stdout = &buf
|
||||||
|
cmd.Stderr = os.Stderr
|
||||||
|
|
||||||
|
if err := cmd.Run(); err != nil {
|
||||||
|
return "", "", errors.WithStack(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
value := strings.TrimSpace(buf.String())
|
||||||
|
|
||||||
|
return c.name, value, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewCollector(name string, command string, args ...string) *Collector {
|
||||||
|
return &Collector{
|
||||||
|
name: name,
|
||||||
|
command: command,
|
||||||
|
args: args,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var _ metadata.Collector = &Collector{}
|
3
internal/agent/metadata/metadata.go
Normal file
3
internal/agent/metadata/metadata.go
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
package metadata
|
||||||
|
|
||||||
|
type Metadata map[string]any
|
37
internal/agent/metadata/sort.go
Normal file
37
internal/agent/metadata/sort.go
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
package metadata
|
||||||
|
|
||||||
|
import (
|
||||||
|
"sort"
|
||||||
|
)
|
||||||
|
|
||||||
|
type Tuple struct {
|
||||||
|
Key string `json:"key"`
|
||||||
|
Value any `json:"value"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func Sort(metadata map[string]any) []Tuple {
|
||||||
|
keys := make([]string, 0, len(metadata))
|
||||||
|
for k := range metadata {
|
||||||
|
keys = append(keys, k)
|
||||||
|
}
|
||||||
|
|
||||||
|
sort.Strings(keys)
|
||||||
|
|
||||||
|
tuples := make([]Tuple, len(keys))
|
||||||
|
|
||||||
|
for i, k := range keys {
|
||||||
|
tuples[i] = Tuple{k, metadata[k]}
|
||||||
|
}
|
||||||
|
|
||||||
|
return tuples
|
||||||
|
}
|
||||||
|
|
||||||
|
func FromSorted(tuples []Tuple) map[string]any {
|
||||||
|
metadata := make(map[string]any)
|
||||||
|
|
||||||
|
for _, t := range tuples {
|
||||||
|
metadata[t.Key] = t.Value
|
||||||
|
}
|
||||||
|
|
||||||
|
return metadata
|
||||||
|
}
|
@ -1,31 +0,0 @@
|
|||||||
package agent
|
|
||||||
|
|
||||||
import (
|
|
||||||
"time"
|
|
||||||
)
|
|
||||||
|
|
||||||
type Option struct {
|
|
||||||
Interval time.Duration
|
|
||||||
Controllers []Controller
|
|
||||||
}
|
|
||||||
|
|
||||||
type OptionFunc func(*Option)
|
|
||||||
|
|
||||||
func defaultOption() *Option {
|
|
||||||
return &Option{
|
|
||||||
Controllers: make([]Controller, 0),
|
|
||||||
Interval: 10 * time.Second,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func WithControllers(controllers ...Controller) OptionFunc {
|
|
||||||
return func(opt *Option) {
|
|
||||||
opt.Controllers = controllers
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func WithInterval(interval time.Duration) OptionFunc {
|
|
||||||
return func(opt *Option) {
|
|
||||||
opt.Interval = interval
|
|
||||||
}
|
|
||||||
}
|
|
43
internal/agent/options.go
Normal file
43
internal/agent/options.go
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
package agent
|
||||||
|
|
||||||
|
import (
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"forge.cadoles.com/Cadoles/emissary/internal/agent/metadata"
|
||||||
|
"forge.cadoles.com/Cadoles/emissary/internal/client"
|
||||||
|
)
|
||||||
|
|
||||||
|
type Options struct {
|
||||||
|
Client *client.Client
|
||||||
|
Interval time.Duration
|
||||||
|
Controllers []Controller
|
||||||
|
Collectors []metadata.Collector
|
||||||
|
}
|
||||||
|
|
||||||
|
type OptionFunc func(*Options)
|
||||||
|
|
||||||
|
func defaultOption() *Options {
|
||||||
|
return &Options{
|
||||||
|
Controllers: make([]Controller, 0),
|
||||||
|
Interval: 10 * time.Second,
|
||||||
|
Collectors: make([]metadata.Collector, 0),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func WithControllers(controllers ...Controller) OptionFunc {
|
||||||
|
return func(opt *Options) {
|
||||||
|
opt.Controllers = controllers
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func WithInterval(interval time.Duration) OptionFunc {
|
||||||
|
return func(opt *Options) {
|
||||||
|
opt.Interval = interval
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func WithCollectors(collectors ...metadata.Collector) OptionFunc {
|
||||||
|
return func(opts *Options) {
|
||||||
|
opts.Collectors = collectors
|
||||||
|
}
|
||||||
|
}
|
@ -3,6 +3,7 @@ package agent
|
|||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
|
||||||
|
"forge.cadoles.com/Cadoles/emissary/internal/datastore"
|
||||||
"forge.cadoles.com/Cadoles/emissary/internal/spec"
|
"forge.cadoles.com/Cadoles/emissary/internal/spec"
|
||||||
"github.com/mitchellh/mapstructure"
|
"github.com/mitchellh/mapstructure"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
@ -13,7 +14,8 @@ var ErrSpecNotFound = errors.New("spec not found")
|
|||||||
type Specs map[spec.Name]spec.Spec
|
type Specs map[spec.Name]spec.Spec
|
||||||
|
|
||||||
type State struct {
|
type State struct {
|
||||||
specs Specs `json:"specs"`
|
agentID datastore.AgentID
|
||||||
|
specs Specs
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewState() *State {
|
func NewState() *State {
|
||||||
@ -24,8 +26,10 @@ func NewState() *State {
|
|||||||
|
|
||||||
func (s *State) MarshalJSON() ([]byte, error) {
|
func (s *State) MarshalJSON() ([]byte, error) {
|
||||||
state := struct {
|
state := struct {
|
||||||
|
ID datastore.AgentID `json:"agentId"`
|
||||||
Specs map[spec.Name]*spec.RawSpec `json:"specs"`
|
Specs map[spec.Name]*spec.RawSpec `json:"specs"`
|
||||||
}{
|
}{
|
||||||
|
ID: s.agentID,
|
||||||
Specs: func(specs map[spec.Name]spec.Spec) map[spec.Name]*spec.RawSpec {
|
Specs: func(specs map[spec.Name]spec.Spec) map[spec.Name]*spec.RawSpec {
|
||||||
rawSpecs := make(map[spec.Name]*spec.RawSpec)
|
rawSpecs := make(map[spec.Name]*spec.RawSpec)
|
||||||
|
|
||||||
@ -51,7 +55,8 @@ func (s *State) MarshalJSON() ([]byte, error) {
|
|||||||
|
|
||||||
func (s *State) UnmarshalJSON(data []byte) error {
|
func (s *State) UnmarshalJSON(data []byte) error {
|
||||||
state := struct {
|
state := struct {
|
||||||
Specs map[spec.Name]*spec.RawSpec `json:"specs"`
|
AgentID datastore.AgentID `json:"agentId"`
|
||||||
|
Specs map[spec.Name]*spec.RawSpec `json:"specs"`
|
||||||
}{}
|
}{}
|
||||||
|
|
||||||
if err := json.Unmarshal(data, &state); err != nil {
|
if err := json.Unmarshal(data, &state); err != nil {
|
||||||
@ -71,6 +76,10 @@ func (s *State) UnmarshalJSON(data []byte) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (s *State) AgentID() datastore.AgentID {
|
||||||
|
return s.agentID
|
||||||
|
}
|
||||||
|
|
||||||
func (s *State) Specs() Specs {
|
func (s *State) Specs() Specs {
|
||||||
return s.specs
|
return s.specs
|
||||||
}
|
}
|
||||||
|
@ -14,6 +14,7 @@ import (
|
|||||||
|
|
||||||
type Client struct {
|
type Client struct {
|
||||||
http *http.Client
|
http *http.Client
|
||||||
|
token string
|
||||||
serverURL string
|
serverURL string
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -33,6 +34,22 @@ func (c *Client) apiPost(ctx context.Context, path string, payload any, result a
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c *Client) apiPut(ctx context.Context, path string, payload any, result any) error {
|
||||||
|
if err := c.apiDo(ctx, http.MethodPut, path, payload, result); err != nil {
|
||||||
|
return errors.WithStack(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Client) apiDelete(ctx context.Context, path string, payload any, result any) error {
|
||||||
|
if err := c.apiDo(ctx, http.MethodDelete, path, payload, result); err != nil {
|
||||||
|
return errors.WithStack(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
func (c *Client) apiDo(ctx context.Context, method string, path string, payload any, response any) error {
|
func (c *Client) apiDo(ctx context.Context, method string, path string, payload any, response any) error {
|
||||||
url := c.serverURL + path
|
url := c.serverURL + path
|
||||||
|
|
||||||
|
@ -12,11 +12,11 @@ import (
|
|||||||
type QueryAgentsOptionFunc func(*QueryAgentsOptions)
|
type QueryAgentsOptionFunc func(*QueryAgentsOptions)
|
||||||
|
|
||||||
type QueryAgentsOptions struct {
|
type QueryAgentsOptions struct {
|
||||||
Limit *int
|
Limit *int
|
||||||
Offset *int
|
Offset *int
|
||||||
RemoteIDs []string
|
Thumbprints []string
|
||||||
IDs []datastore.AgentID
|
IDs []datastore.AgentID
|
||||||
Statuses []datastore.AgentStatus
|
Statuses []datastore.AgentStatus
|
||||||
}
|
}
|
||||||
|
|
||||||
func WithQueryAgentsLimit(limit int) QueryAgentsOptionFunc {
|
func WithQueryAgentsLimit(limit int) QueryAgentsOptionFunc {
|
||||||
@ -31,9 +31,9 @@ func WithQueryAgentsOffset(offset int) QueryAgentsOptionFunc {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func WithQueryAgentsRemoteID(remoteIDs ...string) QueryAgentsOptionFunc {
|
func WithQueryAgentsThumbprints(thumbprints ...string) QueryAgentsOptionFunc {
|
||||||
return func(opts *QueryAgentsOptions) {
|
return func(opts *QueryAgentsOptions) {
|
||||||
opts.RemoteIDs = remoteIDs
|
opts.Thumbprints = thumbprints
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -61,11 +61,11 @@ func (c *Client) QueryAgents(ctx context.Context, funcs ...QueryAgentsOptionFunc
|
|||||||
query.Set("ids", joinSlice(options.IDs))
|
query.Set("ids", joinSlice(options.IDs))
|
||||||
}
|
}
|
||||||
|
|
||||||
if options.RemoteIDs != nil && len(options.RemoteIDs) > 0 {
|
if options.Thumbprints != nil && len(options.Thumbprints) > 0 {
|
||||||
query.Set("remoteIds", joinSlice(options.RemoteIDs))
|
query.Set("thumbprints", joinSlice(options.Thumbprints))
|
||||||
}
|
}
|
||||||
|
|
||||||
if options.Statuses != nil && len(options.RemoteIDs) > 0 {
|
if options.Statuses != nil && len(options.Statuses) > 0 {
|
||||||
query.Set("statuses", joinSlice(options.Statuses))
|
query.Set("statuses", joinSlice(options.Statuses))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,15 +3,33 @@ package client
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
|
"forge.cadoles.com/Cadoles/emissary/internal/agent/metadata"
|
||||||
"forge.cadoles.com/Cadoles/emissary/internal/datastore"
|
"forge.cadoles.com/Cadoles/emissary/internal/datastore"
|
||||||
|
"forge.cadoles.com/Cadoles/emissary/internal/jwk"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (c *Client) RegisterAgent(ctx context.Context, remoteID string) (*datastore.Agent, error) {
|
func (c *Client) RegisterAgent(ctx context.Context, key jwk.Key, thumbprint string, meta []metadata.Tuple) (*datastore.Agent, error) {
|
||||||
|
keySet, err := jwk.PublicKeySet(key)
|
||||||
|
if err != nil {
|
||||||
|
return nil, errors.WithStack(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
signature, err := jwk.Sign(key, thumbprint, meta)
|
||||||
|
if err != nil {
|
||||||
|
return nil, errors.WithStack(err)
|
||||||
|
}
|
||||||
|
|
||||||
payload := struct {
|
payload := struct {
|
||||||
RemoteID string `json:"remoteId"`
|
KeySet jwk.Set `json:"keySet"`
|
||||||
|
Thumbprint string `json:"thumbprint"`
|
||||||
|
Metadata []metadata.Tuple `json:"metadata"`
|
||||||
|
Signature string `json:"signature"`
|
||||||
}{
|
}{
|
||||||
RemoteID: remoteID,
|
Thumbprint: thumbprint,
|
||||||
|
Metadata: meta,
|
||||||
|
Signature: signature,
|
||||||
|
KeySet: keySet,
|
||||||
}
|
}
|
||||||
|
|
||||||
response := withResponse[struct {
|
response := withResponse[struct {
|
||||||
|
50
internal/client/update_agent.go
Normal file
50
internal/client/update_agent.go
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
package client
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"fmt"
|
||||||
|
|
||||||
|
"forge.cadoles.com/Cadoles/emissary/internal/datastore"
|
||||||
|
"github.com/pkg/errors"
|
||||||
|
)
|
||||||
|
|
||||||
|
type UpdateAgentOptions struct {
|
||||||
|
Status *int
|
||||||
|
}
|
||||||
|
|
||||||
|
type UpdateAgentOptionFunc func(*UpdateAgentOptions)
|
||||||
|
|
||||||
|
func WithAgentStatus(status int) UpdateAgentOptionFunc {
|
||||||
|
return func(opts *UpdateAgentOptions) {
|
||||||
|
opts.Status = &status
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Client) UpdateAgent(ctx context.Context, agentID datastore.AgentID, funcs ...UpdateAgentOptionFunc) (*datastore.Agent, error) {
|
||||||
|
opts := &UpdateAgentOptions{}
|
||||||
|
for _, fn := range funcs {
|
||||||
|
fn(opts)
|
||||||
|
}
|
||||||
|
|
||||||
|
payload := map[string]any{}
|
||||||
|
|
||||||
|
if opts.Status != nil {
|
||||||
|
payload["status"] = *opts.Status
|
||||||
|
}
|
||||||
|
|
||||||
|
response := withResponse[struct {
|
||||||
|
Agent *datastore.Agent `json:"agent"`
|
||||||
|
}]()
|
||||||
|
|
||||||
|
path := fmt.Sprintf("/api/v1/agents/%d", agentID)
|
||||||
|
|
||||||
|
if err := c.apiPut(ctx, path, payload, &response); err != nil {
|
||||||
|
return nil, errors.WithStack(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if response.Error != nil {
|
||||||
|
return nil, errors.WithStack(response.Error)
|
||||||
|
}
|
||||||
|
|
||||||
|
return response.Data.Agent, nil
|
||||||
|
}
|
39
internal/client/update_agent_spec.go
Normal file
39
internal/client/update_agent_spec.go
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
package client
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"fmt"
|
||||||
|
|
||||||
|
"forge.cadoles.com/Cadoles/emissary/internal/agent/metadata"
|
||||||
|
"forge.cadoles.com/Cadoles/emissary/internal/datastore"
|
||||||
|
"forge.cadoles.com/Cadoles/emissary/internal/spec"
|
||||||
|
"github.com/pkg/errors"
|
||||||
|
)
|
||||||
|
|
||||||
|
func (c *Client) UpdateAgentSpec(ctx context.Context, agentID datastore.AgentID, spc spec.Spec) (*datastore.Spec, error) {
|
||||||
|
payload := struct {
|
||||||
|
Name spec.Name `json:"name"`
|
||||||
|
Revision int `json:"revision"`
|
||||||
|
Data metadata.Metadata `json:"data"`
|
||||||
|
}{
|
||||||
|
Name: spc.SpecName(),
|
||||||
|
Revision: spc.SpecRevision(),
|
||||||
|
Data: spc.SpecData(),
|
||||||
|
}
|
||||||
|
|
||||||
|
response := withResponse[struct {
|
||||||
|
Spec *datastore.Spec `json:"spec"`
|
||||||
|
}]()
|
||||||
|
|
||||||
|
path := fmt.Sprintf("/api/v1/agents/%d/specs", agentID)
|
||||||
|
|
||||||
|
if err := c.apiPost(ctx, path, payload, &response); err != nil {
|
||||||
|
return nil, errors.WithStack(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if response.Error != nil {
|
||||||
|
return nil, errors.WithStack(response.Error)
|
||||||
|
}
|
||||||
|
|
||||||
|
return response.Data.Spec, nil
|
||||||
|
}
|
@ -2,6 +2,7 @@ package agent
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"forge.cadoles.com/Cadoles/emissary/internal/command/agent/openwrt"
|
"forge.cadoles.com/Cadoles/emissary/internal/command/agent/openwrt"
|
||||||
|
"forge.cadoles.com/Cadoles/emissary/internal/command/config"
|
||||||
"github.com/urfave/cli/v2"
|
"github.com/urfave/cli/v2"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -11,6 +12,7 @@ func Root() *cli.Command {
|
|||||||
Usage: "Agent related commands",
|
Usage: "Agent related commands",
|
||||||
Subcommands: []*cli.Command{
|
Subcommands: []*cli.Command{
|
||||||
openwrt.Root(),
|
openwrt.Root(),
|
||||||
|
config.Root(),
|
||||||
RunCommand(),
|
RunCommand(),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
@ -4,11 +4,18 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
|
|
||||||
"forge.cadoles.com/Cadoles/emissary/internal/agent"
|
"forge.cadoles.com/Cadoles/emissary/internal/agent"
|
||||||
|
"forge.cadoles.com/Cadoles/emissary/internal/agent/controller/app"
|
||||||
"forge.cadoles.com/Cadoles/emissary/internal/agent/controller/gateway"
|
"forge.cadoles.com/Cadoles/emissary/internal/agent/controller/gateway"
|
||||||
"forge.cadoles.com/Cadoles/emissary/internal/agent/controller/openwrt"
|
"forge.cadoles.com/Cadoles/emissary/internal/agent/controller/openwrt"
|
||||||
"forge.cadoles.com/Cadoles/emissary/internal/agent/controller/persistence"
|
"forge.cadoles.com/Cadoles/emissary/internal/agent/controller/persistence"
|
||||||
"forge.cadoles.com/Cadoles/emissary/internal/agent/controller/spec"
|
"forge.cadoles.com/Cadoles/emissary/internal/agent/controller/spec"
|
||||||
|
"forge.cadoles.com/Cadoles/emissary/internal/agent/metadata"
|
||||||
|
"forge.cadoles.com/Cadoles/emissary/internal/agent/metadata/collector/buildinfo"
|
||||||
|
"forge.cadoles.com/Cadoles/emissary/internal/agent/metadata/collector/shell"
|
||||||
"forge.cadoles.com/Cadoles/emissary/internal/command/common"
|
"forge.cadoles.com/Cadoles/emissary/internal/command/common"
|
||||||
|
"forge.cadoles.com/Cadoles/emissary/internal/config"
|
||||||
|
"forge.cadoles.com/Cadoles/emissary/internal/jwk"
|
||||||
|
"forge.cadoles.com/Cadoles/emissary/internal/machineid"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
_ "github.com/santhosh-tekuri/jsonschema/v5/httploader"
|
_ "github.com/santhosh-tekuri/jsonschema/v5/httploader"
|
||||||
"github.com/urfave/cli/v2"
|
"github.com/urfave/cli/v2"
|
||||||
@ -40,7 +47,7 @@ func RunCommand() *cli.Command {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ctrlConf.Spec.Enabled {
|
if ctrlConf.Spec.Enabled {
|
||||||
controllers = append(controllers, spec.NewController(string(ctrlConf.Spec.ServerURL)))
|
controllers = append(controllers, spec.NewController())
|
||||||
}
|
}
|
||||||
|
|
||||||
if ctrlConf.Gateway.Enabled {
|
if ctrlConf.Gateway.Enabled {
|
||||||
@ -53,9 +60,33 @@ func RunCommand() *cli.Command {
|
|||||||
))
|
))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ctrlConf.App.Enabled {
|
||||||
|
controllers = append(controllers, app.NewController(
|
||||||
|
app.WithDataDir(string(ctrlConf.App.DataDir)),
|
||||||
|
app.WithDownloadDir(string(ctrlConf.App.DownloadDir)),
|
||||||
|
))
|
||||||
|
}
|
||||||
|
|
||||||
|
key, err := jwk.LoadOrGenerate(string(conf.Agent.PrivateKeyPath), jwk.DefaultKeySize)
|
||||||
|
if err != nil {
|
||||||
|
return errors.WithStack(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
thumbprint, err := machineid.Get()
|
||||||
|
if err != nil {
|
||||||
|
return errors.WithStack(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
collectors := createShellCollectors(&conf.Agent)
|
||||||
|
collectors = append(collectors, buildinfo.NewCollector())
|
||||||
|
|
||||||
agent := agent.New(
|
agent := agent.New(
|
||||||
|
string(conf.Agent.ServerURL),
|
||||||
|
key,
|
||||||
|
thumbprint,
|
||||||
agent.WithInterval(time.Duration(conf.Agent.ReconciliationInterval)*time.Second),
|
agent.WithInterval(time.Duration(conf.Agent.ReconciliationInterval)*time.Second),
|
||||||
agent.WithControllers(controllers...),
|
agent.WithControllers(controllers...),
|
||||||
|
agent.WithCollectors(collectors...),
|
||||||
)
|
)
|
||||||
|
|
||||||
if err := agent.Run(ctx.Context); err != nil {
|
if err := agent.Run(ctx.Context); err != nil {
|
||||||
@ -66,3 +97,15 @@ func RunCommand() *cli.Command {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func createShellCollectors(conf *config.AgentConfig) []metadata.Collector {
|
||||||
|
collectors := make([]metadata.Collector, 0)
|
||||||
|
|
||||||
|
for _, c := range conf.Collectors {
|
||||||
|
collector := shell.NewCollector(string(c.Name), string(c.Command), c.Args...)
|
||||||
|
|
||||||
|
collectors = append(collectors, collector)
|
||||||
|
}
|
||||||
|
|
||||||
|
return collectors
|
||||||
|
}
|
||||||
|
47
internal/command/client/agent/count.go
Normal file
47
internal/command/client/agent/count.go
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
package agent
|
||||||
|
|
||||||
|
import (
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"forge.cadoles.com/Cadoles/emissary/internal/client"
|
||||||
|
"forge.cadoles.com/Cadoles/emissary/internal/command/client/apierr"
|
||||||
|
clientFlag "forge.cadoles.com/Cadoles/emissary/internal/command/client/flag"
|
||||||
|
"forge.cadoles.com/Cadoles/emissary/internal/format"
|
||||||
|
"github.com/pkg/errors"
|
||||||
|
"github.com/urfave/cli/v2"
|
||||||
|
)
|
||||||
|
|
||||||
|
func CountCommand() *cli.Command {
|
||||||
|
return &cli.Command{
|
||||||
|
Name: "count",
|
||||||
|
Usage: "Count agents",
|
||||||
|
Flags: clientFlag.ComposeFlags(),
|
||||||
|
Action: func(ctx *cli.Context) error {
|
||||||
|
baseFlags := clientFlag.GetBaseFlags(ctx)
|
||||||
|
client := client.New(baseFlags.ServerURL)
|
||||||
|
|
||||||
|
_, total, err := client.QueryAgents(ctx.Context)
|
||||||
|
if err != nil {
|
||||||
|
return errors.WithStack(apierr.Wrap(err))
|
||||||
|
}
|
||||||
|
|
||||||
|
hints := format.Hints{
|
||||||
|
OutputMode: baseFlags.OutputMode,
|
||||||
|
}
|
||||||
|
|
||||||
|
results := []struct {
|
||||||
|
Total int `json:"total"`
|
||||||
|
}{
|
||||||
|
{
|
||||||
|
Total: total,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := format.Write(baseFlags.Format, os.Stdout, hints, clientFlag.AsAnySlice(results)...); err != nil {
|
||||||
|
return errors.WithStack(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
34
internal/command/client/agent/flag/flag.go
Normal file
34
internal/command/client/agent/flag/flag.go
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
package flag
|
||||||
|
|
||||||
|
import (
|
||||||
|
"errors"
|
||||||
|
|
||||||
|
clientFlag "forge.cadoles.com/Cadoles/emissary/internal/command/client/flag"
|
||||||
|
"forge.cadoles.com/Cadoles/emissary/internal/datastore"
|
||||||
|
"github.com/urfave/cli/v2"
|
||||||
|
)
|
||||||
|
|
||||||
|
func WithAgentFlags(flags ...cli.Flag) []cli.Flag {
|
||||||
|
baseFlags := clientFlag.ComposeFlags(
|
||||||
|
&cli.Int64Flag{
|
||||||
|
Name: "agent-id",
|
||||||
|
Aliases: []string{"a"},
|
||||||
|
Usage: "use `AGENT_ID` as selected agent",
|
||||||
|
Value: -1,
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
|
flags = append(flags, baseFlags...)
|
||||||
|
|
||||||
|
return flags
|
||||||
|
}
|
||||||
|
|
||||||
|
func AssertAgentID(ctx *cli.Context) (datastore.AgentID, error) {
|
||||||
|
rawAgentID := ctx.Int64("agent-id")
|
||||||
|
|
||||||
|
if rawAgentID == -1 {
|
||||||
|
return -1, errors.New("flag 'agent-id' is required")
|
||||||
|
}
|
||||||
|
|
||||||
|
return datastore.AgentID(rawAgentID), nil
|
||||||
|
}
|
44
internal/command/client/agent/get.go
Normal file
44
internal/command/client/agent/get.go
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
package agent
|
||||||
|
|
||||||
|
import (
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"forge.cadoles.com/Cadoles/emissary/internal/client"
|
||||||
|
agentFlag "forge.cadoles.com/Cadoles/emissary/internal/command/client/agent/flag"
|
||||||
|
"forge.cadoles.com/Cadoles/emissary/internal/command/client/apierr"
|
||||||
|
clientFlag "forge.cadoles.com/Cadoles/emissary/internal/command/client/flag"
|
||||||
|
"forge.cadoles.com/Cadoles/emissary/internal/format"
|
||||||
|
"github.com/pkg/errors"
|
||||||
|
"github.com/urfave/cli/v2"
|
||||||
|
)
|
||||||
|
|
||||||
|
func GetCommand() *cli.Command {
|
||||||
|
return &cli.Command{
|
||||||
|
Name: "get",
|
||||||
|
Usage: "Get agent",
|
||||||
|
Flags: agentFlag.WithAgentFlags(),
|
||||||
|
Action: func(ctx *cli.Context) error {
|
||||||
|
baseFlags := clientFlag.GetBaseFlags(ctx)
|
||||||
|
|
||||||
|
agentID, err := agentFlag.AssertAgentID(ctx)
|
||||||
|
if err != nil {
|
||||||
|
return errors.WithStack(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
client := client.New(baseFlags.ServerURL)
|
||||||
|
|
||||||
|
agent, err := client.GetAgent(ctx.Context, agentID)
|
||||||
|
if err != nil {
|
||||||
|
return errors.WithStack(apierr.Wrap(err))
|
||||||
|
}
|
||||||
|
|
||||||
|
hints := agentHints(baseFlags.OutputMode)
|
||||||
|
|
||||||
|
if err := format.Write(baseFlags.Format, os.Stdout, hints, agent); err != nil {
|
||||||
|
return errors.WithStack(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
37
internal/command/client/agent/query.go
Normal file
37
internal/command/client/agent/query.go
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
package agent
|
||||||
|
|
||||||
|
import (
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"forge.cadoles.com/Cadoles/emissary/internal/client"
|
||||||
|
"forge.cadoles.com/Cadoles/emissary/internal/command/client/apierr"
|
||||||
|
clientFlag "forge.cadoles.com/Cadoles/emissary/internal/command/client/flag"
|
||||||
|
"forge.cadoles.com/Cadoles/emissary/internal/format"
|
||||||
|
"github.com/pkg/errors"
|
||||||
|
"github.com/urfave/cli/v2"
|
||||||
|
)
|
||||||
|
|
||||||
|
func QueryCommand() *cli.Command {
|
||||||
|
return &cli.Command{
|
||||||
|
Name: "query",
|
||||||
|
Usage: "Query agents",
|
||||||
|
Flags: clientFlag.ComposeFlags(),
|
||||||
|
Action: func(ctx *cli.Context) error {
|
||||||
|
baseFlags := clientFlag.GetBaseFlags(ctx)
|
||||||
|
client := client.New(baseFlags.ServerURL)
|
||||||
|
|
||||||
|
agents, _, err := client.QueryAgents(ctx.Context)
|
||||||
|
if err != nil {
|
||||||
|
return errors.WithStack(apierr.Wrap(err))
|
||||||
|
}
|
||||||
|
|
||||||
|
hints := agentHints(baseFlags.OutputMode)
|
||||||
|
|
||||||
|
if err := format.Write(baseFlags.Format, os.Stdout, hints, clientFlag.AsAnySlice(agents)...); err != nil {
|
||||||
|
return errors.WithStack(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
20
internal/command/client/agent/root.go
Normal file
20
internal/command/client/agent/root.go
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
package agent
|
||||||
|
|
||||||
|
import (
|
||||||
|
"forge.cadoles.com/Cadoles/emissary/internal/command/client/agent/spec"
|
||||||
|
"github.com/urfave/cli/v2"
|
||||||
|
)
|
||||||
|
|
||||||
|
func Root() *cli.Command {
|
||||||
|
return &cli.Command{
|
||||||
|
Name: "agent",
|
||||||
|
Usage: "Agents related commands",
|
||||||
|
Subcommands: []*cli.Command{
|
||||||
|
QueryCommand(),
|
||||||
|
CountCommand(),
|
||||||
|
UpdateCommand(),
|
||||||
|
GetCommand(),
|
||||||
|
spec.Root(),
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
45
internal/command/client/agent/spec/get.go
Normal file
45
internal/command/client/agent/spec/get.go
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
package spec
|
||||||
|
|
||||||
|
import (
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"forge.cadoles.com/Cadoles/emissary/internal/client"
|
||||||
|
agentFlag "forge.cadoles.com/Cadoles/emissary/internal/command/client/agent/flag"
|
||||||
|
"forge.cadoles.com/Cadoles/emissary/internal/command/client/apierr"
|
||||||
|
clientFlag "forge.cadoles.com/Cadoles/emissary/internal/command/client/flag"
|
||||||
|
"forge.cadoles.com/Cadoles/emissary/internal/format"
|
||||||
|
"github.com/pkg/errors"
|
||||||
|
"github.com/urfave/cli/v2"
|
||||||
|
)
|
||||||
|
|
||||||
|
func GetCommand() *cli.Command {
|
||||||
|
return &cli.Command{
|
||||||
|
Name: "get",
|
||||||
|
Usage: "Get agent specifications",
|
||||||
|
Flags: agentFlag.WithAgentFlags(),
|
||||||
|
Action: func(ctx *cli.Context) error {
|
||||||
|
baseFlags := clientFlag.GetBaseFlags(ctx)
|
||||||
|
agentID, err := agentFlag.AssertAgentID(ctx)
|
||||||
|
if err != nil {
|
||||||
|
return errors.WithStack(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
client := client.New(baseFlags.ServerURL)
|
||||||
|
|
||||||
|
specs, err := client.GetAgentSpecs(ctx.Context, agentID)
|
||||||
|
if err != nil {
|
||||||
|
return errors.WithStack(apierr.Wrap(err))
|
||||||
|
}
|
||||||
|
|
||||||
|
hints := format.Hints{
|
||||||
|
OutputMode: baseFlags.OutputMode,
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := format.Write(baseFlags.Format, os.Stdout, hints, clientFlag.AsAnySlice(specs)...); err != nil {
|
||||||
|
return errors.WithStack(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
16
internal/command/client/agent/spec/root.go
Normal file
16
internal/command/client/agent/spec/root.go
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
package spec
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/urfave/cli/v2"
|
||||||
|
)
|
||||||
|
|
||||||
|
func Root() *cli.Command {
|
||||||
|
return &cli.Command{
|
||||||
|
Name: "spec",
|
||||||
|
Usage: "Specifications related commands",
|
||||||
|
Subcommands: []*cli.Command{
|
||||||
|
GetCommand(),
|
||||||
|
UpdateCommand(),
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
185
internal/command/client/agent/spec/update.go
Normal file
185
internal/command/client/agent/spec/update.go
Normal file
@ -0,0 +1,185 @@
|
|||||||
|
package spec
|
||||||
|
|
||||||
|
import (
|
||||||
|
"encoding/json"
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"forge.cadoles.com/Cadoles/emissary/internal/client"
|
||||||
|
agentFlag "forge.cadoles.com/Cadoles/emissary/internal/command/client/agent/flag"
|
||||||
|
"forge.cadoles.com/Cadoles/emissary/internal/command/client/apierr"
|
||||||
|
clientFlag "forge.cadoles.com/Cadoles/emissary/internal/command/client/flag"
|
||||||
|
"forge.cadoles.com/Cadoles/emissary/internal/format"
|
||||||
|
"forge.cadoles.com/Cadoles/emissary/internal/spec"
|
||||||
|
jsonpatch "github.com/evanphx/json-patch/v5"
|
||||||
|
"github.com/pkg/errors"
|
||||||
|
"github.com/urfave/cli/v2"
|
||||||
|
|
||||||
|
// Import specs
|
||||||
|
_ "forge.cadoles.com/Cadoles/emissary/internal/spec/app"
|
||||||
|
_ "forge.cadoles.com/Cadoles/emissary/internal/spec/gateway"
|
||||||
|
_ "forge.cadoles.com/Cadoles/emissary/internal/spec/uci"
|
||||||
|
)
|
||||||
|
|
||||||
|
func UpdateCommand() *cli.Command {
|
||||||
|
return &cli.Command{
|
||||||
|
Name: "update",
|
||||||
|
Usage: "Update agent specification",
|
||||||
|
Flags: agentFlag.WithAgentFlags(
|
||||||
|
&cli.StringFlag{
|
||||||
|
Name: "spec-name",
|
||||||
|
Usage: "use `NAME` as spec name",
|
||||||
|
},
|
||||||
|
&cli.StringFlag{
|
||||||
|
Name: "spec-data",
|
||||||
|
Usage: "use `DATA` as spec data, '-' to read from STDIN",
|
||||||
|
},
|
||||||
|
&cli.BoolFlag{
|
||||||
|
Name: "no-patch",
|
||||||
|
Usage: "Dont use spec-data as a patch to existing specification",
|
||||||
|
},
|
||||||
|
&cli.IntFlag{
|
||||||
|
Name: "revision",
|
||||||
|
Usage: "Use `REVISION` as specification revision number",
|
||||||
|
},
|
||||||
|
),
|
||||||
|
Action: func(ctx *cli.Context) error {
|
||||||
|
baseFlags := clientFlag.GetBaseFlags(ctx)
|
||||||
|
agentID, err := agentFlag.AssertAgentID(ctx)
|
||||||
|
if err != nil {
|
||||||
|
return errors.WithStack(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
specName, err := assertSpecName(ctx)
|
||||||
|
if err != nil {
|
||||||
|
return errors.WithStack(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
specData, err := assertSpecData(ctx)
|
||||||
|
if err != nil {
|
||||||
|
return errors.WithStack(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
noPatch := ctx.Bool("no-patch")
|
||||||
|
|
||||||
|
client := client.New(baseFlags.ServerURL)
|
||||||
|
|
||||||
|
specs, err := client.GetAgentSpecs(ctx.Context, agentID)
|
||||||
|
if err != nil {
|
||||||
|
return errors.WithStack(apierr.Wrap(err))
|
||||||
|
}
|
||||||
|
|
||||||
|
var existingSpec spec.Spec
|
||||||
|
|
||||||
|
for _, s := range specs {
|
||||||
|
if s.SpecName() != specName {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
existingSpec = s
|
||||||
|
|
||||||
|
break
|
||||||
|
}
|
||||||
|
|
||||||
|
revision := 0
|
||||||
|
|
||||||
|
if existingSpec != nil {
|
||||||
|
originSpecData := existingSpec.SpecData()
|
||||||
|
|
||||||
|
if !noPatch {
|
||||||
|
specData, err = applyPatch(originSpecData, specData)
|
||||||
|
if err != nil {
|
||||||
|
return errors.WithStack(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
revision = existingSpec.SpecRevision()
|
||||||
|
}
|
||||||
|
|
||||||
|
if specificRevision := ctx.Int("revision"); specificRevision != 0 {
|
||||||
|
revision = specificRevision
|
||||||
|
}
|
||||||
|
|
||||||
|
rawSpec := &spec.RawSpec{
|
||||||
|
Name: specName,
|
||||||
|
Revision: revision,
|
||||||
|
Data: specData,
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := spec.Validate(ctx.Context, rawSpec); err != nil {
|
||||||
|
return errors.WithStack(apierr.Wrap(err))
|
||||||
|
}
|
||||||
|
|
||||||
|
spec, err := client.UpdateAgentSpec(ctx.Context, agentID, rawSpec)
|
||||||
|
if err != nil {
|
||||||
|
return errors.WithStack(apierr.Wrap(err))
|
||||||
|
}
|
||||||
|
|
||||||
|
hints := format.Hints{
|
||||||
|
OutputMode: baseFlags.OutputMode,
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := format.Write(baseFlags.Format, os.Stdout, hints, spec); err != nil {
|
||||||
|
return errors.WithStack(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func assertSpecName(ctx *cli.Context) (spec.Name, error) {
|
||||||
|
specName := ctx.String("spec-name")
|
||||||
|
|
||||||
|
if specName == "" {
|
||||||
|
return "", errors.New("flag 'spec-name' is required")
|
||||||
|
}
|
||||||
|
|
||||||
|
return spec.Name(specName), nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func assertSpecData(ctx *cli.Context) (map[string]any, error) {
|
||||||
|
rawSpecData := ctx.String("spec-data")
|
||||||
|
|
||||||
|
if rawSpecData == "" {
|
||||||
|
return nil, errors.New("flag 'spec-data' is required")
|
||||||
|
}
|
||||||
|
|
||||||
|
var specData map[string]any
|
||||||
|
|
||||||
|
if rawSpecData == "-" {
|
||||||
|
decoder := json.NewDecoder(os.Stdin)
|
||||||
|
if err := decoder.Decode(&specData); err != nil {
|
||||||
|
return nil, errors.WithStack(err)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if err := json.Unmarshal([]byte(rawSpecData), &specData); err != nil {
|
||||||
|
return nil, errors.WithStack(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return specData, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func applyPatch(origin any, patch any) (map[string]any, error) {
|
||||||
|
originJSON, err := json.Marshal(origin)
|
||||||
|
if err != nil {
|
||||||
|
return nil, errors.WithStack(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
patchJSON, err := json.Marshal(patch)
|
||||||
|
if err != nil {
|
||||||
|
return nil, errors.WithStack(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
result, err := jsonpatch.MergePatch(originJSON, patchJSON)
|
||||||
|
if err != nil {
|
||||||
|
return nil, errors.WithStack(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
var specData map[string]any
|
||||||
|
|
||||||
|
if err := json.Unmarshal(result, &specData); err != nil {
|
||||||
|
}
|
||||||
|
|
||||||
|
return specData, nil
|
||||||
|
}
|
57
internal/command/client/agent/update.go
Normal file
57
internal/command/client/agent/update.go
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
package agent
|
||||||
|
|
||||||
|
import (
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"forge.cadoles.com/Cadoles/emissary/internal/client"
|
||||||
|
agentFlag "forge.cadoles.com/Cadoles/emissary/internal/command/client/agent/flag"
|
||||||
|
"forge.cadoles.com/Cadoles/emissary/internal/command/client/apierr"
|
||||||
|
clientFlag "forge.cadoles.com/Cadoles/emissary/internal/command/client/flag"
|
||||||
|
"forge.cadoles.com/Cadoles/emissary/internal/format"
|
||||||
|
"github.com/pkg/errors"
|
||||||
|
"github.com/urfave/cli/v2"
|
||||||
|
)
|
||||||
|
|
||||||
|
func UpdateCommand() *cli.Command {
|
||||||
|
return &cli.Command{
|
||||||
|
Name: "update",
|
||||||
|
Usage: "Updata agent",
|
||||||
|
Flags: agentFlag.WithAgentFlags(
|
||||||
|
&cli.IntFlag{
|
||||||
|
Name: "status",
|
||||||
|
Usage: "Set `STATUS` to selected agent",
|
||||||
|
Value: -1,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
Action: func(ctx *cli.Context) error {
|
||||||
|
baseFlags := clientFlag.GetBaseFlags(ctx)
|
||||||
|
|
||||||
|
agentID, err := agentFlag.AssertAgentID(ctx)
|
||||||
|
if err != nil {
|
||||||
|
return errors.WithStack(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
options := make([]client.UpdateAgentOptionFunc, 0)
|
||||||
|
|
||||||
|
status := ctx.Int("status")
|
||||||
|
if status != -1 {
|
||||||
|
options = append(options, client.WithAgentStatus(status))
|
||||||
|
}
|
||||||
|
|
||||||
|
client := client.New(baseFlags.ServerURL)
|
||||||
|
|
||||||
|
agent, err := client.UpdateAgent(ctx.Context, agentID, options...)
|
||||||
|
if err != nil {
|
||||||
|
return errors.WithStack(apierr.Wrap(err))
|
||||||
|
}
|
||||||
|
|
||||||
|
hints := agentHints(baseFlags.OutputMode)
|
||||||
|
|
||||||
|
if err := format.Write(baseFlags.Format, os.Stdout, hints, agent); err != nil {
|
||||||
|
return errors.WithStack(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
16
internal/command/client/agent/util.go
Normal file
16
internal/command/client/agent/util.go
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
package agent
|
||||||
|
|
||||||
|
import "forge.cadoles.com/Cadoles/emissary/internal/format"
|
||||||
|
|
||||||
|
func agentHints(outputMode format.OutputMode) format.Hints {
|
||||||
|
return format.Hints{
|
||||||
|
OutputMode: outputMode,
|
||||||
|
Props: []format.Prop{
|
||||||
|
format.NewProp("ID", "ID"),
|
||||||
|
format.NewProp("Thumbprint", "Thumbprint"),
|
||||||
|
format.NewProp("Status", "Status"),
|
||||||
|
format.NewProp("CreatedAt", "CreatedAt"),
|
||||||
|
format.NewProp("UpdatedAt", "UpdatedAt"),
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
91
internal/command/client/apierr/wrap.go
Normal file
91
internal/command/client/apierr/wrap.go
Normal file
@ -0,0 +1,91 @@
|
|||||||
|
package apierr
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/pkg/errors"
|
||||||
|
"gitlab.com/wpetit/goweb/api"
|
||||||
|
)
|
||||||
|
|
||||||
|
func Wrap(err error) error {
|
||||||
|
apiErr := &api.Error{}
|
||||||
|
if !errors.As(err, &apiErr) {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
switch apiErr.Code {
|
||||||
|
case api.ErrCodeInvalidFieldValue:
|
||||||
|
return wrapInvalidFieldValueErr(apiErr)
|
||||||
|
|
||||||
|
default:
|
||||||
|
return wrapApiErrorWithMessage(apiErr)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func wrapApiErrorWithMessage(err *api.Error) error {
|
||||||
|
data, ok := err.Data.(map[string]any)
|
||||||
|
if !ok {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
rawMessage, exists := data["message"]
|
||||||
|
if !exists {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
message, ok := rawMessage.(string)
|
||||||
|
if !ok {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return errors.Wrapf(err, message)
|
||||||
|
}
|
||||||
|
|
||||||
|
func wrapInvalidFieldValueErr(err *api.Error) error {
|
||||||
|
data, ok := err.Data.(map[string]any)
|
||||||
|
if !ok {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
rawFields, exists := data["Fields"]
|
||||||
|
if !exists {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
fields, ok := rawFields.([]any)
|
||||||
|
if !ok {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
var (
|
||||||
|
field string
|
||||||
|
rule string
|
||||||
|
)
|
||||||
|
|
||||||
|
if len(fields) == 0 {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
firstField, ok := fields[0].(map[string]any)
|
||||||
|
if !ok {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
param, ok := firstField["Param"].(string)
|
||||||
|
if !ok {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
tag, ok := firstField["Tag"].(string)
|
||||||
|
if !ok {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
fieldName, ok := firstField["Field"].(string)
|
||||||
|
if !ok {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
field = fieldName
|
||||||
|
rule = tag + "=" + param
|
||||||
|
|
||||||
|
return errors.Wrapf(err, "server expected field '%s' to match rule '%s'", field, rule)
|
||||||
|
}
|
54
internal/command/client/flag/flag.go
Normal file
54
internal/command/client/flag/flag.go
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
package flag
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
|
||||||
|
"forge.cadoles.com/Cadoles/emissary/internal/format"
|
||||||
|
"forge.cadoles.com/Cadoles/emissary/internal/format/table"
|
||||||
|
"github.com/urfave/cli/v2"
|
||||||
|
)
|
||||||
|
|
||||||
|
func ComposeFlags(flags ...cli.Flag) []cli.Flag {
|
||||||
|
baseFlags := []cli.Flag{
|
||||||
|
&cli.StringFlag{
|
||||||
|
Name: "server",
|
||||||
|
Aliases: []string{"s"},
|
||||||
|
Usage: "use `SERVER` as server url",
|
||||||
|
Value: "http://127.0.0.1:3000",
|
||||||
|
},
|
||||||
|
&cli.StringFlag{
|
||||||
|
Name: "format",
|
||||||
|
Aliases: []string{"f"},
|
||||||
|
Usage: fmt.Sprintf("use `FORMAT` as output format (available: %s)", format.Available()),
|
||||||
|
Value: string(table.Format),
|
||||||
|
},
|
||||||
|
&cli.StringFlag{
|
||||||
|
Name: "output-mode",
|
||||||
|
Aliases: []string{"m"},
|
||||||
|
Usage: fmt.Sprintf("use `MODE` as output mode (available: %s)", []format.OutputMode{format.OutputModeCompact, format.OutputModeWide}),
|
||||||
|
Value: string(format.OutputModeCompact),
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
flags = append(flags, baseFlags...)
|
||||||
|
|
||||||
|
return flags
|
||||||
|
}
|
||||||
|
|
||||||
|
type BaseFlags struct {
|
||||||
|
ServerURL string
|
||||||
|
Format format.Format
|
||||||
|
OutputMode format.OutputMode
|
||||||
|
}
|
||||||
|
|
||||||
|
func GetBaseFlags(ctx *cli.Context) *BaseFlags {
|
||||||
|
serverURL := ctx.String("server")
|
||||||
|
rawFormat := ctx.String("format")
|
||||||
|
rawOutputMode := ctx.String("output-mode")
|
||||||
|
|
||||||
|
return &BaseFlags{
|
||||||
|
ServerURL: serverURL,
|
||||||
|
Format: format.Format(rawFormat),
|
||||||
|
OutputMode: format.OutputMode(rawOutputMode),
|
||||||
|
}
|
||||||
|
}
|
11
internal/command/client/flag/util.go
Normal file
11
internal/command/client/flag/util.go
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
package flag
|
||||||
|
|
||||||
|
func AsAnySlice[T any](src []T) []any {
|
||||||
|
dst := make([]any, len(src))
|
||||||
|
|
||||||
|
for i, s := range src {
|
||||||
|
dst[i] = s
|
||||||
|
}
|
||||||
|
|
||||||
|
return dst
|
||||||
|
}
|
20
internal/command/client/root.go
Normal file
20
internal/command/client/root.go
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
package client
|
||||||
|
|
||||||
|
import (
|
||||||
|
"forge.cadoles.com/Cadoles/emissary/internal/command/client/agent"
|
||||||
|
"github.com/urfave/cli/v2"
|
||||||
|
|
||||||
|
// Output format
|
||||||
|
_ "forge.cadoles.com/Cadoles/emissary/internal/format/json"
|
||||||
|
_ "forge.cadoles.com/Cadoles/emissary/internal/format/table"
|
||||||
|
)
|
||||||
|
|
||||||
|
func Root() *cli.Command {
|
||||||
|
return &cli.Command{
|
||||||
|
Name: "client",
|
||||||
|
Usage: "Client related commands",
|
||||||
|
Subcommands: []*cli.Command{
|
||||||
|
agent.Root(),
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
@ -9,6 +9,10 @@ import (
|
|||||||
|
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
"github.com/urfave/cli/v2"
|
"github.com/urfave/cli/v2"
|
||||||
|
|
||||||
|
// Spec validation
|
||||||
|
_ "forge.cadoles.com/Cadoles/emissary/internal/spec/gateway"
|
||||||
|
_ "forge.cadoles.com/Cadoles/emissary/internal/spec/uci"
|
||||||
)
|
)
|
||||||
|
|
||||||
func Main(buildDate, projectVersion, gitRef, defaultConfigPath string, commands ...*cli.Command) {
|
func Main(buildDate, projectVersion, gitRef, defaultConfigPath string, commands ...*cli.Command) {
|
||||||
|
@ -1,8 +1,17 @@
|
|||||||
package config
|
package config
|
||||||
|
|
||||||
type AgentConfig struct {
|
type AgentConfig struct {
|
||||||
ReconciliationInterval InterpolatedInt `yaml:"reconciliationInterval"`
|
ServerURL InterpolatedString `yaml:"serverUrl"`
|
||||||
Controllers ControllersConfig `yaml:"controllers"`
|
PrivateKeyPath InterpolatedString `yaml:"privateKeyPath"`
|
||||||
|
ReconciliationInterval InterpolatedInt `yaml:"reconciliationInterval"`
|
||||||
|
Controllers ControllersConfig `yaml:"controllers"`
|
||||||
|
Collectors []ShellCollectorConfig `yaml:"collectors"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type ShellCollectorConfig struct {
|
||||||
|
Name InterpolatedString `yaml:"name"`
|
||||||
|
Command InterpolatedString `yaml:"command"`
|
||||||
|
Args InterpolatedStringSlice `yaml:"args"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type ControllersConfig struct {
|
type ControllersConfig struct {
|
||||||
@ -10,6 +19,7 @@ type ControllersConfig struct {
|
|||||||
Spec SpecControllerConfig `yaml:"spec"`
|
Spec SpecControllerConfig `yaml:"spec"`
|
||||||
Gateway GatewayControllerConfig `yaml:"gateway"`
|
Gateway GatewayControllerConfig `yaml:"gateway"`
|
||||||
UCI UCIControllerConfig `yaml:"uci"`
|
UCI UCIControllerConfig `yaml:"uci"`
|
||||||
|
App AppControllerConfig `yaml:"app"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type PersistenceControllerConfig struct {
|
type PersistenceControllerConfig struct {
|
||||||
@ -18,10 +28,8 @@ type PersistenceControllerConfig struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type SpecControllerConfig struct {
|
type SpecControllerConfig struct {
|
||||||
Enabled InterpolatedBool `yaml:"enabled"`
|
Enabled InterpolatedBool `yaml:"enabled"`
|
||||||
ServerURL InterpolatedString `yaml:"serverUrl"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type GatewayControllerConfig struct {
|
type GatewayControllerConfig struct {
|
||||||
Enabled InterpolatedBool `yaml:"enabled"`
|
Enabled InterpolatedBool `yaml:"enabled"`
|
||||||
}
|
}
|
||||||
@ -32,13 +40,20 @@ type UCIControllerConfig struct {
|
|||||||
ConfigBackupFile InterpolatedString `yaml:"configBackupFile"`
|
ConfigBackupFile InterpolatedString `yaml:"configBackupFile"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type AppControllerConfig struct {
|
||||||
|
Enabled InterpolatedBool `yaml:"enabled"`
|
||||||
|
DataDir InterpolatedString `yaml:"dataDir"`
|
||||||
|
DownloadDir InterpolatedString `yaml:"downloadDir"`
|
||||||
|
}
|
||||||
|
|
||||||
func NewDefaultAgentConfig() AgentConfig {
|
func NewDefaultAgentConfig() AgentConfig {
|
||||||
return AgentConfig{
|
return AgentConfig{
|
||||||
|
ServerURL: "http://127.0.0.1:3000",
|
||||||
|
PrivateKeyPath: "agent-key.json",
|
||||||
ReconciliationInterval: 5,
|
ReconciliationInterval: 5,
|
||||||
Controllers: ControllersConfig{
|
Controllers: ControllersConfig{
|
||||||
Spec: SpecControllerConfig{
|
Spec: SpecControllerConfig{
|
||||||
Enabled: true,
|
Enabled: true,
|
||||||
ServerURL: "http://127.0.0.1:3000",
|
|
||||||
},
|
},
|
||||||
Persistence: PersistenceControllerConfig{
|
Persistence: PersistenceControllerConfig{
|
||||||
Enabled: true,
|
Enabled: true,
|
||||||
@ -52,6 +67,18 @@ func NewDefaultAgentConfig() AgentConfig {
|
|||||||
ConfigBackupFile: "uci-backup.conf",
|
ConfigBackupFile: "uci-backup.conf",
|
||||||
BinPath: "uci",
|
BinPath: "uci",
|
||||||
},
|
},
|
||||||
|
App: AppControllerConfig{
|
||||||
|
Enabled: true,
|
||||||
|
DataDir: "apps/data",
|
||||||
|
DownloadDir: "apps/bundles",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
Collectors: []ShellCollectorConfig{
|
||||||
|
{
|
||||||
|
Name: "uname",
|
||||||
|
Command: "uname",
|
||||||
|
Args: []string{"-a"},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,11 @@
|
|||||||
package datastore
|
package datastore
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"encoding/json"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/lestrrat-go/jwx/v2/jwk"
|
||||||
|
"github.com/pkg/errors"
|
||||||
)
|
)
|
||||||
|
|
||||||
type AgentID int64
|
type AgentID int64
|
||||||
@ -16,9 +20,36 @@ const (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type Agent struct {
|
type Agent struct {
|
||||||
ID AgentID `json:"id"`
|
ID AgentID `json:"id"`
|
||||||
RemoteID string `json:"remoteId"`
|
Thumbprint string `json:"thumbprint"`
|
||||||
Status AgentStatus `json:"status"`
|
KeySet *SerializableKeySet `json:"keyset,omitempty"`
|
||||||
CreatedAt time.Time `json:"createdAt"`
|
Metadata map[string]any `json:"metadata,omitempty"`
|
||||||
UpdatedAt time.Time `json:"updatedAt"`
|
Status AgentStatus `json:"status"`
|
||||||
|
CreatedAt time.Time `json:"createdAt"`
|
||||||
|
UpdatedAt time.Time `json:"updatedAt"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type SerializableKeySet struct {
|
||||||
|
jwk.Set
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *SerializableKeySet) UnmarshalJSON(data []byte) error {
|
||||||
|
keySet := jwk.NewSet()
|
||||||
|
|
||||||
|
if err := json.Unmarshal(data, &keySet); err != nil {
|
||||||
|
return errors.WithStack(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
s.Set = keySet
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *SerializableKeySet) MarshalJSON() ([]byte, error) {
|
||||||
|
data, err := json.Marshal(s.Set)
|
||||||
|
if err != nil {
|
||||||
|
return nil, errors.WithStack(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
return data, nil
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,13 @@
|
|||||||
package datastore
|
package datastore
|
||||||
|
|
||||||
import "context"
|
import (
|
||||||
|
"context"
|
||||||
|
|
||||||
|
"github.com/lestrrat-go/jwx/v2/jwk"
|
||||||
|
)
|
||||||
|
|
||||||
type AgentRepository interface {
|
type AgentRepository interface {
|
||||||
Create(ctx context.Context, remoteID string, state AgentStatus) (*Agent, error)
|
Create(ctx context.Context, thumbprint string, keySet jwk.Set, metadata map[string]any) (*Agent, error)
|
||||||
Get(ctx context.Context, id AgentID) (*Agent, error)
|
Get(ctx context.Context, id AgentID) (*Agent, error)
|
||||||
Update(ctx context.Context, id AgentID, updates ...AgentUpdateOptionFunc) (*Agent, error)
|
Update(ctx context.Context, id AgentID, updates ...AgentUpdateOptionFunc) (*Agent, error)
|
||||||
Query(ctx context.Context, opts ...AgentQueryOptionFunc) ([]*Agent, int, error)
|
Query(ctx context.Context, opts ...AgentQueryOptionFunc) ([]*Agent, int, error)
|
||||||
@ -17,11 +21,12 @@ type AgentRepository interface {
|
|||||||
type AgentQueryOptionFunc func(*AgentQueryOptions)
|
type AgentQueryOptionFunc func(*AgentQueryOptions)
|
||||||
|
|
||||||
type AgentQueryOptions struct {
|
type AgentQueryOptions struct {
|
||||||
Limit *int
|
Limit *int
|
||||||
Offset *int
|
Offset *int
|
||||||
RemoteIDs []string
|
IDs []AgentID
|
||||||
IDs []AgentID
|
Thumbprints []string
|
||||||
Statuses []AgentStatus
|
Metadata *map[string]any
|
||||||
|
Statuses []AgentStatus
|
||||||
}
|
}
|
||||||
|
|
||||||
func WithAgentQueryLimit(limit int) AgentQueryOptionFunc {
|
func WithAgentQueryLimit(limit int) AgentQueryOptionFunc {
|
||||||
@ -36,9 +41,9 @@ func WithAgentQueryOffset(offset int) AgentQueryOptionFunc {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func WithAgentQueryRemoteID(remoteIDs ...string) AgentQueryOptionFunc {
|
func WithAgentQueryMetadata(metadata map[string]any) AgentQueryOptionFunc {
|
||||||
return func(opts *AgentQueryOptions) {
|
return func(opts *AgentQueryOptions) {
|
||||||
opts.RemoteIDs = remoteIDs
|
opts.Metadata = &metadata
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -54,10 +59,19 @@ func WithAgentQueryStatus(statuses ...AgentStatus) AgentQueryOptionFunc {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func WithAgentQueryThumbprints(thumbprints ...string) AgentQueryOptionFunc {
|
||||||
|
return func(opts *AgentQueryOptions) {
|
||||||
|
opts.Thumbprints = thumbprints
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
type AgentUpdateOptionFunc func(*AgentUpdateOptions)
|
type AgentUpdateOptionFunc func(*AgentUpdateOptions)
|
||||||
|
|
||||||
type AgentUpdateOptions struct {
|
type AgentUpdateOptions struct {
|
||||||
Status *AgentStatus
|
Status *AgentStatus
|
||||||
|
Metadata *map[string]any
|
||||||
|
KeySet *jwk.Set
|
||||||
|
Thumbprint *string
|
||||||
}
|
}
|
||||||
|
|
||||||
func WithAgentUpdateStatus(status AgentStatus) AgentUpdateOptionFunc {
|
func WithAgentUpdateStatus(status AgentStatus) AgentUpdateOptionFunc {
|
||||||
@ -65,3 +79,21 @@ func WithAgentUpdateStatus(status AgentStatus) AgentUpdateOptionFunc {
|
|||||||
opts.Status = &status
|
opts.Status = &status
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func WithAgentUpdateMetadata(metadata map[string]any) AgentUpdateOptionFunc {
|
||||||
|
return func(opts *AgentUpdateOptions) {
|
||||||
|
opts.Metadata = &metadata
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func WithAgentUpdateKeySet(keySet jwk.Set) AgentUpdateOptionFunc {
|
||||||
|
return func(opts *AgentUpdateOptions) {
|
||||||
|
opts.KeySet = &keySet
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func WithAgentUpdateThumbprint(thumbprint string) AgentUpdateOptionFunc {
|
||||||
|
return func(opts *AgentUpdateOptions) {
|
||||||
|
opts.Thumbprint = &thumbprint
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -4,7 +4,6 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
|
|
||||||
"forge.cadoles.com/Cadoles/emissary/internal/spec"
|
"forge.cadoles.com/Cadoles/emissary/internal/spec"
|
||||||
"github.com/pkg/errors"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type SpecID int64
|
type SpecID int64
|
||||||
@ -26,10 +25,6 @@ func (s *Spec) SpecRevision() int {
|
|||||||
return s.Revision
|
return s.Revision
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Spec) SpecData() any {
|
func (s *Spec) SpecData() map[string]any {
|
||||||
return s.Data
|
return s.Data
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Spec) SpecValid() (bool, error) {
|
|
||||||
return false, errors.WithStack(spec.ErrSchemaUnknown)
|
|
||||||
}
|
|
||||||
|
@ -3,10 +3,13 @@ package sqlite
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"database/sql"
|
"database/sql"
|
||||||
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"forge.cadoles.com/Cadoles/emissary/internal/datastore"
|
"forge.cadoles.com/Cadoles/emissary/internal/datastore"
|
||||||
|
|
||||||
|
"github.com/lestrrat-go/jwx/v2/jwk"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
"gitlab.com/wpetit/goweb/logger"
|
"gitlab.com/wpetit/goweb/logger"
|
||||||
)
|
)
|
||||||
@ -116,7 +119,7 @@ func (r *AgentRepository) Query(ctx context.Context, opts ...datastore.AgentQuer
|
|||||||
count := 0
|
count := 0
|
||||||
|
|
||||||
err := r.withTx(ctx, func(tx *sql.Tx) error {
|
err := r.withTx(ctx, func(tx *sql.Tx) error {
|
||||||
query := `SELECT id, remote_id, status, created_at, updated_at FROM agents`
|
query := `SELECT id, thumbprint, status, created_at, updated_at FROM agents`
|
||||||
|
|
||||||
limit := 10
|
limit := 10
|
||||||
if options.Limit != nil {
|
if options.Limit != nil {
|
||||||
@ -133,20 +136,18 @@ func (r *AgentRepository) Query(ctx context.Context, opts ...datastore.AgentQuer
|
|||||||
args := []any{offset, limit}
|
args := []any{offset, limit}
|
||||||
|
|
||||||
if options.IDs != nil && len(options.IDs) > 0 {
|
if options.IDs != nil && len(options.IDs) > 0 {
|
||||||
filters += "id in ("
|
filter, newArgs, newParamIndex := inFilter("id", paramIndex, options.IDs)
|
||||||
|
|
||||||
filter, newArgs, newParamIndex := inFilter("id", paramIndex, options.RemoteIDs)
|
|
||||||
filters += filter
|
filters += filter
|
||||||
paramIndex = newParamIndex
|
paramIndex = newParamIndex
|
||||||
args = append(args, newArgs...)
|
args = append(args, newArgs...)
|
||||||
}
|
}
|
||||||
|
|
||||||
if options.RemoteIDs != nil && len(options.RemoteIDs) > 0 {
|
if options.Thumbprints != nil && len(options.Thumbprints) > 0 {
|
||||||
if filters != "" {
|
if filters != "" {
|
||||||
filters += " AND "
|
filters += " AND "
|
||||||
}
|
}
|
||||||
|
|
||||||
filter, newArgs, newParamIndex := inFilter("remote_id", paramIndex, options.RemoteIDs)
|
filter, newArgs, newParamIndex := inFilter("thumbprint", paramIndex, options.Thumbprints)
|
||||||
filters += filter
|
filters += filter
|
||||||
paramIndex = newParamIndex
|
paramIndex = newParamIndex
|
||||||
args = append(args, newArgs...)
|
args = append(args, newArgs...)
|
||||||
@ -180,10 +181,14 @@ func (r *AgentRepository) Query(ctx context.Context, opts ...datastore.AgentQuer
|
|||||||
for rows.Next() {
|
for rows.Next() {
|
||||||
agent := &datastore.Agent{}
|
agent := &datastore.Agent{}
|
||||||
|
|
||||||
if err := rows.Scan(&agent.ID, &agent.RemoteID, &agent.Status, &agent.CreatedAt, &agent.UpdatedAt); err != nil {
|
metadata := JSONMap{}
|
||||||
|
|
||||||
|
if err := rows.Scan(&agent.ID, &agent.Thumbprint, &agent.Status, &agent.CreatedAt, &agent.UpdatedAt); err != nil {
|
||||||
return errors.WithStack(err)
|
return errors.WithStack(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
agent.Metadata = metadata
|
||||||
|
|
||||||
agents = append(agents, agent)
|
agents = append(agents, agent)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -202,12 +207,12 @@ func (r *AgentRepository) Query(ctx context.Context, opts ...datastore.AgentQuer
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Create implements datastore.AgentRepository
|
// Create implements datastore.AgentRepository
|
||||||
func (r *AgentRepository) Create(ctx context.Context, remoteID string, status datastore.AgentStatus) (*datastore.Agent, error) {
|
func (r *AgentRepository) Create(ctx context.Context, thumbprint string, keySet jwk.Set, metadata map[string]any) (*datastore.Agent, error) {
|
||||||
agent := &datastore.Agent{}
|
agent := &datastore.Agent{}
|
||||||
|
|
||||||
err := r.withTx(ctx, func(tx *sql.Tx) error {
|
err := r.withTx(ctx, func(tx *sql.Tx) error {
|
||||||
query := `SELECT count(id) FROM agents WHERE remote_id = $1`
|
query := `SELECT count(id) FROM agents WHERE thumbprint = $1`
|
||||||
row := tx.QueryRowContext(ctx, query, remoteID)
|
row := tx.QueryRowContext(ctx, query, thumbprint)
|
||||||
|
|
||||||
var count int
|
var count int
|
||||||
|
|
||||||
@ -222,21 +227,37 @@ func (r *AgentRepository) Create(ctx context.Context, remoteID string, status da
|
|||||||
now := time.Now().UTC()
|
now := time.Now().UTC()
|
||||||
|
|
||||||
query = `
|
query = `
|
||||||
INSERT INTO agents (remote_id, status, created_at, updated_at)
|
INSERT INTO agents (thumbprint, keyset, metadata, status, created_at, updated_at)
|
||||||
VALUES($1, $2, $3, $3)
|
VALUES($1, $2, $3, $4, $5, $5)
|
||||||
RETURNING "id", "remote_id", "status", "created_at", "updated_at"
|
RETURNING "id", "thumbprint", "keyset", "metadata", "status", "created_at", "updated_at"
|
||||||
`
|
`
|
||||||
|
|
||||||
row = tx.QueryRowContext(
|
rawKeySet, err := json.Marshal(keySet)
|
||||||
ctx, query,
|
|
||||||
remoteID, status, now,
|
|
||||||
)
|
|
||||||
|
|
||||||
err := row.Scan(&agent.ID, &agent.RemoteID, &agent.Status, &agent.CreatedAt, &agent.UpdatedAt)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return errors.WithStack(err)
|
return errors.WithStack(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
row = tx.QueryRowContext(
|
||||||
|
ctx, query,
|
||||||
|
thumbprint, rawKeySet, JSONMap(metadata), datastore.AgentStatusPending, now,
|
||||||
|
)
|
||||||
|
|
||||||
|
metadata := JSONMap{}
|
||||||
|
|
||||||
|
err = row.Scan(&agent.ID, &agent.Thumbprint, &rawKeySet, &metadata, &agent.Status, &agent.CreatedAt, &agent.UpdatedAt)
|
||||||
|
if err != nil {
|
||||||
|
return errors.WithStack(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
agent.Metadata = metadata
|
||||||
|
|
||||||
|
keySet, err = jwk.Parse(rawKeySet)
|
||||||
|
if err != nil {
|
||||||
|
return errors.WithStack(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
agent.KeySet = &datastore.SerializableKeySet{keySet}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -266,14 +287,17 @@ func (r *AgentRepository) Get(ctx context.Context, id datastore.AgentID) (*datas
|
|||||||
|
|
||||||
err := r.withTx(ctx, func(tx *sql.Tx) error {
|
err := r.withTx(ctx, func(tx *sql.Tx) error {
|
||||||
query := `
|
query := `
|
||||||
SELECT "remote_id", "status", "created_at", "updated_at"
|
SELECT "id", "thumbprint", "keyset", "metadata", "status", "created_at", "updated_at"
|
||||||
FROM agents
|
FROM agents
|
||||||
WHERE id = $1
|
WHERE id = $1
|
||||||
`
|
`
|
||||||
|
|
||||||
row := r.db.QueryRowContext(ctx, query, id)
|
row := r.db.QueryRowContext(ctx, query, id)
|
||||||
|
|
||||||
if err := row.Scan(&agent.RemoteID, &agent.Status, &agent.CreatedAt, &agent.UpdatedAt); err != nil {
|
metadata := JSONMap{}
|
||||||
|
var rawKeySet []byte
|
||||||
|
|
||||||
|
if err := row.Scan(&agent.ID, &agent.Thumbprint, &rawKeySet, &metadata, &agent.Status, &agent.CreatedAt, &agent.UpdatedAt); err != nil {
|
||||||
if errors.Is(err, sql.ErrNoRows) {
|
if errors.Is(err, sql.ErrNoRows) {
|
||||||
return datastore.ErrNotFound
|
return datastore.ErrNotFound
|
||||||
}
|
}
|
||||||
@ -281,6 +305,15 @@ func (r *AgentRepository) Get(ctx context.Context, id datastore.AgentID) (*datas
|
|||||||
return errors.WithStack(err)
|
return errors.WithStack(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
agent.Metadata = metadata
|
||||||
|
|
||||||
|
keySet := jwk.NewSet()
|
||||||
|
if err := json.Unmarshal(rawKeySet, &keySet); err != nil {
|
||||||
|
return errors.WithStack(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
agent.KeySet = &datastore.SerializableKeySet{keySet}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -313,23 +346,60 @@ func (r *AgentRepository) Update(ctx context.Context, id datastore.AgentID, opts
|
|||||||
|
|
||||||
if options.Status != nil {
|
if options.Status != nil {
|
||||||
query += fmt.Sprintf(`, status = $%d`, index)
|
query += fmt.Sprintf(`, status = $%d`, index)
|
||||||
|
|
||||||
args = append(args, *options.Status)
|
args = append(args, *options.Status)
|
||||||
|
index++
|
||||||
|
}
|
||||||
|
|
||||||
|
if options.KeySet != nil {
|
||||||
|
rawKeySet, err := json.Marshal(*options.KeySet)
|
||||||
|
if err != nil {
|
||||||
|
return errors.WithStack(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
query += fmt.Sprintf(`, keyset = $%d`, index)
|
||||||
|
args = append(args, rawKeySet)
|
||||||
|
index++
|
||||||
|
}
|
||||||
|
|
||||||
|
if options.Thumbprint != nil {
|
||||||
|
query += fmt.Sprintf(`, thumbprint = $%d`, index)
|
||||||
|
args = append(args, *options.Thumbprint)
|
||||||
|
index++
|
||||||
|
}
|
||||||
|
|
||||||
|
if options.Metadata != nil {
|
||||||
|
query += fmt.Sprintf(`, metadata = $%d`, index)
|
||||||
|
args = append(args, JSONMap(*options.Metadata))
|
||||||
index++
|
index++
|
||||||
}
|
}
|
||||||
|
|
||||||
query += `
|
query += `
|
||||||
WHERE id = $1
|
WHERE id = $1
|
||||||
RETURNING "id","remote_id","status","updated_at","created_at"
|
RETURNING "id", "thumbprint", "keyset", "metadata", "status", "created_at", "updated_at"
|
||||||
`
|
`
|
||||||
|
|
||||||
row := tx.QueryRowContext(ctx, query, args...)
|
row := tx.QueryRowContext(ctx, query, args...)
|
||||||
|
|
||||||
if err := row.Scan(&agent.ID, &agent.RemoteID, &agent.Status, &agent.CreatedAt, &agent.UpdatedAt); err != nil {
|
metadata := JSONMap{}
|
||||||
|
var rawKeySet []byte
|
||||||
|
|
||||||
|
if err := row.Scan(&agent.ID, &agent.Thumbprint, &rawKeySet, &metadata, &agent.Status, &agent.CreatedAt, &agent.UpdatedAt); err != nil {
|
||||||
|
if errors.Is(err, sql.ErrNoRows) {
|
||||||
|
return datastore.ErrNotFound
|
||||||
|
}
|
||||||
|
|
||||||
return errors.WithStack(err)
|
return errors.WithStack(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
agent.Metadata = metadata
|
||||||
|
|
||||||
|
keySet := jwk.NewSet()
|
||||||
|
if err := json.Unmarshal(rawKeySet, &keySet); err != nil {
|
||||||
|
return errors.WithStack(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
agent.KeySet = &datastore.SerializableKeySet{keySet}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
38
internal/format/json/writer.go
Normal file
38
internal/format/json/writer.go
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
package json
|
||||||
|
|
||||||
|
import (
|
||||||
|
"encoding/json"
|
||||||
|
"io"
|
||||||
|
|
||||||
|
"forge.cadoles.com/Cadoles/emissary/internal/format"
|
||||||
|
"github.com/pkg/errors"
|
||||||
|
)
|
||||||
|
|
||||||
|
const Format format.Format = "json"
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
format.Register(Format, NewWriter())
|
||||||
|
}
|
||||||
|
|
||||||
|
type Writer struct{}
|
||||||
|
|
||||||
|
// Format implements format.Writer.
|
||||||
|
func (*Writer) Write(writer io.Writer, hints format.Hints, data ...any) error {
|
||||||
|
encoder := json.NewEncoder(writer)
|
||||||
|
|
||||||
|
if hints.OutputMode == format.OutputModeWide {
|
||||||
|
encoder.SetIndent("", " ")
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := encoder.Encode(data); err != nil {
|
||||||
|
return errors.WithStack(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewWriter() *Writer {
|
||||||
|
return &Writer{}
|
||||||
|
}
|
||||||
|
|
||||||
|
var _ format.Writer = &Writer{}
|
18
internal/format/prop.go
Normal file
18
internal/format/prop.go
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
package format
|
||||||
|
|
||||||
|
type Prop struct {
|
||||||
|
name string
|
||||||
|
label string
|
||||||
|
}
|
||||||
|
|
||||||
|
func (p *Prop) Name() string {
|
||||||
|
return p.name
|
||||||
|
}
|
||||||
|
|
||||||
|
func (p *Prop) Label() string {
|
||||||
|
return p.label
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewProp(name, label string) Prop {
|
||||||
|
return Prop{name, label}
|
||||||
|
}
|
46
internal/format/registry.go
Normal file
46
internal/format/registry.go
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
package format
|
||||||
|
|
||||||
|
import (
|
||||||
|
"io"
|
||||||
|
|
||||||
|
"github.com/pkg/errors"
|
||||||
|
)
|
||||||
|
|
||||||
|
type Format string
|
||||||
|
|
||||||
|
type Registry map[Format]Writer
|
||||||
|
|
||||||
|
var defaultRegistry = Registry{}
|
||||||
|
|
||||||
|
var ErrUnknownFormat = errors.New("unknown format")
|
||||||
|
|
||||||
|
func Write(format Format, writer io.Writer, hints Hints, data ...any) error {
|
||||||
|
formatWriter, exists := defaultRegistry[format]
|
||||||
|
if !exists {
|
||||||
|
return errors.WithStack(ErrUnknownFormat)
|
||||||
|
}
|
||||||
|
|
||||||
|
if hints.OutputMode == "" {
|
||||||
|
hints.OutputMode = OutputModeCompact
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := formatWriter.Write(writer, hints, data...); err != nil {
|
||||||
|
return errors.WithStack(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func Available() []Format {
|
||||||
|
formats := make([]Format, 0, len(defaultRegistry))
|
||||||
|
|
||||||
|
for f := range defaultRegistry {
|
||||||
|
formats = append(formats, f)
|
||||||
|
}
|
||||||
|
|
||||||
|
return formats
|
||||||
|
}
|
||||||
|
|
||||||
|
func Register(format Format, writer Writer) {
|
||||||
|
defaultRegistry[format] = writer
|
||||||
|
}
|
49
internal/format/table/prop.go
Normal file
49
internal/format/table/prop.go
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
package table
|
||||||
|
|
||||||
|
import (
|
||||||
|
"encoding/json"
|
||||||
|
"fmt"
|
||||||
|
"reflect"
|
||||||
|
|
||||||
|
"forge.cadoles.com/Cadoles/emissary/internal/format"
|
||||||
|
"github.com/pkg/errors"
|
||||||
|
)
|
||||||
|
|
||||||
|
func getProps(d any) []format.Prop {
|
||||||
|
props := make([]format.Prop, 0)
|
||||||
|
|
||||||
|
v := reflect.Indirect(reflect.ValueOf(d))
|
||||||
|
typeOf := v.Type()
|
||||||
|
|
||||||
|
for i := 0; i < v.NumField(); i++ {
|
||||||
|
name := typeOf.Field(i).Name
|
||||||
|
props = append(props, format.NewProp(name, name))
|
||||||
|
}
|
||||||
|
|
||||||
|
return props
|
||||||
|
}
|
||||||
|
|
||||||
|
func getFieldValue(obj any, name string) string {
|
||||||
|
v := reflect.Indirect(reflect.ValueOf(obj))
|
||||||
|
|
||||||
|
fieldValue := v.FieldByName(name)
|
||||||
|
|
||||||
|
switch fieldValue.Kind() {
|
||||||
|
case reflect.Map:
|
||||||
|
fallthrough
|
||||||
|
case reflect.Struct:
|
||||||
|
fallthrough
|
||||||
|
case reflect.Slice:
|
||||||
|
fallthrough
|
||||||
|
case reflect.Interface:
|
||||||
|
json, err := json.Marshal(fieldValue.Interface())
|
||||||
|
if err != nil {
|
||||||
|
panic(errors.WithStack(err))
|
||||||
|
}
|
||||||
|
|
||||||
|
return string(json)
|
||||||
|
|
||||||
|
default:
|
||||||
|
return fmt.Sprintf("%v", fieldValue.Interface())
|
||||||
|
}
|
||||||
|
}
|
75
internal/format/table/writer.go
Normal file
75
internal/format/table/writer.go
Normal file
@ -0,0 +1,75 @@
|
|||||||
|
package table
|
||||||
|
|
||||||
|
import (
|
||||||
|
"io"
|
||||||
|
|
||||||
|
"forge.cadoles.com/Cadoles/emissary/internal/format"
|
||||||
|
"github.com/jedib0t/go-pretty/v6/table"
|
||||||
|
)
|
||||||
|
|
||||||
|
const Format format.Format = "table"
|
||||||
|
|
||||||
|
const DefaultCompactModeMaxColumnWidth = 30
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
format.Register(Format, NewWriter(DefaultCompactModeMaxColumnWidth))
|
||||||
|
}
|
||||||
|
|
||||||
|
type Writer struct {
|
||||||
|
compactModeMaxColumnWidth int
|
||||||
|
}
|
||||||
|
|
||||||
|
// Write implements format.Writer.
|
||||||
|
func (w *Writer) Write(writer io.Writer, hints format.Hints, data ...any) error {
|
||||||
|
t := table.NewWriter()
|
||||||
|
|
||||||
|
t.SetOutputMirror(writer)
|
||||||
|
|
||||||
|
var props []format.Prop
|
||||||
|
|
||||||
|
if hints.Props != nil {
|
||||||
|
props = hints.Props
|
||||||
|
} else {
|
||||||
|
if len(data) > 0 {
|
||||||
|
props = getProps(data[0])
|
||||||
|
} else {
|
||||||
|
props = make([]format.Prop, 0)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
labels := table.Row{}
|
||||||
|
|
||||||
|
for _, p := range props {
|
||||||
|
labels = append(labels, p.Label())
|
||||||
|
}
|
||||||
|
|
||||||
|
t.AppendHeader(labels)
|
||||||
|
|
||||||
|
isCompactMode := hints.OutputMode == format.OutputModeCompact
|
||||||
|
|
||||||
|
for _, d := range data {
|
||||||
|
row := table.Row{}
|
||||||
|
|
||||||
|
for _, p := range props {
|
||||||
|
value := getFieldValue(d, p.Name())
|
||||||
|
|
||||||
|
if isCompactMode && len(value) > w.compactModeMaxColumnWidth {
|
||||||
|
value = value[:w.compactModeMaxColumnWidth] + "..."
|
||||||
|
}
|
||||||
|
|
||||||
|
row = append(row, value)
|
||||||
|
}
|
||||||
|
|
||||||
|
t.AppendRow(row)
|
||||||
|
}
|
||||||
|
|
||||||
|
t.Render()
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewWriter(compactModeMaxColumnWidth int) *Writer {
|
||||||
|
return &Writer{compactModeMaxColumnWidth}
|
||||||
|
}
|
||||||
|
|
||||||
|
var _ format.Writer = &Writer{}
|
86
internal/format/table/writer_test.go
Normal file
86
internal/format/table/writer_test.go
Normal file
@ -0,0 +1,86 @@
|
|||||||
|
package table
|
||||||
|
|
||||||
|
import (
|
||||||
|
"bytes"
|
||||||
|
"strings"
|
||||||
|
"testing"
|
||||||
|
|
||||||
|
"forge.cadoles.com/Cadoles/emissary/internal/format"
|
||||||
|
"github.com/pkg/errors"
|
||||||
|
)
|
||||||
|
|
||||||
|
type dummyItem struct {
|
||||||
|
MyString string
|
||||||
|
MyInt int
|
||||||
|
MySub subItem
|
||||||
|
}
|
||||||
|
|
||||||
|
type subItem struct {
|
||||||
|
MyBool bool
|
||||||
|
}
|
||||||
|
|
||||||
|
var dummyItems = []any{
|
||||||
|
dummyItem{
|
||||||
|
MyString: "Foo",
|
||||||
|
MyInt: 1,
|
||||||
|
MySub: subItem{
|
||||||
|
MyBool: false,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
dummyItem{
|
||||||
|
MyString: "Bar",
|
||||||
|
MyInt: 0,
|
||||||
|
MySub: subItem{
|
||||||
|
MyBool: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestWriterNoHints(t *testing.T) {
|
||||||
|
var buf bytes.Buffer
|
||||||
|
|
||||||
|
writer := NewWriter(DefaultCompactModeMaxColumnWidth)
|
||||||
|
|
||||||
|
if err := writer.Write(&buf, format.Hints{}, dummyItems...); err != nil {
|
||||||
|
t.Fatalf("%+v", errors.WithStack(err))
|
||||||
|
}
|
||||||
|
|
||||||
|
expected := `+----------+-------+------------------+
|
||||||
|
| MYSTRING | MYINT | MYSUB |
|
||||||
|
+----------+-------+------------------+
|
||||||
|
| Foo | 1 | {"MyBool":false} |
|
||||||
|
| Bar | 0 | {"MyBool":true} |
|
||||||
|
+----------+-------+------------------+`
|
||||||
|
|
||||||
|
if e, g := strings.TrimSpace(expected), strings.TrimSpace(buf.String()); e != g {
|
||||||
|
t.Errorf("buf.String(): expected \n%v\ngot\n%v", e, g)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestWriterWithPropHints(t *testing.T) {
|
||||||
|
var buf bytes.Buffer
|
||||||
|
|
||||||
|
writer := NewWriter(DefaultCompactModeMaxColumnWidth)
|
||||||
|
|
||||||
|
hints := format.Hints{
|
||||||
|
Props: []format.Prop{
|
||||||
|
format.NewProp("MyString", "MyString"),
|
||||||
|
format.NewProp("MyInt", "MyInt"),
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := writer.Write(&buf, hints, dummyItems...); err != nil {
|
||||||
|
t.Fatalf("%+v", errors.WithStack(err))
|
||||||
|
}
|
||||||
|
|
||||||
|
expected := `+----------+-------+
|
||||||
|
| MYSTRING | MYINT |
|
||||||
|
+----------+-------+
|
||||||
|
| Foo | 1 |
|
||||||
|
| Bar | 0 |
|
||||||
|
+----------+-------+`
|
||||||
|
|
||||||
|
if e, g := strings.TrimSpace(expected), strings.TrimSpace(buf.String()); e != g {
|
||||||
|
t.Errorf("buf.String(): expected \n%v\ngot\n%v", e, g)
|
||||||
|
}
|
||||||
|
}
|
19
internal/format/writer.go
Normal file
19
internal/format/writer.go
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
package format
|
||||||
|
|
||||||
|
import "io"
|
||||||
|
|
||||||
|
type OutputMode string
|
||||||
|
|
||||||
|
const (
|
||||||
|
OutputModeWide OutputMode = "wide"
|
||||||
|
OutputModeCompact OutputMode = "compact"
|
||||||
|
)
|
||||||
|
|
||||||
|
type Hints struct {
|
||||||
|
Props []Prop
|
||||||
|
OutputMode OutputMode
|
||||||
|
}
|
||||||
|
|
||||||
|
type Writer interface {
|
||||||
|
Write(writer io.Writer, hints Hints, data ...any) error
|
||||||
|
}
|
133
internal/jwk/jwk.go
Normal file
133
internal/jwk/jwk.go
Normal file
@ -0,0 +1,133 @@
|
|||||||
|
package jwk
|
||||||
|
|
||||||
|
import (
|
||||||
|
"crypto/rand"
|
||||||
|
"crypto/rsa"
|
||||||
|
"encoding/json"
|
||||||
|
"io/ioutil"
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"github.com/btcsuite/btcd/btcutil/base58"
|
||||||
|
"github.com/lestrrat-go/jwx/v2/jwa"
|
||||||
|
"github.com/lestrrat-go/jwx/v2/jwk"
|
||||||
|
"github.com/lestrrat-go/jwx/v2/jws"
|
||||||
|
|
||||||
|
"github.com/pkg/errors"
|
||||||
|
)
|
||||||
|
|
||||||
|
const DefaultKeySize = 2048
|
||||||
|
|
||||||
|
type (
|
||||||
|
Key = jwk.Key
|
||||||
|
Set = jwk.Set
|
||||||
|
ParseOption = jwk.ParseOption
|
||||||
|
)
|
||||||
|
|
||||||
|
func Parse(src []byte, options ...jwk.ParseOption) (Set, error) {
|
||||||
|
return jwk.Parse(src, options...)
|
||||||
|
}
|
||||||
|
|
||||||
|
func PublicKeySet(keys ...jwk.Key) (jwk.Set, error) {
|
||||||
|
set := jwk.NewSet()
|
||||||
|
|
||||||
|
for _, k := range keys {
|
||||||
|
pubkey, err := k.PublicKey()
|
||||||
|
if err != nil {
|
||||||
|
return nil, errors.WithStack(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := pubkey.Set(jwk.AlgorithmKey, jwa.RS256); err != nil {
|
||||||
|
return nil, errors.WithStack(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := set.AddKey(pubkey); err != nil {
|
||||||
|
return nil, errors.WithStack(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return set, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func LoadOrGenerate(path string, size int) (jwk.Key, error) {
|
||||||
|
data, err := ioutil.ReadFile(path)
|
||||||
|
if err != nil && !errors.Is(err, os.ErrNotExist) {
|
||||||
|
return nil, errors.WithStack(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if errors.Is(err, os.ErrNotExist) {
|
||||||
|
key, err := Generate(size)
|
||||||
|
if err != nil {
|
||||||
|
return nil, errors.WithStack(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
data, err = json.Marshal(key)
|
||||||
|
if err != nil {
|
||||||
|
return nil, errors.WithStack(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := ioutil.WriteFile(path, data, 0o640); err != nil {
|
||||||
|
return nil, errors.WithStack(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
key, err := jwk.ParseKey(data)
|
||||||
|
if err != nil {
|
||||||
|
return nil, errors.WithStack(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
return key, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func Generate(size int) (jwk.Key, error) {
|
||||||
|
privKey, err := rsa.GenerateKey(rand.Reader, size)
|
||||||
|
if err != nil {
|
||||||
|
return nil, errors.WithStack(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
key, err := jwk.FromRaw(privKey)
|
||||||
|
if err != nil {
|
||||||
|
return nil, errors.WithStack(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
return key, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func Sign(key jwk.Key, payload ...any) (string, error) {
|
||||||
|
json, err := json.Marshal(payload)
|
||||||
|
if err != nil {
|
||||||
|
return "", errors.WithStack(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
rawSignature, err := jws.Sign(
|
||||||
|
nil,
|
||||||
|
jws.WithKey(jwa.RS256, key),
|
||||||
|
jws.WithDetachedPayload(json),
|
||||||
|
)
|
||||||
|
if err != nil {
|
||||||
|
return "", errors.WithStack(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
signature := base58.Encode(rawSignature)
|
||||||
|
|
||||||
|
return signature, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func Verify(jwks jwk.Set, signature string, payload ...any) (bool, error) {
|
||||||
|
json, err := json.Marshal(payload)
|
||||||
|
if err != nil {
|
||||||
|
return false, errors.WithStack(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
decoded := base58.Decode(signature)
|
||||||
|
|
||||||
|
_, err = jws.Verify(
|
||||||
|
decoded,
|
||||||
|
jws.WithKeySet(jwks, jws.WithRequireKid(false)),
|
||||||
|
jws.WithDetachedPayload(json),
|
||||||
|
)
|
||||||
|
if err != nil {
|
||||||
|
return false, errors.WithStack(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
return true, nil
|
||||||
|
}
|
40
internal/jwk/jwk_test.go
Normal file
40
internal/jwk/jwk_test.go
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
package jwk
|
||||||
|
|
||||||
|
import (
|
||||||
|
"testing"
|
||||||
|
|
||||||
|
"github.com/pkg/errors"
|
||||||
|
)
|
||||||
|
|
||||||
|
func TestJWK(t *testing.T) {
|
||||||
|
privateKey, err := Generate(DefaultKeySize)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatalf("%+v", errors.WithStack(err))
|
||||||
|
}
|
||||||
|
|
||||||
|
keySet, err := PublicKeySet(privateKey)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatalf("%+v", errors.WithStack(err))
|
||||||
|
}
|
||||||
|
|
||||||
|
metadata := map[string]any{
|
||||||
|
"Foo": "bar",
|
||||||
|
"Test": 1,
|
||||||
|
}
|
||||||
|
|
||||||
|
signature, err := Sign(privateKey, metadata)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatalf("%+v", errors.WithStack(err))
|
||||||
|
}
|
||||||
|
|
||||||
|
t.Logf("Signature: %s", signature)
|
||||||
|
|
||||||
|
matches, err := Verify(keySet, signature, metadata)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatalf("%+v", errors.WithStack(err))
|
||||||
|
}
|
||||||
|
|
||||||
|
if !matches {
|
||||||
|
t.Error("signature should match")
|
||||||
|
}
|
||||||
|
}
|
@ -1,11 +1,14 @@
|
|||||||
package server
|
package server
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"encoding/json"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
"forge.cadoles.com/Cadoles/emissary/internal/agent/metadata"
|
||||||
"forge.cadoles.com/Cadoles/emissary/internal/datastore"
|
"forge.cadoles.com/Cadoles/emissary/internal/datastore"
|
||||||
|
"forge.cadoles.com/Cadoles/emissary/internal/jwk"
|
||||||
"github.com/go-chi/chi"
|
"github.com/go-chi/chi"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
"gitlab.com/wpetit/goweb/api"
|
"gitlab.com/wpetit/goweb/api"
|
||||||
@ -13,13 +16,16 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
ErrCodeUnknownError api.ErrorCode = "unknown-error"
|
ErrCodeUnknownError api.ErrorCode = "unknown-error"
|
||||||
ErrCodeNotFound api.ErrorCode = "not-found"
|
ErrCodeNotFound api.ErrorCode = "not-found"
|
||||||
ErrCodeAlreadyRegistered api.ErrorCode = "already-registered"
|
ErrInvalidSignature api.ErrorCode = "invalid-signature"
|
||||||
)
|
)
|
||||||
|
|
||||||
type registerAgentRequest struct {
|
type registerAgentRequest struct {
|
||||||
RemoteID string `json:"remoteId"`
|
KeySet json.RawMessage `json:"keySet" validate:"required"`
|
||||||
|
Metadata []metadata.Tuple `json:"metadata" validate:"required"`
|
||||||
|
Thumbprint string `json:"thumbprint" validate:"required"`
|
||||||
|
Signature string `json:"signature" validate:"required"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Server) registerAgent(w http.ResponseWriter, r *http.Request) {
|
func (s *Server) registerAgent(w http.ResponseWriter, r *http.Request) {
|
||||||
@ -30,23 +36,79 @@ func (s *Server) registerAgent(w http.ResponseWriter, r *http.Request) {
|
|||||||
|
|
||||||
ctx := r.Context()
|
ctx := r.Context()
|
||||||
|
|
||||||
|
keySet, err := jwk.Parse(registerAgentReq.KeySet)
|
||||||
|
if err != nil {
|
||||||
|
logger.Error(ctx, "could not parse key set", logger.E(errors.WithStack(err)))
|
||||||
|
api.ErrorResponse(w, http.StatusInternalServerError, ErrCodeUnknownError, nil)
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
ctx = logger.With(ctx, logger.F("agentThumbprint", registerAgentReq.Thumbprint))
|
||||||
|
|
||||||
|
validSignature, err := jwk.Verify(keySet, registerAgentReq.Signature, registerAgentReq.Thumbprint, registerAgentReq.Metadata)
|
||||||
|
if err != nil {
|
||||||
|
logger.Error(ctx, "could not validate signature", logger.E(errors.WithStack(err)))
|
||||||
|
api.ErrorResponse(w, http.StatusInternalServerError, ErrCodeUnknownError, nil)
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if !validSignature {
|
||||||
|
logger.Error(ctx, "invalid signature", logger.F("signature", registerAgentReq.Signature))
|
||||||
|
api.ErrorResponse(w, http.StatusBadRequest, ErrInvalidSignature, nil)
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
metadata := metadata.FromSorted(registerAgentReq.Metadata)
|
||||||
|
|
||||||
agent, err := s.agentRepo.Create(
|
agent, err := s.agentRepo.Create(
|
||||||
ctx,
|
ctx,
|
||||||
registerAgentReq.RemoteID,
|
registerAgentReq.Thumbprint,
|
||||||
datastore.AgentStatusPending,
|
keySet,
|
||||||
|
metadata,
|
||||||
)
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if errors.Is(err, datastore.ErrAlreadyExist) {
|
if !errors.Is(err, datastore.ErrAlreadyExist) {
|
||||||
logger.Error(ctx, "agent already registered", logger.F("remoteID", registerAgentReq.RemoteID))
|
logger.Error(ctx, "could not create agent", logger.E(errors.WithStack(err)))
|
||||||
api.ErrorResponse(w, http.StatusConflict, ErrCodeAlreadyRegistered, nil)
|
api.ErrorResponse(w, http.StatusInternalServerError, ErrCodeUnknownError, nil)
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
logger.Error(ctx, "could not create agent", logger.E(errors.WithStack(err)))
|
agents, _, err := s.agentRepo.Query(
|
||||||
api.ErrorResponse(w, http.StatusInternalServerError, ErrCodeUnknownError, nil)
|
ctx,
|
||||||
|
datastore.WithAgentQueryThumbprints(registerAgentReq.Thumbprint),
|
||||||
|
datastore.WithAgentQueryLimit(1),
|
||||||
|
)
|
||||||
|
if err != nil {
|
||||||
|
logger.Error(ctx, "could not retrieve agents", logger.E(errors.WithStack(err)))
|
||||||
|
api.ErrorResponse(w, http.StatusInternalServerError, ErrCodeUnknownError, nil)
|
||||||
|
|
||||||
return
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(agents) == 0 {
|
||||||
|
logger.Error(ctx, "could not retrieve matching agent", logger.E(errors.WithStack(err)))
|
||||||
|
|
||||||
|
api.ErrorResponse(w, http.StatusInternalServerError, ErrCodeNotFound, nil)
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
agent, err = s.agentRepo.Update(
|
||||||
|
ctx, agents[0].ID,
|
||||||
|
datastore.WithAgentUpdateKeySet(keySet),
|
||||||
|
datastore.WithAgentUpdateMetadata(metadata),
|
||||||
|
datastore.WithAgentUpdateThumbprint(registerAgentReq.Thumbprint),
|
||||||
|
)
|
||||||
|
if err != nil {
|
||||||
|
logger.Error(ctx, "could not update agent", logger.E(errors.WithStack(err)))
|
||||||
|
api.ErrorResponse(w, http.StatusInternalServerError, ErrCodeUnknownError, nil)
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
api.DataResponse(w, http.StatusCreated, struct {
|
api.DataResponse(w, http.StatusCreated, struct {
|
||||||
@ -57,7 +119,7 @@ func (s *Server) registerAgent(w http.ResponseWriter, r *http.Request) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type updateAgentRequest struct {
|
type updateAgentRequest struct {
|
||||||
Status *datastore.AgentStatus `json:"status"`
|
Status *datastore.AgentStatus `json:"status" validate:"omitempty,oneof=0 1 2 3"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Server) updateAgent(w http.ResponseWriter, r *http.Request) {
|
func (s *Server) updateAgent(w http.ResponseWriter, r *http.Request) {
|
||||||
@ -132,13 +194,13 @@ func (s *Server) queryAgents(w http.ResponseWriter, r *http.Request) {
|
|||||||
options = append(options, datastore.WithAgentQueryID(agentIDs...))
|
options = append(options, datastore.WithAgentQueryID(agentIDs...))
|
||||||
}
|
}
|
||||||
|
|
||||||
remoteIDs, ok := getStringSliceValues(w, r, "remoteIds", nil)
|
thumbprints, ok := getStringSliceValues(w, r, "thumbprints", nil)
|
||||||
if !ok {
|
if !ok {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if remoteIDs != nil {
|
if thumbprints != nil {
|
||||||
options = append(options, datastore.WithAgentQueryRemoteID(remoteIDs...))
|
options = append(options, datastore.WithAgentQueryThumbprints(thumbprints...))
|
||||||
}
|
}
|
||||||
|
|
||||||
statuses, ok := getIntSliceValues(w, r, "statuses", nil)
|
statuses, ok := getIntSliceValues(w, r, "statuses", nil)
|
||||||
|
@ -5,10 +5,16 @@ import (
|
|||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
"forge.cadoles.com/Cadoles/emissary/internal/datastore"
|
"forge.cadoles.com/Cadoles/emissary/internal/datastore"
|
||||||
|
"forge.cadoles.com/Cadoles/emissary/internal/spec"
|
||||||
"github.com/go-chi/chi"
|
"github.com/go-chi/chi"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
"gitlab.com/wpetit/goweb/api"
|
"gitlab.com/wpetit/goweb/api"
|
||||||
"gitlab.com/wpetit/goweb/logger"
|
"gitlab.com/wpetit/goweb/logger"
|
||||||
|
|
||||||
|
// Import specs
|
||||||
|
_ "forge.cadoles.com/Cadoles/emissary/internal/spec/app"
|
||||||
|
_ "forge.cadoles.com/Cadoles/emissary/internal/spec/gateway"
|
||||||
|
_ "forge.cadoles.com/Cadoles/emissary/internal/spec/uci"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@ -16,9 +22,7 @@ const (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type updateSpecRequest struct {
|
type updateSpecRequest struct {
|
||||||
Name string `json:"name"`
|
spec.RawSpec
|
||||||
Revision int `json:"revision"`
|
|
||||||
Data map[string]any `json:"data"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Server) updateSpec(w http.ResponseWriter, r *http.Request) {
|
func (s *Server) updateSpec(w http.ResponseWriter, r *http.Request) {
|
||||||
@ -34,12 +38,29 @@ func (s *Server) updateSpec(w http.ResponseWriter, r *http.Request) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if err := spec.Validate(ctx, updateSpecReq); err != nil {
|
||||||
|
data := struct {
|
||||||
|
Message string `json:"message"`
|
||||||
|
}{}
|
||||||
|
|
||||||
|
var validationErr *spec.ValidationError
|
||||||
|
|
||||||
|
if errors.As(err, &validationErr) {
|
||||||
|
data.Message = validationErr.Error()
|
||||||
|
}
|
||||||
|
|
||||||
|
logger.Error(ctx, "could not validate spec", logger.E(errors.WithStack(err)))
|
||||||
|
api.ErrorResponse(w, http.StatusBadRequest, api.ErrCodeInvalidRequest, data)
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
spec, err := s.agentRepo.UpdateSpec(
|
spec, err := s.agentRepo.UpdateSpec(
|
||||||
ctx,
|
ctx,
|
||||||
datastore.AgentID(agentID),
|
datastore.AgentID(agentID),
|
||||||
updateSpecReq.Name,
|
string(updateSpecReq.SpecName()),
|
||||||
updateSpecReq.Revision,
|
updateSpecReq.SpecRevision(),
|
||||||
updateSpecReq.Data,
|
updateSpecReq.SpecData(),
|
||||||
)
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if errors.Is(err, datastore.ErrUnexpectedRevision) {
|
if errors.Is(err, datastore.ErrUnexpectedRevision) {
|
||||||
|
17
internal/spec/app/init.go
Normal file
17
internal/spec/app/init.go
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
package app
|
||||||
|
|
||||||
|
import (
|
||||||
|
_ "embed"
|
||||||
|
|
||||||
|
"forge.cadoles.com/Cadoles/emissary/internal/spec"
|
||||||
|
"github.com/pkg/errors"
|
||||||
|
)
|
||||||
|
|
||||||
|
//go:embed schema.json
|
||||||
|
var schema []byte
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
if err := spec.Register(NameApp, schema); err != nil {
|
||||||
|
panic(errors.WithStack(err))
|
||||||
|
}
|
||||||
|
}
|
36
internal/spec/app/schema.json
Normal file
36
internal/spec/app/schema.json
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
{
|
||||||
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||||
|
"$id": "https://app.emissary.cadoles.com/spec.json",
|
||||||
|
"title": "AppSpec",
|
||||||
|
"description": "Emissary 'App' specification",
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"apps": {
|
||||||
|
"type": "object",
|
||||||
|
"patternProperties": {
|
||||||
|
".*": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"url": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"sha256sum": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"address": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"format": {
|
||||||
|
"type": "string",
|
||||||
|
"enum": ["zip", "tar.gz"]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": ["url", "sha256sum", "address", "format"],
|
||||||
|
"additionalProperties": false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": ["apps"],
|
||||||
|
"additionalProperties": false
|
||||||
|
}
|
39
internal/spec/app/spec.go
Normal file
39
internal/spec/app/spec.go
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
package app
|
||||||
|
|
||||||
|
import (
|
||||||
|
"forge.cadoles.com/Cadoles/emissary/internal/spec"
|
||||||
|
)
|
||||||
|
|
||||||
|
const NameApp spec.Name = "app.emissary.cadoles.com"
|
||||||
|
|
||||||
|
type Spec struct {
|
||||||
|
Revision int `json:"revisions"`
|
||||||
|
Apps map[string]AppEntry
|
||||||
|
}
|
||||||
|
|
||||||
|
type AppEntry struct {
|
||||||
|
URL string `json:"url"`
|
||||||
|
SHA256Sum string `json:"sha256sum"`
|
||||||
|
Address string `json:"address"`
|
||||||
|
Format string `json:"format"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *Spec) SpecName() spec.Name {
|
||||||
|
return NameApp
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *Spec) SpecRevision() int {
|
||||||
|
return s.Revision
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *Spec) SpecData() map[string]any {
|
||||||
|
return map[string]any{
|
||||||
|
"apps": s.Apps,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewSpec() *Spec {
|
||||||
|
return &Spec{}
|
||||||
|
}
|
||||||
|
|
||||||
|
var _ spec.Spec = &Spec{}
|
7
internal/spec/app/testdata/spec-ok.json
vendored
Normal file
7
internal/spec/app/testdata/spec-ok.json
vendored
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"name": "app.emissary.cadoles.com",
|
||||||
|
"data": {
|
||||||
|
"apps": {}
|
||||||
|
},
|
||||||
|
"revision": 0
|
||||||
|
}
|
65
internal/spec/app/validator_test.go
Normal file
65
internal/spec/app/validator_test.go
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
package app
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"encoding/json"
|
||||||
|
"io/ioutil"
|
||||||
|
"testing"
|
||||||
|
|
||||||
|
"forge.cadoles.com/Cadoles/emissary/internal/spec"
|
||||||
|
"github.com/pkg/errors"
|
||||||
|
)
|
||||||
|
|
||||||
|
type validatorTestCase struct {
|
||||||
|
Name string
|
||||||
|
Source string
|
||||||
|
ShouldFail bool
|
||||||
|
}
|
||||||
|
|
||||||
|
var validatorTestCases = []validatorTestCase{
|
||||||
|
{
|
||||||
|
Name: "SpecOK",
|
||||||
|
Source: "testdata/spec-ok.json",
|
||||||
|
ShouldFail: false,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestValidator(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
|
||||||
|
validator := spec.NewValidator()
|
||||||
|
if err := validator.Register(NameApp, schema); err != nil {
|
||||||
|
t.Fatalf("+%v", errors.WithStack(err))
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, tc := range validatorTestCases {
|
||||||
|
func(tc validatorTestCase) {
|
||||||
|
t.Run(tc.Name, func(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
|
||||||
|
rawSpec, err := ioutil.ReadFile(tc.Source)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatalf("+%v", errors.WithStack(err))
|
||||||
|
}
|
||||||
|
|
||||||
|
var spec spec.RawSpec
|
||||||
|
|
||||||
|
if err := json.Unmarshal(rawSpec, &spec); err != nil {
|
||||||
|
t.Fatalf("+%v", errors.WithStack(err))
|
||||||
|
}
|
||||||
|
|
||||||
|
ctx := context.Background()
|
||||||
|
|
||||||
|
err = validator.Validate(ctx, &spec)
|
||||||
|
|
||||||
|
if !tc.ShouldFail && err != nil {
|
||||||
|
t.Errorf("+%v", errors.WithStack(err))
|
||||||
|
}
|
||||||
|
|
||||||
|
if tc.ShouldFail && err == nil {
|
||||||
|
t.Error("validation should have failed")
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}(tc)
|
||||||
|
}
|
||||||
|
}
|
@ -1,5 +1,36 @@
|
|||||||
package spec
|
package spec
|
||||||
|
|
||||||
import "errors"
|
import (
|
||||||
|
"strings"
|
||||||
|
|
||||||
var ErrSchemaUnknown = errors.New("schema unknown")
|
"github.com/pkg/errors"
|
||||||
|
"github.com/qri-io/jsonschema"
|
||||||
|
)
|
||||||
|
|
||||||
|
var ErrUnknownSchema = errors.New("unknown schema")
|
||||||
|
|
||||||
|
type ValidationError struct {
|
||||||
|
keyErrors []jsonschema.KeyError
|
||||||
|
}
|
||||||
|
|
||||||
|
func (e *ValidationError) Error() string {
|
||||||
|
var sb strings.Builder
|
||||||
|
|
||||||
|
if _, err := sb.WriteString("validation error: "); err != nil {
|
||||||
|
panic(errors.WithStack(err))
|
||||||
|
}
|
||||||
|
|
||||||
|
for i, err := range e.keyErrors {
|
||||||
|
if i != 0 {
|
||||||
|
if _, err := sb.WriteString(", "); err != nil {
|
||||||
|
panic(errors.WithStack(err))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if _, err := sb.WriteString(err.Error()); err != nil {
|
||||||
|
panic(errors.WithStack(err))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return sb.String()
|
||||||
|
}
|
||||||
|
@ -1,35 +0,0 @@
|
|||||||
package spec
|
|
||||||
|
|
||||||
const NameGateway Name = "gateway.emissary.cadoles.com"
|
|
||||||
|
|
||||||
type GatewayID string
|
|
||||||
|
|
||||||
type Gateway struct {
|
|
||||||
Revision int `json:"revision"`
|
|
||||||
Gateways map[GatewayID]GatewayEntry `json:"gateways"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type GatewayEntry struct {
|
|
||||||
Address string `json:"address"`
|
|
||||||
Target string `json:"target"`
|
|
||||||
}
|
|
||||||
|
|
||||||
func (g *Gateway) SpecName() Name {
|
|
||||||
return NameGateway
|
|
||||||
}
|
|
||||||
|
|
||||||
func (g *Gateway) SpecRevision() int {
|
|
||||||
return g.Revision
|
|
||||||
}
|
|
||||||
|
|
||||||
func (g *Gateway) SpecData() any {
|
|
||||||
return struct {
|
|
||||||
Gateways map[GatewayID]GatewayEntry
|
|
||||||
}{Gateways: g.Gateways}
|
|
||||||
}
|
|
||||||
|
|
||||||
func NewGatewaySpec() *Gateway {
|
|
||||||
return &Gateway{
|
|
||||||
Gateways: make(map[GatewayID]GatewayEntry),
|
|
||||||
}
|
|
||||||
}
|
|
17
internal/spec/gateway/init.go
Normal file
17
internal/spec/gateway/init.go
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
package gateway
|
||||||
|
|
||||||
|
import (
|
||||||
|
_ "embed"
|
||||||
|
|
||||||
|
"forge.cadoles.com/Cadoles/emissary/internal/spec"
|
||||||
|
"github.com/pkg/errors"
|
||||||
|
)
|
||||||
|
|
||||||
|
//go:embed schema.json
|
||||||
|
var schema []byte
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
if err := spec.Register(NameGateway, schema); err != nil {
|
||||||
|
panic(errors.WithStack(err))
|
||||||
|
}
|
||||||
|
}
|
29
internal/spec/gateway/schema.json
Normal file
29
internal/spec/gateway/schema.json
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
{
|
||||||
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||||
|
"$id": "https://gateway.emissary.cadoles.com/spec.json",
|
||||||
|
"title": "GatewaySpec",
|
||||||
|
"description": "Emissary 'Gateway' specification",
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"gateways": {
|
||||||
|
"type": "object",
|
||||||
|
"patternProperties": {
|
||||||
|
".*": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"address": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"target": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": ["address", "target"],
|
||||||
|
"additionalProperties": false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": ["gateways"],
|
||||||
|
"additionalProperties": false
|
||||||
|
}
|
39
internal/spec/gateway/spec.go
Normal file
39
internal/spec/gateway/spec.go
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
package gateway
|
||||||
|
|
||||||
|
import "forge.cadoles.com/Cadoles/emissary/internal/spec"
|
||||||
|
|
||||||
|
const NameGateway spec.Name = "gateway.emissary.cadoles.com"
|
||||||
|
|
||||||
|
type ID string
|
||||||
|
|
||||||
|
type Spec struct {
|
||||||
|
Revision int `json:"revision"`
|
||||||
|
Gateways map[ID]GatewayEntry `json:"gateways"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type GatewayEntry struct {
|
||||||
|
Address string `json:"address"`
|
||||||
|
Target string `json:"target"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *Spec) SpecName() spec.Name {
|
||||||
|
return NameGateway
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *Spec) SpecRevision() int {
|
||||||
|
return s.Revision
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *Spec) SpecData() map[string]any {
|
||||||
|
return map[string]any{
|
||||||
|
"gateways": s.Gateways,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewSpec() *Spec {
|
||||||
|
return &Spec{
|
||||||
|
Gateways: make(map[ID]GatewayEntry),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var _ spec.Spec = &Spec{}
|
13
internal/spec/gateway/testdata/spec-additional-prop.json
vendored
Normal file
13
internal/spec/gateway/testdata/spec-additional-prop.json
vendored
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
{
|
||||||
|
"name": "gateway.emissary.cadoles.com",
|
||||||
|
"data": {
|
||||||
|
"gateways": {
|
||||||
|
"cadoles.com": {
|
||||||
|
"address": ":3003",
|
||||||
|
"target": "https://www.cadoles.com",
|
||||||
|
"foo": "bar"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"revision": 0
|
||||||
|
}
|
11
internal/spec/gateway/testdata/spec-missing-prop.json
vendored
Normal file
11
internal/spec/gateway/testdata/spec-missing-prop.json
vendored
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
{
|
||||||
|
"name": "gateway.emissary.cadoles.com",
|
||||||
|
"data": {
|
||||||
|
"gateways": {
|
||||||
|
"cadoles.com": {
|
||||||
|
"address": ":3003"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"revision": 0
|
||||||
|
}
|
12
internal/spec/gateway/testdata/spec-ok.json
vendored
Normal file
12
internal/spec/gateway/testdata/spec-ok.json
vendored
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
{
|
||||||
|
"name": "gateway.emissary.cadoles.com",
|
||||||
|
"data": {
|
||||||
|
"gateways": {
|
||||||
|
"cadoles.com": {
|
||||||
|
"address": ":3003",
|
||||||
|
"target": "https://www.cadoles.com"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"revision": 0
|
||||||
|
}
|
75
internal/spec/gateway/validator_test.go
Normal file
75
internal/spec/gateway/validator_test.go
Normal file
@ -0,0 +1,75 @@
|
|||||||
|
package gateway
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"encoding/json"
|
||||||
|
"io/ioutil"
|
||||||
|
"testing"
|
||||||
|
|
||||||
|
"forge.cadoles.com/Cadoles/emissary/internal/spec"
|
||||||
|
"github.com/pkg/errors"
|
||||||
|
)
|
||||||
|
|
||||||
|
type validatorTestCase struct {
|
||||||
|
Name string
|
||||||
|
Source string
|
||||||
|
ShouldFail bool
|
||||||
|
}
|
||||||
|
|
||||||
|
var validatorTestCases = []validatorTestCase{
|
||||||
|
{
|
||||||
|
Name: "SpecOK",
|
||||||
|
Source: "testdata/spec-ok.json",
|
||||||
|
ShouldFail: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Name: "SpecMissingProp",
|
||||||
|
Source: "testdata/spec-missing-prop.json",
|
||||||
|
ShouldFail: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Name: "SpecAdditionalProp",
|
||||||
|
Source: "testdata/spec-additional-prop.json",
|
||||||
|
ShouldFail: true,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestValidator(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
|
||||||
|
validator := spec.NewValidator()
|
||||||
|
if err := validator.Register(NameGateway, schema); err != nil {
|
||||||
|
t.Fatalf("+%v", errors.WithStack(err))
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, tc := range validatorTestCases {
|
||||||
|
func(tc validatorTestCase) {
|
||||||
|
t.Run(tc.Name, func(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
|
||||||
|
rawSpec, err := ioutil.ReadFile(tc.Source)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatalf("+%v", errors.WithStack(err))
|
||||||
|
}
|
||||||
|
|
||||||
|
var spec spec.RawSpec
|
||||||
|
|
||||||
|
if err := json.Unmarshal(rawSpec, &spec); err != nil {
|
||||||
|
t.Fatalf("+%v", errors.WithStack(err))
|
||||||
|
}
|
||||||
|
|
||||||
|
ctx := context.Background()
|
||||||
|
|
||||||
|
err = validator.Validate(ctx, &spec)
|
||||||
|
|
||||||
|
if !tc.ShouldFail && err != nil {
|
||||||
|
t.Errorf("+%v", errors.WithStack(err))
|
||||||
|
}
|
||||||
|
|
||||||
|
if tc.ShouldFail && err == nil {
|
||||||
|
t.Error("validation should have failed")
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}(tc)
|
||||||
|
}
|
||||||
|
}
|
@ -3,13 +3,13 @@ package spec
|
|||||||
type Spec interface {
|
type Spec interface {
|
||||||
SpecName() Name
|
SpecName() Name
|
||||||
SpecRevision() int
|
SpecRevision() int
|
||||||
SpecData() any
|
SpecData() map[string]any
|
||||||
}
|
}
|
||||||
|
|
||||||
type RawSpec struct {
|
type RawSpec struct {
|
||||||
Name Name `json:"name"`
|
Name Name `json:"name"`
|
||||||
Revision int `json:"revision"`
|
Revision int `json:"revision"`
|
||||||
Data any `json:"data"`
|
Data map[string]any `json:"data"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *RawSpec) SpecName() Name {
|
func (s *RawSpec) SpecName() Name {
|
||||||
@ -20,6 +20,8 @@ func (s *RawSpec) SpecRevision() int {
|
|||||||
return s.Revision
|
return s.Revision
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *RawSpec) SpecData() any {
|
func (s *RawSpec) SpecData() map[string]any {
|
||||||
return s.Data
|
return s.Data
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var _ Spec = &RawSpec{}
|
||||||
|
@ -1,37 +0,0 @@
|
|||||||
package spec
|
|
||||||
|
|
||||||
import "forge.cadoles.com/Cadoles/emissary/internal/openwrt/uci"
|
|
||||||
|
|
||||||
const NameUCI Name = "uci.emissary.cadoles.com"
|
|
||||||
|
|
||||||
type UCI struct {
|
|
||||||
Revision int `json:"revisions"`
|
|
||||||
Config *uci.UCI `json:"config"`
|
|
||||||
PostImportCommands []*UCIPostImportCommand `json:"postImportCommands"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type UCIPostImportCommand struct {
|
|
||||||
Command string `json:"command"`
|
|
||||||
Args []string `json:"args"`
|
|
||||||
}
|
|
||||||
|
|
||||||
func (u *UCI) SpecName() Name {
|
|
||||||
return NameUCI
|
|
||||||
}
|
|
||||||
|
|
||||||
func (u *UCI) SpecRevision() int {
|
|
||||||
return u.Revision
|
|
||||||
}
|
|
||||||
|
|
||||||
func (u *UCI) SpecData() any {
|
|
||||||
return struct {
|
|
||||||
Config *uci.UCI `json:"config"`
|
|
||||||
PostImportCommands []*UCIPostImportCommand `json:"postImportCommands"`
|
|
||||||
}{Config: u.Config, PostImportCommands: u.PostImportCommands}
|
|
||||||
}
|
|
||||||
|
|
||||||
func NewUCISpec() *UCI {
|
|
||||||
return &UCI{
|
|
||||||
PostImportCommands: make([]*UCIPostImportCommand, 0),
|
|
||||||
}
|
|
||||||
}
|
|
17
internal/spec/uci/init.go
Normal file
17
internal/spec/uci/init.go
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
package uci
|
||||||
|
|
||||||
|
import (
|
||||||
|
_ "embed"
|
||||||
|
|
||||||
|
"forge.cadoles.com/Cadoles/emissary/internal/spec"
|
||||||
|
"github.com/pkg/errors"
|
||||||
|
)
|
||||||
|
|
||||||
|
//go:embed schema.json
|
||||||
|
var schema []byte
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
if err := spec.Register(NameUCI, schema); err != nil {
|
||||||
|
panic(errors.WithStack(err))
|
||||||
|
}
|
||||||
|
}
|
97
internal/spec/uci/schema.json
Normal file
97
internal/spec/uci/schema.json
Normal file
@ -0,0 +1,97 @@
|
|||||||
|
{
|
||||||
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||||
|
"$id": "https://uci.emissary.cadoles.com/spec.json",
|
||||||
|
"title": "UCISpec",
|
||||||
|
"description": "Emissary 'UCI' specification",
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"config": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"packages": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"$ref": "#/$defs/package"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": ["packages"],
|
||||||
|
"additionalProperties": false
|
||||||
|
},
|
||||||
|
"postImportCommands": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"command": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"args": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": ["command", "args"],
|
||||||
|
"additionalProperties": false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": ["config", "postImportCommands"],
|
||||||
|
"additionalProperties": false,
|
||||||
|
"$defs": {
|
||||||
|
"package": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"name": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"configs": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"$ref": "#/$defs/config"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": ["name", "configs"],
|
||||||
|
"additionalProperties": false
|
||||||
|
},
|
||||||
|
"config": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"name": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"section": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"options": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"$ref": "#/$defs/option"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": ["name", "section", "options"],
|
||||||
|
"additionalProperties": false
|
||||||
|
},
|
||||||
|
"option": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"type": {
|
||||||
|
"type": "string",
|
||||||
|
"enum": ["list", "option"]
|
||||||
|
},
|
||||||
|
"name": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"value": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": ["type", "name", "value"],
|
||||||
|
"additionalProperties": false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
42
internal/spec/uci/spec.go
Normal file
42
internal/spec/uci/spec.go
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
package uci
|
||||||
|
|
||||||
|
import (
|
||||||
|
"forge.cadoles.com/Cadoles/emissary/internal/openwrt/uci"
|
||||||
|
"forge.cadoles.com/Cadoles/emissary/internal/spec"
|
||||||
|
)
|
||||||
|
|
||||||
|
const NameUCI spec.Name = "uci.emissary.cadoles.com"
|
||||||
|
|
||||||
|
type Spec struct {
|
||||||
|
Revision int `json:"revisions"`
|
||||||
|
Config *uci.UCI `json:"config"`
|
||||||
|
PostImportCommands []*UCIPostImportCommand `json:"postImportCommands"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type UCIPostImportCommand struct {
|
||||||
|
Command string `json:"command"`
|
||||||
|
Args []string `json:"args"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *Spec) SpecName() spec.Name {
|
||||||
|
return NameUCI
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *Spec) SpecRevision() int {
|
||||||
|
return s.Revision
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *Spec) SpecData() map[string]any {
|
||||||
|
return map[string]any{
|
||||||
|
"config": s.Config,
|
||||||
|
"postImportCommands": s.PostImportCommands,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewSpec() *Spec {
|
||||||
|
return &Spec{
|
||||||
|
PostImportCommands: make([]*UCIPostImportCommand, 0),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var _ spec.Spec = &Spec{}
|
162
internal/spec/uci/testdata/spec-missing-prop.json
vendored
Normal file
162
internal/spec/uci/testdata/spec-missing-prop.json
vendored
Normal file
@ -0,0 +1,162 @@
|
|||||||
|
{
|
||||||
|
"name": "uci.emissary.cadoles.com",
|
||||||
|
"data": {
|
||||||
|
"config": {
|
||||||
|
"packages": [
|
||||||
|
{
|
||||||
|
"name": "uhttpd",
|
||||||
|
"configs": [
|
||||||
|
{
|
||||||
|
"name": "uhttpd",
|
||||||
|
"section": "main",
|
||||||
|
"options": [
|
||||||
|
{
|
||||||
|
"type": "list",
|
||||||
|
"name": "listen_http",
|
||||||
|
"value": "0.0.0.0:8080"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "list",
|
||||||
|
"name": "listen_http",
|
||||||
|
"value": "[::]:8080"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "list",
|
||||||
|
"name": "listen_https",
|
||||||
|
"value": "0.0.0.0:8443"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "list",
|
||||||
|
"name": "listen_https",
|
||||||
|
"value": "[::]:8443"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "option",
|
||||||
|
"name": "redirect_https",
|
||||||
|
"value": "0"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "option",
|
||||||
|
"name": "home",
|
||||||
|
"value": "/www"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "option",
|
||||||
|
"name": "rfc1918_filter",
|
||||||
|
"value": "1"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "option",
|
||||||
|
"name": "max_requests",
|
||||||
|
"value": "3"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "option",
|
||||||
|
"name": "max_connections",
|
||||||
|
"value": "100"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "option",
|
||||||
|
"name": "cert",
|
||||||
|
"value": "/etc/uhttpd.crt"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "option",
|
||||||
|
"name": "key",
|
||||||
|
"value": "/etc/uhttpd.key"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "option",
|
||||||
|
"name": "cgi_prefix",
|
||||||
|
"value": "/cgi-bin"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "list",
|
||||||
|
"name": "lua_prefix",
|
||||||
|
"value": "/cgi-bin/luci=/usr/lib/lua/luci/sgi/uhttpd.lua"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "option",
|
||||||
|
"name": "script_timeout",
|
||||||
|
"value": "60"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "option",
|
||||||
|
"name": "network_timeout",
|
||||||
|
"value": "30"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "option",
|
||||||
|
"name": "http_keepalive",
|
||||||
|
"value": "20"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "option",
|
||||||
|
"name": "tcp_keepalive",
|
||||||
|
"value": "1"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "option",
|
||||||
|
"name": "ubus_prefix"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "cert",
|
||||||
|
"section": "defaults",
|
||||||
|
"options": [
|
||||||
|
{
|
||||||
|
"type": "option",
|
||||||
|
"name": "days",
|
||||||
|
"value": "730"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "option",
|
||||||
|
"name": "key_type",
|
||||||
|
"value": "ec"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "option",
|
||||||
|
"name": "bits",
|
||||||
|
"value": "2048"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "option",
|
||||||
|
"name": "ec_curve",
|
||||||
|
"value": "P-256"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "option",
|
||||||
|
"name": "country",
|
||||||
|
"value": "ZZ"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "option",
|
||||||
|
"name": "state",
|
||||||
|
"value": "Somewhere"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "option",
|
||||||
|
"name": "location",
|
||||||
|
"value": "Unknown"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "option",
|
||||||
|
"name": "commonname",
|
||||||
|
"value": "OpenWrt"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"postImportCommands": [
|
||||||
|
{
|
||||||
|
"command": "reload_config",
|
||||||
|
"args": []
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"revision": 0
|
||||||
|
}
|
163
internal/spec/uci/testdata/spec-ok.json
vendored
Normal file
163
internal/spec/uci/testdata/spec-ok.json
vendored
Normal file
@ -0,0 +1,163 @@
|
|||||||
|
{
|
||||||
|
"name": "uci.emissary.cadoles.com",
|
||||||
|
"data": {
|
||||||
|
"config": {
|
||||||
|
"packages": [
|
||||||
|
{
|
||||||
|
"name": "uhttpd",
|
||||||
|
"configs": [
|
||||||
|
{
|
||||||
|
"name": "uhttpd",
|
||||||
|
"section": "main",
|
||||||
|
"options": [
|
||||||
|
{
|
||||||
|
"type": "list",
|
||||||
|
"name": "listen_http",
|
||||||
|
"value": "0.0.0.0:8080"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "list",
|
||||||
|
"name": "listen_http",
|
||||||
|
"value": "[::]:8080"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "list",
|
||||||
|
"name": "listen_https",
|
||||||
|
"value": "0.0.0.0:8443"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "list",
|
||||||
|
"name": "listen_https",
|
||||||
|
"value": "[::]:8443"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "option",
|
||||||
|
"name": "redirect_https",
|
||||||
|
"value": "0"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "option",
|
||||||
|
"name": "home",
|
||||||
|
"value": "/www"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "option",
|
||||||
|
"name": "rfc1918_filter",
|
||||||
|
"value": "1"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "option",
|
||||||
|
"name": "max_requests",
|
||||||
|
"value": "3"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "option",
|
||||||
|
"name": "max_connections",
|
||||||
|
"value": "100"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "option",
|
||||||
|
"name": "cert",
|
||||||
|
"value": "/etc/uhttpd.crt"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "option",
|
||||||
|
"name": "key",
|
||||||
|
"value": "/etc/uhttpd.key"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "option",
|
||||||
|
"name": "cgi_prefix",
|
||||||
|
"value": "/cgi-bin"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "list",
|
||||||
|
"name": "lua_prefix",
|
||||||
|
"value": "/cgi-bin/luci=/usr/lib/lua/luci/sgi/uhttpd.lua"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "option",
|
||||||
|
"name": "script_timeout",
|
||||||
|
"value": "60"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "option",
|
||||||
|
"name": "network_timeout",
|
||||||
|
"value": "30"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "option",
|
||||||
|
"name": "http_keepalive",
|
||||||
|
"value": "20"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "option",
|
||||||
|
"name": "tcp_keepalive",
|
||||||
|
"value": "1"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "option",
|
||||||
|
"name": "ubus_prefix",
|
||||||
|
"value": "/ubus"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "cert",
|
||||||
|
"section": "defaults",
|
||||||
|
"options": [
|
||||||
|
{
|
||||||
|
"type": "option",
|
||||||
|
"name": "days",
|
||||||
|
"value": "730"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "option",
|
||||||
|
"name": "key_type",
|
||||||
|
"value": "ec"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "option",
|
||||||
|
"name": "bits",
|
||||||
|
"value": "2048"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "option",
|
||||||
|
"name": "ec_curve",
|
||||||
|
"value": "P-256"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "option",
|
||||||
|
"name": "country",
|
||||||
|
"value": "ZZ"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "option",
|
||||||
|
"name": "state",
|
||||||
|
"value": "Somewhere"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "option",
|
||||||
|
"name": "location",
|
||||||
|
"value": "Unknown"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "option",
|
||||||
|
"name": "commonname",
|
||||||
|
"value": "OpenWrt"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"postImportCommands": [
|
||||||
|
{
|
||||||
|
"command": "reload_config",
|
||||||
|
"args": []
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"revision": 0
|
||||||
|
}
|
70
internal/spec/uci/validator_test.go
Normal file
70
internal/spec/uci/validator_test.go
Normal file
@ -0,0 +1,70 @@
|
|||||||
|
package uci
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"encoding/json"
|
||||||
|
"io/ioutil"
|
||||||
|
"testing"
|
||||||
|
|
||||||
|
"forge.cadoles.com/Cadoles/emissary/internal/spec"
|
||||||
|
"github.com/pkg/errors"
|
||||||
|
)
|
||||||
|
|
||||||
|
type validatorTestCase struct {
|
||||||
|
Name string
|
||||||
|
Source string
|
||||||
|
ShouldFail bool
|
||||||
|
}
|
||||||
|
|
||||||
|
var validatorTestCases = []validatorTestCase{
|
||||||
|
{
|
||||||
|
Name: "SpecOK",
|
||||||
|
Source: "testdata/spec-ok.json",
|
||||||
|
ShouldFail: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Name: "SpecMissingProp",
|
||||||
|
Source: "testdata/spec-missing-prop.json",
|
||||||
|
ShouldFail: true,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestValidator(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
|
||||||
|
validator := spec.NewValidator()
|
||||||
|
if err := validator.Register(NameUCI, schema); err != nil {
|
||||||
|
t.Fatalf("+%v", errors.WithStack(err))
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, tc := range validatorTestCases {
|
||||||
|
func(tc validatorTestCase) {
|
||||||
|
t.Run(tc.Name, func(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
|
||||||
|
rawSpec, err := ioutil.ReadFile(tc.Source)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatalf("+%v", errors.WithStack(err))
|
||||||
|
}
|
||||||
|
|
||||||
|
var spec spec.RawSpec
|
||||||
|
|
||||||
|
if err := json.Unmarshal(rawSpec, &spec); err != nil {
|
||||||
|
t.Fatalf("+%v", errors.WithStack(err))
|
||||||
|
}
|
||||||
|
|
||||||
|
ctx := context.Background()
|
||||||
|
|
||||||
|
err = validator.Validate(ctx, &spec)
|
||||||
|
|
||||||
|
if !tc.ShouldFail && err != nil {
|
||||||
|
t.Errorf("+%v", errors.WithStack(err))
|
||||||
|
}
|
||||||
|
|
||||||
|
if tc.ShouldFail && err == nil {
|
||||||
|
t.Error("validation should have failed")
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}(tc)
|
||||||
|
}
|
||||||
|
}
|
62
internal/spec/validator.go
Normal file
62
internal/spec/validator.go
Normal file
@ -0,0 +1,62 @@
|
|||||||
|
package spec
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"encoding/json"
|
||||||
|
|
||||||
|
"github.com/pkg/errors"
|
||||||
|
"github.com/qri-io/jsonschema"
|
||||||
|
)
|
||||||
|
|
||||||
|
type Validator struct {
|
||||||
|
schemas map[Name]*jsonschema.Schema
|
||||||
|
}
|
||||||
|
|
||||||
|
func (v *Validator) Register(name Name, rawSchema []byte) error {
|
||||||
|
schema := &jsonschema.Schema{}
|
||||||
|
if err := json.Unmarshal(rawSchema, schema); err != nil {
|
||||||
|
return errors.Wrapf(err, "could not register spec shema '%s'", name)
|
||||||
|
}
|
||||||
|
|
||||||
|
v.schemas[name] = schema
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (v *Validator) Validate(ctx context.Context, spec Spec) error {
|
||||||
|
schema, exists := v.schemas[spec.SpecName()]
|
||||||
|
if !exists {
|
||||||
|
return errors.WithStack(ErrUnknownSchema)
|
||||||
|
}
|
||||||
|
|
||||||
|
state := schema.Validate(ctx, map[string]any(spec.SpecData()))
|
||||||
|
if !state.IsValid() {
|
||||||
|
return errors.WithStack(&ValidationError{*state.Errs})
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewValidator() *Validator {
|
||||||
|
return &Validator{
|
||||||
|
schemas: make(map[Name]*jsonschema.Schema),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var defaultValidator = NewValidator()
|
||||||
|
|
||||||
|
func Register(name Name, rawSchema []byte) error {
|
||||||
|
if err := defaultValidator.Register(name, rawSchema); err != nil {
|
||||||
|
return errors.WithStack(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func Validate(ctx context.Context, spec Spec) error {
|
||||||
|
if err := defaultValidator.Validate(ctx, spec); err != nil {
|
||||||
|
return errors.WithStack(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
@ -2,7 +2,9 @@
|
|||||||
|
|
||||||
CREATE TABLE agents (
|
CREATE TABLE agents (
|
||||||
id INTEGER PRIMARY KEY,
|
id INTEGER PRIMARY KEY,
|
||||||
remote_id TEXT NOT NULL UNIQUE,
|
thumbprint TEXT UNIQUE,
|
||||||
|
keyset TEXT,
|
||||||
|
metadata TEXT,
|
||||||
status INTEGER NOT NULL,
|
status INTEGER NOT NULL,
|
||||||
created_at datetime NOT NULL,
|
created_at datetime NOT NULL,
|
||||||
updated_at datetime NOT NULL
|
updated_at datetime NOT NULL
|
||||||
@ -13,7 +15,7 @@ CREATE TABLE specs (
|
|||||||
agent_id INTEGER,
|
agent_id INTEGER,
|
||||||
name TEXT NOT NULL,
|
name TEXT NOT NULL,
|
||||||
revision INTEGER DEFAULT 0,
|
revision INTEGER DEFAULT 0,
|
||||||
data TEXT,
|
data TEXT,
|
||||||
created_at datetime NOT NULL,
|
created_at datetime NOT NULL,
|
||||||
updated_at datetime NOT NULL,
|
updated_at datetime NOT NULL,
|
||||||
FOREIGN KEY (agent_id) REFERENCES agents (id) ON DELETE CASCADE,
|
FOREIGN KEY (agent_id) REFERENCES agents (id) ON DELETE CASCADE,
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
agent:
|
agent:
|
||||||
|
serverUrl: http://127.0.0.1:3000
|
||||||
|
privateKeyPath: /var/lib/emissary/agent-key.json
|
||||||
reconciliationInterval: 5
|
reconciliationInterval: 5
|
||||||
controllers:
|
controllers:
|
||||||
persistence:
|
persistence:
|
||||||
@ -6,10 +8,14 @@ agent:
|
|||||||
stateFile: /var/lib/emissary/state.json
|
stateFile: /var/lib/emissary/state.json
|
||||||
spec:
|
spec:
|
||||||
enabled: true
|
enabled: true
|
||||||
serverUrl: http://192.168.0.45:3000
|
|
||||||
gateway:
|
gateway:
|
||||||
enabled: true
|
enabled: true
|
||||||
uci:
|
uci:
|
||||||
enabled: true
|
enabled: true
|
||||||
binPath: uci
|
binPath: uci
|
||||||
configBackupFile: /var/lib/emissary/uci-backup.conf
|
configBackupFile: /var/lib/emissary/uci-backup.conf
|
||||||
|
collectors:
|
||||||
|
- name: uname
|
||||||
|
command: uname
|
||||||
|
args:
|
||||||
|
- -a
|
||||||
|
@ -1,9 +1,10 @@
|
|||||||
#!/sbin/openrc-run
|
#!/sbin/openrc-run
|
||||||
|
|
||||||
command="/usr/bin/emissary"
|
command="/usr/bin/emissary"
|
||||||
command_args="--config /etc/emissary/config.yml agent run"
|
command_args="--workdir /usr/share/emissary --config /etc/emissary/agent.yml agent run"
|
||||||
start_stop_daemon_args='--chdir /usr/share/emissary'
|
|
||||||
supervisor=supervise-daemon
|
supervisor=supervise-daemon
|
||||||
|
output_log="/var/log/emissary/agent.log"
|
||||||
|
error_log="$output_log"
|
||||||
|
|
||||||
depend() {
|
depend() {
|
||||||
need net
|
need net
|
||||||
|
@ -1,9 +1,14 @@
|
|||||||
#!/sbin/openrc-run
|
#!/sbin/openrc-run
|
||||||
|
|
||||||
command="/usr/bin/emissary"
|
command="/usr/bin/emissary"
|
||||||
command_args="--config /etc/emissary/config.yml server run"
|
command_args="--workdir /usr/share/emissary --config /etc/emissary/server.yml server run"
|
||||||
start_stop_daemon_args='--chdir /usr/share/emissary'
|
|
||||||
supervisor=supervise-daemon
|
supervisor=supervise-daemon
|
||||||
|
output_log="/var/log/emissary/server.log"
|
||||||
|
error_log="$output_log"
|
||||||
|
|
||||||
|
start_pre() {
|
||||||
|
/usr/bin/emissary --workdir /usr/share/emissary --config /etc/emissary/server.yml server database migrate
|
||||||
|
}
|
||||||
|
|
||||||
depend() {
|
depend() {
|
||||||
need net
|
need net
|
||||||
|
@ -1,20 +0,0 @@
|
|||||||
#!/bin/sh /etc/rc.common
|
|
||||||
|
|
||||||
USE_PROCD=1
|
|
||||||
START=50
|
|
||||||
STOP=50
|
|
||||||
|
|
||||||
start_service() {
|
|
||||||
local config_file="/etc/emissary/agent.yml"
|
|
||||||
procd_open_instance emissary-agent
|
|
||||||
procd_set_param command /usr/bin/emissary
|
|
||||||
procd_append_param command --workdir /usr/share/emissary
|
|
||||||
procd_append_param command --config "$config_file"
|
|
||||||
procd_append_param command agent run
|
|
||||||
procd_set_param respawn ${respawn_threshold:-3600} ${respawn_timeout:-5} ${respawn_retry:-5}
|
|
||||||
procd_set_param file "$config_file"
|
|
||||||
procd_set_param stdout 1
|
|
||||||
procd_set_param stderr 1
|
|
||||||
procd_set_param pidfile /var/run/emissary-agent.pid
|
|
||||||
procd_close_instance
|
|
||||||
}
|
|
10
misc/rest/app-spec-data.json
Normal file
10
misc/rest/app-spec-data.json
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
{
|
||||||
|
"apps": {
|
||||||
|
"edge.sdk.client.test": {
|
||||||
|
"url": "http://localhost:3001/edge.sdk.client.test_0.0.0.zip",
|
||||||
|
"sha256sum": "58019192dacdae17755707719707db007e26dac856102280583fbd18427dd352",
|
||||||
|
"format": "zip",
|
||||||
|
"address": "127.0.0.1:8081"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -6,6 +6,7 @@ tmp/config.yml
|
|||||||
prep: make build-emissary
|
prep: make build-emissary
|
||||||
prep: make tmp/server.yml
|
prep: make tmp/server.yml
|
||||||
prep: make tmp/agent.yml
|
prep: make tmp/agent.yml
|
||||||
|
prep: make run-emissary-server EMISSARY_CMD="--debug --config tmp/agent.yml server database migrate"
|
||||||
daemon: make run-emissary-server EMISSARY_CMD="--debug --config tmp/server.yml server run"
|
daemon: make run-emissary-server EMISSARY_CMD="--debug --config tmp/server.yml server run"
|
||||||
daemon: make run-emissary-agent EMISSARY_CMD="--debug --config tmp/agent.yml agent run"
|
daemon: make run-emissary-agent EMISSARY_CMD="--debug --config tmp/agent.yml agent run"
|
||||||
}
|
}
|
Reference in New Issue
Block a user