linkchecker

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2022 License: MIT Imports: 14 Imported by: 0

README

link-cheker is a tool to check for broken links. By specifying the URL of the page you want to check, you can display a list of broken URLs.

スクリーンショット 2022-02-06 22 14 59

usage

$ go run cmd/link-checker/main.go -u='{check page URL}'

By default, links with an HTTP status of 400 or higher will be displayed. If you want to display HTTP status 200 links as well, add -a option.

$ go run cmd/link-checker/main.go -u='{check page URL}' -a

-t option can be set to set the request interval. Default value is 100(ms). For example, if you want to make two requests in one second, you can do the following:

$ go run cmd/link-checker/main.go -u='{check page URL}' -t 500

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Exec

func Exec(pageURL string, all bool, interval int) error

Types

type AnchorNode

type AnchorNode struct {
	Href string
	Text string
}

func (*AnchorNode) URL

func (n *AnchorNode) URL() (string, error)

type CheckResults

type CheckResults struct {
	AnchorResults []*Result
	ImgResults    []*Result
	// contains filtered or unexported fields
}

func CheckPage

func CheckPage(r io.Reader, host, scheme string, interval int) (*CheckResults, error)

type Font

type Font struct {
	// contains filtered or unexported fields
}

func NewFont

func NewFont() *Font

func (*Font) Bold

func (f *Font) Bold(t string) string

func (*Font) Green

func (f *Font) Green(t string) string

func (*Font) Greenf

func (f *Font) Greenf(t string, args ...interface{}) string

func (*Font) Red

func (f *Font) Red(t string) string

func (*Font) Redf

func (f *Font) Redf(t string, args ...interface{}) string

func (*Font) Yellow

func (f *Font) Yellow(t string) string

func (*Font) Yellowf

func (f *Font) Yellowf(t string, args ...interface{}) string

type IOStream

type IOStream struct {
	In     io.ReadCloser
	Out    io.Writer
	ErrOut io.Writer
	// contains filtered or unexported fields
}

func NewIOStream

func NewIOStream() *IOStream

func (*IOStream) StartIndicator

func (s *IOStream) StartIndicator()

func (*IOStream) StopIndicator

func (s *IOStream) StopIndicator()

type ImgNode

type ImgNode struct {
	Src string
	Alt string
}

func (*ImgNode) URL

func (n *ImgNode) URL() (string, error)

type Node

type Node interface {
	URL() (string, error)
}

func Parse

func Parse(r io.Reader) ([]Node, error)

type Result

type Result struct {
	Text   string
	Status int
}

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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