portal

package
v0.0.0-...-19631d5 Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2020 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ResponseSizeLimit = 1024 * 1024 * 4
	ResponseReadSize  = 512
)

Variables

This section is empty.

Functions

func CtxGetWebsocketConfig

func CtxGetWebsocketConfig(ctx context.Context) *websocket.Config

func CtxWithWebsocketConfig

func CtxWithWebsocketConfig(ctx context.Context, config *websocket.Config) context.Context

func GetWebsocketConfig

func GetWebsocketConfig(req *http.Request) (*websocket.Config, int32, error)

func SetLogger

func SetLogger(l Logger)

Types

type BodyReader

type BodyReader struct {
	Buf *bytes.Buffer
}

func (*BodyReader) Close

func (r *BodyReader) Close() error

func (*BodyReader) Read

func (r *BodyReader) Read(p []byte) (n int, err error)

type DebugLogger

type DebugLogger interface {
	Debugf(format string, args ...interface{})
}

type HttpResponseWriter

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

func (*HttpResponseWriter) Flush

func (w *HttpResponseWriter) Flush(finish bool) error

func (*HttpResponseWriter) Header

func (w *HttpResponseWriter) Header() http.Header

func (*HttpResponseWriter) ReadFrom

func (w *HttpResponseWriter) ReadFrom(reader io.Reader) (int, error)

func (*HttpResponseWriter) Write

func (w *HttpResponseWriter) Write(data []byte) (int, error)

func (*HttpResponseWriter) WriteHeader

func (w *HttpResponseWriter) WriteHeader(statusCode int)

type LocalPortal

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

func NewLocalPortal

func NewLocalPortal(name string, handler http.Handler, remoteHost string) *LocalPortal

func (*LocalPortal) Run

func (p *LocalPortal) Run()

func (*LocalPortal) SetTimeout

func (p *LocalPortal) SetTimeout(t TimeoutConfig)

func (*LocalPortal) SetWebsocketHandler

func (p *LocalPortal) SetWebsocketHandler(h WebsocketHandler)

func (*LocalPortal) Start

func (p *LocalPortal) Start()

func (*LocalPortal) Stop

func (p *LocalPortal) Stop()

type Logger

type Logger interface {
	Infof(format string, args ...interface{})
	Errorf(format string, args ...interface{})
}

type TimeoutConfig

type TimeoutConfig struct {
	ServerConnect time.Duration `yaml:"server_connect"`
	ServerWrite   time.Duration `yaml:"server_write"`
	HTTPRead      time.Duration `yaml:"http_read"`
}

type WebsocketHandler

type WebsocketHandler interface {
	http.Handler
	Handshake(*websocket.Config, *http.Request) error
}

Jump to

Keyboard shortcuts

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