Skip to Content
Hands-On Software Engineering with Golang
book

Hands-On Software Engineering with Golang

by Achilleas Anagnostopoulos
January 2020
Intermediate to advanced
640 pages
16h 56m
English
Packt Publishing
Content preview from Hands-On Software Engineering with Golang

Fetching the contents of graph links

The link fetcher serves as the first stage of the crawler pipeline. It operates on Payload values emitted by the input source and attempts to retrieve the contents of each link by sending out HTTP GET requests. The retrieved link web page contents are stored within the payload's RawContent field and made available to the following stages of the pipeline.

Let's now take a look at the definition of the linkFetcher type and its associated methods:

type linkFetcher struct {
    urlGetter URLGetter
    netDetector PrivateNetworkDetector
}

func newLinkFetcher(urlGetter URLGetter, netDetector PrivateNetworkDetector) *linkFetcher {
    return &linkFetcher{
        urlGetter: urlGetter,
        netDetector: netDetector,
    }
}

func (lf *linkFetcher) ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Hands-On Software Architecture with Golang

Hands-On Software Architecture with Golang

Jyotiswarup Raiturkar

Publisher Resources

ISBN: 9781838554491Supplemental Content