server

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2020 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type File

type File struct {
	// Path is optional if Name, Ext and MimeType are provided
	Path string

	// Name, Ext and MimeType are optional if Path is provided
	Name     string
	Ext      string
	MimeType string
	// contains filtered or unexported fields
}

File represents the file being transferred, whether its from an actual file or stdin. File also holds the files metadata.

func (*File) Close

func (f *File) Close() error

func (*File) Open

func (f *File) Open() error

func (*File) Read

func (f *File) Read(p []byte) (n int, err error)

type Server

type Server struct {
	Port     string
	ErrorLog *log.Logger
	InfoLog  *log.Logger
	Timeout  time.Duration // zero value -> max duration
	Done     chan struct{}
	// contains filtered or unexported fields
}

func NewServer

func NewServer(file *File) *Server

func (*Server) Serve

func (s *Server) Serve(ctx context.Context) error

func (*Server) ServeHTTP

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

func (*Server) Stop

func (s *Server) Stop(ctx context.Context) error

Jump to

Keyboard shortcuts

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