gemini

package
v0.0.0-...-af80692 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 25, 2022 License: GPL-3.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const TextWidth = 80

Variables

View Source
var CertChanged = errors.New("cert has changed")
View Source
var NotFound = errors.New("cert not found")

Functions

func GenerateClientCertificate

func GenerateClientCertificate(certFile, keyFile string, config x509.Certificate) error

func ToANSI

func ToANSI(data string, availableWidth int, baseURL neturl.URL) (
	content string, links text.Links, title string)

ToANSI convert Gemtext to text suitable for terminal output with colors It returns the converted text, a list of links with vertical positions, and the title of the page the title defaults to given baseURL when not found in the page

Types

type CertStore

type CertStore struct {
	Certificates map[string]string
	// contains filtered or unexported fields
}

func Load

func Load(savePath string) (*CertStore, error)

func (*CertStore) Check

func (cs *CertStore) Check(host string, cert *x509.Certificate, skipVerify bool) error

type Client

type Client struct {
	// contains filtered or unexported fields
}

func NewClient

func NewClient(certsPath string, clientCert *tls.Certificate) (*Client, error)

func (*Client) LoadURL

func (client *Client) LoadURL(ctx context.Context, surl url.URL, skipVerify bool) (*Response, error)
type Header struct {
	Status, StatusDetail uint8
	Meta                 string
}
type Link struct {
	URL  string
	Name string
}
func ParseLink(line string) (*Link, error)

func (*Link) FullURL

func (l *Link) FullURL(parent string) string

type Response

type Response struct {
	Header Header
	URL    string
	Body   []byte
}

func (*Response) GetBody

func (r *Response) GetBody() (string, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL