Documentation ¶
Index ¶
- Constants
- Variables
- func File(status types.Status, contents io.Reader) *types.Response
- func GuessItemType(filepath string) types.Status
- func NewResponseReader(response *types.Response) types.ResponseReader
- func NewServer(ctx context.Context, hostname string, network string, address string, ...) (types.Server, error)
- func NewTLSServer(ctx context.Context, hostname string, network string, address string, ...) (types.Server, error)
- func ParseRequest(rdr io.Reader) (*types.Request, error)
- type Client
- type MapDocument
- type MapItem
Constants ¶
const ( TextFileType types.Status = '0' MenuType types.Status = '1' CSOPhoneBookType types.Status = '2' ErrorType types.Status = '3' MacBinHexType types.Status = '4' DosBinType types.Status = '5' UuencodedType types.Status = '6' SearchType types.Status = '7' TelnetSessionType types.Status = '8' BinaryFileType types.Status = '9' MirrorServerType types.Status = '+' GifFileType types.Status = 'g' ImageFileType types.Status = 'I' Telnet3270Type types.Status = 'T' )
The Canonical gopher item types.
const ( BitmapType types.Status = ':' MovieFileType types.Status = ';' SoundFileType types.Status = '<' )
The gopher+ types.
const ( DocumentType types.Status = 'd' HTMLType types.Status = 'h' InfoMessageType types.Status = 'i' PngImageFileType types.Status = 'p' RtfDocumentType types.Status = 'r' WavSoundFileType types.Status = 's' PdfDocumentType types.Status = 'P' XmlDocumentType types.Status = 'X' )
The various non-canonical gopher types.
Variables ¶
var ServerProtocol types.ServerProtocol = proto{}
Functions ¶
func File ¶
File builds a minimal response delivering a file's contents.
Meta is nil in this response.
func GuessItemType ¶ added in v1.3.0
GuessItemType attempts to find the best gopher item type for a file based on its name.
func NewResponseReader ¶
func NewResponseReader(response *types.Response) types.ResponseReader
NewResponseReader produces a reader which supports reading gopher protocol responses.
func NewServer ¶
func NewServer( ctx context.Context, hostname string, network string, address string, handler types.Handler, baseLog logging.Logger, ) (types.Server, error)
NewServer builds a gopher server.
func NewTLSServer ¶ added in v1.5.0
func NewTLSServer( ctx context.Context, hostname string, network string, address string, handler types.Handler, baseLog logging.Logger, tlsConfig *tls.Config, ) (types.Server, error)
NewTLSServer builds a gopher server which serves gopher over tls-encrypted connections.
Types ¶
type Client ¶
type Client struct{}
Client is used for sending gopher requests and producing the responses.
It carries no state and is reusable simultaneously by multiple goroutines.
The zero value is immediately usable.
type MapDocument ¶
type MapDocument []MapItem
MapDocument is a list of map items which can print out a full gophermap document.
func (MapDocument) Response ¶
func (md MapDocument) Response() *types.Response
Response builds a gopher response containing the gophermap.
Meta will be the MapDocument itself.
func (MapDocument) String ¶
func (md MapDocument) String() string
String serializes the document into gophermap format.
type MapItem ¶
type MapItem struct { Type types.Status Display string Selector string Hostname string Port string }
MapItem is a single item in a gophermap.