proxy

package
v0.0.11 Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2026 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var BufferPool = &bufPool{
	pool: sync.Pool{
		New: func() any {
			buf := make([]byte, 64*1024)
			return &buf
		},
	},
}

Functions

func Rewrite

func Rewrite(pr *httputil.ProxyRequest)

Types

type Proxy

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

func NodeToService

func NodeToService(svc *mess.Service, dir string) (*Proxy, error)

func ServiceToNode

func ServiceToNode(svc *mess.Service, nodeID uint64, dir string, handler http.HandlerFunc) (*Proxy, error)

func (*Proxy) Addr

func (p *Proxy) Addr() string

func (*Proxy) Close

func (p *Proxy) Close() error

func (*Proxy) ServeHTTP

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

type Wrapper

type Wrapper struct {
	Start time.Time

	Caller proxyArgs
	Target proxyArgs

	InProto string

	Scheme string
	Host   string

	Status int
	Bytes  uint64
	// contains filtered or unexported fields
}

func FromContext

func FromContext(ctx context.Context) *Wrapper

func Wrap

func Wrap(hw http.ResponseWriter, hr *http.Request) (*Wrapper, *http.Request)

func (*Wrapper) FromLocal

func (w *Wrapper) FromLocal(r *http.Request) (err error)

func (*Wrapper) FromRemote

func (w *Wrapper) FromRemote(r *http.Request) (err error)

func (*Wrapper) Header

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

func (*Wrapper) Release

func (w *Wrapper) Release()

func (*Wrapper) ToLocal

func (w *Wrapper) ToLocal()

func (*Wrapper) ToRemote

func (w *Wrapper) ToRemote(tn *mess.Node) error

func (*Wrapper) Unwrap

func (w *Wrapper) Unwrap() http.ResponseWriter

func (*Wrapper) Write

func (w *Wrapper) Write(p []byte) (int, error)

func (*Wrapper) WriteHeader

func (w *Wrapper) WriteHeader(code int)

Jump to

Keyboard shortcuts

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