echo-service

command module
v1.0.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 12, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

README

Simple echo service

Build and Test Build Release CodeQL

Plain and very simple echo service usefully for testing infrastructure components.

A docker image is available on Docker Hub and ghcr.io.

Build & Test

Install the latest go version: https://go.dev/doc/install

Compilation can be done via go build -v ./..., Tests via go test -v ./...

Usage

The binary can be started via ./echo-service. By default, it listens on port 8080. You can change the listen port by setting the environment variable echo_service_port

If called with a Chrome browser this is the output:

{
  "http": {
    "method": "GET",
    "protocol": "HTTP/1.1",
    "host": "localhost:8080"
  },
  "header": {
    "Accept": [
      "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9"
    ],
    "Accept-Encoding": [
      "gzip, deflate, br"
    ],
    "Accept-Language": [
      "de-DE,de;q=0.9,en-US;q=0.8,en;q=0.7"
    ],
    "Connection": [
      "keep-alive"
    ],
    "Dnt": [
      "1"
    ],
    "Sec-Ch-Ua": [
      "\"Not_A Brand\";v=\"99\", \"Google Chrome\";v=\"109\", \"Chromium\";v=\"109\""
    ],
    "Sec-Ch-Ua-Mobile": [
      "?0"
    ],
    "Sec-Ch-Ua-Platform": [
      "\"macOS\""
    ],
    "Sec-Fetch-Dest": [
      "document"
    ],
    "Sec-Fetch-Mode": [
      "navigate"
    ],
    "Sec-Fetch-Site": [
      "none"
    ],
    "Sec-Fetch-User": [
      "?1"
    ],
    "Upgrade-Insecure-Requests": [
      "1"
    ],
    "User-Agent": [
      "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36"
    ]
  },
  "remoteAddress": "[::1]:60259",
  "request": {
    "requestURI": "/foo/bar?q=v",
    "path": "/foo/bar",
    "queryString": "q=v",
    "body": ""
  }
}

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL