lib

package
v0.0.0-...-15eb671 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	Timeout    = 5 * time.Minute
	MaxTimeout = Timeout*2 + 15*time.Second
)

Variables

View Source
var (
	Logger = log.New(os.Stdout, "", log.Ldate|log.Ltime)
)

Functions

func Await

func Await(wg *sync.WaitGroup) <-chan error

func Checksum

func Checksum(path string) (string, error)

func ChecksumPath

func ChecksumPath(prefix string) (string, error)

func ChecksumRead

func ChecksumRead(path string) (string, error)

func ChecksumWrite

func ChecksumWrite(path string, checksum string) error

func Contains

func Contains(parts []string, part string) bool

func DefaultConfPath

func DefaultConfPath() string

func Dir

func Dir(pth string) string

func Exists

func Exists(path string) (bool, error)

func IsChecksum

func IsChecksum(path string) bool

func Join

func Join(parts ...string) string

func KeyPrefix

func KeyPrefix(key string) string

func Last

func Last(parts []string) string

func NewTempPath

func NewTempPath(dir string) string

func OnThisServer

func OnThisServer(key string, this Server, servers []Server) (bool, error)

func ParseGlob

func ParseGlob(indir string) (string, string)

func QueryParam

func QueryParam(r *http.Request, name string) string

func QueryParamDefault

func QueryParamDefault(r *http.Request, name string, defaultVal string) string

func Recv

func Recv(w io.Writer, port chan<- string) (string, error)

func RecvFile

func RecvFile(path string, port chan<- string) (string, error)

func Retry

func Retry(fn func() error) error

func Send

func Send(r io.Reader, addr string, port string) (string, error)

func SendFile

func SendFile(path string, addr string, port string) (string, error)

func Suffix

func Suffix(keys []string) string

func With

func With(pool *semaphore.Weighted, fn func())

Types

type HTTPResult

type HTTPResult struct {
	StatusCode int
	Body       []byte
	Err        error
}

func Get

func Get(url string) *HTTPResult

func Post

func Post(url, contentType string, body io.Reader) *HTTPResult

type MapArgs

type MapArgs struct {
	Cmd    string `json:"cmd"`
	Indir  string `json:"indir"`
	Outdir string `json:"outidr"`
}

type RootHandler

type RootHandler struct {
	Handler func(w http.ResponseWriter, r *http.Request, this Server, servers []Server)
	This    Server
	Servers []Server
}

func (*RootHandler) ServeHTTP

func (h *RootHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

type Server

type Server struct {
	Address string
	Port    string
}

func GetServers

func GetServers(confPath string) ([]Server, error)

func PickServer

func PickServer(key string, servers []Server) (Server, error)

func ThisServer

func ThisServer(port int, servers []Server) Server

type WarnResult

type WarnResult struct {
	Stdout string
	Stderr string
	Err    error
}

func Warn

func Warn(format string, args ...interface{}) *WarnResult

type WarnResultTempdir

type WarnResultTempdir struct {
	Stdout  string
	Stderr  string
	Err     error
	Tempdir string
}

func WarnTempdir

func WarnTempdir(format string, args ...interface{}) *WarnResultTempdir

func WarnTempdirStreamIn

func WarnTempdirStreamIn(stdin io.Reader, format string, args ...interface{}) *WarnResultTempdir

Jump to

Keyboard shortcuts

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