Documentation ¶
Overview ¶
Package client retrieves data over Gemini and implements a TOFU system.
Index ¶
- Variables
- func Fetch(u string) (*gemini.Response, error)
- func FetchWithProxy(proxyHostname, proxyPort, u string) (*gemini.Response, error)
- func FixUserURL(u string) string
- func GetExpiry(domain, port string) time.Time
- func HasClientCert(host string, path string) bool
- func Init() error
- func NormalizeURL(u string) string
- func ResetTofuEntry(domain, port string, cert *x509.Certificate)
Constants ¶
This section is empty.
Variables ¶
var ErrTofu = errors.New("server cert does not match TOFU database")
Functions ¶
func Fetch ¶
Fetch returns response data and an error. The error text is human friendly and should be displayed.
func FetchWithProxy ¶
FetchWithProxy is the same as Fetch, but uses a proxy.
func FixUserURL ¶
FixUserURL will take a user-typed URL and add a gemini scheme to it if necessary. It is not the same as normalizeURL, and that func should still be used, afterward.
For example "example.com" will become "gemini://example.com", but "//example.com" will be left untouched.
func GetExpiry ¶
GetExpiry returns the stored expiry date for the given host. The time will be empty (zero) if there is not expiry date stored for that host.
func HasClientCert ¶
HasClientCert returns whether or not a client certificate exists for a host and path.
func NormalizeURL ¶
NormalizeURL attempts to make URLs that are different strings but point to the same place all look the same.
Example: gemini://gus.guru:1965/ and //gus.guru/. This function will take both output the same URL each time.
It will also percent-encode invalid characters, and decode chars that don't need to be encoded. It will also apply Unicode NFC normalization.
The string passed must already be confirmed to be a URL. Detection of a search string vs. a URL must happen elsewhere.
It only works with absolute URLs.
func ResetTofuEntry ¶
func ResetTofuEntry(domain, port string, cert *x509.Certificate)
ResetTofuEntry forces the cert passed to be valid, overwriting any previous TOFU entry. The port string can be empty, to indicate port 1965.
Types ¶
This section is empty.