net

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: May 6, 2023 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultMaxHeaderBytes  = 1 << 20
	DefaultAddr            = ":8080"
	DefaultReadTimeout     = 20 * time.Second
	DefaultWriteTimeout    = 20 * time.Second
	DefaultIdleTimeout     = 120 * time.Second
	DefaultShutdownTimeout = 5 * time.Minute
)
View Source
const UserAgent = "Mozilla/5.0 (Macintosh; Intel Mac OS X x.y; rv:10.0) Gecko/20100101 Firefox/10.0"

Variables

This section is empty.

Functions

func NewClient

func NewClient() *resty.Client

func NewServer

func NewServer(httpCfg HTTPServerConfig, handler http.Handler, shutdownFn func()) *server

Types

type HTTPServerConfig

type HTTPServerConfig struct {
	// MaxHeaderBytes can be used to override the default of 1<<20.
	MaxHeaderBytes int

	// ReadTimeout can be used to override the default http Server timeout of 20s.
	// The string should be formatted like a time.Duration string.
	ReadTimeout time.Duration

	// WriteTimeout can be used to override the default http Server timeout of 20s.
	// The string should be formatted like a time.Duration string.
	WriteTimeout time.Duration

	// IdleTimeout can be used to override the default http Server timeout of 120s.
	// The string should be formatted like a time.Duration string.
	IdleTimeout time.Duration

	// ShutdownTimeout can be used to override the default http Server Shutdown timeout
	// of 5m.
	ShutdownTimeout time.Duration

	// Addr is the binding address the Server implementation will serve HTTP over.
	// The default is ":8080"
	Addr string
}

HTTPServerConfig holds info required to configure a server.Server.

type Server

type Server interface {
	Run() error
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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