pastehere

package
v0.0.0-...-51513de Latest Latest
Warning

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

Go to latest
Published: Dec 27, 2017 License: BSD-3-Clause Imports: 16 Imported by: 0

Documentation

Overview

Package pastehere implements a pastebin-like application.

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func Home

func Home(resp http.ResponseWriter, req *http.Request)

Home displays pastehere's homepage.

func Paste

func Paste(resp http.ResponseWriter, req *http.Request)

Paste receives a new paste from a client.

func Register

func Register(mux *http.ServeMux)

Register registers HTTP handlers for pastehere.

Example
package main

import (
	"flag"
	"log"
	"net/http"

	"github.com/remyoudompheng/go-misc/pastehere"
)

var address string

func init() {
	flag.StringVar(&address, "http", ":8080", "listen address")
}

func main() {
	flag.Parse()
	if address == "" {
		flag.Usage()
		return
	}
	log.Printf("start listening at %s", address)

	pastehere.Register(nil)
	err := http.ListenAndServe(address, nil)
	if err != nil {
		log.Fatal(err)
	}
}
Output:

func View

func View(resp http.ResponseWriter, req *http.Request)

View views a selected paste.

Types

type Item

type Item []byte

type Key

type Key [3]uint16

func ChooseKey

func ChooseKey() Key

ChooseKey chooses a random storage key.

func KeyFromStrings

func KeyFromStrings(s [3]string) Key

KeyFromStrings parses a triple of strings to a numerical key.

func (Key) String

func (k Key) String() string

Jump to

Keyboard shortcuts

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