项目作者: hedzr

项目描述 :
a http2 server with `cmdr` full daemon supports and graceful shutdown.
高级语言: Go
项目地址: git://github.com/hedzr/cmdr-http2.git
创建时间: 2019-06-17T10:32:02Z
项目社区:https://github.com/hedzr/cmdr-http2

开源协议:MIT License

下载


cmdr-http2

A cmdr demo app.
cmdr-http2 implements a http2 server with full daemon supports and graceful shutdown.

NOTE: need cmdr v1.6.25+ [20200204]

  1. # clone and init
  2. git clone https://github.com/hedzr/cmdr-http2.git
  3. cd cmdr-http2
  4. go mod download
  5. # run server
  6. go run ./cli/ server run &
  7. # run client and make an request
  8. go run ./cli/ h2
  9. # or via curl
  10. curl -k https://localhost:5151/
  11. #
  12. # Build the binary
  13. #
  14. go build -o bin/cli ./cli/
  15. # or:
  16. make build
  17. # Shell prompt mode
  18. $ go run ./cli/ shell
  19. >>> --help
  20. >>> quit
  21. # type <space> to get auto-completion tip
  22. # type sub-commands

Plugins for cmdr System

sample

sample plugin give a example to howto modify cmdr daemon plugin server start command at an appropriate time.

trace

trace plugin adds a trace option to cmdr system.

shell

enable shell prompt mode inside app.

cmdr-http2 Shell Prompt Mode:

image

Shell prompt mode

the feature is powered by c-bata/go-prompt.

New H2 Server since v1.3.5

  • supports autocert, std TLS, …
  • supports graceful-shutdown
  • supports hot-reload
  • demostrates howto use various of Go Web Frameworks: std go/http, iris, gin, …

create certificates for testing

This command will generate CA, server, client certificates and wrote them into ./ci/certs for h2 server loading.

  1. bin/cmdr-http2 server certs create
  2. bin/cmdr-http2 server certs create --help
  3. bin/cmdr-http2 server certs --help

See the source codes for more information.

configuration file(s)

In the project root directory, cmdr-http2.yml will be loaded as main config file, this depends on cmdr config file searching algorithm. See also cmdr.WithPredefinedLocations(locations...).

LICENSE

MIT