summaryrefslogtreecommitdiff
path: root/fetch/gopher.go
diff options
context:
space:
mode:
authornytpu <alex@nytpu.com>2021-03-18 13:02:17 -0600
committernytpu <alex@nytpu.com>2021-03-18 13:02:17 -0600
commitf8601b82abe77e19fbe0c97a21f00540da39ac9f (patch)
tree0855e50f31d8997e10d8e6580939a902648d6ea6 /fetch/gopher.go
parent794b1fc04f350c4977c873e42752ccc0ecd0a98c (diff)
Use strings for URLs internally for consistency.
Diffstat (limited to 'fetch/gopher.go')
-rw-r--r--fetch/gopher.go11
1 files changed, 5 insertions, 6 deletions
diff --git a/fetch/gopher.go b/fetch/gopher.go
index 79b5a5b..5fe24ad 100644
--- a/fetch/gopher.go
+++ b/fetch/gopher.go
@@ -9,7 +9,6 @@ import (
"crypto/sha256"
"fmt"
"io"
- "net/url"
"time"
"github.com/prologic/go-gopher"
@@ -18,8 +17,8 @@ import (
)
// fetchGopher will make a request for a gopher resource
-func fetchGopher(remoteURL *url.URL) (*gopher.Response, error) {
- resp, err := gopher.Get(remoteURL.String())
+func fetchGopher(remote string) (*gopher.Response, error) {
+ resp, err := gopher.Get(remote)
if err != nil {
return nil, err
}
@@ -28,14 +27,14 @@ func fetchGopher(remoteURL *url.URL) (*gopher.Response, error) {
// gopherFeed will fetch and insert a new core.Feed into a core.FullData given a
// gopher url (or update if it's preexisting)
-func gopherFeed(data *core.FullData, remote *url.URL, title string) error {
+func gopherFeed(data *core.FullData, remote string, title string) error {
// TODO
return fmt.Errorf("Feeds served over gopher are currently unsupported.")
}
// gopherPage will fetch and insert a new core.Page into a core.FullData given a
// gopher url (or update if it's preexisting)
-func gopherPage(data *core.FullData, remote *url.URL, title string) error {
+func gopherPage(data *core.FullData, remote string, title string) error {
resp, err := fetchGopher(remote)
if err != nil {
return err
@@ -55,7 +54,7 @@ func gopherPage(data *core.FullData, remote *url.URL, title string) error {
var page core.Page
page.Title = title
- page.Link = remote.String()
+ page.Link = remote
h := sha256.New()
if _, err := io.Copy(h, reader); err != nil {
return err