185 lines
6.0 KiB
Go
185 lines
6.0 KiB
Go
|
// Code generated by vfsgen; DO NOT EDIT.
|
|||
|
|
|||
|
package gen
|
|||
|
|
|||
|
import (
|
|||
|
"bytes"
|
|||
|
"compress/gzip"
|
|||
|
"fmt"
|
|||
|
"io"
|
|||
|
"io/ioutil"
|
|||
|
"net/http"
|
|||
|
"os"
|
|||
|
pathpkg "path"
|
|||
|
"time"
|
|||
|
)
|
|||
|
|
|||
|
// Assets statically implements the virtual filesystem provided to vfsgen.
|
|||
|
var Assets = func() http.FileSystem {
|
|||
|
fs := vfsgen۰FS{
|
|||
|
"/": &vfsgen۰DirInfo{
|
|||
|
name: "/",
|
|||
|
modTime: time.Date(2018, 8, 2, 2, 1, 27, 751097893, time.UTC),
|
|||
|
},
|
|||
|
"/index.tpl": &vfsgen۰CompressedFileInfo{
|
|||
|
name: "index.tpl",
|
|||
|
modTime: time.Date(2018, 8, 2, 2, 1, 27, 751448710, time.UTC),
|
|||
|
uncompressedSize: 563,
|
|||
|
|
|||
|
compressedContent: []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xe4\xd0\xbd\x4e\xc3\x30\x10\x07\xf0\x3d\x4f\x71\xba\xa5\x20\xa1\x5a\xdd\x6d\x4f\x3c\x06\x8b\x93\x1c\x38\x22\xfe\x90\x7d\x46\x74\x83\x8d\x81\x8e\x9d\xd8\x98\x19\x3a\x31\x20\x10\x2f\x43\xa2\x3e\x06\x2a\x19\x22\x21\x10\x0f\xc0\x66\x59\xf7\xf1\xbf\x9f\xb4\x2b\xbd\x7f\x7b\x1a\x37\x8f\xc3\xe6\x76\xff\xfe\x30\xdc\x3d\x4b\x61\x57\xba\x92\xe7\x21\x39\x30\x0d\x77\xc1\x2b\x6c\x11\x1c\xb1\x0d\xad\xc2\x18\x32\xa3\xae\x00\x00\x64\xe7\x63\x61\xe0\x75\x24\x85\x4c\xd7\x8c\xe0\x8d\x23\x85\xb9\x31\x3d\x21\x04\x7f\x49\xeb\x12\x15\xb2\xed\xf2\xf2\xca\xf4\x85\xd4\xfc\x5c\x26\x8a\xbd\x69\xe8\x48\x9c\x9d\x8a\x8b\x93\xc5\xe2\x18\xe1\xeb\xc3\x86\xbe\xa5\xa4\x70\x8a\x33\x6e\x77\x28\xb4\xac\xd3\x1f\x3b\x5b\xc3\xe6\xdb\x80\x71\xbb\x1b\x6e\x5e\x51\xfc\xd0\x99\x4b\xed\x3a\x46\x98\x42\xe1\x44\x70\xa8\x94\xe2\x70\xb8\xae\xaa\x59\xe6\xe3\xe5\xfe\x77\x99\xfa\x7f\xc8\xc0\x4c\xf3\x19\x00\x00\xff\xff\xac\x32\x6c\x93\x33\x02\x00\x00"),
|
|||
|
},
|
|||
|
}
|
|||
|
fs["/"].(*vfsgen۰DirInfo).entries = []os.FileInfo{
|
|||
|
fs["/index.tpl"].(os.FileInfo),
|
|||
|
}
|
|||
|
|
|||
|
return fs
|
|||
|
}()
|
|||
|
|
|||
|
type vfsgen۰FS map[string]interface{}
|
|||
|
|
|||
|
func (fs vfsgen۰FS) Open(path string) (http.File, error) {
|
|||
|
path = pathpkg.Clean("/" + path)
|
|||
|
f, ok := fs[path]
|
|||
|
if !ok {
|
|||
|
return nil, &os.PathError{Op: "open", Path: path, Err: os.ErrNotExist}
|
|||
|
}
|
|||
|
|
|||
|
switch f := f.(type) {
|
|||
|
case *vfsgen۰CompressedFileInfo:
|
|||
|
gr, err := gzip.NewReader(bytes.NewReader(f.compressedContent))
|
|||
|
if err != nil {
|
|||
|
// This should never happen because we generate the gzip bytes such that they are always valid.
|
|||
|
panic("unexpected error reading own gzip compressed bytes: " + err.Error())
|
|||
|
}
|
|||
|
return &vfsgen۰CompressedFile{
|
|||
|
vfsgen۰CompressedFileInfo: f,
|
|||
|
gr: gr,
|
|||
|
}, nil
|
|||
|
case *vfsgen۰DirInfo:
|
|||
|
return &vfsgen۰Dir{
|
|||
|
vfsgen۰DirInfo: f,
|
|||
|
}, nil
|
|||
|
default:
|
|||
|
// This should never happen because we generate only the above types.
|
|||
|
panic(fmt.Sprintf("unexpected type %T", f))
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
// vfsgen۰CompressedFileInfo is a static definition of a gzip compressed file.
|
|||
|
type vfsgen۰CompressedFileInfo struct {
|
|||
|
name string
|
|||
|
modTime time.Time
|
|||
|
compressedContent []byte
|
|||
|
uncompressedSize int64
|
|||
|
}
|
|||
|
|
|||
|
func (f *vfsgen۰CompressedFileInfo) Readdir(count int) ([]os.FileInfo, error) {
|
|||
|
return nil, fmt.Errorf("cannot Readdir from file %s", f.name)
|
|||
|
}
|
|||
|
func (f *vfsgen۰CompressedFileInfo) Stat() (os.FileInfo, error) { return f, nil }
|
|||
|
|
|||
|
func (f *vfsgen۰CompressedFileInfo) GzipBytes() []byte {
|
|||
|
return f.compressedContent
|
|||
|
}
|
|||
|
|
|||
|
func (f *vfsgen۰CompressedFileInfo) Name() string { return f.name }
|
|||
|
func (f *vfsgen۰CompressedFileInfo) Size() int64 { return f.uncompressedSize }
|
|||
|
func (f *vfsgen۰CompressedFileInfo) Mode() os.FileMode { return 0444 }
|
|||
|
func (f *vfsgen۰CompressedFileInfo) ModTime() time.Time { return f.modTime }
|
|||
|
func (f *vfsgen۰CompressedFileInfo) IsDir() bool { return false }
|
|||
|
func (f *vfsgen۰CompressedFileInfo) Sys() interface{} { return nil }
|
|||
|
|
|||
|
// vfsgen۰CompressedFile is an opened compressedFile instance.
|
|||
|
type vfsgen۰CompressedFile struct {
|
|||
|
*vfsgen۰CompressedFileInfo
|
|||
|
gr *gzip.Reader
|
|||
|
grPos int64 // Actual gr uncompressed position.
|
|||
|
seekPos int64 // Seek uncompressed position.
|
|||
|
}
|
|||
|
|
|||
|
func (f *vfsgen۰CompressedFile) Read(p []byte) (n int, err error) {
|
|||
|
if f.grPos > f.seekPos {
|
|||
|
// Rewind to beginning.
|
|||
|
err = f.gr.Reset(bytes.NewReader(f.compressedContent))
|
|||
|
if err != nil {
|
|||
|
return 0, err
|
|||
|
}
|
|||
|
f.grPos = 0
|
|||
|
}
|
|||
|
if f.grPos < f.seekPos {
|
|||
|
// Fast-forward.
|
|||
|
_, err = io.CopyN(ioutil.Discard, f.gr, f.seekPos-f.grPos)
|
|||
|
if err != nil {
|
|||
|
return 0, err
|
|||
|
}
|
|||
|
f.grPos = f.seekPos
|
|||
|
}
|
|||
|
n, err = f.gr.Read(p)
|
|||
|
f.grPos += int64(n)
|
|||
|
f.seekPos = f.grPos
|
|||
|
return n, err
|
|||
|
}
|
|||
|
func (f *vfsgen۰CompressedFile) Seek(offset int64, whence int) (int64, error) {
|
|||
|
switch whence {
|
|||
|
case io.SeekStart:
|
|||
|
f.seekPos = 0 + offset
|
|||
|
case io.SeekCurrent:
|
|||
|
f.seekPos += offset
|
|||
|
case io.SeekEnd:
|
|||
|
f.seekPos = f.uncompressedSize + offset
|
|||
|
default:
|
|||
|
panic(fmt.Errorf("invalid whence value: %v", whence))
|
|||
|
}
|
|||
|
return f.seekPos, nil
|
|||
|
}
|
|||
|
func (f *vfsgen۰CompressedFile) Close() error {
|
|||
|
return f.gr.Close()
|
|||
|
}
|
|||
|
|
|||
|
// vfsgen۰DirInfo is a static definition of a directory.
|
|||
|
type vfsgen۰DirInfo struct {
|
|||
|
name string
|
|||
|
modTime time.Time
|
|||
|
entries []os.FileInfo
|
|||
|
}
|
|||
|
|
|||
|
func (d *vfsgen۰DirInfo) Read([]byte) (int, error) {
|
|||
|
return 0, fmt.Errorf("cannot Read from directory %s", d.name)
|
|||
|
}
|
|||
|
func (d *vfsgen۰DirInfo) Close() error { return nil }
|
|||
|
func (d *vfsgen۰DirInfo) Stat() (os.FileInfo, error) { return d, nil }
|
|||
|
|
|||
|
func (d *vfsgen۰DirInfo) Name() string { return d.name }
|
|||
|
func (d *vfsgen۰DirInfo) Size() int64 { return 0 }
|
|||
|
func (d *vfsgen۰DirInfo) Mode() os.FileMode { return 0755 | os.ModeDir }
|
|||
|
func (d *vfsgen۰DirInfo) ModTime() time.Time { return d.modTime }
|
|||
|
func (d *vfsgen۰DirInfo) IsDir() bool { return true }
|
|||
|
func (d *vfsgen۰DirInfo) Sys() interface{} { return nil }
|
|||
|
|
|||
|
// vfsgen۰Dir is an opened dir instance.
|
|||
|
type vfsgen۰Dir struct {
|
|||
|
*vfsgen۰DirInfo
|
|||
|
pos int // Position within entries for Seek and Readdir.
|
|||
|
}
|
|||
|
|
|||
|
func (d *vfsgen۰Dir) Seek(offset int64, whence int) (int64, error) {
|
|||
|
if offset == 0 && whence == io.SeekStart {
|
|||
|
d.pos = 0
|
|||
|
return 0, nil
|
|||
|
}
|
|||
|
return 0, fmt.Errorf("unsupported Seek in directory %s", d.name)
|
|||
|
}
|
|||
|
|
|||
|
func (d *vfsgen۰Dir) Readdir(count int) ([]os.FileInfo, error) {
|
|||
|
if d.pos >= len(d.entries) && count > 0 {
|
|||
|
return nil, io.EOF
|
|||
|
}
|
|||
|
if count <= 0 || count > len(d.entries)-d.pos {
|
|||
|
count = len(d.entries) - d.pos
|
|||
|
}
|
|||
|
e := d.entries[d.pos : d.pos+count]
|
|||
|
d.pos += count
|
|||
|
return e, nil
|
|||
|
}
|