load_balancer

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2024 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewGrpcLoadBalanceHandler

func NewGrpcLoadBalanceHandler(lb load_balance.LoadBalance) grpc.StreamHandler

func NewLoadBalanceReverseProxy

func NewLoadBalanceReverseProxy(c *gin.Context, lb load_balance.LoadBalance, trans *http.Transport) *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 (*TcpReverseProxy) ServeTCP

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

ServeTCP 传入上游 conn,在这里完成下游连接与数据交换

Jump to

Keyboard shortcuts

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