From 82a651cd5deddf3a699a66317e85b4ef16d4f1a5 Mon Sep 17 00:00:00 2001 From: Peter Kurfer Date: Wed, 22 Dec 2021 11:52:02 +0100 Subject: [PATCH] First draft of new fiber based server - replaced previous net/http based muxer and all other components with fiber - replaced polling with SSE to handle file changes - auto-update custom stylesheets - natively support mermaid diagrams - handle custom element attributes for lists properly - reload on config changes - replace JS templating with actual JS code and an API --- .gitattributes | 1 + .gitignore | 1 + Taskfile.yml | 4 +- api/config.go | 25 +++ api/events.go | 74 ++++++++ api/no_cache_middleware.go | 12 ++ api/reveal.go | 31 +++ api/views.go | 73 +++++++ assets/assets.go | 4 +- assets/lint/config.toml | 46 ----- assets/web/js/reload.js | 24 --- cmd/goveal/main.go | 6 +- cmd/goveal/root.go | 52 +++++ cmd/goveal/serve.go | 73 +++++++ config/components.go | 68 +++++++ config/load.go | 51 +++++ events/event_hub.go | 151 +++++++++++++++ examples/gopher.jpg | Bin 35704 -> 130 bytes examples/goveal.yaml | 7 +- examples/slides.md | 71 +++++-- fs/layered.go | 24 +++ fs/watching_fs.go | 66 +++++++ go.mod | 26 ++- go.sum | 194 +++++++++++++++++-- internal/app/cmd/root.go | 132 ------------- internal/app/cmd/serve.go | 94 --------- internal/app/rendering/reveal_params.go | 89 --------- internal/app/rendering/template.go | 70 ------- internal/app/routing/layered_fs.go | 47 ----- internal/app/routing/markdown_fs.go | 33 ---- internal/app/routing/no_cache_handler.go | 56 ------ internal/app/routing/regexp_router.go | 38 ---- internal/app/server/hash_handler.go | 103 ---------- internal/app/server/http_server.go | 118 ------------ internal/encoding/line_ending.go | 44 ----- internal/encoding/line_ending_test.go | 74 -------- rendering/render_to_reveal.go | 232 +++++++++++++++++++++++ rendering/state.go | 126 ++++++++++++ rendering/templates/any-code.gohtml | 6 + rendering/templates/image.gohtml | 8 + rendering/templates/listItem.gohtml | 5 + rendering/templates/mermaid.gohtml | 3 + web/index.gohtml | 36 ++++ web/js/app.js | 116 ++++++++++++ web/web.go | 6 + 45 files changed, 1500 insertions(+), 1020 deletions(-) create mode 100644 .gitattributes create mode 100644 api/config.go create mode 100644 api/events.go create mode 100644 api/no_cache_middleware.go create mode 100644 api/reveal.go create mode 100644 api/views.go delete mode 100644 assets/lint/config.toml delete mode 100644 assets/web/js/reload.js create mode 100644 cmd/goveal/root.go create mode 100644 cmd/goveal/serve.go create mode 100644 config/components.go create mode 100644 config/load.go create mode 100644 events/event_hub.go create mode 100644 fs/layered.go create mode 100644 fs/watching_fs.go delete mode 100644 internal/app/cmd/root.go delete mode 100644 internal/app/cmd/serve.go delete mode 100644 internal/app/rendering/reveal_params.go delete mode 100644 internal/app/rendering/template.go delete mode 100644 internal/app/routing/layered_fs.go delete mode 100644 internal/app/routing/markdown_fs.go delete mode 100644 internal/app/routing/no_cache_handler.go delete mode 100644 internal/app/routing/regexp_router.go delete mode 100644 internal/app/server/hash_handler.go delete mode 100644 internal/app/server/http_server.go delete mode 100644 internal/encoding/line_ending.go delete mode 100644 internal/encoding/line_ending_test.go create mode 100644 rendering/render_to_reveal.go create mode 100644 rendering/state.go create mode 100644 rendering/templates/any-code.gohtml create mode 100644 rendering/templates/image.gohtml create mode 100644 rendering/templates/listItem.gohtml create mode 100644 rendering/templates/mermaid.gohtml create mode 100644 web/index.gohtml create mode 100644 web/js/app.js create mode 100644 web/web.go diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..4fae6dc --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +*.jpg filter=lfs diff=lfs merge=lfs -text diff --git a/.gitignore b/.gitignore index cb049df..8025e3f 100644 --- a/.gitignore +++ b/.gitignore @@ -22,6 +22,7 @@ bin/ assets/reveal/ +assets/mermaid/ pkged.go diff --git a/Taskfile.yml b/Taskfile.yml index c1c3ad0..354a126 100644 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -4,6 +4,7 @@ vars: DEBUG_PORT: 2345 REVEALJS_VERSION: 4.1.2 HIGHLIGHTJS_VERSION: 11.3.1 + MERMAID_VERSION: 8.13.4 BINARY_NAME: goveal OUT_DIR: ./out GO_BUILD_ARGS: -ldflags="-w -s" @@ -90,13 +91,14 @@ tasks: - Taskfile.yml cmds: - rm -rf ./assets/reveal - - mkdir -p ./assets/reveal + - mkdir -p ./assets/reveal ./assets/mermaid - curl -sL https://github.com/hakimel/reveal.js/archive/{{ .REVEALJS_VERSION }}.tar.gz | tar -xvz --strip-components=1 -C ./assets/reveal --wildcards "*.js" --wildcards "*.css" --wildcards "*.html" --wildcards "*.woff" --wildcards "*.ttf" --exclude "test" --exclude "gulpfile.js" --exclude "gruntfile.js" --exclude "demo.html" --exclude "index.html" --exclude "examples/*.html" - mkdir -p ./assets/reveal/plugin/menu ./assets/reveal/plugin/mouse-pointer - git clone https://github.com/denehyg/reveal.js-menu.git ./assets/reveal/plugin/menu - curl -L -o ./assets/reveal/plugin/mouse-pointer/mouse-pointer.js https://raw.githubusercontent.com/caiofcm/plugin-revealjs-mouse-pointer/master/mouse-pointer.js - rm -f ./assets/reveal/plugin/menu/{bower.json,CONTRIBUTING.md,LICENSE,package.json,README.md,.gitignore,gulpfile.js,package-lock.json} - curl -L https://github.com/highlightjs/highlight.js/archive/{{ .HIGHLIGHTJS_VERSION }}.tar.gz | tar -xvz --strip-components=3 -C ./assets/reveal/plugin/highlight --wildcards "*.css" highlight.js-{{ .HIGHLIGHTJS_VERSION }}/src/styles/ + - curl -L https://github.com/mermaid-js/mermaid/archive/refs/tags/{{ .MERMAID_VERSION }}.tar.gz | tar -xvz -C ./assets/mermaid/ mermaid-{{ .MERMAID_VERSION }}/dist --strip-components=2 go-get-tool: vars: diff --git a/api/config.go b/api/config.go new file mode 100644 index 0000000..5050560 --- /dev/null +++ b/api/config.go @@ -0,0 +1,25 @@ +package api + +import ( + "github.com/gofiber/fiber/v2" + + "github.com/baez90/goveal/config" +) + +type ConfigAPI struct { + cfg *config.Components +} + +func RegisterConfigAPI(app *fiber.App, cfg *config.Components) { + cfgApi := &ConfigAPI{cfg: cfg} + app.Get("/api/v1/config/reveal", cfgApi.RevealConfig) + app.Get("/api/v1/config/mermaid", cfgApi.MermaidConfig) +} + +func (a *ConfigAPI) RevealConfig(ctx *fiber.Ctx) error { + return ctx.JSON(a.cfg.Reveal) +} + +func (a *ConfigAPI) MermaidConfig(ctx *fiber.Ctx) error { + return ctx.JSON(a.cfg.Mermaid) +} diff --git a/api/events.go b/api/events.go new file mode 100644 index 0000000..8ebaca2 --- /dev/null +++ b/api/events.go @@ -0,0 +1,74 @@ +package api + +import ( + "bufio" + "encoding/json" + "errors" + "fmt" + "time" + + "github.com/gofiber/fiber/v2" + log "github.com/sirupsen/logrus" + + "github.com/baez90/goveal/events" +) + +type ContentEventHandler chan events.ContentEvent + +func (h ContentEventHandler) OnEvent(ce events.ContentEvent) error { + const enqueueTimeout = 50 * time.Millisecond + select { + case h <- ce: + return nil + case <-time.After(enqueueTimeout): + return errors.New("failed to enqueue due to timeout") + } +} + +type Events struct { + logger *log.Logger + hub *events.EventHub +} + +func RegisterEventsAPI(app *fiber.App, hub *events.EventHub, logger *log.Logger) { + ev := &Events{hub: hub, logger: logger} + app.Get("/api/v1/events", ev.EventHandler) +} + +func (e *Events) EventHandler(fc *fiber.Ctx) error { + var ( + ctx = fc.Context() + handler = make(ContentEventHandler) + clientID, onError = e.hub.Subscribe(handler) + ) + + ctx.SetContentType("text/event-stream") + ctx.Response.Header.Set("Cache-Control", "no-cache") + ctx.Response.Header.Set("Connection", "keep-alive") + ctx.Response.Header.Set("Transfer-Encoding", "chunked") + ctx.Response.Header.Set("Access-Control-Allow-Origin", "*") + ctx.Response.Header.Set("Access-Control-Allow-Headers", "Cache-Control") + ctx.Response.Header.Set("Access-Control-Allow-Credentials", "true") + + ctx.SetBodyStreamWriter(func(w *bufio.Writer) { + for ev := range handler { + if msg, err := json.Marshal(ev); err != nil { + e.logger.Errorf("Failed to marshal to JSON: %v", err) + continue + } else if _, err = fmt.Fprintf(w, "data: %s\n\n", string(msg)); err != nil { + e.logger.Errorf("Failed to write to client: %v", err) + continue + } else if err = w.Flush(); err != nil { + e.hub.Unsubscribe(clientID) + } + } + }) + + go func() { + for err := range onError { + e.logger.Errorf("Error while sending events to client: %v", err) + } + }() + + return nil +} diff --git a/api/no_cache_middleware.go b/api/no_cache_middleware.go new file mode 100644 index 0000000..15e43ca --- /dev/null +++ b/api/no_cache_middleware.go @@ -0,0 +1,12 @@ +package api + +import "github.com/gofiber/fiber/v2" + +func NoCache(app *fiber.App) { + app.Use(NoCacheHandler) +} + +func NoCacheHandler(ctx *fiber.Ctx) error { + ctx.Response().Header.Set("Cache-Control", "no-cache") + return ctx.Next() +} diff --git a/api/reveal.go b/api/reveal.go new file mode 100644 index 0000000..fed5133 --- /dev/null +++ b/api/reveal.go @@ -0,0 +1,31 @@ +package api + +import ( + "net/http" + "strings" + + "github.com/gofiber/fiber/v2" + "github.com/gofiber/fiber/v2/middleware/filesystem" + + "github.com/baez90/goveal/assets" + "github.com/baez90/goveal/fs" + "github.com/baez90/goveal/web" +) + +func RegisterStaticFileHandling(app *fiber.App, wdfs fs.FS) error { + layers := []fs.FS{wdfs} + layers = append([]fs.FS{web.WebFS, assets.Assets}, layers...) + + layeredFS := fs.Layered{Layers: layers} + fsMiddleware := filesystem.New(filesystem.Config{ + Root: http.FS(layeredFS), + Next: func(c *fiber.Ctx) bool { + _, err := layeredFS.Open(strings.TrimLeft(c.Path(), "/")) + return err != nil + }, + }) + + app.Use(fsMiddleware) + + return nil +} diff --git a/api/views.go b/api/views.go new file mode 100644 index 0000000..884ccb2 --- /dev/null +++ b/api/views.go @@ -0,0 +1,73 @@ +package api + +import ( + "hash/fnv" + "io" + + "github.com/gofiber/fiber/v2" + "github.com/gomarkdown/markdown" + "github.com/gomarkdown/markdown/html" + "github.com/gomarkdown/markdown/parser" + "go.uber.org/multierr" + + "github.com/baez90/goveal/config" + "github.com/baez90/goveal/fs" + "github.com/baez90/goveal/rendering" +) + +const ( + parserExtensions = parser.NoIntraEmphasis | parser.Tables | parser.FencedCode | + parser.Autolink | parser.Strikethrough | parser.SpaceHeadings | parser.HeadingIDs | + parser.BackslashLineBreak | parser.DefinitionLists | parser.MathJax | parser.Titleblock | + parser.OrderedListStart | parser.Attributes +) + +type Views struct { + cfg *config.Components + wdfs fs.FS + mdFilepath string +} + +func RegisterViews(app *fiber.App, wdfs fs.FS, mdFilepath string, cfg *config.Components) { + p := &Views{cfg: cfg, wdfs: wdfs, mdFilepath: mdFilepath} + app.Get("/", p.IndexPage) + app.Get("/index.html", p.IndexPage) + app.Get("/index.htm", p.IndexPage) + app.Get("/slides", p.RenderedMarkdown) +} + +func (p *Views) IndexPage(ctx *fiber.Ctx) error { + return ctx.Render("index", fiber.Map{ + "Reveal": p.cfg.Reveal, + "Rendering": p.cfg.Rendering, + }) +} + +func (p *Views) RenderedMarkdown(ctx *fiber.Ctx) (err error) { + f, err := p.wdfs.Open(p.mdFilepath) + if err != nil { + return err + } + defer multierr.AppendInvoke(&err, multierr.Close(f)) + data, err := io.ReadAll(f) + if err != nil { + return err + } + + mdParser := parser.NewWithExtensions(parserExtensions) + rr := &rendering.RevealRenderer{ + StateMachine: rendering.NewStateMachine("***", "---"), + Hash: fnv.New32a(), + } + renderer := html.NewRenderer(html.RendererOptions{ + Flags: html.CommonFlags | html.HrefTargetBlank, + RenderNodeHook: rr.RenderHook, + }) + + ctx.Append(fiber.HeaderContentType, fiber.MIMETextHTML) + if _, err = ctx.Write(markdown.ToHTML(data, mdParser, renderer)); err != nil { + return err + } + + return err +} diff --git a/assets/assets.go b/assets/assets.go index 84828fa..e5a6a07 100644 --- a/assets/assets.go +++ b/assets/assets.go @@ -3,8 +3,6 @@ package assets import "embed" var ( - //go:embed template/reveal-markdown.tmpl - Template []byte - //go:embed web reveal + //go:embed reveal mermaid/mermaid.min.js Assets embed.FS ) diff --git a/assets/lint/config.toml b/assets/lint/config.toml deleted file mode 100644 index c61446b..0000000 --- a/assets/lint/config.toml +++ /dev/null @@ -1,46 +0,0 @@ -ignoreGeneratedHeader = false -severity = "warning" -confidence = 0.8 -errorCode = 1 -warningCode = 1 -empty-block = true -confusing-naming = true -get-return = true -deep-exit = true -unused-parameter = true -unreachable-code = true - - -[rule.blank-imports] -[rule.context-as-argument] -[rule.context-keys-type] -[rule.dot-imports] -[rule.error-return] -[rule.error-strings] -[rule.error-naming] -[rule.exported] -[rule.if-return] -[rule.increment-decrement] -[rule.var-naming] -[rule.var-declaration] -[rule.package-comments] -[rule.range] -[rule.receiver-naming] -[rule.time-naming] -[rule.unexported-return] -[rule.indent-error-flow] -[rule.errorf] -[rule.empty-block] -[rule.superfluous-else] -[rule.unused-parameter] -[rule.unreachable-code] -[rule.redefines-builtin-id] - -[argument-limit] - arguments =[4] - -[line-length-limit] - arguments =[80] - -[rule.add-constant] - arguments = [{maxLitCount = "3",allowStrs ="\"\"",allowInts="0,1,2",allowFloats="0.0,0.,1.0,1.,2.0,2."}] \ No newline at end of file diff --git a/assets/web/js/reload.js b/assets/web/js/reload.js deleted file mode 100644 index 34981f2..0000000 --- a/assets/web/js/reload.js +++ /dev/null @@ -1,24 +0,0 @@ -let knownHashes = {} - -function getLatestHash(path) { - let request = new XMLHttpRequest() - request.open("GET", `/hash/md5${path}`) - - request.onload = () => { - if(request.status === 200) { - let hashResp = JSON.parse(request.responseText) - if(path in knownHashes && knownHashes[path] !== hashResp["Hash"]) { - window.location.reload() - } else { - knownHashes[path] = hashResp["Hash"] - } - } - } - request.send() -} - -function subscribeForUpdates(path) { - setInterval(() => { - getLatestHash(path) - }, 1000) -} \ No newline at end of file diff --git a/cmd/goveal/main.go b/cmd/goveal/main.go index 753a789..8931dae 100644 --- a/cmd/goveal/main.go +++ b/cmd/goveal/main.go @@ -15,9 +15,11 @@ package main import ( - "github.com/baez90/goveal/internal/app/cmd" + log "github.com/sirupsen/logrus" ) func main() { - cmd.Execute() + if err := rootCmd.Execute(); err != nil { + log.Errorf("Failed to run command: %v", err) + } } diff --git a/cmd/goveal/root.go b/cmd/goveal/root.go new file mode 100644 index 0000000..5439626 --- /dev/null +++ b/cmd/goveal/root.go @@ -0,0 +1,52 @@ +// Copyright © 2019 Peter Kurfer +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package main + +import ( + "os" + + log "github.com/sirupsen/logrus" + "github.com/spf13/cobra" + + "github.com/baez90/goveal/config" +) + +var ( + cfgFile string + rootCmd = &cobra.Command{ + Use: "goveal", + Short: "goveal is a small reveal.js server", + Long: `goveal is a single static binary to host your reveal.js based markdown presentation. +It is running a small web server that loads your markdown file, renders a complete HTML page and delivers it including all the reveal.js assets. +It is not required to restart the server when you edit the markdown - a simple reload of the page is doing all the required magic.`, + PersistentPreRunE: func(*cobra.Command, []string) (err error) { + log.SetFormatter(&log.TextFormatter{ + ForceColors: true, + }) + + if workingDir, err = os.Getwd(); err != nil { + return err + } + + cfg, err = config.Load(workingDir, cfgFile) + return err + }, + } +) + +func init() { + rootCmd.PersistentFlags().StringVar(&cfgFile, "config", "", "config file (default is $HOME/.go-reveal-slides.yaml)") + rootCmd.PersistentFlags().StringVar(&workingDir, "working-dir", workingDir, "working directory to use") +} diff --git a/cmd/goveal/serve.go b/cmd/goveal/serve.go new file mode 100644 index 0000000..2cba01c --- /dev/null +++ b/cmd/goveal/serve.go @@ -0,0 +1,73 @@ +package main + +import ( + "encoding/hex" + "hash/fnv" + "net/http" + "path" + "path/filepath" + + "github.com/gofiber/fiber/v2" + "github.com/gofiber/template/html" + log "github.com/sirupsen/logrus" + "github.com/spf13/cobra" + "go.uber.org/multierr" + + "github.com/baez90/goveal/api" + "github.com/baez90/goveal/config" + "github.com/baez90/goveal/events" + "github.com/baez90/goveal/fs" + "github.com/baez90/goveal/web" +) + +var ( + workingDir string + cfg *config.Components + serveCmd = &cobra.Command{ + Use: "serve", + Args: cobra.ExactArgs(1), + RunE: func(_ *cobra.Command, args []string) (err error) { + var wdfs *fs.Watching + + if wdfs, err = fs.NewWatching(fs.Dir(workingDir)); err != nil { + return err + } + + defer multierr.AppendInvoke(&err, multierr.Close(wdfs)) + + var mdFile fs.File + if mdFile, err = wdfs.Open(args[0]); err != nil { + return err + } + _ = mdFile.Close() + + app := fiber.New(fiber.Config{ + Views: html.NewFileSystem(http.FS(web.WebFS), ".gohtml"). + AddFunc("fileId", func(fileName string) string { + h := fnv.New32a() + return hex.EncodeToString(h.Sum([]byte(path.Base(fileName)))) + }), + }) + hub := events.NewEventHub( + wdfs, + fnv.New32a(), + events.FileNameTrigger(args[0]), + events.FileNameTrigger(filepath.Base(cfg.ConfigFileInUse)), + ) + + api.NoCache(app) + api.RegisterViews(app, wdfs, args[0], cfg) + api.RegisterEventsAPI(app, hub, log.StandardLogger()) + api.RegisterConfigAPI(app, cfg) + if err := api.RegisterStaticFileHandling(app, wdfs); err != nil { + return err + } + + return app.Listen(":3000") + }, + } +) + +func init() { + rootCmd.AddCommand(serveCmd) +} diff --git a/config/components.go b/config/components.go new file mode 100644 index 0000000..64fdceb --- /dev/null +++ b/config/components.go @@ -0,0 +1,68 @@ +package config + +var ( + defaults = map[string]interface{}{ + "mermaid.theme": "forest", + "reveal.theme": "beige", + "codeTheme": "monokai", + "transition": TransitionNone, + "controls": true, + "progress": true, + "history": true, + "center": true, + "slideNumber": true, + "menu.numbers": true, + "menu.useTextContentForMissingTitles": true, + } +) + +const ( + TransitionNone Transition = "none" + TransitionFade Transition = "fade" + TransitionSlide Transition = "slide" + TransitionConvex Transition = "convex" + TransitionConcave Transition = "concave" + TransitionZoom Transition = "zoom" +) + +type ( + Transition string + Mermaid struct { + Theme string `json:"theme"` + } + Rendering struct { + VerticalSeparator string + HorizontalSeparator string + Stylesheets []string + } + Reveal struct { + Theme string `json:"theme"` + CodeTheme string `json:"codeTheme"` + Transition Transition `json:"transition"` + Controls bool `json:"controls"` + Progress bool `json:"progress"` + History bool `json:"history"` + Center bool `json:"center"` + SlideNumber bool `json:"slideNumber"` + Menu struct { + Numbers bool `json:"numbers"` + UseTextContentForMissingTitles bool `json:"useTextContentForMissingTitles"` + Transitions bool + } `json:"menu"` + } + Components struct { + ConfigFileInUse string `mapstructure:"-"` + Reveal Reveal `mapstructure:",squash"` + Rendering Rendering `mapstructure:",squash"` + Mermaid Mermaid + } +) + +func (t Transition) String() string { + switch t { + case TransitionNone: + return "none" + default: + return string(t) + } +} diff --git a/config/load.go b/config/load.go new file mode 100644 index 0000000..5c564b4 --- /dev/null +++ b/config/load.go @@ -0,0 +1,51 @@ +package config + +import ( + "github.com/fsnotify/fsnotify" + "github.com/mitchellh/go-homedir" + log "github.com/sirupsen/logrus" + "github.com/spf13/viper" +) + +func Load(workingDir, configFile string) (cfg *Components, err error) { + var ( + loader = viper.New() + home string + ) + cfg = new(Components) + + for k, v := range defaults { + loader.SetDefault(k, v) + } + + if configFile != "" { + loader.SetConfigFile(configFile) + } else if home, err = homedir.Dir(); err != nil { + return nil, err + } else { + loader.AddConfigPath(home) + } + + loader.AddConfigPath(workingDir) + loader.SetConfigName("goveal") + loader.SetConfigType("yaml") + loader.AutomaticEnv() + + if err = loader.ReadInConfig(); err == nil { + log.Info("Using config file:", loader.ConfigFileUsed()) + cfg.ConfigFileInUse = loader.ConfigFileUsed() + loader.WatchConfig() + } else { + return nil, err + } + + loader.OnConfigChange(func(in fsnotify.Event) { + if in.Op == fsnotify.Write { + _ = loader.Unmarshal(cfg) + } + }) + + err = loader.Unmarshal(cfg) + + return cfg, err +} diff --git a/events/event_hub.go b/events/event_hub.go new file mode 100644 index 0000000..2bf9ee1 --- /dev/null +++ b/events/event_hub.go @@ -0,0 +1,151 @@ +package events + +import ( + "encoding/hex" + "fmt" + "hash" + "io" + "path" + "path/filepath" + "strconv" + "strings" + "sync" + + "github.com/google/uuid" + + "github.com/baez90/goveal/fs" +) + +const ( + baseDecimal = 10 +) + +type ( + ReloadTrigger interface { + Triggers(ev fs.Event) bool + } + ContentEvent struct { + File string `json:"file"` + FileNameHash string `json:"fileNameHash"` + Timestamp string `json:"ts"` + ForceReload bool `json:"forceReload"` + } + EventSource interface { + io.Closer + fs.FS + Events() chan fs.Event + } + EventHandler interface { + OnEvent(ev ContentEvent) error + } + EventHandlerFunc func(ev ContentEvent) error + subscription struct { + EventHandler + OnError chan error + } + FileNameTrigger string + FileSuffixTrigger string +) + +func (t FileNameTrigger) Triggers(ev fs.Event) bool { + fileBase := filepath.Base(ev.File) + return strings.EqualFold(fileBase, string(t)) +} + +func (t FileSuffixTrigger) Triggers(ev fs.Event) bool { + return strings.HasSuffix(strings.ToLower(filepath.Base(ev.File)), strings.ToLower(string(t))) +} + +func (f EventHandlerFunc) OnEvent(ev ContentEvent) error { + return f(ev) +} + +func NewEventHub(eventSource EventSource, fileNameHash hash.Hash, triggers ...ReloadTrigger) *EventHub { + hub := &EventHub{ + FileNameHash: fileNameHash, + reloadTriggers: triggers, + source: eventSource, + subscriptions: make(map[uuid.UUID]*subscription), + done: make(chan struct{}), + } + + go hub.processEvents() + + return hub +} + +type EventHub struct { + FileNameHash hash.Hash + reloadTriggers []ReloadTrigger + lock sync.RWMutex + done chan struct{} + source EventSource + subscriptions map[uuid.UUID]*subscription +} + +func (h *EventHub) Subscribe(handler EventHandler) (id uuid.UUID, onError <-chan error) { + h.lock.Lock() + defer h.lock.Unlock() + + s := &subscription{ + EventHandler: handler, + OnError: make(chan error), + } + clientID := uuid.New() + h.subscriptions[clientID] = s + + return clientID, s.OnError +} + +func (h *EventHub) Unsubscribe(id uuid.UUID) { + h.lock.Lock() + defer h.lock.Unlock() + delete(h.subscriptions, id) +} + +func (h *EventHub) Close() error { + close(h.done) + return h.source.Close() +} + +func (h *EventHub) processEvents() { + events := h.source.Events() + for { + select { + case ev, more := <-events: + if !more { + return + } + h.notifySubscribers(ev) + case _, more := <-h.done: + if !more { + return + } + } + } +} + +func (h *EventHub) notifySubscribers(ev fs.Event) { + h.lock.RLock() + defer h.lock.RUnlock() + + var triggerReload bool + for idx := range h.reloadTriggers { + if triggerReload = h.reloadTriggers[idx].Triggers(ev); triggerReload { + break + } + } + + ce := ContentEvent{ + File: fmt.Sprintf("/%s", ev.File), + Timestamp: strconv.FormatInt(ev.Timestamp.Unix(), baseDecimal), + ForceReload: triggerReload, + FileNameHash: hex.EncodeToString(h.FileNameHash.Sum([]byte(path.Base(ev.File)))), + } + + for _, handler := range h.subscriptions { + if err := handler.OnEvent(ce); err != nil { + handler.OnError <- err + } + } +} diff --git a/examples/gopher.jpg b/examples/gopher.jpg index bcf63e98766b8e8a539eab0eb207b24b0df574e9..c8130d060b84b3e0f2a426c6e91e66a04ed9f706 100644 GIT binary patch literal 130 zcmWN|xe>!45J1tKDrmssTn=>uh&9aEM&m^aT)heYyy)NcOMQHJoAabyh-aUV7t*$D zSKi8a3p#5Nw_>9ooLbW0cICXT@&K8#_ohT+q)Ji8qD#;=Ez#8#Dgd;AL0X$*!jP?T NYh=`al^gKVvOmduCkFrk literal 35704 zcmdqIby!_VvoE|hd*iOb-3jgvA$X7wT!RI7cS#_DAOQjd55YaSTW}8^+}+*b+hpdQ znLGE~d(U(J{Q7y;TEE?0)!kLqtGjA-?}uLxivWh4l&lm00)ZgkA>RSuVHrhJRzku+ zSw%@o_Jt(0002;AURc=L!C(M@jjgkziu5ybO)YJ5_(1>$Km_0bb^tImcCuG^C8Y{L zldPl!xf7J=5&xN>b(~KC&^rK(GRr8FlmD6j-+f>j+dDb~07x0iz-eOYWDLdcpxD~Y z+5R#A5Q=e(tR688*UatS*d zdqZ0f0Qf`ZM=k*CQMcq!CG)WJ^YAcput3%SSNgve{zdhF2amS>gW}}nZ<~Se`v1=R zoA>WLyKex%cLvqXr@!-z5&)n&2mtV>|IVZS3IOQu0HA8N*y}NENso7=C(DlaJI0sCAYBsKUw&H$o7vuJib z&;s-UW567+0UQB0z#9kvf`N~~Cm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Ll-#0M#^FxOSt@Dq}htvV#vmO&>uCcfJ4n&$CtkX(*8HP$*#~9wPEk z|20Ni;x4DuowSt5CP_v?QOmR{cBX@Tr@Yk)+YyM&;RfV~?AliK5v==m;vGi%)-K=* z=N(Ajib=lTyJo{$lki`z>)*83hmS4aR8P^^>UR*z%p-kBGbp7fkiyBl-fqo|jT&mq zDt*PNx{<0UR-hF5XoK=-NgO<_h@X8k^Wh~j@{>;6y`3sh| z7!PA5C1C;XpY&_s=99>7S5VEha!2gMaW5l7)fZ3ANUvD9`*nhOwan=s-qn9WbN_ww zwI=K$2Ji?E2eQz@Z<)Aq&3bMGR$ksv@>iI-5RKUgutzzNy@C(iPHSp7MazCCO-&65 z=ZBjV$E-oK)@~(=@qiI;`qvk0O6|mtTQ0oQ6*H|>rGN!Bbm$2Vuiyzj7C#L`KCInz z+^Xba&QOV2AB&u9x=v<%`?H4sVg)}(N~``CxbvsjqiLv8{65PF2qM{nz~u`gM5q|^ zeb}JEvCA-j$Q%9ac!7sRuaa-J2wyKxmtgsm&aihab70_dIfC~8{q88@ raewW-|9MZaLjS@3?|UQUxBs8d9RB}Z+JDjB{%4{5f4D;XJ@fwn#;SWW diff --git a/examples/goveal.yaml b/examples/goveal.yaml index 8187d56..d1aef4f 100644 --- a/examples/goveal.yaml +++ b/examples/goveal.yaml @@ -2,8 +2,7 @@ theme: night codeTheme: monokai horizontalSeparator: === verticalSeparator: --- -transition: fade +transition: convex +menu.numbers: false stylesheets: - - custom.css -filesToMonitor: - - ./**/*.css \ No newline at end of file + - custom.css \ No newline at end of file diff --git a/examples/slides.md b/examples/slides.md index 603948a..0c5a09e 100644 --- a/examples/slides.md +++ b/examples/slides.md @@ -4,51 +4,78 @@ Content 1.1 -Note: This will only appear in the speaker notes window. - ---- +*** ## External 1.2 Content 1.2 -=== +Note: + +This will only display in the notes window. + +*** + +### List & fragments + +* unordered +* list +* with `code` +* with __bold__ text + +Notes: + +- some other points only +- in the nodes + +*** + +### List in HTML + +
    +
  • List
  • +
  • with code
  • +
  • with bold text
  • +
+ +--- ## External 2 Content 2.1 -=== +--- ## External 3.1 Content 3.1 ---- +*** ## External 3.2 Content 3.2 ---- +*** ## External 3.3 ![External Image](https://s3.amazonaws.com/static.slid.es/logo/v2/slides-symbol-512x512.png) -=== +--- + ## External 4.1 -![Local image](/examples/gopher.jpg) +![Local image](/gopher.jpg) ---- +*** ## External 4.2 Google -=== +--- ## Code @@ -57,4 +84,26 @@ var i = 10; for (var j = 0; j < i; j++) { Console.WriteLine($"{j}"); } +``` + +*** + +### Mermaid + +```mermaid +flowchart LR + a --> b & c--> d +``` + +*** + +### The inadequacy of a non-highlighted being + +{line-numbers="1-2|3|4"} + +```js + let a = 1; +let b = 2; +let c = x => 1 + 2 + x; +c(3); ``` \ No newline at end of file diff --git a/fs/layered.go b/fs/layered.go new file mode 100644 index 0000000..1c37416 --- /dev/null +++ b/fs/layered.go @@ -0,0 +1,24 @@ +package fs + +import ( + "io/fs" + "os" +) + +type FS = fs.FS +type File = fs.File + +var Dir = os.DirFS + +type Layered struct { + Layers []FS +} + +func (l Layered) Open(name string) (file fs.File, err error) { + for idx := range l.Layers { + if file, err = l.Layers[idx].Open(name); err == nil { + return file, nil + } + } + return nil, err +} diff --git a/fs/watching_fs.go b/fs/watching_fs.go new file mode 100644 index 0000000..d04a776 --- /dev/null +++ b/fs/watching_fs.go @@ -0,0 +1,66 @@ +package fs + +import ( + "io/fs" + "path/filepath" + "time" + + "github.com/fsnotify/fsnotify" + log "github.com/sirupsen/logrus" +) + +type Event struct { + File string + Timestamp time.Time +} + +func NewWatching(backing FS) (*Watching, error) { + watcher, err := fsnotify.NewWatcher() + if err != nil { + return nil, err + } + return &Watching{ + watcher: watcher, + backing: backing, + }, nil +} + +type Watching struct { + events chan Event + watcher *fsnotify.Watcher + backing FS +} + +func (w *Watching) Open(name string) (file fs.File, err error) { + file, err = w.backing.Open(name) + if err == nil { + dir := filepath.Dir(name) + if watchErr := w.watcher.Add(dir); watchErr != nil { + log.Errorf("Failed to watch %s: %v", dir, watchErr) + } + return file, nil + } + return nil, err +} + +func (w *Watching) Events() chan Event { + if w.events == nil { + w.events = make(chan Event) + go transportEvents(w.watcher.Events, w.events) + } + return w.events +} + +func (w *Watching) Close() error { + return w.watcher.Close() +} + +func transportEvents(in <-chan fsnotify.Event, out chan<- Event) { + for ev := range in { + ev.Name = filepath.Base(ev.Name) + out <- Event{ + File: ev.Name, + Timestamp: time.Now(), + } + } +} diff --git a/go.mod b/go.mod index 8f5da87..2669311 100644 --- a/go.mod +++ b/go.mod @@ -4,27 +4,29 @@ go 1.17 require ( github.com/Masterminds/sprig/v3 v3.2.2 - github.com/bmatcuk/doublestar/v2 v2.0.4 github.com/fsnotify/fsnotify v1.5.1 - github.com/imdario/mergo v0.3.12 + github.com/gofiber/fiber/v2 v2.22.0 + github.com/gofiber/template v1.6.19 + github.com/gomarkdown/markdown v0.0.0-20211203165214-0d698b49fbb4 + github.com/google/uuid v1.3.0 github.com/mitchellh/go-homedir v1.1.0 github.com/sirupsen/logrus v1.8.1 - github.com/spf13/cobra v1.2.1 - github.com/spf13/viper v1.9.0 - go.uber.org/multierr v1.7.0 + github.com/spf13/cobra v1.3.0 + github.com/spf13/viper v1.10.1 ) require ( github.com/Masterminds/goutils v1.1.1 // indirect github.com/Masterminds/semver/v3 v3.1.1 // indirect - github.com/google/uuid v1.3.0 // indirect + github.com/andybalholm/brotli v1.0.2 // indirect github.com/hashicorp/hcl v1.0.0 // indirect github.com/huandu/xstrings v1.3.2 // indirect + github.com/imdario/mergo v0.3.11 // indirect github.com/inconshreveable/mousetrap v1.0.0 // indirect - github.com/kr/pretty v0.3.0 // indirect + github.com/klauspost/compress v1.13.4 // indirect github.com/magiconair/properties v1.8.5 // indirect github.com/mitchellh/copystructure v1.2.0 // indirect - github.com/mitchellh/mapstructure v1.4.2 // indirect + github.com/mitchellh/mapstructure v1.4.3 // indirect github.com/mitchellh/reflectwalk v1.0.2 // indirect github.com/pelletier/go-toml v1.9.4 // indirect github.com/shopspring/decimal v1.2.0 // indirect @@ -33,10 +35,14 @@ require ( github.com/spf13/jwalterweatherman v1.1.0 // indirect github.com/spf13/pflag v1.0.5 // indirect github.com/subosito/gotenv v1.2.0 // indirect + github.com/valyala/bytebufferpool v1.0.0 // indirect + github.com/valyala/fasthttp v1.31.0 // indirect + github.com/valyala/tcplisten v1.0.0 // indirect go.uber.org/atomic v1.9.0 // indirect + go.uber.org/multierr v1.7.0 // indirect golang.org/x/crypto v0.0.0-20211108221036-ceb1ce70b4fa // indirect - golang.org/x/sys v0.0.0-20211111213525-f221eed1c01e // indirect + golang.org/x/sys v0.0.0-20211214234402-4825e8c3871d // indirect golang.org/x/text v0.3.7 // indirect - gopkg.in/ini.v1 v1.63.2 // indirect + gopkg.in/ini.v1 v1.66.2 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect ) diff --git a/go.sum b/go.sum index aea74cc..133d9da 100644 --- a/go.sum +++ b/go.sum @@ -23,6 +23,10 @@ cloud.google.com/go v0.84.0/go.mod h1:RazrYuxIK6Kb7YrzzhPoLmCVzl7Sup4NrbKPg8KHSU cloud.google.com/go v0.87.0/go.mod h1:TpDYlFy7vuLzZMMZ+B6iRiELaY7z/gJPaqbMx6mlWcY= cloud.google.com/go v0.90.0/go.mod h1:kRX0mNRHe0e2rC6oNakvwQqzyDmg57xJ+SZU1eT2aDQ= cloud.google.com/go v0.93.3/go.mod h1:8utlLll2EF5XMAV15woO4lSbWQlk8rer9aLOfLh7+YI= +cloud.google.com/go v0.94.1/go.mod h1:qAlAugsXlC+JWO+Bke5vCtc9ONxjQT3drlTTnAplMW4= +cloud.google.com/go v0.97.0/go.mod h1:GF7l59pYBVlXQIBLx3a761cZ41F9bBH3JUlihCt2Udc= +cloud.google.com/go v0.98.0/go.mod h1:ua6Ush4NALrHk5QXDWnjvZHN93OuF0HfuEPq9I1X0cM= +cloud.google.com/go v0.99.0/go.mod h1:w0Xx2nLzqWJPuozYQX+hFfCSI8WioryfRDzkoI/Y2ZA= cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= cloud.google.com/go/bigquery v1.3.0/go.mod h1:PjpwJnslEMmckchkHFfq+HTD2DmtT67aNFKH1/VBDHE= cloud.google.com/go/bigquery v1.4.0/go.mod h1:S8dzgnTigyfTmLBfrtrhyYhwRxG72rYxvftPBK2Dvzc= @@ -32,7 +36,7 @@ cloud.google.com/go/bigquery v1.8.0/go.mod h1:J5hqkt3O0uAFnINi6JXValWIb1v0goeZM7 cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= cloud.google.com/go/datastore v1.1.0/go.mod h1:umbIZjpQpHh4hmRpGhH4tLFup+FVzqBi1b3c64qFpCk= cloud.google.com/go/firestore v1.1.0/go.mod h1:ulACoGHTpvq5r8rxGJ4ddJZBZqakUQqClKRT5SZwBmk= -cloud.google.com/go/firestore v1.6.0/go.mod h1:afJwI0vaXwAG54kI7A//lP/lSPDkQORQuMkv56TxEPU= +cloud.google.com/go/firestore v1.6.1/go.mod h1:asNXNOzBdyVQmEU+ggO8UPodTkEVFW5Qx+rwHnAz+EY= cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I= cloud.google.com/go/pubsub v1.1.0/go.mod h1:EwwdRX2sKPjnvnqCa270oGRyludottCI76h+R3AArQw= cloud.google.com/go/pubsub v1.2.0/go.mod h1:jhfEVHT8odbXTkndysNHCcx0awwzvfOlguIAii9o8iA= @@ -45,6 +49,12 @@ cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9 dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= +github.com/CloudyKit/fastprinter v0.0.0-20200109182630-33d98a066a53/go.mod h1:+3IMCy2vIlbG1XG/0ggNQv0SvxCAIpPM5b1nCz56Xno= +github.com/CloudyKit/jet/v6 v6.1.0/go.mod h1:d3ypHeIRNo2+XyqnGA8s+aphtcVpjP5hPwP/Lzo7Ro4= +github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= +github.com/Joker/hpp v0.0.0-20180418125244-6893e659854a/go.mod h1:MzD2WMdSxvbHw5fM/OXOFily/lipJWRc9C1px0Mt0ZE= +github.com/Joker/hpp v1.0.0/go.mod h1:8x5n+M1Hp5hC0g8okX3sR3vFQwynaX/UgSOM9MeBKzY= +github.com/Joker/jade v1.0.0/go.mod h1:efZIdO0py/LtcJRSa/j2WEklMSAw84WV0zZVMxNToB8= github.com/Masterminds/goutils v1.1.1 h1:5nUrii3FMTL5diU80unEVvNevw1nH4+ZV4DSLVJLSYI= github.com/Masterminds/goutils v1.1.1/go.mod h1:8cTjp+g8YejhMuvIA5y2vz3BpJxksy863GQaJW2MFNU= github.com/Masterminds/semver/v3 v3.1.1 h1:hLg3sBzpNErnxhQtUy/mmLR2I9foDujNK030IGemrRc= @@ -52,32 +62,55 @@ github.com/Masterminds/semver/v3 v3.1.1/go.mod h1:VPu/7SZ7ePZ3QOrcuXROw5FAcLl4a0 github.com/Masterminds/sprig/v3 v3.2.2 h1:17jRggJu518dr3QaafizSXOjKYp94wKfABxUmyxvxX8= github.com/Masterminds/sprig/v3 v3.2.2/go.mod h1:UoaO7Yp8KlPnJIYWTFkMaqPUYKTfGFPhxNuwnnxkKlk= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= +github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= +github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= +github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= +github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= +github.com/andybalholm/brotli v1.0.2 h1:JKnhI/XQ75uFBTiuzXpzFrUriDPiZjlOSzh6wXogP0E= +github.com/andybalholm/brotli v1.0.2/go.mod h1:loMXtMfwqflxFJPmdbJO0a3KNoPuLBgiu3qAvBg8x/Y= github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o= github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY= +github.com/armon/go-metrics v0.3.10/go.mod h1:4O98XIr/9W0sxpJ8UaYkvjk10Iff7SnFrb4QAOwNTFc= github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= github.com/armon/go-radix v1.0.0/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= +github.com/aymerick/raymond v2.0.2+incompatible/go.mod h1:osfaiScAUVup+UC9Nfq76eWqDhXlp+4UYaA8uhTBO6g= +github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= +github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= +github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= github.com/bketelsen/crypt v0.0.4/go.mod h1:aI6NrJ0pMGgvZKL1iVgXLnfIFJtfV+bKCoqOes/6LfM= -github.com/bmatcuk/doublestar/v2 v2.0.4 h1:6I6oUiT/sU27eE2OFcWqBhL1SwjyvQuOssxT4a1yidI= -github.com/bmatcuk/doublestar/v2 v2.0.4/go.mod h1:QMmcs3H2AUQICWhfzLXz+IYln8lRQmTZRptLie8RgRw= +github.com/cbroglie/mustache v1.3.0/go.mod h1:w58RIHjw/L7DPyRX2CcCTduNmcP1dvztaHP72ciSfh0= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= +github.com/census-instrumentation/opencensus-proto v0.3.0/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= +github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/cespare/xxhash/v2 v2.1.2/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= +github.com/circonus-labs/circonus-gometrics v2.3.1+incompatible/go.mod h1:nmEj6Dob7S7YxXgwXpfOuvO54S+tGdZdw9fuRZt25Ag= +github.com/circonus-labs/circonusllhist v0.1.3/go.mod h1:kMXHVDlOchFAehlya5ePtbp5jckzBHf4XRpQvBOLI+I= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= github.com/cncf/udpa/go v0.0.0-20200629203442-efcf912fb354/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= +github.com/cncf/udpa/go v0.0.0-20210930031921-04548b0d99d4/go.mod h1:6pvJx4me5XPnfI9Z40ddWsdw2W/uZgQLFXToKeRcDiI= github.com/cncf/xds/go v0.0.0-20210312221358-fbca930ec8ed/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= +github.com/cncf/xds/go v0.0.0-20210805033703-aa0b78936158/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= +github.com/cncf/xds/go v0.0.0-20210922020428-25de7278fc84/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= +github.com/cncf/xds/go v0.0.0-20211001041855-01bcc9b48dfe/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= +github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= +github.com/cncf/xds/go v0.0.0-20211130200136-a8f946100490/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= github.com/coreos/go-systemd/v22 v22.3.2/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= +github.com/cpuguy83/go-md2man/v2 v2.0.1/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= 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/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/eknkc/amber v0.0.0-20171010120322-cdade1c07385/go.mod h1:0vRUJqYpeSZifjYj7uP3BG/gKcuzL9xWVV/Y+cK33KM= github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= @@ -85,9 +118,14 @@ github.com/envoyproxy/go-control-plane v0.9.7/go.mod h1:cwu0lG7PUMfa9snN8LXBig5y github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= github.com/envoyproxy/go-control-plane v0.9.9-0.20210217033140-668b12f5399d/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= github.com/envoyproxy/go-control-plane v0.9.9-0.20210512163311-63b5d3c536b0/go.mod h1:hliV/p42l8fGbc6Y9bQ70uLwIvmJyVE5k4iMKlh8wCQ= +github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go.mod h1:AFq3mo9L8Lqqiid3OhADV3RfLJnjiw63cSpi+fDTRC0= +github.com/envoyproxy/go-control-plane v0.10.1/go.mod h1:AY7fTTXNdv/aJ2O5jwpxAPOWUZ7hQAEvzN5Pf27BkQQ= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= +github.com/envoyproxy/protoc-gen-validate v0.6.2/go.mod h1:2t7qjJNvHPx8IjnBOzl9E9/baC+qXE/TeeyBRzgJDws= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= github.com/fatih/color v1.9.0/go.mod h1:eQcE1qtQxscV5RaZvpXrrb8Drkc3/DdQ+uUYCNjL+zU= +github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk= +github.com/flosch/pongo2/v4 v4.0.2/go.mod h1:B5ObFANs/36VwxxlgKpdchIJHMvHB562PW+BWPhwZD8= github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= github.com/fsnotify/fsnotify v1.5.1 h1:mZcQUHVQUQWoPXXtuf9yuEXKudkV2sx1E06UadKWpgI= github.com/fsnotify/fsnotify v1.5.1/go.mod h1:T3375wBYaZdLLcVNkcVbzGHY7f1l/uK5T5Ai1i3InKU= @@ -95,12 +133,23 @@ github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeME github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= +github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= +github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= +github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= +github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= +github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= +github.com/gofiber/fiber/v2 v2.22.0 h1:+iyKK4ooDH6z0lAHdaWO1AFIB/DZ9AVo6vz8VZIA0EU= +github.com/gofiber/fiber/v2 v2.22.0/go.mod h1:MR1usVH3JHYRyQwMe2eZXRSZHRX38fkV+A7CPB+DlDQ= +github.com/gofiber/template v1.6.19 h1:Qc2oePYcfG0QTp9MKJA+ivVC2lXVdqY6Ue7gZMU3PQU= +github.com/gofiber/template v1.6.19/go.mod h1:EO3L5FvrKkU8JtmINciPNwWIeA0cmzjdb6n/pdmypIM= +github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y= @@ -128,6 +177,8 @@ github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaS github.com/golang/protobuf v1.5.1/go.mod h1:DopwsBzvsk0Fs44TXzsVbJyPhcCPeIwnvohx4u74HPM= github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/golang/snappy v0.0.3/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +github.com/gomarkdown/markdown v0.0.0-20211203165214-0d698b49fbb4 h1:hue2D68UuAO4besRdtrQ+/i2npAF2WMbCMU5MLhYmOo= +github.com/gomarkdown/markdown v0.0.0-20211203165214-0d698b49fbb4/go.mod h1:JDGcbDT52eL4fju3sZ4TeHGsQwhG9nbDV21aMyhwPoA= github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= @@ -169,19 +220,25 @@ github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+ github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= github.com/googleapis/gax-go/v2 v2.1.0/go.mod h1:Q3nei7sK6ybPYH7twZdmQpAd1MKb7pfu6SK+H1/DsU0= +github.com/googleapis/gax-go/v2 v2.1.1/go.mod h1:hddJymUZASv3XPyGkUpKj8pPO47Rmb0eJc8R6ouapiM= github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= github.com/hashicorp/consul/api v1.1.0/go.mod h1:VmuI/Lkw1nC05EYQWNKwWGbkg+FbDBtguAZLlVdkD9Q= -github.com/hashicorp/consul/api v1.10.1/go.mod h1:XjsvQN+RJGWI2TWy1/kqaE16HrR2J/FWgkYjdZQsX9M= +github.com/hashicorp/consul/api v1.11.0/go.mod h1:XjsvQN+RJGWI2TWy1/kqaE16HrR2J/FWgkYjdZQsX9M= github.com/hashicorp/consul/sdk v0.1.1/go.mod h1:VKf9jXwCTEY1QZP2MOLRhb5i/I/ssyNV1vwHyQBF0x8= github.com/hashicorp/consul/sdk v0.8.0/go.mod h1:GBvyrGALthsZObzUGsfgHZQDXjg4lOjagTIwIR1vPms= github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= +github.com/hashicorp/go-cleanhttp v0.5.0/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= github.com/hashicorp/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= +github.com/hashicorp/go-cleanhttp v0.5.2/go.mod h1:kO/YDlP8L1346E6Sodw+PrpBSV4/SoxCXGY6BqNFT48= github.com/hashicorp/go-hclog v0.12.0/go.mod h1:whpDNt7SSdeAju8AWKIWsul05p54N/39EeqMAyrmvFQ= +github.com/hashicorp/go-hclog v1.0.0/go.mod h1:whpDNt7SSdeAju8AWKIWsul05p54N/39EeqMAyrmvFQ= github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= +github.com/hashicorp/go-immutable-radix v1.3.1/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= github.com/hashicorp/go-msgpack v0.5.3/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iPBM1vqhUKIvfM= github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk= github.com/hashicorp/go-multierror v1.1.0/go.mod h1:spPvp8C1qA32ftKqdAHm4hHTbPw+vmowP0z+KUhOZdA= +github.com/hashicorp/go-retryablehttp v0.5.3/go.mod h1:9B5zBasrRhHXnJnui7y6sL7es7NDiJgTc6Er0maI1Xs= github.com/hashicorp/go-rootcerts v1.0.0/go.mod h1:K6zTfqpRlCUIjkwsN4Z+hiSfzSTQa6eBIzfwKfwNnHU= github.com/hashicorp/go-rootcerts v1.0.2/go.mod h1:pqUvnprVnM5bf7AOirdbb01K4ccR319Vf4pU3K5EGc8= github.com/hashicorp/go-sockaddr v1.0.0/go.mod h1:7Xibr9yA9JjQq1JpNB2Vw7kxv8xerXegt+ozgdvDeDU= @@ -191,52 +248,69 @@ github.com/hashicorp/go-uuid v1.0.1/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/b 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.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= +github.com/hashicorp/golang-lru v0.5.4/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4= github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4= 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/mdns v1.0.0/go.mod h1:tL+uN++7HEJ6SQLQ2/p+z2pH24WQKWjBPkE0mNTz8vQ= github.com/hashicorp/mdns v1.0.1/go.mod h1:4gW7WsVCke5TE7EPeYliwHlRUyBtfCwuFwuMg2DmyNY= +github.com/hashicorp/mdns v1.0.4/go.mod h1:mtBihi+LeNXGtG8L9dX59gAEa12BDtBQSp4v/YAJqrc= github.com/hashicorp/memberlist v0.1.3/go.mod h1:ajVTdAv/9Im8oMAAj5G31PhhMCZJV2pPBoIllUwCN7I= github.com/hashicorp/memberlist v0.2.2/go.mod h1:MS2lj3INKhZjWNqd3N0m3J+Jxf3DAOnAH9VT3Sh9MUE= +github.com/hashicorp/memberlist v0.3.0/go.mod h1:MS2lj3INKhZjWNqd3N0m3J+Jxf3DAOnAH9VT3Sh9MUE= github.com/hashicorp/serf v0.8.2/go.mod h1:6hOLApaqBFA1NXqRQAsxw9QxuDEvNxSQRwA/JwenrHc= github.com/hashicorp/serf v0.9.5/go.mod h1:UWDWwZeL5cuWDJdl0C6wrvrUwEqtQ4ZKBKKENpqIUyk= +github.com/hashicorp/serf v0.9.6/go.mod h1:TXZNMjZQijwlDvp+r0b63xZ45H7JmCmgg4gpTwn9UV4= github.com/huandu/xstrings v1.3.1/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE= github.com/huandu/xstrings v1.3.2 h1:L18LIDzqlW6xN2rEkpdV8+oL/IXWJ1APd+vsdYy4Wdw= github.com/huandu/xstrings v1.3.2/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE= +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-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= +github.com/imdario/mergo v0.3.11 h1:3tnifQM4i+fbajXKBHXWEH+KvNHqojZ778UH75j3bGA= github.com/imdario/mergo v0.3.11/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA= -github.com/imdario/mergo v0.3.12 h1:b6R2BslTbIEToALKP7LxUvijTsNI9TAe80pLWN2g/HU= -github.com/imdario/mergo v0.3.12/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA= github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM= github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= +github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= +github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/json-iterator/go v1.1.11/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= +github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk= github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= +github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= +github.com/klauspost/compress v1.13.4 h1:0zhec2I8zGnjWcKyLl6i3gPqKANCCn5e9xmviEEeX6s= +github.com/klauspost/compress v1.13.4/go.mod h1:8dP1Hq4DHOhN9w426knH3Rhby4rFm6D8eO+e+Dq5Gzg= +github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/kr/fs v0.1.0/go.mod h1:FFnZGqtBN9Gxj7eW1uZ42v5BccTP0vu6NEaFoC2HwRg= +github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pretty v0.2.0/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= -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/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= +github.com/lyft/protoc-gen-star v0.5.3/go.mod h1:V0xaHgaf5oCCqmcxYcWiDfTiKsZsRc87/1qhoTACD8w= github.com/magiconair/properties v1.8.5 h1:b6kJs+EmPFMYGkow9GiUyCyOvIwYetYJ3fSaWak/Gls= github.com/magiconair/properties v1.8.5/go.mod h1:y3VJvCyxH9uVvJTWEGAELF3aiYNyPKd5NZ3oSwXrF60= github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= github.com/mattn/go-colorable v0.1.6/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= +github.com/mattn/go-colorable v0.1.9/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= +github.com/mattn/go-colorable v0.1.12/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4= github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= github.com/mattn/go-isatty v0.0.10/go.mod h1:qgIWMr58cqv1PHHyhnkY9lrL7etaEgOFcMEpPG5Rm84= github.com/mattn/go-isatty v0.0.11/go.mod h1:PhnuNfih5lzO57/f3n+odYbM4JtupLOxQOAqxQCu2WE= github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= +github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94= +github.com/mattn/go-slim v0.0.0-20200618151855-bde33eecb5ee/go.mod h1:ma9TUJeni8LGZMJvOwbAv/FOwiwqIMQN570LnpqCBSM= +github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg= github.com/miekg/dns v1.1.26/go.mod h1:bPDLeHnStXmXAq1m/Ch/hvfNHr14JKNPMBo3VZKjuso= +github.com/miekg/dns v1.1.41/go.mod h1:p6aan82bvRIyn+zDIv9xYNUpwa73JcSh9BKwknJysuI= github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc= github.com/mitchellh/cli v1.1.0/go.mod h1:xcISNoH86gajksDmfB23e/pu+B+GeFRMYmoHXxx3xhI= github.com/mitchellh/copystructure v1.0.0/go.mod h1:SNtv71yrdKgLRyLFxmLdkAbkKEFWgYaq1OVrnRcwhnw= @@ -251,56 +325,79 @@ github.com/mitchellh/iochan v1.0.0/go.mod h1:JwYml1nuB7xOzsp52dPpHFffvOCDupsG0Qu github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= github.com/mitchellh/mapstructure v1.4.1/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= -github.com/mitchellh/mapstructure v1.4.2 h1:6h7AQ0yhTcIsmFmnAwQls75jp2Gzs4iB8W7pjMO+rqo= -github.com/mitchellh/mapstructure v1.4.2/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= +github.com/mitchellh/mapstructure v1.4.3 h1:OVowDSCllw/YjdLkam3/sm7wEtOy59d8ndGgCcyj8cs= +github.com/mitchellh/mapstructure v1.4.3/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/mitchellh/reflectwalk v1.0.0/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw= github.com/mitchellh/reflectwalk v1.0.2 h1:G2LzWKi524PWgd3mLHV8Y5k7s6XUvT0Gef6zxSIeXaQ= github.com/mitchellh/reflectwalk v1.0.2/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= +github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= +github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= +github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWbfPhv4DMiApHyliiK5xCTNVSPiaAs= +github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= +github.com/pascaldekloe/goe v0.1.0/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= github.com/pelletier/go-toml v1.9.3/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= github.com/pelletier/go-toml v1.9.4 h1:tjENF6MfZAg8e4ZmZTeWaWiT2vXtsoO6+iuOjFhECwM= github.com/pelletier/go-toml v1.9.4/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= +github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/sftp v1.10.1/go.mod h1:lYOWFsE0bwd1+KfKJaKeuokY15vzFx25BLbzYYoAxZI= 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/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI= github.com/posener/complete v1.2.3/go.mod h1:WZIdtGGp+qx0sLrYKtIRAruyNpv6hFCicSgv7Sy7s/s= +github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= +github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= +github.com/prometheus/client_golang v1.4.0/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3OK1iX/F2sw+iXX5zU= +github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= +github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= +github.com/prometheus/common v0.9.1/go.mod h1:yhUN8i9wzaXS3w1O07YhxHEBxD+W35wd8bs7vj7HSQ4= +github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= +github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= +github.com/prometheus/procfs v0.0.8/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+GxbHq6oeK9A= github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= -github.com/rogpeppe/go-internal v1.6.1 h1:/FiVV8dS/e+YqF2JvO3yXRFbBLTIuSDkuC7aBOAvL+k= -github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc= github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= +github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= -github.com/sagikazarmark/crypt v0.1.0/go.mod h1:B/mN0msZuINBtQ1zZLEQcegFJJf9vnYIR88KRMEuODE= +github.com/sagikazarmark/crypt v0.3.0/go.mod h1:uD/D+6UF4SrIR1uGEv7bBNkNqLGqUr43MRiaGWX1Nig= github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= github.com/shopspring/decimal v1.2.0 h1:abSATXmQEYyShuxI4/vyW3tV1MrKAJzCZ/0zLUXYbsQ= github.com/shopspring/decimal v1.2.0/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o= github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= +github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= +github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= github.com/sirupsen/logrus v1.8.1 h1:dJKuHgqk1NNQlqoA6BTlM1Wf9DOH3NBjQyu0h9+AZZE= github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= +github.com/spf13/afero v1.3.3/go.mod h1:5KUK8ByomD5Ti5Artl0RtHeI5pTF7MIDuXL3yY520V4= github.com/spf13/afero v1.6.0 h1:xoax2sJ2DT8S8xA2paPFjDCScCNeWsg75VG0DLRreiY= github.com/spf13/afero v1.6.0/go.mod h1:Ai8FlHk4v/PARR026UzYexafAt9roJ7LcLMAmO6Z93I= github.com/spf13/cast v1.3.1/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= github.com/spf13/cast v1.4.1 h1:s0hze+J0196ZfEMTs80N7UlFt0BDuQ7Q+JDnHiMWKdA= github.com/spf13/cast v1.4.1/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= -github.com/spf13/cobra v1.2.1 h1:+KmjbUw1hriSNMF55oPrkZcb27aECyrj8V2ytv7kWDw= github.com/spf13/cobra v1.2.1/go.mod h1:ExllRjgxM/piMAM+3tAZvg8fsklGAf3tPfi+i8t68Nk= +github.com/spf13/cobra v1.3.0 h1:R7cSvGu+Vv+qX0gW5R/85dx2kmmJT5z5NM8ifdYjdn0= +github.com/spf13/cobra v1.3.0/go.mod h1:BrRVncBjOJa/eUcVVm9CE+oC6as8k+VYr4NY7WCi9V4= github.com/spf13/jwalterweatherman v1.1.0 h1:ue6voC5bR5F8YxI5S67j9i582FU4Qvo2bmqnqMYADFk= github.com/spf13/jwalterweatherman v1.1.0/go.mod h1:aNWZUN0dPAAO/Ljvb5BEdw96iTZ0EXowPYD95IqWIGo= github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/spf13/viper v1.8.1/go.mod h1:o0Pch8wJ9BVSWGQMbra6iw0oQ5oktSIBaujf1rJH9Ns= -github.com/spf13/viper v1.9.0 h1:yR6EXjTp0y0cLN8OZg1CRZmOBdI88UcGkhgyJhu6nZk= -github.com/spf13/viper v1.9.0/go.mod h1:+i6ajR7OX2XaiBkrcZJFK21htRk7eDeLg7+O6bhUPP4= +github.com/spf13/viper v1.10.0/go.mod h1:SoyBPwAtKDzypXNDFKN5kzH7ppppbGZtls1UpIy5AsM= +github.com/spf13/viper v1.10.1 h1:nuJZuYpG7gTj/XqiUwg8bA0cp1+M2mC3J4g5luUYBKk= +github.com/spf13/viper v1.10.1/go.mod h1:IGlFPqhNAPKRxohIzWpI5QEy4kuI7tcl5WvR+8qy1rU= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= 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.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= @@ -310,14 +407,25 @@ github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5Cc github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/subosito/gotenv v1.2.0 h1:Slr1R9HxAlEKefgq5jn9U+DnETlIUa6HfgEzj0g5d7s= github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw= +github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926/go.mod h1:9ESjWnEqriFuLhtthL60Sar/7RFoluCcXsuvEwTV5KM= +github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw= +github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc= +github.com/valyala/fasthttp v1.31.0 h1:lrauRLII19afgCs2fnWRJ4M5IkV0lo2FqA61uGkNBfE= +github.com/valyala/fasthttp v1.31.0/go.mod h1:2rsYD01CKFrjjsvFxx75KlEUNpWNBY9JWD3K/7o2Cus= +github.com/valyala/tcplisten v1.0.0 h1:rBHj/Xf+E1tRGZyWIWwJDiRY0zc1Js+CV5DqwacVSA8= +github.com/valyala/tcplisten v1.0.0/go.mod h1:T0xQ8SeCZGxckz9qRXTfG43PvQ/mcWh7FwZEA7Ioqkc= +github.com/yosssi/ace v0.0.5/go.mod h1:ALfIzm2vT7t5ZE7uoIZqF3TQ7SAOyupFZnkrF5id+K0= github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.27/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.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= go.etcd.io/etcd/api/v3 v3.5.0/go.mod h1:cbVKeC6lCfl7j/8jBhAK6aIYO9XOjdptoxU/nLQcPvs= +go.etcd.io/etcd/api/v3 v3.5.1/go.mod h1:cbVKeC6lCfl7j/8jBhAK6aIYO9XOjdptoxU/nLQcPvs= go.etcd.io/etcd/client/pkg/v3 v3.5.0/go.mod h1:IJHfcCEKxYu1Os13ZdwCwIUTUVGYTSAM3YSwc9/Ac1g= +go.etcd.io/etcd/client/pkg/v3 v3.5.1/go.mod h1:IJHfcCEKxYu1Os13ZdwCwIUTUVGYTSAM3YSwc9/Ac1g= go.etcd.io/etcd/client/v2 v2.305.0/go.mod h1:h9puh54ZTgAKtEbut2oe9P4L/oqKCVB6xsXlzd7alYQ= +go.etcd.io/etcd/client/v2 v2.305.1/go.mod h1:pMEacxZW7o8pg4CrFE7pquyCJJzZvkvdD2RibOCCCGs= go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= @@ -333,6 +441,7 @@ go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9i go.uber.org/multierr v1.7.0 h1:zaiO/rmgFjbmCXdSYJWQcdvOCsthmdaHfr3Gm2Kx4Ec= go.uber.org/multierr v1.7.0/go.mod h1:7EAYxJLBy9rStEaz58O2t4Uvip6FSURkq8/ppBp95ak= go.uber.org/zap v1.17.0/go.mod h1:MXVU+bhUf/A7Xi2HNOnopQOrmycQ5Ih87HtOu4q5SSo= +golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20181029021203-45a5f77698d3/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= @@ -342,6 +451,7 @@ golang.org/x/crypto v0.0.0-20190923035154-9ee001bba392/go.mod h1:/lpIB1dKB+9EgE3 golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200414173820-0848c9571904/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20210513164829-c07d793c2f9a/go.mod h1:P+XmwS30IXTQdn5tA2iutPOUgjI07+tq3H3K9MVA1s8= golang.org/x/crypto v0.0.0-20210817164053-32db794688a5/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20211108221036-ceb1ce70b4fa h1:idItI2DDfCokpg0N51B2VtiLdJ4vAuXC9fnCb2gACo4= golang.org/x/crypto v0.0.0-20211108221036-ceb1ce70b4fa/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= @@ -380,17 +490,21 @@ golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.1/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= 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/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181023162649-9b4f9f5ad519/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181201002055-351d144fa1fc/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190327091125-710a502c58a2/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190501004415-9ce7a6920f09/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= +golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190628185345-da137c7871d7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190724013045-ca1201d0de80/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= @@ -417,7 +531,10 @@ 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-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-20210410081132-afb366fc7cd1/go.mod h1:9tjilg8BloeKEkVJvy7fQ90B1CfIiPueXVOjqfkSzI8= golang.org/x/net v0.0.0-20210503060351-7fd8e65b6420/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20210510120150-4163338589ed/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20210813160813-60bc85c4be6d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -434,6 +551,8 @@ golang.org/x/oauth2 v0.0.0-20210514164344-f6687ab2804c/go.mod h1:KelEdhl1UZF7XfJ golang.org/x/oauth2 v0.0.0-20210628180205-a41e5a781914/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20210805134026-6f1e6394065a/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20210819190943-2bc19b11175f/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20211005180243-6b3c2da341f1/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20211104180415-d3ed0bb246c8/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -447,11 +566,14 @@ golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= 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-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181026203630-95b1ffbd15a5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -487,6 +609,7 @@ golang.org/x/sys v0.0.0-20201201145000-ef89a241ccb3/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20210104204734-6f8348627aad/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/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-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-20210320140829-1e4c9ba3b0c4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -500,9 +623,15 @@ golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20210616094352-59db8d763f22/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210806184541-e5e7981a1069/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210816183151-1e6c022a8912/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210823070655-63515b42dcdf/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20211111213525-f221eed1c01e h1:zeJt6jBtVDK23XK9QXcmG0FvO0elikp0dYZQZOeL1y0= -golang.org/x/sys v0.0.0-20211111213525-f221eed1c01e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210908233432-aa78b53d3365/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20211007075335-d3039528d8ac/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20211124211545-fe61309f8881/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20211205182925-97ca703d548d/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20211214234402-4825e8c3871d h1:1oIt9o40TWWI9FUaveVpUvBe13FNqBNVXy3ue2fcfkw= +golang.org/x/sys v0.0.0-20211214234402-4825e8c3871d/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= 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= @@ -604,7 +733,12 @@ google.golang.org/api v0.48.0/go.mod h1:71Pr1vy+TAZRPkPs/xlCf5SsU8WjuAWv1Pfjbtuk google.golang.org/api v0.50.0/go.mod h1:4bNT5pAuq5ji4SRZm+5QIkjny9JAyVD/3gaSihNefaw= google.golang.org/api v0.51.0/go.mod h1:t4HdrdoNgyN5cbEfm7Lum0lcLDLiise1F8qDKX00sOU= google.golang.org/api v0.54.0/go.mod h1:7C4bFFOvVDGXjfDTAsgGwDgAxRDeQ4X8NvUedIt6z3k= +google.golang.org/api v0.55.0/go.mod h1:38yMfeP1kfjsl8isn0tliTjIb1rJXcQi4UXlbqivdVE= google.golang.org/api v0.56.0/go.mod h1:38yMfeP1kfjsl8isn0tliTjIb1rJXcQi4UXlbqivdVE= +google.golang.org/api v0.57.0/go.mod h1:dVPlbZyBo2/OjBpmvNdpn2GRm6rPy75jyU7bmhdrMgI= +google.golang.org/api v0.59.0/go.mod h1:sT2boj7M9YJxZzgeZqXogmhfmRWDtPzT31xkieUbuZU= +google.golang.org/api v0.61.0/go.mod h1:xQRti5UdCmoCEqFxcz93fTl338AVqDgyaDRuOZ3hg9I= +google.golang.org/api v0.62.0/go.mod h1:dKmwPCydfsad4qCH08MSdgWjfHOyfpd4VtDGgRFdavw= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= @@ -664,6 +798,17 @@ google.golang.org/genproto v0.0.0-20210805201207-89edb61ffb67/go.mod h1:ob2IJxKr google.golang.org/genproto v0.0.0-20210813162853-db860fec028c/go.mod h1:cFeNkxwySK631ADgubI+/XFU/xp8FD5KIVV4rj8UC5w= google.golang.org/genproto v0.0.0-20210821163610-241b8fcbd6c8/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= google.golang.org/genproto v0.0.0-20210828152312-66f60bf46e71/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= +google.golang.org/genproto v0.0.0-20210831024726-fe130286e0e2/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= +google.golang.org/genproto v0.0.0-20210903162649-d08c68adba83/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= +google.golang.org/genproto v0.0.0-20210909211513-a8c4777a87af/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= +google.golang.org/genproto v0.0.0-20210924002016-3dee208752a0/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= +google.golang.org/genproto v0.0.0-20211008145708-270636b82663/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= +google.golang.org/genproto v0.0.0-20211028162531-8db9c33dc351/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= +google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= +google.golang.org/genproto v0.0.0-20211129164237-f09f9a12af12/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= +google.golang.org/genproto v0.0.0-20211203200212-54befc351ae9/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= +google.golang.org/genproto v0.0.0-20211206160659-862468c7d6e0/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= +google.golang.org/genproto v0.0.0-20211208223120-3a66f561d7aa/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= @@ -689,6 +834,8 @@ google.golang.org/grpc v1.38.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQ google.golang.org/grpc v1.39.0/go.mod h1:PImNr+rS9TWYb2O4/emRugxiyHZ5JyHW5F+RPnDzfrE= google.golang.org/grpc v1.39.1/go.mod h1:PImNr+rS9TWYb2O4/emRugxiyHZ5JyHW5F+RPnDzfrE= google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= +google.golang.org/grpc v1.40.1/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= +google.golang.org/grpc v1.42.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0/go.mod h1:6Kw0yEErY5E/yWrBtf03jp27GLLJujG4z/JK95pnjjw= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= @@ -703,16 +850,21 @@ google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlba google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= +gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20200902074654-038fdea0a05b h1:QRR6H1YWRnHb4Y/HeNFCTJLFVxaq6wH4YuVdsUOr75U= +gopkg.in/check.v1 v1.0.0-20200902074654-038fdea0a05b/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= gopkg.in/ini.v1 v1.62.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= -gopkg.in/ini.v1 v1.63.2 h1:tGK/CyBg7SMzb60vP1M03vNZ3VDu3wGQJwn7Sxi9r3c= -gopkg.in/ini.v1 v1.63.2/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= +gopkg.in/ini.v1 v1.66.2 h1:XfR1dOYubytKy4Shzc2LHrrGhU0lDCfDGG1yLPmpgsI= +gopkg.in/ini.v1 v1.66.2/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= +gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.5/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.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= diff --git a/internal/app/cmd/root.go b/internal/app/cmd/root.go deleted file mode 100644 index c4199df..0000000 --- a/internal/app/cmd/root.go +++ /dev/null @@ -1,132 +0,0 @@ -// Copyright © 2019 Peter Kurfer -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package cmd - -import ( - "fmt" - "os" - "path/filepath" - - "github.com/fsnotify/fsnotify" - - "github.com/baez90/goveal/internal/app/rendering" - - "github.com/mitchellh/go-homedir" - log "github.com/sirupsen/logrus" - "github.com/spf13/cobra" - "github.com/spf13/viper" -) - -var ( - cfgFile string - workingDir string - rootCmd = &cobra.Command{ - Use: "goveal", - Short: "goveal is a small reveal.js server", - Long: `goveal is a single static binary to host your reveal.js based markdown presentation. -It is running a small web server that loads your markdown file, renders a complete HTML page and delivers it including all the reveal.js assets. -It is not required to restart the server when you edit the markdown - a simple reload of the page is doing all the required magic.`, - } - params rendering.RevealParams -) - -// Execute adds all child commands to the root command and sets flags appropriately. -// This is called by main.main(). It only needs to happen once to the rootCmd. -func Execute() { - if err := rootCmd.Execute(); err != nil { - fmt.Println(err) - os.Exit(1) - } -} - -func init() { - cobra.OnInitialize(initLogging) - cobra.OnInitialize(initConfig) - - var err error - workingDir, err = os.Getwd() - if err != nil { - fmt.Println(err) - os.Exit(1) - } - - rootCmd.PersistentFlags().StringVar(&cfgFile, "config", "", "config file (default is $HOME/.go-reveal-slides.yaml)") - rootCmd.PersistentFlags().StringVar(&workingDir, "working-dir", workingDir, "working directory to use") -} - -func initLogging() { - log.SetFormatter(&log.TextFormatter{ - ForceColors: true, - }) -} - -// initConfig reads in config file and ENV variables if set. -func initConfig() { - var err error - if workingDir, err = filepath.Abs(workingDir); err != nil { - log.Warnf("Failed to determine absolute path for working dir %s: %v", workingDir, err) - return - } - - var cwd string - if cwd, err = os.Getwd(); err != nil { - log.Warnf("Failed to determine current working directory") - return - } - - if cwd != workingDir { - if err = os.Chdir(workingDir); err != nil { - log.Warnf("Failed to change working directory to %s", workingDir) - } - } - - if cfgFile != "" { - // Use config file from the flag. - viper.SetConfigFile(cfgFile) - } else { - // Find home directory. - home, err := homedir.Dir() - if err != nil { - log.Infof("Failed to determine home directory: %v", err) - } else { - viper.AddConfigPath(home) - } - - viper.AddConfigPath(workingDir) - viper.SetConfigName("goveal") - viper.SetConfigType("yaml") - } - - viper.AutomaticEnv() // read in environment variables that match - - // If a config file is found, read it in. - if err := viper.ReadInConfig(); err == nil { - log.Info("Using config file:", viper.ConfigFileUsed()) - - log.Info("Starting to watch config file...") - viper.WatchConfig() - viper.OnConfigChange(func(in fsnotify.Event) { - log.Info("Noticed configuration change...") - if err := params.Load(); err != nil { - log.Warnf("Failed to load config: %v", err) - } - }) - } - - params.WorkingDirectory = workingDir - if err := params.Load(); err != nil { - log.Warnf("Failed to load config: %v", err) - } -} diff --git a/internal/app/cmd/serve.go b/internal/app/cmd/serve.go deleted file mode 100644 index aa180d4..0000000 --- a/internal/app/cmd/serve.go +++ /dev/null @@ -1,94 +0,0 @@ -// Copyright © 2019 Peter Kurfer peter.kurfer@googlemail.com -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package cmd - -import ( - "errors" - "fmt" - "net/http" - "os/exec" - "runtime" - - "github.com/spf13/cobra" - - "github.com/baez90/goveal/internal/app/server" - - log "github.com/sirupsen/logrus" -) - -var ( - host string - port uint16 - openBrowser bool - serveCmd = &cobra.Command{ - Use: "serve", - Args: cobra.ExactArgs(1), - Short: "", - Long: ``, - RunE: func(cmd *cobra.Command, args []string) (err error) { - var srv *server.HTTPServer - srv, err = server.NewHTTPServer(server.Config{ - Host: host, - Port: port, - MarkdownPath: args[0], - RevealParams: ¶ms, - }) - - if err != nil { - log.Errorf("Error while setting up server: %v", err) - return - } - - listenUrl := fmt.Sprintf("http://%s/", srv.ListenAddress()) - log.Infof("Going to listen on %s", listenUrl) - - if openBrowser { - log.Info("Opening browser...") - openBrowserInBackground(listenUrl) - } - - if err = srv.Serve(); err != nil && !errors.Is(err, http.ErrServerClosed) { - log.Errorf("Error while running serve command: %v", err) - } - return nil - }, - } -) - -func init() { - rootCmd.AddCommand(serveCmd) - - serveCmd.Flags().StringVar(&host, "host", "localhost", "host the CLI should listen on") - serveCmd.Flags().Uint16Var(&port, "port", 2233, "port the CLI should listen on") - serveCmd.Flags().BoolVar(&openBrowser, "open-browser", true, "if the browser should be opened at the URL") -} - -func openBrowserInBackground(url string) { - var err error - - switch runtime.GOOS { - case "linux": - err = exec.Command("xdg-open", url).Start() - case "windows": - err = exec.Command("rundll32", "url.dll,FileProtocolHandler", url).Start() - case "darwin": - err = exec.Command("open", url).Start() - default: - err = fmt.Errorf("unsupported platform") - } - if err != nil { - log.Warn(err) - } -} diff --git a/internal/app/rendering/reveal_params.go b/internal/app/rendering/reveal_params.go deleted file mode 100644 index 4d41987..0000000 --- a/internal/app/rendering/reveal_params.go +++ /dev/null @@ -1,89 +0,0 @@ -// Copyright © 2019 Peter Kurfer peter.kurfer@googlemail.com -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package rendering - -import ( - "path" - "path/filepath" - - "github.com/bmatcuk/doublestar/v2" - "github.com/imdario/mergo" - "github.com/spf13/viper" - - "github.com/baez90/goveal/internal/encoding" -) - -var defaultParams = RevealParams{ - Theme: "white", - CodeTheme: "vs", - Transition: "None", - NavigationMode: "default", - HorizontalSeparator: "===", - VerticalSeparator: "---", - SlideNumberVisibility: "all", - SlideNumberFormat: "h.v", - StyleSheets: make([]string, 0), - FilesToMonitor: make([]string, 0), -} - -type RevealParams struct { - Theme string `mapstructure:"theme"` - CodeTheme string `mapstructure:"codeTheme"` - Transition string `mapstructure:"transition"` - NavigationMode string `mapstructure:"navigationMode"` - HorizontalSeparator string `mapstructure:"horizontalSeparator"` - VerticalSeparator string `mapstructure:"verticalSeparator"` - SlideNumberVisibility string `mapstructure:"slideNumberVisibility"` - SlideNumberFormat string `mapstructure:"slideNumberFormat"` - StyleSheets []string `mapstructure:"stylesheets"` - FilesToMonitor []string `mapstructure:"filesToMonitor"` - WorkingDirectory string `mapstructure:"working-dir"` - LineEnding encoding.LineEnding `mapstructure:"-"` -} - -func (params *RevealParams) Load() error { - _ = viper.Unmarshal(params) - expandGlobs(params) - return mergo.Merge(params, &defaultParams) -} - -func expandGlobs(params *RevealParams) { - var allFiles []string - - for _, f := range params.FilesToMonitor { - var err error - - f, err = filepath.Abs(f) - if err != nil { - continue - } - - var matches []string - if matches, err = doublestar.Glob(f); err != nil { - continue - } - - for idx := range matches { - if relative, err := filepath.Rel(params.WorkingDirectory, matches[idx]); err != nil { - continue - } else { - matches[idx] = path.Join("/", relative) - } - } - - allFiles = append(allFiles, matches...) - } - params.FilesToMonitor = allFiles -} diff --git a/internal/app/rendering/template.go b/internal/app/rendering/template.go deleted file mode 100644 index 5cfe3be..0000000 --- a/internal/app/rendering/template.go +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright © 2019 Peter Kurfer peter.kurfer@googlemail.com -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package rendering - -import ( - "html/template" - "net/http" - - "github.com/Masterminds/sprig/v3" - log "github.com/sirupsen/logrus" - - "github.com/baez90/goveal/assets" -) - -type RevealRenderer interface { - http.Handler - init() error -} - -func NewRevealRenderer(params *RevealParams) (renderer RevealRenderer, err error) { - renderer = &revealRenderer{ - params: params, - } - err = renderer.init() - - return -} - -type revealRenderer struct { - template *template.Template - params *RevealParams -} - -func (renderer *revealRenderer) init() (err error) { - renderer.template, err = template.New("index").Funcs(sprig.FuncMap()).Parse(string(assets.Template)) - return -} - -func (renderer *revealRenderer) ServeHTTP(response http.ResponseWriter, _ *http.Request) { - if renderer.template == nil { - writeErrorResponse(500, "rendering is not set - probably error during startup", response) - return - } - - err := renderer.template.Execute(response, struct { - Reveal RevealParams - }{Reveal: *renderer.params}) - if err != nil { - writeErrorResponse(500, "Failed to render Markdown to rendering", response) - log.Errorf("Failed to render Markdown rendering: %v", err) - } -} - -func writeErrorResponse(code int, msg string, response http.ResponseWriter) { - response.WriteHeader(code) - _, err := response.Write([]byte(msg)) - log.Errorf("Failed to write error reponse: %v", err) -} diff --git a/internal/app/routing/layered_fs.go b/internal/app/routing/layered_fs.go deleted file mode 100644 index ed22005..0000000 --- a/internal/app/routing/layered_fs.go +++ /dev/null @@ -1,47 +0,0 @@ -package routing - -import ( - "errors" - "net/http" - "sync" -) - -var ErrFileNotFound = errors.New("file not found in any layer") - -func NewLayeredFileSystem(layers ...http.FileSystem) http.FileSystem { - return &layeredFileSystem{ - resolveCache: make(map[string]http.FileSystem), - layers: layers, - } -} - -type layeredFileSystem struct { - layers []http.FileSystem - resolveCache map[string]http.FileSystem - lock sync.Mutex -} - -func (l *layeredFileSystem) Open(name string) (f http.File, err error) { - if cachedLayer, isCached := l.resolveCache[name]; isCached { - if cachedLayer != nil { - return cachedLayer.Open(name) - } else { - return nil, ErrFileNotFound - } - } - - for idx := range l.layers { - layer := l.layers[idx] - if f, err = layer.Open(name); err == nil { - l.lock.Lock() - l.resolveCache[name] = layer - l.lock.Unlock() - return - } - } - - l.lock.Lock() - l.resolveCache[name] = nil - l.lock.Unlock() - return nil, ErrFileNotFound -} diff --git a/internal/app/routing/markdown_fs.go b/internal/app/routing/markdown_fs.go deleted file mode 100644 index a4c6388..0000000 --- a/internal/app/routing/markdown_fs.go +++ /dev/null @@ -1,33 +0,0 @@ -package routing - -import ( - "fmt" - "net/http" - "os" - "path/filepath" -) - -type markdownFs struct { - destinationPath string -} - -func NewMarkdownFS(path string) (fs http.FileSystem, err error) { - var info os.FileInfo - info, err = os.Stat(path) - if err != nil { - return - } - - if info.IsDir() || filepath.Ext(info.Name()) != ".md" { - err = fmt.Errorf("path %s did not pass sanity checks for markdown files", path) - return - } - - return &markdownFs{ - destinationPath: path, - }, nil -} - -func (m markdownFs) Open(_ string) (http.File, error) { - return os.Open(m.destinationPath) -} diff --git a/internal/app/routing/no_cache_handler.go b/internal/app/routing/no_cache_handler.go deleted file mode 100644 index 6360e7b..0000000 --- a/internal/app/routing/no_cache_handler.go +++ /dev/null @@ -1,56 +0,0 @@ -package routing - -import ( - "net/http" - "strings" - "time" -) - -var epoch = time.Unix(0, 0).Format(time.RFC1123) - -var noCacheHeaders = map[string]string{ - "Expires": epoch, - "Cache-Control": "no-cache, private, max-age=0", - "Pragma": "no-cache", - "X-Accel-Expires": "0", -} - -var etagHeaders = []string{ - "ETag", - "If-Modified-Since", - "If-Match", - "If-None-Match", - "If-Range", - "If-Unmodified-Since", -} - -func NoCache(h http.Handler, pathsToDisableCache []string) http.Handler { - pathLookup := make(map[string]bool) - - for idx := range pathsToDisableCache { - pathLookup[strings.ToLower(pathsToDisableCache[idx])] = true - } - - fn := func(w http.ResponseWriter, r *http.Request) { - if _, shouldBeHandled := pathLookup[strings.ToLower(r.URL.Path)]; !shouldBeHandled { - h.ServeHTTP(w, r) - return - } - - // Delete any ETag headers that may have been set - for _, v := range etagHeaders { - if r.Header.Get(v) != "" { - r.Header.Del(v) - } - } - - // Set our NoCache headers - for k, v := range noCacheHeaders { - w.Header().Set(k, v) - } - - h.ServeHTTP(w, r) - } - - return http.HandlerFunc(fn) -} diff --git a/internal/app/routing/regexp_router.go b/internal/app/routing/regexp_router.go deleted file mode 100644 index 63f3b79..0000000 --- a/internal/app/routing/regexp_router.go +++ /dev/null @@ -1,38 +0,0 @@ -package routing - -import ( - "net/http" - "regexp" -) - -type regexpRule struct { - pattern *regexp.Regexp - handler http.Handler -} - -type RegexpRouter struct { - rules []regexpRule -} - -func (r *RegexpRouter) AddRule(pattern string, handler http.Handler) (err error) { - var exp *regexp.Regexp - if exp, err = regexp.Compile(pattern); err != nil { - return - } - r.rules = append(r.rules, regexpRule{ - pattern: exp, - handler: handler, - }) - return -} - -func (r *RegexpRouter) ServeHTTP(writer http.ResponseWriter, request *http.Request) { - for idx := range r.rules { - rule := r.rules[idx] - if rule.pattern.MatchString(request.URL.Path) { - rule.handler.ServeHTTP(writer, request) - return - } - } - writer.WriteHeader(404) -} diff --git a/internal/app/server/hash_handler.go b/internal/app/server/hash_handler.go deleted file mode 100644 index 2ff6f4e..0000000 --- a/internal/app/server/hash_handler.go +++ /dev/null @@ -1,103 +0,0 @@ -package server - -import ( - "crypto" - "encoding/hex" - "encoding/json" - "hash" - "io" - "net/http" - "regexp" - "strings" - "sync" - - log "github.com/sirupsen/logrus" - "go.uber.org/multierr" -) - -var ( - pathMatcherRegexp = regexp.MustCompile(`(?i)^/hash/(md5|sha1|sha2)(/.*)`) - hashes = map[string]crypto.Hash{ - "md5": crypto.MD5, - "sha1": crypto.SHA1, - "sha256": crypto.SHA256, - } -) - -type hashResponse struct { - FilePath string - Hash string -} - -func NewHashHandler(fs http.FileSystem) http.Handler { - return &hashHandler{ - fs: fs, - bufferPool: &sync.Pool{ - New: func() interface{} { - return make([]byte, 4096) - }, - }, - } -} - -type hashHandler struct { - bufferPool *sync.Pool - fs http.FileSystem -} - -func (h hashHandler) ServeHTTP(writer http.ResponseWriter, request *http.Request) { - components := pathMatcherRegexp.FindStringSubmatch(request.URL.Path) - if len(components) != 3 { - writer.WriteHeader(400) - return - } - - filePath := components[2] - - var hashFound bool - var hashInstance crypto.Hash - if hashInstance, hashFound = hashes[strings.ToLower(components[1])]; !hashFound { - writer.WriteHeader(404) - return - } - var f http.File - var err error - if f, err = h.fs.Open(filePath); err != nil { - writer.WriteHeader(404) - return - } - - var encodedHash string - if encodedHash, err = h.buildHash(hashInstance.New(), f); err != nil { - log.Errorf("Failed to calculate hash %v", err) - writer.WriteHeader(500) - return - } - - resp := hashResponse{ - FilePath: filePath, - Hash: encodedHash, - } - - writer.Header().Set("Content-Type", "application/json") - encoder := json.NewEncoder(writer) - if err = encoder.Encode(resp); err != nil { - writer.WriteHeader(500) - return - } -} - -func (h *hashHandler) buildHash(hasher hash.Hash, src io.ReadCloser) (encodedHash string, err error) { - defer func() { - err = multierr.Append(err, src.Close()) - }() - - buffer := h.bufferPool.Get().([]byte) - for n, err := src.Read(buffer); n > 0 && err == nil; n, err = src.Read(buffer) { - if _, err := hasher.Write(buffer[:n]); err != nil { - return "", err - } - } - encodedHash = hex.EncodeToString(hasher.Sum(nil)) - return -} diff --git a/internal/app/server/http_server.go b/internal/app/server/http_server.go deleted file mode 100644 index 9637c92..0000000 --- a/internal/app/server/http_server.go +++ /dev/null @@ -1,118 +0,0 @@ -package server - -import ( - "fmt" - "io/fs" - "net" - "net/http" - "os" - - "github.com/baez90/goveal/assets" - "github.com/baez90/goveal/internal/app/rendering" - "github.com/baez90/goveal/internal/app/routing" - "github.com/baez90/goveal/internal/encoding" -) - -const ( - markdownFilePath = "/content.md" -) - -type ( - Config struct { - Host string - Port uint16 - MarkdownPath string - RevealParams *rendering.RevealParams - } - - HTTPServer struct { - listener net.Listener - handler http.Handler - } -) - -func (srv HTTPServer) Serve() error { - return http.Serve(srv.listener, srv.handler) -} - -func (srv HTTPServer) ListenAddress() string { - return srv.listener.Addr().String() -} - -func NewHTTPServer(config Config) (srv *HTTPServer, err error) { - noCacheFiles := append(config.RevealParams.FilesToMonitor, markdownFilePath) - if err := detectMarkdownFileEnding(config.MarkdownPath, config.RevealParams); err != nil { - return nil, err - } - - router := &routing.RegexpRouter{} - var tmplRenderer rendering.RevealRenderer - if tmplRenderer, err = rendering.NewRevealRenderer(config.RevealParams); err != nil { - err = fmt.Errorf("failed to initialize reveal renderer %w", err) - return - } - - // language=regexp - if err = router.AddRule(`^(/(index.html(l)?)?)?$`, tmplRenderer); err != nil { - return - } - - var mdFS http.FileSystem - if mdFS, err = routing.NewMarkdownFS(config.MarkdownPath); err != nil { - err = fmt.Errorf("failed to initialize markdown file handler %w", err) - return - } - - var revealFS, webFS fs.FS - if revealFS, err = fs.Sub(assets.Assets, "reveal"); err != nil { - return nil, err - } - - if webFS, err = fs.Sub(assets.Assets, "web"); err != nil { - return nil, err - } - - layeredFS := routing.NewLayeredFileSystem(http.FS(revealFS), http.FS(webFS), http.Dir("."), mdFS) - - // language=regexp - if err = router.AddRule(`^(?i)/hash/(md5|sha1|sha2)/.*`, NewHashHandler(layeredFS)); err != nil { - return - } - // language=regexp - if err = router.AddRule("^/.*\\.md$", http.FileServer(mdFS)); err != nil { - return - } - // language=regexp - if err = router.AddRule("/.+", http.FileServer(layeredFS)); err != nil { - return - } - - hostPort := fmt.Sprintf("%s:%d", config.Host, config.Port) - - srv = &HTTPServer{ - handler: routing.NoCache(router, noCacheFiles), - } - - if srv.listener, err = net.Listen("tcp", hostPort); err != nil { - return - } - - return -} - -func detectMarkdownFileEnding(filePath string, params *rendering.RevealParams) error { - f, err := os.Open(filePath) - if err != nil { - return err - } - defer func() { - _ = f.Close() - }() - - if le, err := encoding.Detect(f); err != nil { - return err - } else { - params.LineEnding = le - } - return nil -} diff --git a/internal/encoding/line_ending.go b/internal/encoding/line_ending.go deleted file mode 100644 index be165c6..0000000 --- a/internal/encoding/line_ending.go +++ /dev/null @@ -1,44 +0,0 @@ -package encoding - -import ( - "bufio" - "io" -) - -const ( - LineEndingUnknown LineEnding = "" - LineEndingWindows LineEnding = "\r\n" - LineEndingUnix LineEnding = "\n" -) - -type LineEnding string - -func (e LineEnding) String() string { - return string(e) -} - -func (e LineEnding) Escaped() string { - switch e { - case LineEndingUnix: - return "\\n" - case LineEndingWindows: - return "\\r\\n" - default: - return "" - } -} - -func Detect(reader io.Reader) (LineEnding, error) { - bufferedReader := bufio.NewReader(reader) - line, err := bufferedReader.ReadString(byte('\n')) - if err != nil { - return LineEndingUnknown, err - } - - lineLength := len(line) - if lineLength <= 1 || line[lineLength-2:] != LineEndingWindows.String() { - return LineEndingUnix, nil - } - - return LineEndingWindows, nil -} diff --git a/internal/encoding/line_ending_test.go b/internal/encoding/line_ending_test.go deleted file mode 100644 index e92dc95..0000000 --- a/internal/encoding/line_ending_test.go +++ /dev/null @@ -1,74 +0,0 @@ -package encoding_test - -import ( - "io" - "strings" - "testing" - - "github.com/baez90/goveal/internal/encoding" -) - -func TestDetect(t *testing.T) { - type args struct { - reader io.Reader - } - tests := []struct { - name string - args args - want encoding.LineEnding - wantErr bool - }{ - { - name: "Empty file expect unknown", - args: args{ - reader: strings.NewReader(""), - }, - want: encoding.LineEndingUnknown, - wantErr: true, - }, - { - name: "File with only Unix line ending", - args: args{ - reader: strings.NewReader("\n"), - }, - want: encoding.LineEndingUnix, - wantErr: false, - }, - { - name: "File with only Windows line ending", - args: args{ - reader: strings.NewReader("\r\n"), - }, - want: encoding.LineEndingWindows, - wantErr: false, - }, - { - name: "File with multiple lines - Unix file ending", - args: args{ - reader: strings.NewReader("Hello, World\nThis comes from Unix!\n"), - }, - want: encoding.LineEndingUnix, - wantErr: false, - }, - { - name: "File with multiple lines - Windows file ending", - args: args{ - reader: strings.NewReader("Hello, World\r\nThis comes from Windows!\r\n"), - }, - want: encoding.LineEndingWindows, - wantErr: false, - }, - } - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - got, err := encoding.Detect(tt.args.reader) - if (err != nil) != tt.wantErr { - t.Errorf("Detect() error = %v, wantErr %v", err, tt.wantErr) - return - } - if got != tt.want { - t.Errorf("Detect() got = %v, want %v", got, tt.want) - } - }) - } -} diff --git a/rendering/render_to_reveal.go b/rendering/render_to_reveal.go new file mode 100644 index 0000000..83e4259 --- /dev/null +++ b/rendering/render_to_reveal.go @@ -0,0 +1,232 @@ +package rendering + +import ( + "bytes" + "embed" + "encoding/hex" + "hash" + "html" + "html/template" + "io" + "path" + "regexp" + "sync" + + "github.com/Masterminds/sprig/v3" + "github.com/gomarkdown/markdown/ast" +) + +var ( + //go:embed templates/*.gohtml + templatesFS embed.FS + templates *template.Template + templateRenderBufferPool = &sync.Pool{ + New: func() interface{} { + return new(bytes.Buffer) + }, + } + htmlElementAttributesRegexp = regexp.MustCompile(`(?P[a-z]+(-[a-z]+)*)="(?P.+)"`) + notesRegexp = regexp.MustCompile(`^(?i)notes?`) +) + +const ( + mermaidCodeBlock = "mermaid" +) + +func init() { + var err error + templates = template.New("rendering").Funcs(sprig.FuncMap()) + if templates, err = templates.ParseFS(templatesFS, "templates/*.gohtml"); err != nil { + panic(err) + } +} + +type RevealRenderer struct { + StateMachine *StateMachine + Hash hash.Hash + hasNotes bool +} + +func (r *RevealRenderer) RenderHook(w io.Writer, node ast.Node, entering bool) (ast.WalkStatus, bool) { + switch b := node.(type) { + case *ast.Document: + if entering { + _, _ = w.Write([]byte("
\n")) + if next := peekNextRuler(b); next != nil && string(next.Literal) == "***" { + _, _ = w.Write([]byte("
\n")) + r.StateMachine.CurrentState = StateTypeNested + } + } else { + _, _ = w.Write([]byte("
\n")) + } + return ast.GoToNext, false + case *ast.ListItem: + if entering { + return r.handleListItem(w, b) + } + return ast.GoToNext, false + case *ast.Text: + if !entering { + return ast.GoToNext, false + } + if notesRegexp.Match(b.Literal) { + _, err := w.Write([]byte(``)) + r.hasNotes = false + } + _, _ = w.Write(r.StateMachine.Accept(input)) + return ast.GoToNext, true + case *ast.Image: + if entering { + return r.handleImage(w, b) + } + return ast.GoToNext, false + default: + return ast.GoToNext, false + } +} + +func (r *RevealRenderer) handleCodeBlock(w io.Writer, code *ast.CodeBlock) (ast.WalkStatus, bool) { + code.Info = bytes.ToLower(code.Info) + switch string(code.Info) { + case mermaidCodeBlock: + output, err := renderCodeTemplate("mermaid.gohtml", code) + if err != nil { + return ast.GoToNext, false + } + _, err = w.Write(output) + return ast.GoToNext, err == nil + default: + output, err := renderCodeTemplate("any-code.gohtml", code) + if err != nil { + return ast.GoToNext, false + } + _, err = w.Write(output) + return ast.GoToNext, err == nil + } +} + +func (r *RevealRenderer) handleListItem(w io.Writer, listItem *ast.ListItem) (ast.WalkStatus, bool) { + for _, child := range listItem.Children { + if p, ok := child.(*ast.Paragraph); ok { + if len(p.Children) == 0 { + return ast.GoToNext, false + } + + data := map[string]interface{}{ + "Attributes": getAttributesFromChildSpan(p), + } + + if rendered, err := renderTemplate("listItem.gohtml", data); err != nil { + return ast.GoToNext, false + } else if _, err = w.Write(rendered); err != nil { + return ast.GoToNext, false + } + + return ast.GoToNext, true + } + } + return ast.GoToNext, false +} + +func (r *RevealRenderer) handleImage(w io.Writer, img *ast.Image) (ast.WalkStatus, bool) { + var title string + if len(img.Children) >= 1 { + if txt, ok := img.Children[0].(*ast.Text); ok { + title = string(txt.Literal) + } + } + + data := map[string]interface{}{ + "ID": hex.EncodeToString(r.Hash.Sum([]byte(path.Base(string(img.Destination))))), + "Attributes": getAttributesFromChildSpan(img.GetParent()), + "ImageSource": string(img.Destination), + "AlternativeText": html.EscapeString(title), + } + + if rendered, err := renderTemplate("image.gohtml", data); err != nil { + return ast.GoToNext, false + } else if _, err = w.Write(rendered); err != nil { + return ast.GoToNext, false + } + + return ast.SkipChildren, true +} + +func getAttributesFromChildSpan(node ast.Node) []template.HTMLAttr { + if getChildren, ok := node.(interface{ GetChildren() []ast.Node }); ok { + childs := getChildren.GetChildren() + if len(childs) == 0 { + return nil + } + for idx := range childs { + if span, ok := childs[idx].(*ast.HTMLSpan); ok { + return extractElementAttributes(span) + } + } + } + return nil +} + +func extractElementAttributes(htmlSpan *ast.HTMLSpan) (attrs []template.HTMLAttr) { + htmlComment := string(htmlSpan.Literal) + if htmlComment == "" { + return nil + } + matches := htmlElementAttributesRegexp.FindAllStringSubmatch(htmlComment, -1) + attrs = make([]template.HTMLAttr, 0, len(matches)) + for idx := range matches { + if len(matches[idx]) != 4 { + continue + } + + //nolint:gosec // it's the user's responsibility to not skrew this up here + attrs = append(attrs, template.HTMLAttr(matches[idx][0])) + } + + return attrs +} + +func renderCodeTemplate(templateName string, codeBlock *ast.CodeBlock) (output []byte, err error) { + data := map[string]interface{}{ + //nolint:gosec // need to embed the code in original format without escaping + "Code": template.HTML(codeBlock.Literal), + "LineNumbers": lineNumbers(codeBlock.Attribute), + } + + return renderTemplate(templateName, data) +} + +func renderTemplate(templateName string, data interface{}) (output []byte, err error) { + buffer := templateRenderBufferPool.Get().(*bytes.Buffer) + defer func() { + buffer.Reset() + templateRenderBufferPool.Put(buffer) + }() + + err = templates.ExecuteTemplate(buffer, templateName, data) + return buffer.Bytes(), err +} + +func lineNumbers(attrs *ast.Attribute) string { + if attrs == nil || attrs.Attrs == nil { + return "" + } + return string(attrs.Attrs["line-numbers"]) +} diff --git a/rendering/state.go b/rendering/state.go new file mode 100644 index 0000000..a926b13 --- /dev/null +++ b/rendering/state.go @@ -0,0 +1,126 @@ +package rendering + +import ( + "fmt" + + "github.com/gomarkdown/markdown/ast" +) + +const ( + EventTypeHorizontalSplit EventType = iota + EventTypeVerticalSplit + EventTypeHorizontalEnd + EventTypeVerticalSplitEnd + EventTypeVerticalDocumentEnd + EventTypeVerticalVerticalSplit + + StateTypeRegular StateType = iota + StateTypeNested +) + +var ( + EventMapping = map[EventType][]byte{ + EventTypeHorizontalSplit: []byte(` +
+
`), + EventTypeVerticalSplit: []byte(` +
+
+
+`), + EventTypeHorizontalEnd: []byte(` +
+`), + EventTypeVerticalSplitEnd: []byte(` +
+ +
`), + EventTypeVerticalDocumentEnd: []byte(` +
+ +`), + EventTypeVerticalVerticalSplit: []byte(` + + +
+
`), + } +) + +func NewStateMachine(verticalSplit, horizontalSplit string) *StateMachine { + return &StateMachine{ + CurrentState: StateTypeRegular, + States: map[StateType]State{ + StateTypeRegular: { + Transitions: map[string]TransitionResult{ + horizontalSplit: {EventTypeHorizontalSplit, StateTypeRegular}, + fmt.Sprintf("%s%s", horizontalSplit, horizontalSplit): {EventTypeHorizontalSplit, StateTypeRegular}, + fmt.Sprintf("%s%s", horizontalSplit, verticalSplit): {EventTypeVerticalSplit, StateTypeNested}, + fmt.Sprintf("%s%s", verticalSplit, horizontalSplit): {EventTypeVerticalSplit, StateTypeNested}, + "": {EventTypeHorizontalEnd, StateTypeRegular}, + }, + }, + StateTypeNested: { + Transitions: map[string]TransitionResult{ + fmt.Sprintf("%s%s", verticalSplit, verticalSplit): {EventTypeHorizontalSplit, StateTypeNested}, + verticalSplit: {EventTypeHorizontalSplit, StateTypeNested}, + fmt.Sprintf("%s%s", verticalSplit, horizontalSplit): {EventTypeVerticalSplitEnd, StateTypeNested}, + horizontalSplit: {EventTypeVerticalSplitEnd, StateTypeRegular}, + fmt.Sprintf("%s%s", horizontalSplit, verticalSplit): {EventTypeVerticalVerticalSplit, StateTypeNested}, + fmt.Sprintf("%s%s", horizontalSplit, horizontalSplit): {EventTypeVerticalSplitEnd, StateTypeRegular}, + "": {EventTypeVerticalDocumentEnd, StateTypeRegular}, + }, + }, + }, + } +} + +type ( + EventType uint + StateType uint + TransitionResult struct { + EventType EventType + StateType StateType + } + State struct { + Transitions map[string]TransitionResult + } + StateMachine struct { + CurrentState StateType + States map[StateType]State + } +) + +func (m *StateMachine) Accept(input string) []byte { + if result, ok := m.States[m.CurrentState].Transitions[input]; ok { + m.CurrentState = result.StateType + return EventMapping[result.EventType] + } + return nil +} + +func peekNextRuler(node ast.Node) *ast.HorizontalRule { + if node.AsContainer() == nil { + node = node.GetParent() + } + + nodes := node.GetChildren() + if nodes == nil { + return nil + } + + var selfIdx int + for idx := range nodes { + if nodes[idx] == node { + selfIdx = idx + break + } + } + + for idx := selfIdx + 1; idx < len(nodes); idx++ { + if hr, ok := nodes[idx].(*ast.HorizontalRule); ok { + return hr + } + } + return nil +} diff --git a/rendering/templates/any-code.gohtml b/rendering/templates/any-code.gohtml new file mode 100644 index 0000000..27e37a4 --- /dev/null +++ b/rendering/templates/any-code.gohtml @@ -0,0 +1,6 @@ +

+    {{- .Code }}
+
\ No newline at end of file diff --git a/rendering/templates/image.gohtml b/rendering/templates/image.gohtml new file mode 100644 index 0000000..8699982 --- /dev/null +++ b/rendering/templates/image.gohtml @@ -0,0 +1,8 @@ +{{ .AlternativeText }} \ No newline at end of file diff --git a/rendering/templates/listItem.gohtml b/rendering/templates/listItem.gohtml new file mode 100644 index 0000000..e95d5a1 --- /dev/null +++ b/rendering/templates/listItem.gohtml @@ -0,0 +1,5 @@ +
  • \ No newline at end of file diff --git a/rendering/templates/mermaid.gohtml b/rendering/templates/mermaid.gohtml new file mode 100644 index 0000000..7f6228d --- /dev/null +++ b/rendering/templates/mermaid.gohtml @@ -0,0 +1,3 @@ +
    + {{ .Code -}} +
    \ No newline at end of file diff --git a/web/index.gohtml b/web/index.gohtml new file mode 100644 index 0000000..7ede00d --- /dev/null +++ b/web/index.gohtml @@ -0,0 +1,36 @@ + + + + + + + goveal + + + + + + + + {{ range .Rendering.Stylesheets}} + + {{ end }} + + + + +
    +
    +
    +
    + + + + + + + + + + + diff --git a/web/js/app.js b/web/js/app.js new file mode 100644 index 0000000..1614abe --- /dev/null +++ b/web/js/app.js @@ -0,0 +1,116 @@ +document.addEventListener("DOMContentLoaded", _ => { + Promise.all([initMermaid(), setSlidesContent()]) + .then(() => { + return initReveal() + }) + .then(() => { + subscribeToEvents() + console.info("finished initializing") + }) + +}); + +async function setSlidesContent() { + let resp = await fetch("/slides") + let contentText = await resp.text() + let parser = new DOMParser() + let contentDocument = parser.parseFromString(contentText, 'text/html') + for (let mermaidElem of contentDocument.getElementsByClassName("mermaid")) { + let insertSVG = (svgCode, _) => { + mermaidElem.innerHTML = svgCode + } + + mermaid.mermaidAPI.render('mermaid', mermaidElem.innerText, insertSVG) + } + document.getElementById("content-root").innerHTML = contentDocument.documentElement.innerHTML +} + +async function initReveal() { + let resp = await fetch('/api/v1/config/reveal') + let cfg = await resp.json() + Reveal.initialize({ + controls: cfg.controls, + progress: cfg.progress, + history: cfg.history, + center: cfg.center, + slideNumber: cfg.slideNumber, + transition: cfg.transition, + hash: true, + pdfSeparateFragments: false, + menu: { + numbers: cfg.menu.numbers, + useTextContentForMissingTitles: cfg.menu.useTextContentForMissingTitles, + custom: [ + { + title: 'Print', + icon: '', + content: 'Go to print view' + } + ], + themes: [ + {name: 'Beige', theme: '/reveal/dist/theme/beige.css'}, + {name: 'Black', theme: '/reveal/dist/theme/black.css'}, + {name: 'Blood', theme: '/reveal/dist/theme/blood.css'}, + {name: 'League', theme: '/reveal/dist/theme/league.css'}, + {name: 'Moon', theme: '/reveal/dist/theme/moon.css'}, + {name: 'Night', theme: '/reveal/dist/theme/night.css'}, + {name: 'Serif', theme: '/reveal/dist/theme/serif.css'}, + {name: 'Simple', theme: '/reveal/dist/theme/simple.css'}, + {name: 'Sky', theme: '/reveal/dist/theme/sky.css'}, + {name: 'Solarized', theme: '/reveal/dist/theme/solarized.css'}, + {name: 'White', theme: '/reveal/dist/theme/white.css'} + ], + transitions: true, + }, + plugins: [RevealHighlight, RevealNotes, RevealMenu] + }) +} + +async function initMermaid() { + let resp = await fetch('/api/v1/config/mermaid') + let cfg = await resp.json() + mermaid.parseError = (err, hash) => { + console.error(`Failed to parse Mermaid diagraph: ${err} - ${hash}`) + } + mermaid.initialize({ + startOnLoad: false, + theme: cfg.theme, + securityLevel: 'loose', + }); +} + +function subscribeToEvents() { + let source = new EventSource("/api/v1/events"); + + source.onopen = (() => { + console.log("eventsource connection open"); + }) + + source.onerror = (ev => { + if (ev.target.readyState === 0) { + console.log("reconnecting to eventsource"); + } else { + console.log("eventsource error", ev); + } + }) + + source.onmessage = (ev => { + let obj = JSON.parse(ev.data); + console.log(obj); + if (obj.forceReload) { + window.location.reload() + } else { + switch (true) { + case obj.file.endsWith(".css"): + let cssLink = document.querySelector(`link[rel=stylesheet][id="${obj.fileNameHash}"]`); + cssLink.href = `${obj.file}?ts=${obj.ts}` + break + default: + let elem = document.getElementById(obj.fileNameHash); + if (elem !== null) { + elem.src = `${obj.file}?ts=${obj.ts}` + } + } + } + }) +} \ No newline at end of file diff --git a/web/web.go b/web/web.go new file mode 100644 index 0000000..495868e --- /dev/null +++ b/web/web.go @@ -0,0 +1,6 @@ +package web + +import "embed" + +//go:embed js/* index.gohtml +var WebFS embed.FS