Home

Awesome

rp Go Reference build Coverage Code to Test Ratio Test Execution Time

rp is a reverse proxy package for multiple domains and multiple upstreams.

Usage

Prepare an instance that implements rp.Relayer interface.

And then, create a new http.Server using rp.NewServer or rp.NewTLSServer with the instance.

Use rp.NewServer ( rp.ListenAndServe ) if handling per-domain (or per-request, as the case may be) upstreams.

package main

import (
    "log"
    "net/http"

    "github.com/2manymws/rp"
)

func main() {
    var r rp.Relayer = newMyRelayer()
    log.Fatal(rp.ListenAndServe(":80", r))
}

Use rp.NewTLSServer ( rp.ListenAndServeTLS )if handling per-domain TLS termination as well as per-domain HTTP request routing.

package main

import (
    "log"
    "net/http"

    "github.com/2manymws/rp"
)

func main() {
    var r rp.Relayer = newMyRelayer()
    log.Fatal(rp.ListenAndServeTLS(":443", r))
}