gostat

command module
v1.2.6 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2023 License: MIT Imports: 1 Imported by: 0

README



govpn-logo

GitHub tag (latest SemVer) Go Report Card Codacy Badge Maintainability circle ci

Overview

This is an interactive CLI tool that uses the net/http package to make an HTTP GET request to a specific URL and checks the latency step by step. It also displays brief information on request and response headers.

It can be useful for testing purposes before transferring to a CNAME record of a domain that uses a CDN domain.

overview

gostat request https://ghdwlsgur.github.io/ -d

Why

The motivation for creating this tool was that while using the curl command to inspect HTTP GET responses, I found that the options I used became increasingly varied, and the command itself became longer. Personally, I had customized the command with the options I frequently used along with request headers in my zshrc script. However, instead of using this method, I wanted to create a tool with fixed options and request header values that I typically use. I wanted to create a tool that could be useful for others who may have similar concerns or team members who could benefit from it.

Korean Document

curl -vo /dev/null -H 'Range:bytes=0-1' --resolve 'naver.com:443:223. 130.195.95' 'https://www.naver.com/include/themecast/targetAndPanels.json'

Installation

homebrew
# [install]
brew tap ghdwlsgur/gostat
brew install gostat

# [upgrade]
brew update --verbose
brew upgrade gostat
Download

Compare

/etc/hosts
1.1.1.1 example.com
gostat
gostat request https://example.com/test.txt -t 1.1.1.1

The gostat command does not make a request to the host IP of example.com, but rather maps it to 1.1.1.1 in the /etc/hosts file and then queries DNS for the host IP. This allows you to check the response code and response headers for the HTTP GET method request.

curl
curl -k -I https://185.199.108.153/assets/js/runtime\~main.873fd742.js -H "Host: ghdwlsgur.github.io" -H "Range: bytes=0-1"
gostat
gostat request https://ghdwlsgur.github.io/assets/js/runtime\~main.873fd742.js -t 185.199.108.153
curl
curl -vo /dev/null -H 'Range:bytes=0-1' --resolve 'naver.com:443:223.130.195.95' 'https://www.naver.com/include/themecast/targetAndPanels.json'
gostat
gostat request https://www.naver.com/include/themecast/targetAndPanels.json -t 223.130.195.95

If you primarily use the HTTP GET method, gostat may be more intuitive and convenient to use than the curl command, which behaves in the same way.

How to use

Simple

gostat request [URL]

# Example
gostat request https://www.naver.com

Target (domain / ip)

gostat request [URL] -t [Target(domain or ip)]

# Example
gostat request https://www.naver.com -t naver.com
gostat request https://www.naver.com -t 223.130.200.104

Request Header (Referer)

gostat request [URL] -t [Target] -r [Referer]

# Example
gostat request https://www.naver.com -t naver.com -r http://naver.com

Request Header (Host)

gostat request [URL] -t [Target] -H [Host]

# Example
gostat request https://www.naver.com -H naver.com

Request Header (Authorization)

gostat request [URL] -A [Authorization]

License

gossl is licensed under the MIT

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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