1
0
mirror of https://github.com/kataras/iris.git synced 2026-01-08 20:41:57 +00:00

Add the new Go 1.8 Shutdown | Remove DisableBanner, is controlled by LoggerPolicy now.

Former-commit-id: 6ef71a4b9f5a79160a42d1111dd924e244ce1f4e
This commit is contained in:
Gerasimos (Makis) Maropoulos
2017-02-17 04:46:33 +02:00
parent 2a4997cadf
commit 21a18d0990
10 changed files with 77 additions and 2104 deletions

View File

@@ -1,6 +1,7 @@
package iris
import (
"context"
"crypto/tls"
"net"
"net/http"
@@ -282,13 +283,12 @@ var ProxyHandler = func(redirectSchemeAndHost string) http.HandlerFunc {
// nothing special, use it only when you want to start a secondary server which its only work is to redirect from one requested path to another
//
// returns a close function
func Proxy(proxyAddr string, redirectSchemeAndHost string) func() error {
func Proxy(proxyAddr string, redirectSchemeAndHost string) func(context.Context) error {
proxyAddr = ParseHost(proxyAddr)
// override the handler and redirect all requests to this addr
h := ProxyHandler(redirectSchemeAndHost)
prx := New(OptionDisableBanner(true))
prx.Adapt(DevLogger())
prx := New()
prx.Adapt(RouterBuilderPolicy(func(RouteRepository, ContextPool) http.Handler {
return h
@@ -297,5 +297,5 @@ func Proxy(proxyAddr string, redirectSchemeAndHost string) func() error {
go prx.Listen(proxyAddr)
time.Sleep(150 * time.Millisecond)
return func() error { return prx.Close() }
return prx.Shutdown
}