proxy

package
v0.0.0-...-869c34b Latest Latest
Warning

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

Go to latest
Published: Jan 17, 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 *middleware.SliceRouterContext, lb loadbalance.LoadBalance) *httputil.ReverseProxy

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

func NewMultipleHostsReverseProxy

func NewMultipleHostsReverseProxy(c *middleware.SliceRouterContext, targets []*url.URL) *httputil.ReverseProxy

NewMultipleHostsReverseProxy 反向代理负载均衡 func NewMultipleHostsReverseProxy(lb loadbalance.LoadBalance) *httputil.ReverseProxy {

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

func NewTCPLoadBalanceReverseProxy(c *tcpmiddleware.TCPSliceRouterContext,
	lb loadbalance.LoadBalance) *TCPReverseProxy

NewTCPLoadBalanceReverseProxy 创建TCP代理负载均衡器

func (*TCPReverseProxy) ServeTCP

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

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

Jump to

Keyboard shortcuts

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