libgemini

package
v0.0.0-...-2e3c079 Latest Latest
Warning

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

Go to latest
Published: May 19, 2020 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	STATUS_INPUT                  = 10
	STATUS_SUCCESS                = 20
	STATUS_SUCCESS_CERT           = 21
	STATUS_REDIRECT_TEMP          = 30
	STATUS_REDIRECT_PERM          = 31
	STATUS_TEMP_FAILURE           = 40
	STATUS_SERVER_UNAVAILABLE     = 41
	STATUS_CGI_ERROR              = 42
	STATUS_PROXY_ERROR            = 43
	STATUS_SLOW_DOWN              = 44
	STATUS_PERM_FAILURE           = 50
	STATUS_NOT_FOUND              = 51
	STATUS_GONE                   = 52
	STATUS_PROXY_REFUSED          = 53
	STATUS_BAD_REQUEST            = 59
	STATUS_CLIENT_CERT_EXPIRED    = 60
	STATUS_TRANSIENT_CERT_REQUEST = 61
	STATUS_AUTH_CERT_REQUIRED     = 62
	STATUS_CERT_REJECTED          = 63
	STATUS_FUTURE_CERT_REJECTED   = 64
	STATUS_EXPIRED_CERT_REJECTED  = 65
)
View Source
const (
	MIME_GEMINI     = "text/gemini"
	DEFAULT_MIME    = MIME_GEMINI
	DEFAULT_CHARSET = "utf-8"
)
View Source
const (
	RAW_TEXT    = GeminiDocSectionType(0)
	REFLOW_TEXT = GeminiDocSectionType(1)
	LINK        = GeminiDocSectionType(2)
	HEADING_1   = GeminiDocSectionType(3)
	HEADING_2   = GeminiDocSectionType(4)
	HEADING_3   = GeminiDocSectionType(5)
	LIST        = GeminiDocSectionType(6)
)
View Source
const (
	CRLF = "\r\n"
)

Variables

View Source
var (
	HeaderPattern        = regexp.MustCompile("^(\\d\\d)[ \\t]+(.*)$")
	LinkPattern          = regexp.MustCompile("^=>[ \\t]*([^ \\t]+)(?:[ \\t]+(.*))?$")
	ReflowModePattern    = regexp.MustCompile("^```(.*)$")
	Heading1Pattern      = regexp.MustCompile("^# *(.*)$")
	Heading2Pattern      = regexp.MustCompile("^## *(.*)$")
	Heading3Pattern      = regexp.MustCompile("^### *(.*)$")
	ListItemPattern      = regexp.MustCompile("^\\* *(.*)$")
	TermEscapeSGRPattern = regexp.MustCompile("�\\[\\d+(;\\d+)*m")
)

Functions

This section is empty.

Types

type GeminiDocSection

type GeminiDocSection struct {
	Type  GeminiDocSectionType
	Text  string
	URL   string
	Items []string
}

func ParseGeminiDocument

func ParseGeminiDocument(body *bytes.Buffer) (sections []GeminiDocSection)

type GeminiDocSectionType

type GeminiDocSectionType byte

func (GeminiDocSectionType) String

func (it GeminiDocSectionType) String() string
type Header struct {
	Status int
	Meta   string
}

func ParseHeader

func ParseHeader(line string) (header *Header, err error)

type Response

type Response struct {
	Header *Header
	Body   io.Reader
}

func Get

func Get(uri string) (*Response, error)

Jump to

Keyboard shortcuts

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