httpserve

package module
v0.0.0-...-f3a1aa8 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2015 License: MPL-2.0 Imports: 21 Imported by: 2

README

go-httpserve

go-httpserve is a lightweight go library to

  • run one single HTTP server on a single port which upgrades to HTTPS when a client tries to connect via HTTP.
  • simplify basic HTTP authentication.

Pull requests, bug reporting and feature request (via github issues) are always welcome. :)

Installation

go get github.com/codedust/go-httpserve

How to run

If you are unfamiliar with Go, please start by reading How to Write Go Code.

The best place to get started are the examples in examples/. Simple run the examples with go run and visit http://localhost:8080/.

Feel free to ask for help in the issue tracker. ;)

License

go-httpserve is licensed under the Mozilla Public License.

Documentation

Overview

This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/.

This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/.

This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BasicAuthHandler

func BasicAuthHandler(next http.Handler, authOptions *AuthOptions) http.Handler

func ChangeAuthOptionsPass

func ChangeAuthOptionsPass(authOptions *AuthOptions, pass string, salt string)

func ChangeAuthOptionsUser

func ChangeAuthOptionsUser(authOptions *AuthOptions, user string)

func CreateCertificateIfNotExist

func CreateCertificateIfNotExist(certFile string, keyFile string, commonName string, bits int)

func ListenAndUpgradeTLS

func ListenAndUpgradeTLS(addr string, certFile string, keyFile string, handler http.Handler) error

func RandomString

func RandomString(len int) (string, error)

func Sha512Sum

func Sha512Sum(s string) string

Types

type AuthOptions

type AuthOptions struct {
	// contains filtered or unexported fields
}

func NewAuthOptions

func NewAuthOptions(user string, pass string, salt string) (authOptions *AuthOptions)

Directories

Path Synopsis
This Source Code Form is subject to the terms of the Mozilla Public * License, v.
This Source Code Form is subject to the terms of the Mozilla Public * License, v.

Jump to

Keyboard shortcuts

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