reverse_proxy

package
v0.0.0-...-2828958 Latest Latest
Warning

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

Go to latest
Published: May 22, 2021 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewGrpcLoadBalanceHandler

func NewGrpcLoadBalanceHandler(lb loadbalance.LoadBalance) grpc.StreamHandler

NewGrpcLoadBalanceHandler 创建 Grpc 负载均衡代理 Handler

func NewLoadBalanceReverseProxy

func NewLoadBalanceReverseProxy(c *gin.Context, lb loadbalance.LoadBalance, transport *http.Transport) *httputil.ReverseProxy

NewLoadBalanceReverseProxy 创建负载均衡反向代理器

Types

type TCPReverseProxy

type TCPReverseProxy struct {
	Addr            string
	KeepAlivePeriod time.Duration // 长连接设置
	DialTimeout     time.Duration // 拨号超时时间
	// 拨号的上下文
	DialContext func(ctx context.Context, network, address string) (net.Conn, error)
	// 拨号的错误
	OnDialError          func(src net.Conn, dstDialErr error)
	ProxyProtocolVersion int
	// contains filtered or unexported fields
}

TCPReverseProxy TCP 反向代理配置

func NewTCPLoadBalanceReverseProxy

NewTCPLoadBalanceReverseProxy 创建TCP代理负载均衡器

func (*TCPReverseProxy) ServeTCP

func (dp *TCPReverseProxy) ServeTCP(ctx context.Context, src net.Conn)

ServeTCP 实现 TCPHandler 接口,实现 TCP 反向代理逻辑

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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