proxy

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Creator func(conf *ConfigVar) Proxy = NewHttp

Creator 开发者可自行设定 Proxy Creator

Functions

func Handler

func Handler(ctx context.Context, request *fakehttp.Request, conf *ConfigVar)

Types

type Config

type Config struct {
	Url     string
	Headers []*Header
}

func DefaultConfig

func DefaultConfig() *Config

type ConfigVar

type ConfigVar struct {
	Url     *vari.Var
	Headers []*HeaderVar
}

func CompileConf

func CompileConf(conf *Config) *ConfigVar
type Header struct {
	Key   string
	Value string
}

type HeaderFixedKey added in v0.1.3

type HeaderFixedKey = string
const (
	MaxResponseKey HeaderFixedKey = "Stream-Max-Response"
)

type HeaderVar

type HeaderVar struct {
	Key   string
	Value *vari.Var
}

type Proxy

type Proxy interface {
	Do(ctx context.Context, request *fakehttp.Request) *fakehttp.Response
}

Proxy 1、request 中的 header 需要透传给上游服务器 2、MaxResponseKey => request.Conn.ServerConfig().MaxBytesPerFrame 需要添加到 header 3、config文件中配置的 headers 需要传递给上游服务器 4、返回的 response.data 不能大于 request.Conn.ServerConfig().MaxBytesPerFrame

func NewHttp added in v0.1.2

func NewHttp(conf *ConfigVar) Proxy

Jump to

Keyboard shortcuts

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