worker

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2024 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var EXTENSIONS = []string{".js", ".ts", ".jsx", ".tsx"}
View Source
var SMALLWEB_ROOT string
View Source
var SmallwebDir string

Functions

func DenoExecutable

func DenoExecutable() (string, error)

func FileExists

func FileExists(parts ...string) bool

func GetFreePort

func GetFreePort() (int, error)

GetFreePort asks the kernel for a free open port that is ready to use.

Types

type Config

type Config struct {
	Permissions Permissions `json:"permissions"`
}

type FetchInput

type FetchInput struct {
	Entrypoint string     `json:"entrypoint"`
	Port       int        `json:"port"`
	Url        string     `json:"url"`
	Headers    [][]string `json:"headers"`
	Method     string     `json:"method"`
}

type Permission

type Permission struct {
	All   bool     `json:"all"`
	Allow []string `json:"allow"`
	Deny  []string `json:"deny"`
}

func (*Permission) UnmarshalJSON

func (p *Permission) UnmarshalJSON(data []byte) error

type Permissions

type Permissions struct {
	All   bool       `json:"all"`
	Read  Permission `json:"read"`
	Write Permission `json:"write"`
	Net   Permission `json:"net"`
	Env   Permission `json:"env"`
	Run   Permission `json:"run"`
	Sys   Permission `json:"sys"`
	Ffi   Permission `json:"ffi"`
}

func (*Permissions) Flags

func (p *Permissions) Flags(rootDir string) []string

type Worker

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

func NewWorker

func NewWorker(alias string) (*Worker, error)

func (*Worker) Cmd

func (me *Worker) Cmd(args ...string) (*exec.Cmd, error)

func (*Worker) LoadPermission

func (me *Worker) LoadPermission() (*Permissions, error)

func (*Worker) Run

func (me *Worker) Run(runArgs []string) error

func (*Worker) ServeHTTP

func (me *Worker) ServeHTTP(w http.ResponseWriter, r *http.Request)

type WorkerEntrypoints

type WorkerEntrypoints struct {
	Http string
	Cli  string
}

Jump to

Keyboard shortcuts

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