gopher: github.com/peterhellberg/gopher Index | Files

package gopher

import "github.com/peterhellberg/gopher"

Index

Package Files

entry.go listing.go server.go

Variables

var Suffixes = map[string]byte{
    "aiff":     's',
    "au":       's',
    "c":        '0',
    "cfg":      '0',
    "cpp":      '0',
    "cs":       '0',
    "css":      '0',
    "csv":      '0',
    "gif":      'g',
    "go":       '0',
    "gpg":      '0',
    "h":        '0',
    "html":     'h',
    "ini":      '0',
    "java":     '0',
    "jpeg":     'I',
    "jpg":      'I',
    "js":       '0',
    "json":     '0',
    "log":      '0',
    "lua":      '0',
    "markdown": '0',
    "md":       '0',
    "mp3":      's',
    "php":      '0',
    "pl":       '0',
    "png":      'I',
    "py":       '0',
    "rb":       '0',
    "rss":      '0',
    "sh":       '0',
    "txt":      '0',
    "wav":      's',
    "xml":      '0',
}

Suffixes is a map of file extensions to item type characters

type Entry Uses

type Entry struct {
    Type     byte
    Display  string
    Selector string
    Hostname string
    Port     string
}

Entry for use in Gopher listings

func (Entry) String Uses

func (e Entry) String() string

String returns entry as a Gopher listing formatted string

type Listing Uses

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

Listing is a Gopher listing containing entries

func (Listing) String Uses

func (l Listing) String() string

String returns a Gopher listing formatted string

func (*Listing) VisitDir Uses

func (l *Listing) VisitDir(name, path, root, host, port string) error

VisitDir appends a dir entry to the list of entries in the listing

func (*Listing) VisitFile Uses

func (l *Listing) VisitFile(name, path, root, host, port string)

VisitFile appends a file entry to the list of entries in the listing

type Server Uses

type Server struct {
    Logger *log.Logger
    Host   string
    Port   string
    Addr   string
    Root   string
}

Server is a Gopher server

func (*Server) ErrorListing Uses

func (s *Server) ErrorListing(msg string) Listing

ErrorListing creates an error listing

func (*Server) ListenAndServe Uses

func (s *Server) ListenAndServe() error

ListenAndServe starts listening

func (*Server) Serve Uses

func (s *Server) Serve(c *net.TCPConn)

Serve Gopher clients

Package gopher imports 9 packages (graph). Updated 2018-04-11. Refresh now. Tools for package owners.