Add Gopherspace crawling!

This commit is contained in:
2025-02-26 10:35:28 +02:00
parent 29877cb2da
commit d89dd72fe9
3 changed files with 613 additions and 0 deletions

32
gopher/errors.go Normal file
View File

@@ -0,0 +1,32 @@
package gopher
import (
"gemini-grc/errors"
)
// GopherError is an error encountered while
// visiting a Gopher host, and is only for
// Gopher errors (item type indicator 3).
type GopherError struct {
Err error
}
func (e *GopherError) Error() string {
return e.Err.Error()
}
func (e *GopherError) Unwrap() error {
return e.Err
}
func NewGopherError(err error) error {
return &GopherError{Err: err}
}
func IsGopherError(err error) bool {
if err == nil {
return false
}
var asError *GopherError
return errors.As(err, &asError)
}