proxy

package
v1.0.4-beta1 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2020 License: Apache-2.0 Imports: 9 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

func New

func New(c *Config)

Types

type Config

type Config struct {
	ProxySchema SchemaType // SchemaHTTP or SchemaHTTPS
	ProxyHost   string
	ProxyPort   string
	ServerPort  string
	Key         string
}

配置文件

type ProxyHandler

type ProxyHandler struct{}

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, method string, header http.Header, path string, params url.Values, body io.ReadCloser) (res []byte, err error)

Jump to

Keyboard shortcuts

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