https://github.com/wlanboy/gosimplehttpserver
Golang http server with logging and gracefull shutdown
https://github.com/wlanboy/gosimplehttpserver
agent golang hostname ip mux
Last synced: 12 months ago
JSON representation
Golang http server with logging and gracefull shutdown
- Host: GitHub
- URL: https://github.com/wlanboy/gosimplehttpserver
- Owner: wlanboy
- License: apache-2.0
- Created: 2020-04-05T08:02:33.000Z (about 6 years ago)
- Default Branch: main
- Last Pushed: 2024-05-04T10:15:29.000Z (about 2 years ago)
- Last Synced: 2024-12-29T12:58:13.309Z (over 1 year ago)
- Topics: agent, golang, hostname, ip, mux
- Language: Go
- Size: 52.7 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
 
# gosimplehttpserver
Golang http server with logging and gracefull shutdown
- 'root' folder with mux and gracefull shutdown
- 'basic' subfolder without mux and gracefull shutdown
# build
* go get -d -v
* go clean
* go build
# run
* go run ip.go
# debug
* go get -u github.com/go-delve/delve/cmd/dlv
* dlv debug ./ip
# go lang build for different boards
- GOOS=linux GOARCH=386 go build (386 needed for busybox)
- GOOS=linux GOARCH=arm GOARM=6 go build (Raspberry Pi build)
- GOOS=linux GOARCH=arm64 go build (Odroid C2 build)
# go lang build for docker
- CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -v .
# docker build
docker build -t gosimplehttpserver:latest . --build-arg BIN_FILE=./gosimplehttpserver
## Docker publish to github registry
- docker tag gosimplehttpserver:latest docker.pkg.github.com/wlanboy/gosimplehttpserver/gosimplehttpserver:latest
- docker push docker.pkg.github.com/wlanboy/gosimplehttpserver/gosimplehttpserver:latest
## Docker hub
- https://hub.docker.com/repository/docker/wlanboy/gosimplehttpserver
## Docker Registry repro
- https://github.com/wlanboy/gosimplehttpserver/packages/278511
# docker run
docker run --name gosimplehttpserver -p 7000:7000 wlanboy/gosimplehttpserver
# calls
* curl http://127.0.0.1:7000/ip
* curl http://127.0.0.1:7000/host
* curl http://127.0.0.1:7000/agent
* curl -H "hello: world" http://127.0.0.1:7000/header
* curl http://127.0.0.1:7000/dump to get the dump of the whole http request object
* http://127.0.0.1:7000/ to get pastebin homepage
* curl -X POST -F 'code=myprettylittleinformation' http://127.0.0.1:7000/paste to create a paste