server

package
v0.0.0-...-07b64fa Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2019 License: MPL-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	IndexWidth  = 640
	IndexHeight = 320
)
View Source
const TileLimit uint = 1920 * 1200
View Source
const TileSize uint = 256
View Source
const TileURLTemplate = "{url}?t={mtime}&tile-x={x}&tile-y={y}&zoom={z}" // tile image: xy are in units of scaled tiles
View Source
const TileZoomMax int = 4
View Source
const TileZoomMin int = 0
View Source
const ViewURLTemplate = "{url}?w={w}&h={h}&x={x}&y={y}&zoom={z}" // fullscreen/linked view image: xy is the scaled center point of the wh viewport

Variables

This section is empty.

Functions

func TileURL

func TileURL(name string, format pngtile.ImageFormat, params TileParams) (string, error)

Types

type Config

type Config struct {
	TemplatePath string
	Path         string
}

func (Config) MakeServer

func (config Config) MakeServer() (*Server, error)

type Image

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

type ImageConfig

type ImageConfig struct {
	URL          string `json:"url"`
	ModifiedTime int    `json:"mtime"`
	TileURL      string `json:"tile_url"`
	TileSize     uint   `json:"tile_size"`
	TileZoom     int    `json:"tile_zoom"`
	ViewURL      string `json:"view_url"`
	ImageFormat  string `json:"image_format"`
	ImageWidth   uint   `json:"image_width"`
	ImageHeight  uint   `json:"image_height"`
}

type ImageResponse

type ImageResponse struct {
	Name   string
	Config ImageConfig
}

type IndexImage

type IndexImage struct {
	IndexItem
	// contains filtered or unexported fields
}

func (IndexImage) ImageURL

func (item IndexImage) ImageURL() string

type IndexItem

type IndexItem struct {
	Name string
}

func (IndexItem) Title

func (item IndexItem) Title() string

func (IndexItem) URL

func (item IndexItem) URL() string

type IndexResponse

type IndexResponse struct {
	Name  string
	Title string

	Breadcrumb []IndexItem
	Navigation []IndexItem
	Images     []IndexImage
}

type Server

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

func (*Server) Handle

func (server *Server) Handle(r *http.Request) (httpResponse, error)

func (*Server) HandleImage

func (server *Server) HandleImage(r *http.Request, name string) (httpResponse, error)

func (*Server) HandleImageTile

func (server *Server) HandleImageTile(r *http.Request, name string, query url.Values) (httpResponse, error)

func (*Server) HandleIndex

func (server *Server) HandleIndex(r *http.Request, name string) (httpResponse, error)

func (*Server) ImageInfo

func (server *Server) ImageInfo(name string) (pngtile.ImageInfo, error)

func (*Server) ImageTile

func (server *Server) ImageTile(name string, params pngtile.TileParams) ([]byte, error)

func (*Server) Images

func (server *Server) Images(name string) ([]string, error)

func (*Server) List

func (server *Server) List(name string) (dirs []string, images []string, err error)

func (*Server) Lookup

func (server *Server) Lookup(url string, forceExt string) (path, name, ext string, err error)

func (*Server) Path

func (server *Server) Path(url, suffix string) (string, error)

func (*Server) ServeHTTP

func (server *Server) ServeHTTP(w http.ResponseWriter, r *http.Request)

func (*Server) URL

func (server *Server) URL(name string) string

type TileParams

type TileParams struct {
	Time   int  `schema:"t"`
	Width  uint `schema:"w"`
	Height uint `schema:"h"`
	TileX  uint `schema:"tile-x"`
	TileY  uint `schema:"tile-y"`
	X      uint `schema:"x"`
	Y      uint `schema:"y"`
	Zoom   int  `schema:"zoom"`
}

Jump to

Keyboard shortcuts

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