项目作者: boratanrikulu

项目描述 :
TCP echo server
高级语言: Go
项目地址: git://github.com/boratanrikulu/echo.git
创建时间: 2021-07-06T19:38:37Z
项目社区:https://github.com/boratanrikulu/echo

开源协议:MIT License

下载


Echo



v0.1.2

Go Reference

What

TCP Echo server. RFC862 implementation.

Usage of package

  1. package main
  2. import (
  3. "context"
  4. "github.com/boratanrikulu/echo"
  5. )
  6. func main() {
  7. s := echo.NewServer().
  8. Address(":1337").
  9. Banner(true).
  10. Verbose(false)
  11. ctx := context.Background()
  12. s.Run(ctx)
  13. }

Usage of CLI

  1. _
  2. | |
  3. ___ ___ | |__ ___
  4. / _ \ / __| | '_ \ / _ \
  5. | __/ | (__ | | | | | (_) |
  6. \___| \___| |_| |_| \___/
  7. Usage: echo [options]
  8. Options:
  9. -a, --address, which interface and port will be used *[example: ":1337"]
  10. -n, --no-banner
  11. -v, --verbose
  12. -h, --help
  13. * means "must be set".

Live Demo

It lives at echo.bora.sh:1337.
You can try it using telnet.

  1. telnet echo.bora.sh 1337

Development

To run tests,

  1. go test ./... -v -cover -count=1 -race

To run server,

  1. go run ./cmd --address :1337

To run server with Docker,

  1. docker build -t echo .
  1. docker run --rm -i -t -p 1337:1337 echo --address :1337