cli

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2020 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var BuildDate = "n/a"
View Source
var Flags struct {
	HttpHost            string
	HttpPort            string
	HttpSock            string
	MaxSize             int64
	UploadDir           string
	Basepath            string
	Timeout             int64
	S3Bucket            string
	S3ObjectPrefix      string
	S3Endpoint          string
	GCSBucket           string
	GCSObjectPrefix     string
	EnabledHooksString  string
	FileHooksDir        string
	HttpHooksEndpoint   string
	HttpHooksRetry      int
	HttpHooksBackoff    int
	GrpcHooksEndpoint   string
	GrpcHooksRetry      int
	GrpcHooksBackoff    int
	HooksStopUploadCode int
	PluginHookPath      string
	EnabledHooks        []hooks.HookType
	ShowVersion         bool
	ExposeMetrics       bool
	MetricsPath         string
	BehindProxy         bool
	VerboseOutput       bool
}
View Source
var GitCommit = "n/a"
View Source
var MetricsHookErrorsTotal = prometheus.NewCounterVec(
	prometheus.CounterOpts{
		Name: "tusd_hook_errors_total",
		Help: "Total number of execution errors per hook type.",
	},
	[]string{"hooktype"},
)
View Source
var MetricsOpenConnections = prometheus.NewGauge(prometheus.GaugeOpts{
	Name: "tusd_connections_open",
	Help: "Current number of open connections.",
})
View Source
var VersionName = "n/a"

Functions

func CreateComposer

func CreateComposer()

func DisplayGreeting

func DisplayGreeting(w http.ResponseWriter, r *http.Request)

func NewListener

func NewListener(addr string, readTimeout, writeTimeout time.Duration) (net.Listener, error)

func NewUnixListener

func NewUnixListener(path string, readTimeout, writeTimeout time.Duration) (net.Listener, error)

Binds to a UNIX socket. If the file already exists, try to remove it before binding again. This logic is borrowed from Gunicorn (see https://github.com/benoitc/gunicorn/blob/a8963ef1a5a76f3df75ce477b55fe0297e3b617d/gunicorn/sock.py#L106)

func ParseFlags

func ParseFlags()

func PrepareGreeting

func PrepareGreeting()

func Serve

func Serve()

Setups the different components, starts a Listener and give it to http.Serve().

By default it will bind to the specified host/port, unless a UNIX socket is specified, in which case a different socket creation and binding mechanism is put in place.

func SetEnabledHooks

func SetEnabledHooks()

func SetupHookMetrics

func SetupHookMetrics()

func SetupMetrics

func SetupMetrics(handler *handler.Handler)

func SetupPostHooks

func SetupPostHooks(handler *handler.Handler)

func SetupPreHooks

func SetupPreHooks(config *handler.Config) error

func ShowVersion

func ShowVersion()

Types

type Conn

type Conn struct {
	net.Conn
	ReadTimeout  time.Duration
	WriteTimeout time.Duration
	// contains filtered or unexported fields
}

Conn wraps a net.Conn, and sets a deadline for every read and write operation.

func (*Conn) Close

func (c *Conn) Close() error

func (*Conn) Read

func (c *Conn) Read(b []byte) (int, error)

func (*Conn) Write

func (c *Conn) Write(b []byte) (int, error)

type Listener

type Listener struct {
	net.Listener
	ReadTimeout  time.Duration
	WriteTimeout time.Duration
}

Listener wraps a net.Listener, and gives a place to store the timeout parameters. On Accept, it will wrap the net.Conn with our own Conn for us. Original implementation taken from https://gist.github.com/jbardin/9663312 Thanks! <3

func (*Listener) Accept

func (l *Listener) Accept() (net.Conn, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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