{"modulePath":"github.com/hyperledger-firefly/common","version":"v1.6.7","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package httpserver\n\n## Constants\n\n```go\nconst (\n\t// CorsAllowCredentials CORS setting to control whether a browser allows credentials to be sent to this API\n\tCorsAllowCredentials = \"credentials\"\n\t// CorsAllowedHeaders CORS setting to control the allowed headers\n\tCorsAllowedHeaders = \"headers\"\n\t// CorsAllowedMethods CORS setting to control the allowed methods\n\tCorsAllowedMethods = \"methods\"\n\t// CorsAllowedOrigins CORS setting to control the allowed origins\n\tCorsAllowedOrigins = \"origins\"\n\t// CorsDebug is whether debug is enabled for the CORS implementation\n\tCorsDebug = \"debug\"\n\t// CorsEnabled is whether cors is enabled\n\tCorsEnabled = \"enabled\"\n\t// CorsMaxAge is the maximum age a browser should rely on CORS checks\n\tCorsMaxAge = \"maxAge\"\n)\n```\n\n```go\nconst (\n\t// HTTPConfAddress the local address to listen on\n\tHTTPConfAddress = \"address\"\n\t// HTTPConfPublicURL the public address of the node to advertise in the swagger\n\tHTTPConfPublicURL = \"publicURL\"\n\t// HTTPConfPort the local port to listen on for HTTP/Websocket connections\n\tHTTPConfPort = \"port\"\n\t// HTTPConfReadTimeout the write timeout for the HTTP server\n\tHTTPConfReadTimeout = \"readTimeout\"\n\t// HTTPConfWriteTimeout the write timeout for the HTTP server\n\tHTTPConfWriteTimeout = \"writeTimeout\"\n\t// HTTPConfShutdownTimeout The maximum amount of time to wait for any open HTTP requests to finish before shutting down the HTTP server\n\tHTTPConfShutdownTimeout = \"shutdownTimeout\"\n\t// HTTPAuthType the auth plugin to use for the HTTP server\n\tHTTPAuthType = \"auth.type\"\n)\n```\n\n```go\nconst (\n\n\t// DebugEnabled is whether to actually run the debug server or not\n\tDebugEnabled = \"enabled\"\n)\n```\n\n## Functions\n\n```go\nfunc InitCORSConfig(conf config.Section)\n```\n\n```go\nfunc InitDebugConfig(conf config.Section)\n```\n\n```go\nfunc InitHTTPConfig(conf config.Section, defaultPort int)\n```\n\n```go\nfunc LocalAddr(ctx context.Context) net.Addr\n```\n\n```go\nfunc RemoteAddr(ctx context.Context) net.Addr\n```\n\n```go\nfunc RunDebugServer(ctx context.Context, debugServerConf config.Section, captureAddr ...func(addr net.Addr))\n```\n\n```go\nfunc WrapCorsIfEnabled(ctx context.Context, conf config.Section, chain http.Handler) http.Handler\n```\n\n## Types\n\n```go\ntype GoHTTPServer interface {\n\tClose() error\n\tServe(l net.Listener) error\n\tServeTLS(l net.Listener, certFile, keyFile string) error\n\tShutdown(ctx context.Context) error\n}\n```\n\n```go\ntype HTTPServer interface {\n\tServeHTTP(ctx context.Context)\n\tAddr() net.Addr\n}\n```\n\n```go\nfunc NewHTTPServer(ctx context.Context, name string, r *mux.Router, onClose chan error, conf config.Section, corsConf config.Section, opts ...*ServerOptions) (is HTTPServer, err error)\n```\n\n```go\ntype ServerOptions struct {\n\tMaximumRequestTimeout time.Duration\n}\n```\nServerOptions are config parameters that are not set from the config, but rather the context in which the HTTP server is being used\n\n","path":"github.com/hyperledger-firefly/common/pkg/httpserver","name":"httpserver","synopsis":"","isRedistributable":true}
