taupe

package module
v0.0.0-...-50c3a40 Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2018 License: GPL-3.0 Imports: 12 Imported by: 1

README

taupe Build Status Coverage Status Go Report Card GoDoc

Simple gopher client (in Go)

Install it

go get -u github.com/LouisBrunner/taupe

Usage

Run the program with the server you want to visit, example:

taupe gopher://gopher.metafilter.com/

Screenshots

MetaFilter Homepage

MetaFilter FanFare

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Application

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

Application runs the different parts of the program together (UI, Network...)

func NewApplication

func NewApplication() *Application

NewApplication creates an Application with initialized internals

func (*Application) Run

func (app *Application) Run(address string)

Run starts the internals and ensure they stop correctly, `address` is the initial Gopher server requested

type Network

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

Network starts its own thread to handle network requests asynchronously

func NewNetwork

func NewNetwork() *Network

NewNetwork builds a valid Network structure with channels, etc

func (*Network) Request

func (network *Network) Request(address string) <-chan *NetworkEvent

Request sends a cancel event for the current request and starts a new request to the provided `address`

func (*Network) Start

func (network *Network) Start()

Start spawns the Network internal loop in a thread

func (*Network) Stop

func (network *Network) Stop()

Stop sends the stop event to the internal network thread

type NetworkEvent

type NetworkEvent struct {
	Event       NetworkEventType
	Result      *NetworkResult
	ResultHTML  *NetworkResultHTML
	ResultError error
}

NetworkEvent represents any answer from the Network

type NetworkEventType

type NetworkEventType int

NetworkEventType is a type of event that be returned by the NetworkManager

const (
	NetworkEventOK NetworkEventType = iota
	NetworkEventHTML
	NetworkEventError
)

Type of possible network results

type NetworkManager

type NetworkManager interface {
	Request(string) <-chan *NetworkEvent
}

NetworkManager is a class that can do Gopher requests

type NetworkResult

type NetworkResult struct {
	Address string
	List    []string
}

NetworkResult is a Gopher answer from a request to the NetworkManager class

type NetworkResultHTML

type NetworkResultHTML struct {
	Address string
	HTML    string
}

NetworkResultHTML is a HTML answer from a request to the NetworkManager class

type UI

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

UI represents the ncurses user interface that someone use to interact with the Gophernet

func NewUI

func NewUI(network NetworkManager) *UI

NewUI construct a UI correctly initialized

func (*UI) Run

func (ui *UI) Run(address string)

Run registers the UI with the Network (to get responses) and starts the internal loop

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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