A toy server that serve DNS and HTTP server (with websocket endpoint) to broadcast incoming text message and DNS request to the connected websocket clients.
- This server provides a DNS server on UDP port 53, each incoming DNS request will be broadcasted to all connected websocket clients. To demonstrate the server-to-client message.
- It also receives an incoming free text message from the WebSocket client and then the incoming message will also be broadcasted to all connected websocket clients. To demonstrate the client-to-server-to-client message.
This repo is a sample codes for sharing session, mainly to cover websocket and concurrent programming (using goroutine and channel)
Source code is vendored, you can just clone this repo and then:
GOOS=linux GOARCH=amd64 go build -trimpath -a -tags "osusergo,netgo" -ldflags '-extldflags=-static -w -s -v' -o ./build/server-linux ./main.go
./build/server-linux
MIT