Documentation
¶
Overview ¶
Package httplib provides common functionality for http servers
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ContextUserKey = &contextUserType{}
ContextUserKey is a simple context key
View Source
var DefaultOpt = Options{ ListenAddr: "localhost:8080", Realm: "rclone", ServerReadTimeout: 1 * time.Hour, ServerWriteTimeout: 1 * time.Hour, MaxHeaderBytes: 4096, }
DefaultOpt is the default values used for Options
View Source
var Help = `` /* 1755-byte string literal not displayed */
Help contains text describing the http server to add to the command help.
Functions ¶
This section is empty.
Types ¶
type Options ¶
type Options struct {
ListenAddr string // Port to listen on
ServerReadTimeout time.Duration // Timeout for server reading data
ServerWriteTimeout time.Duration // Timeout for server writing data
MaxHeaderBytes int // Maximum size of request header
SslCert string // SSL PEM key (concatenation of certificate and CA certificate)
SslKey string // SSL PEM Private key
ClientCA string // Client certificate authority to verify clients with
HtPasswd string // htpasswd file - if not provided no authentication is done
Realm string // realm for authentication
BasicUser string // single username for basic auth if not using Htpasswd
BasicPass string // password for BasicUser
}
Options contains options for the http Server
type Server ¶
type Server struct {
Opt Options
HTMLTemplate *template.Template // HTML template for web interface
// contains filtered or unexported fields
}
Server contains info about the running http server
func NewServer ¶
NewServer creates an http server. The opt can be nil in which case the default options will be used.
func (*Server) Serve ¶
Serve runs the server - returns an error only if the listener was not started; does not block, so use s.Wait() to block on the listener indefinitely.
Click to show internal directories.
Click to hide internal directories.