MCPcopy Create free account
hub / github.com/TheThingsNetwork/lorawan-stack / FromHTTP

Function FromHTTP

pkg/fetch/http.go:64–83  ·  view source on GitHub ↗

FromHTTP returns an object to fetch files from a webserver.

(client *http.Client, rootURL string)

Source from the content-addressed store, hash-verified

62
63// FromHTTP returns an object to fetch files from a webserver.
64func FromHTTP(client *http.Client, rootURL string) (Interface, error) {
65 var root *url.URL
66 if rootURL != "" {
67 var err error
68 root, err = url.Parse(rootURL)
69 if err != nil {
70 return nil, err
71 }
72 if !root.IsAbs() {
73 return nil, errSchemeNotSpecified.New()
74 }
75 }
76 return httpFetcher{
77 baseFetcher: baseFetcher{
78 latency: fetchLatency.WithLabelValues("http", rootURL),
79 },
80 httpClient: client,
81 root: root,
82 }, nil
83}

Callers 11

ExampleFunction · 0.92
TestHTTPFunction · 0.92
FetcherMethod · 0.92
ExampleFunction · 0.92
FetcherMethod · 0.92
NewTemplateStoreMethod · 0.92
FetcherMethod · 0.92
FetcherMethod · 0.92
FetcherMethod · 0.92
FetcherMethod · 0.92

Calls 3

ParseMethod · 0.65
NewMethod · 0.65
WithLabelValuesMethod · 0.45

Tested by 4

ExampleFunction · 0.74
TestHTTPFunction · 0.74
ExampleFunction · 0.74