server

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Dec 29, 2023 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Context

type Context struct {
	context.Context

	RemoteAddr net.Addr

	State
	// contains filtered or unexported fields
}

func (*Context) Close

func (s *Context) Close() error

type Handler

type Handler interface {
	HandleOpenDir(ctx *Context, path string) bool
	HandleReadDir(ctx *Context) []fs.FileInfo
	HandleReadDirEntry(ctx *Context) fs.FileInfo
	HandleStatFile(ctx *Context, path string) (fs.FileInfo, error)
	HandleOpenFile(ctx *Context, path string) error
	HandleCloseFile(ctx *Context)
	HandleReadFile(ctx *Context, limit uint32, offset uint64) LenReader
	HandleReadFileCritical(ctx *Context, limit uint32, offset uint64) (io.Reader, error)
	HandleCreateFile(ctx *Context, path string) error
	HandleWriteFile(ctx *Context, data io.Reader) (int32, error)
	HandleDeleteFile(ctx *Context, path string) error
	HandleMkdir(ctx *Context, path string) error
	HandleRmdir(ctx *Context, path string) error
	HandleGetDirSize(ctx *Context, path string) (int64, error)
}

type LenReader

type LenReader = proto.LenReader

type Server

type Server struct {
	Handler     Handler
	Copier      *copier.Copier
	ReadTimeout time.Duration

	// ConnContext optionally specifies a function that modifies
	// the context used for a new connection c.
	ConnContext func(ctx context.Context, c net.Conn) context.Context
}

func (*Server) Serve

func (s *Server) Serve(ln net.Listener) error

type SlogContextHandler added in v0.0.3

type SlogContextHandler struct {
	slog.Handler
}

SlogContextHandler wraps slog.Handler to inject attributes from Context.

func (*SlogContextHandler) Handle added in v0.0.3

func (h *SlogContextHandler) Handle(ctx context.Context, rec slog.Record) error

func (*SlogContextHandler) WithAttrs added in v0.0.3

func (h *SlogContextHandler) WithAttrs(attrs []slog.Attr) slog.Handler

func (*SlogContextHandler) WithGroup added in v0.0.3

func (h *SlogContextHandler) WithGroup(name string) slog.Handler

type State

type State struct {
	CwdHandle afero.File
	ROFile    afero.File
	WOFile    afero.File
}

Jump to

Keyboard shortcuts

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