mirror of
https://github.com/makeworld-the-better-one/amfora.git
synced 2024-11-23 09:43:33 +03:00
21 lines
463 B
Go
21 lines
463 B
Go
// Package client retrieves data over Gemini and implements a TOFU system.
|
|
package client
|
|
|
|
import (
|
|
"github.com/makeworld-the-better-one/go-gemini"
|
|
)
|
|
|
|
// Fetch returns response data and an error.
|
|
// The error text is human friendly and should be displayed.
|
|
func Fetch(url string) (*gemini.Response, error) {
|
|
resp, err := gemini.Fetch(url)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
ok := handleTofu(resp.Cert)
|
|
if !ok {
|
|
return nil, ErrTofu
|
|
}
|
|
return resp, err
|
|
}
|