proxy

package
v1.0.20 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2021 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SchemaHTTP  SchemaType = "http://"
	SchemaHTTPS SchemaType = "https://"

	HTTP_METHOD_GET  = "GET"
	HTTP_METHOD_POST = "POST"

	CONTENT_TYPE_JSON = "application/json"
	CONTENT_TYPE_FORM = "application/x-www-form-urlencoded"
	CONTENT_TYPE_XML  = "application/xml"

	HEADER_CONTENT_TYPE = "Content-Type"
	HEADER_CONTENT_KEY  = "key"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	ProxySchema SchemaType // SchemaHTTP or SchemaHTTPS
	ProxyHost   string     // 转发到的接口 Host
	ProxyPort   string     // 转发到的接口 Port
	ServerPort  string     // 代理转发服务启动的端口
	Key         string     // 简单的校验Key
}

配置文件

type ProxyHandler

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

func NewHandler added in v1.0.8

func NewHandler(c *Config) (handler *ProxyHandler)

func (*ProxyHandler) Handle added in v1.0.8

func (p *ProxyHandler) Handle(path string, handler http.Handler)

func (*ProxyHandler) ListenAndServe added in v1.0.8

func (p *ProxyHandler) ListenAndServe() error

func (*ProxyHandler) ServeHTTP

func (p *ProxyHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

type SchemaType

type SchemaType string

type Service

type Service struct {
	Schema SchemaType // SchemaHTTP or SchemaHTTPS

	Host string
	Port string
	Key  string
	// contains filtered or unexported fields
}

func (*Service) Proxy

func (s *Service) Proxy(c context.Context, w http.ResponseWriter, r *http.Request)

Proxy

Jump to

Keyboard shortcuts

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