proxy

package
v0.0.0-...-ae88a46 Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2023 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Overview

Package proxy_http

@author: xwc1125

Package proxy_http

@author: xwc1125

Package proxy_http

@author: xwc1125

Index

Constants

This section is empty.

Variables

View Source
var (
	// DefaultUpgrader specifies the parameters for upgrading an HTTP
	// connection to a WebSocket connection.
	DefaultUpgrader = &websocket.FastHTTPUpgrader{
		ReadBufferSize:  1024,
		WriteBufferSize: 1024,
	}

	// DefaultDialer is a dialer with all fields set to the default zero values.
	DefaultDialer = websocket.DefaultDialer
)

Functions

This section is empty.

Types

type Option

type Option interface {
	// contains filtered or unexported methods
}

Option to define all options to reverse http proxy.

func WithCompressionLevel

func WithCompressionLevel(compressionLevel int) Option

WithCompressionLevel

func WithDisablePathNormalizing

func WithDisablePathNormalizing(isDisablePathNormalizing bool) Option

WithDisablePathNormalizing sets whether disable path normalizing.

func WithPlugins

func WithPlugins(plugins ...plugin.Plugin) Option

WithPlugins sets whether disable path normalizing.

func WithTLS

func WithTLS(certFile, keyFile string) Option

WithTLS build tls.Config with server certFile and keyFile. tlsConfig is nil as default

func WithTLSConfig

func WithTLSConfig(config *tls.Config) Option

func WithTimeout

func WithTimeout(d time.Duration) Option

WithTimeout specify the timeout of each request

type Proxy

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

Proxy 反向代理的handler

func NewProxy

func NewProxy(route entity.Route, opts ...Option) (*Proxy, error)

NewProxy create one Proxy with options

func (*Proxy) Close

func (p *Proxy) Close()

Close ... clear and release

func (*Proxy) GetClient

func (p *Proxy) GetClient(req *fasthttp.Request) (*fasthttp.HostClient, error)

GetClient 获取client

func (*Proxy) GetWs

func (p *Proxy) GetWs(req *fasthttp.Request) (string, error)

GetWs 获取client

func (*Proxy) Reset

func (p *Proxy) Reset()

Reset ...

func (*Proxy) ServeHTTP

func (p *Proxy) ServeHTTP(ctx *fasthttp.RequestCtx)

ServeHTTP 代理服务

func (*Proxy) SetClient

func (p *Proxy) SetClient(addr string) *Proxy

SetClient ...

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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