proxy

package module
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2020 License: Apache-2.0 Imports: 5 Imported by: 0

README

Build Status Codecov GoDoc

Kivik Proxy

This package provides a CouchDB proxy accessible as a Go http.Handler.

Example

package main

import (
    "log"
    "net/http"

    "github.com/go-kivik/proxy"
)

func main() {
    p, err := proxy.New("http://localhost:5984")
    if err != nil {
        log.Fatal(err)
    }
    s := &http.Server{
        Handler: p,
    }
    log.Fatal(s.ListenAndServe(":8080")) // localhost:5984 now proxied to localhost:8080
}

What license is Kivik released under?

This software is released under the terms of the Apache 2.0 license. See LICENCE.md, or read the full license.

Documentation

Overview

Package proxy provides a simple proxy for a CouchDB server

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Proxy

type Proxy struct {
	*httputil.ReverseProxy
	// StrictMethods will reject any non-standard CouchDB methods immediately,
	// rather than relaying to the CouchDB server.
	StrictMethods bool
}

Proxy is an http.Handler which proxies connections to a CouchDB server.

func New

func New(serverURL string) (*Proxy, error)

New returns a new Proxy instance, which redirects all requests to the specified URL.

func (*Proxy) ServeHTTP

func (p *Proxy) ServeHTTP(w http.ResponseWriter, r *http.Request)

Jump to

Keyboard shortcuts

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