proxy

package
v0.0.0-...-a1b4a84 Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2023 License: Apache-2.0 Imports: 18 Imported by: 0

README

Proxy

Proxy专门用于提供代理服务的包,具有良好的接口设计

目前支持的协议

  • HTTP

计划支持的协议

  • Websocket
  • GRPC

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Close

func Close() error

func Init

func Init(opt *types.ProxyOption) error

func NewProxyClient

func NewProxyClient(timeout time.Duration, maxIdleConns int, maxIdleConnsPerHost int) *http.Client

func NewProxyClientFromConfig

func NewProxyClientFromConfig(config *types.ProxyOption) *http.Client

func ReverseHandler

func ReverseHandler() gin.HandlerFunc

Types

type AsyncCallbackRequest

type AsyncCallbackRequest struct {
	Status int
	Body   []byte
}

type AsyncRequest

type AsyncRequest struct {
	RawRequest *http.Request
	FuncName   string
	Callback   string
}

type Proxy

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

Proxy 代理管理中枢 将会以HTTP服务的形式,反向代理HTTP、Websocket和GRPC请求

func (*Proxy) BuildProxyRequest

func (p *Proxy) BuildProxyRequest(ori *http.Request, node *rtypes.Node, requestURI string) (*http.Request, error)

func (*Proxy) Close

func (p *Proxy) Close() error

func (*Proxy) GetRemoteNodeByName

func (p *Proxy) GetRemoteNodeByName(ctx context.Context, funcName string) (*rtypes.Node, error)

func (*Proxy) Init

func (p *Proxy) Init(config *types.ProxyOption) error

func (*Proxy) ReverseHandler

func (p *Proxy) ReverseHandler() gin.HandlerFunc

ReverseHandler 反向代理 直接穿透给目标服务器 网络地址格式为: http://host_ip:port/functionName/requestURI...

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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