在项目中经常需要查看被访问的 HTTP 接口携带的 HTTP HEAD 接口.这里我们就可以采用 Whoami 来进行为简单的接收平台.
Hostname: 028c056bf96b
IP: 127.0.0.1
IP: ::1
IP: 192.168.215.5
RemoteAddr: 192.168.215.1:43620
GET / HTTP/1.1
Host: localhost
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36
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.7
Accept-Encoding: gzip, deflate, br, zstd
Accept-Language: zh-CN,zh;q=0.9,en;q=0.8
Cache-Control: max-age=0
Connection: keep-alive
Sec-Ch-Ua: "Chromium";v="128", "Not;A=Brand";v="24", "Google Chrome";v="128"
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: 1Docker化安装
docker run -idt -p 80:80 --name some-whoami containous/whoami使用
Paths
/data?size=n[&unit=u]: creates a response with a sizen. The unit of measure, if specified, accepts the following values:KB,MB,GB,TB(optional, default: bytes)./echo: webSocket echo./bench: always return the same response (1)./[?wait=d]: returns the whoami information (request and network information). The optionalwaitquery parameter can be provided to tell the server to wait before sending the response. The duration is expected in Go'stime.Duration format (e.g./?wait=100msto wait 100 milliseconds)./api: returns the whoami information as JSON./health: heath checkGET,HEAD, ...: returns a response with the status code defined by thePOSTPOST: changes the status code of theGET(HEAD, ...) response.
Flags
cert: give me a certificate.key: give me a key.port: give me a port number. (default: 80)name: give me a name. (it can be also defined withWHOAMI_NAMEenvironment variable)
评论