client

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: May 23, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package client contains utilities to make Gemini requests

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Response

type Response struct {
	// Data contains the raw data returned from the server.
	// TODO: implement function to pipe this straight to Gemtext parser
	Data []byte
	// MetaData contains the metadata of the response.
	// If StatusCode == 20, it is the MIME type associated with the data
	MetaData string
	// StatusCode contains the status code returned by the server.
	// If this is not 20, Data should be considered to be empty
	StatusCode int
}

A Response represents a Gemini response

func Request

func Request(address string, tlsConfig *tls.Config) (*Response, error)

Request sends a Gemini request to address tlsConfig will be removed in a future update. Per the tls.Client documentation,

The config cannot be nil: users must set either ServerName or InsecureSkipVerify in the config.

TODO: Does not currently handle redirects.

func TitanRequest added in v0.4.0

func TitanRequest(address string, tlsConfig *tls.Config, body []byte, token string, mime string) (*Response, error)

TitanRequest sends a request to a Titan server

If token or mime is not desired, an empty string can be passed. The same caveat for tlsConfig as Request applies.

Jump to

Keyboard shortcuts

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