check

package
v0.0.0-...-70fba2f Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2020 License: MIT Imports: 7 Imported by: 2

Documentation

Overview

Package check identifies if a given site is up or not. Data is from https://isitup.org.

Example: check := check.New("google.com")

check.IsUp() check.IP() check.Verbose()

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Check

type Check struct {
	Res    *IsUpResponse
	Req    *http.Request
	Client *http.Client
	// contains filtered or unexported fields
}

Check custom type for our package to check if a site is up or not.

func New

func New(site string) *Check

New returns a pointer to check that defines the different methods to check a site.

func (*Check) IP

func (c *Check) IP() string

IP returns the IP of the given site.

func (*Check) IsUp

func (c *Check) IsUp() bool

IsUp checks whether the given site is up or not.

func (*Check) Verbose

func (c *Check) Verbose() string

Verbose returns a prettified JSON format as a string. Example output:

{
    "domain": "google.com",
    "port": 80,
    "status_code": 1,
    "response_ip": "216.58.201.46",
    "response_code": 301,
    "response_time": 0.007
}

type IsUpResponse

type IsUpResponse struct {
	Domain       string  `json:"domain"`
	Port         int     `json:"port"`
	StatusCode   int     `json:"status_code"`
	ResponseIP   string  `json:"response_ip"`
	ResponseCode int     `json:"response_code"`
	ResponseTime float64 `json:"response_time"`
}

IsUpResponse represents the result of the site to check if its okay

func (IsUpResponse) String

func (iur IsUpResponse) String() string

Jump to

Keyboard shortcuts

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