netutil

package
v0.0.0-...-a0650b7 Latest Latest
Warning

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

Go to latest
Published: May 26, 2017 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var NextProtos = []string{http2.NextProtoTLS}

Functions

func Hash

func Hash(backends []*ReverseProxyBackend) (*reverseHash, error)

func Least

func Least(backends []*ReverseProxyBackend) (*reverseLeast, error)

func Random

func Random(backends []*ReverseProxyBackend) (*reverseRandom, error)

func RoundRobin

func RoundRobin(backends []*ReverseProxyBackend) (*reverseRoundRobin, error)

Types

type Balancer

type Balancer interface {
	Pick(req *http.Request) http.Handler
}

type ReverseProxyBackend

type ReverseProxyBackend struct {
	Weight int

	Count int64
	// contains filtered or unexported fields
}

func NewReverseProxyBackend

func NewReverseProxyBackend(rawBack string, target *url.URL, weight int, transport http.RoundTripper) *ReverseProxyBackend

func (*ReverseProxyBackend) ServeHTTP

func (this *ReverseProxyBackend) ServeHTTP(rw http.ResponseWriter, req *http.Request)

func (*ReverseProxyBackend) String

func (this *ReverseProxyBackend) String() string

type Server

type Server struct {
	http2.Server
	// contains filtered or unexported fields
}

func NewServer

func NewServer(svr *http.Server) *Server

func (*Server) Close

func (this *Server) Close()

func (*Server) Run

func (this *Server) Run() error

type Transport

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

func NewTransport

func NewTransport(opt TransportOpt) *Transport

func (*Transport) RoundTrip

func (this *Transport) RoundTrip(req *http.Request) (*http.Response, error)

type TransportOpt

type TransportOpt struct {
	Trailer         []string
	AllowHTTP       bool
	TLSClientConfig *tls.Config
}

Jump to

Keyboard shortcuts

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